Remove unused CPDF_NameTree::GetIndex()

-- Rename one test-only method ForTest().

Change-Id: I6e543084b6846f0e552dad62ff746a6003eca39f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/65751
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfdoc/cpdf_nametree.cpp b/core/fpdfdoc/cpdf_nametree.cpp
index fd3f592..b232540 100644
--- a/core/fpdfdoc/cpdf_nametree.cpp
+++ b/core/fpdfdoc/cpdf_nametree.cpp
@@ -316,18 +316,6 @@
   return m_pRoot ? CountNamesInternal(m_pRoot.Get(), 0) : 0;
 }
 
-int CPDF_NameTree::GetIndex(const WideString& csName) const {
-  if (!m_pRoot)
-    return -1;
-
-  size_t nIndex = 0;
-  if (!SearchNameNodeByName(m_pRoot.Get(), csName, 0, &nIndex, nullptr,
-                            nullptr)) {
-    return -1;
-  }
-  return nIndex;
-}
-
 bool CPDF_NameTree::AddValueAndName(RetainPtr<CPDF_Object> pObj,
                                     const WideString& name) {
   if (!m_pRoot)
diff --git a/core/fpdfdoc/cpdf_nametree.h b/core/fpdfdoc/cpdf_nametree.h
index e6a50e7..b018ae7 100644
--- a/core/fpdfdoc/cpdf_nametree.h
+++ b/core/fpdfdoc/cpdf_nametree.h
@@ -30,9 +30,8 @@
   CPDF_Object* LookupValue(const WideString& csName) const;
   CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, const WideString& sName);
 
-  int GetIndex(const WideString& csName) const;
   size_t GetCount() const;
-  CPDF_Dictionary* GetRoot() const { return m_pRoot.Get(); }
+  CPDF_Dictionary* GetRootForTest() const { return m_pRoot.Get(); }
 
  private:
   RetainPtr<CPDF_Dictionary> m_pRoot;
diff --git a/core/fpdfdoc/cpdf_nametree_unittest.cpp b/core/fpdfdoc/cpdf_nametree_unittest.cpp
index 1a8086d..13b6b5c 100644
--- a/core/fpdfdoc/cpdf_nametree_unittest.cpp
+++ b/core/fpdfdoc/cpdf_nametree_unittest.cpp
@@ -109,7 +109,7 @@
   AddNameKeyValue(pNames, "7.txt", 777);
 
   CPDF_NameTree nameTree(pRootDict.Get());
-  pNames = nameTree.GetRoot()->GetArrayFor("Names");
+  pNames = nameTree.GetRootForTest()->GetArrayFor("Names");
 
   // Insert a name that already exists in the names array.
   EXPECT_FALSE(
@@ -171,7 +171,7 @@
 
   // Check that the node on the first level has the expected limits.
   CPDF_Dictionary* pKid1 =
-      nameTree.GetRoot()->GetArrayFor("Kids")->GetDictAt(0);
+      nameTree.GetRootForTest()->GetArrayFor("Kids")->GetDictAt(0);
   ASSERT_TRUE(pKid1);
   CheckLimitsArray(pKid1, "0.txt", "99.txt");
 
@@ -217,7 +217,7 @@
 
   // Retrieve the kid dictionaries.
   CPDF_Dictionary* pKid1 =
-      nameTree.GetRoot()->GetArrayFor("Kids")->GetDictAt(0);
+      nameTree.GetRootForTest()->GetArrayFor("Kids")->GetDictAt(0);
   ASSERT_TRUE(pKid1);
   CPDF_Dictionary* pKid2 = pKid1->GetArrayFor("Kids")->GetDictAt(0);
   ASSERT_TRUE(pKid2);
@@ -287,9 +287,9 @@
   EXPECT_EQ(555, nameTree.LookupValue(L"5.txt")->GetInteger());
   EXPECT_TRUE(nameTree.LookupValueAndName(0, &csName));
   EXPECT_STREQ(L"5.txt", csName.c_str());
-  EXPECT_EQ(1u, nameTree.GetRoot()->GetArrayFor("Kids")->size());
+  EXPECT_EQ(1u, nameTree.GetRootForTest()->GetArrayFor("Kids")->size());
   EXPECT_TRUE(nameTree.DeleteValueAndName(0));
-  EXPECT_EQ(0u, nameTree.GetRoot()->GetArrayFor("Kids")->size());
+  EXPECT_EQ(0u, nameTree.GetRootForTest()->GetArrayFor("Kids")->size());
 
   // Check that the tree is now empty.
   EXPECT_EQ(0u, nameTree.GetCount());