Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2430)

Unified Diff: core/fpdfdoc/cpdf_formfield_unittest.cpp

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/cpdf_formfield.cpp ('k') | core/fpdfdoc/cpdf_interform.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpdf_formfield_unittest.cpp
diff --git a/core/fpdfdoc/cpdf_formfield_unittest.cpp b/core/fpdfdoc/cpdf_formfield_unittest.cpp
index f69df1d064dd92bf07b35e9865ca8dd6f0876a50..4aeda84c880ab8305c621fbd1a725cc607f17015 100644
--- a/core/fpdfdoc/cpdf_formfield_unittest.cpp
+++ b/core/fpdfdoc/cpdf_formfield_unittest.cpp
@@ -4,6 +4,8 @@
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_indirect_object_holder.h"
+#include "core/fpdfapi/parser/cpdf_name.h"
+#include "core/fpdfapi/parser/cpdf_reference.h"
#include "core/fpdfdoc/cpdf_formfield.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -13,29 +15,28 @@ TEST(cpdf_formfield, FPDF_GetFullName) {
CPDF_IndirectObjectHolder obj_holder;
CPDF_Dictionary* root = obj_holder.NewIndirect<CPDF_Dictionary>();
- root->SetNameFor("T", "foo");
+ root->SetNewFor<CPDF_Name>("T", "foo");
name = FPDF_GetFullName(root);
EXPECT_STREQ("foo", name.UTF8Encode().c_str());
CPDF_Dictionary* dict1 = obj_holder.NewIndirect<CPDF_Dictionary>();
- root->SetReferenceFor("Parent", &obj_holder, dict1);
- dict1->SetNameFor("T", "bar");
+ root->SetNewFor<CPDF_Reference>("Parent", &obj_holder, dict1->GetObjNum());
+ dict1->SetNewFor<CPDF_Name>("T", "bar");
name = FPDF_GetFullName(root);
EXPECT_STREQ("bar.foo", name.UTF8Encode().c_str());
- CPDF_Dictionary* dict2 = new CPDF_Dictionary();
- dict1->SetFor("Parent", dict2);
+ CPDF_Dictionary* dict2 = dict1->SetNewFor<CPDF_Dictionary>("Parent");
name = FPDF_GetFullName(root);
EXPECT_STREQ("bar.foo", name.UTF8Encode().c_str());
CPDF_Dictionary* dict3 = obj_holder.NewIndirect<CPDF_Dictionary>();
- dict2->SetReferenceFor("Parent", &obj_holder, dict3);
+ dict2->SetNewFor<CPDF_Reference>("Parent", &obj_holder, dict3->GetObjNum());
- dict3->SetNameFor("T", "qux");
+ dict3->SetNewFor<CPDF_Name>("T", "qux");
name = FPDF_GetFullName(root);
EXPECT_STREQ("qux.bar.foo", name.UTF8Encode().c_str());
- dict3->SetReferenceFor("Parent", &obj_holder, root->GetObjNum());
+ dict3->SetNewFor<CPDF_Reference>("Parent", &obj_holder, root->GetObjNum());
name = FPDF_GetFullName(root);
EXPECT_STREQ("qux.bar.foo", name.UTF8Encode().c_str());
name = FPDF_GetFullName(dict1);
« no previous file with comments | « core/fpdfdoc/cpdf_formfield.cpp ('k') | core/fpdfdoc/cpdf_interform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698