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

Unified Diff: core/fpdfdoc/cpdf_formfield_unittest.cpp

Issue 2419173002: Update CPDF_IndirectObjectHolder APIs for unique objects (Closed)
Patch Set: Fix issues Created 4 years, 2 months 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/fpdfapi/parser/cpdf_parser.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 11cccf19b890424671f168aeccf97efcce7ed494..a9d3d2403a86688b9ba277143a47927782605193 100644
--- a/core/fpdfdoc/cpdf_formfield_unittest.cpp
+++ b/core/fpdfdoc/cpdf_formfield_unittest.cpp
@@ -12,15 +12,13 @@ TEST(cpdf_formfield, FPDF_GetFullName) {
EXPECT_TRUE(name.IsEmpty());
CPDF_IndirectObjectHolder obj_holder;
- CPDF_Dictionary* root = new CPDF_Dictionary();
- obj_holder.AddIndirectObject(root);
+ CPDF_Dictionary* root = obj_holder.AddIndirectDictionary();
root->SetNameFor("T", "foo");
name = FPDF_GetFullName(root);
EXPECT_STREQ("foo", name.UTF8Encode().c_str());
- CPDF_Dictionary* dict1 = new CPDF_Dictionary();
- root->SetReferenceFor("Parent", &obj_holder,
- obj_holder.AddIndirectObject(dict1));
+ CPDF_Dictionary* dict1 = obj_holder.AddIndirectDictionary();
+ root->SetReferenceFor("Parent", &obj_holder, dict1);
dict1->SetNameFor("T", "bar");
name = FPDF_GetFullName(root);
EXPECT_STREQ("bar.foo", name.UTF8Encode().c_str());
@@ -30,9 +28,8 @@ TEST(cpdf_formfield, FPDF_GetFullName) {
name = FPDF_GetFullName(root);
EXPECT_STREQ("bar.foo", name.UTF8Encode().c_str());
- CPDF_Dictionary* dict3 = new CPDF_Dictionary();
- dict2->SetReferenceFor("Parent", &obj_holder,
- obj_holder.AddIndirectObject(dict3));
+ CPDF_Dictionary* dict3 = obj_holder.AddIndirectDictionary();
+ dict2->SetReferenceFor("Parent", &obj_holder, dict3);
dict3->SetNameFor("T", "qux");
name = FPDF_GetFullName(root);
EXPECT_STREQ("qux.bar.foo", name.UTF8Encode().c_str());
« no previous file with comments | « core/fpdfapi/parser/cpdf_parser.cpp ('k') | core/fpdfdoc/cpdf_interform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698