diff options
author | tsepez <tsepez@chromium.org> | 2016-11-18 16:22:41 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-18 16:22:41 -0800 |
commit | 0e606b5ecd6e45f74391f110cc1fe0cce0e80c64 (patch) | |
tree | 07c55fac710b191cf5d1d6595c63b90ca52e3cbb /core/fpdfdoc/cpdf_filespec_unittest.cpp | |
parent | 430ab8363e77c48b2c2435af4d289f85e2be1b96 (diff) | |
download | pdfium-0e606b5ecd6e45f74391f110cc1fe0cce0e80c64.tar.xz |
Make CPDF_Dictionary use unique pointers.chromium/2926
Some changes were required to match underlying ctors
as invoked by the templated methods.
Many release() calls go away, a few WrapUniques() are
introduced to avoid going deeper into other code.
Review-Url: https://codereview.chromium.org/2510223002
Diffstat (limited to 'core/fpdfdoc/cpdf_filespec_unittest.cpp')
-rw-r--r-- | core/fpdfdoc/cpdf_filespec_unittest.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/fpdfdoc/cpdf_filespec_unittest.cpp b/core/fpdfdoc/cpdf_filespec_unittest.cpp index 4da5019314..d164165f00 100644 --- a/core/fpdfdoc/cpdf_filespec_unittest.cpp +++ b/core/fpdfdoc/cpdf_filespec_unittest.cpp @@ -67,7 +67,8 @@ TEST(cpdf_filespec, GetFileName) { L"/docs/test.pdf" #endif }; - std::unique_ptr<CPDF_Object> str_obj(new CPDF_String(test_data.input)); + std::unique_ptr<CPDF_Object> str_obj( + new CPDF_String(nullptr, test_data.input)); CPDF_FileSpec file_spec(str_obj.get()); CFX_WideString file_name; EXPECT_TRUE(file_spec.GetFileName(&file_name)); @@ -102,13 +103,13 @@ TEST(cpdf_filespec, GetFileName) { CPDF_FileSpec file_spec(dict_obj.get()); CFX_WideString file_name; for (int i = 0; i < 5; ++i) { - dict_obj->SetFor(keywords[i], new CPDF_String(test_data[i].input)); + dict_obj->SetNewFor<CPDF_String>(keywords[i], test_data[i].input); EXPECT_TRUE(file_spec.GetFileName(&file_name)); EXPECT_TRUE(file_name == test_data[i].expected); } // With all the former fields and 'FS' field suggests 'URL' type. - dict_obj->SetStringFor("FS", "URL"); + dict_obj->SetNewFor<CPDF_String>("FS", "URL", false); EXPECT_TRUE(file_spec.GetFileName(&file_name)); // Url string is not decoded. EXPECT_TRUE(file_name == test_data[4].input); @@ -136,7 +137,7 @@ TEST(cpdf_filespec, SetFileName) { #endif }; // String object. - std::unique_ptr<CPDF_Object> str_obj(new CPDF_String(L"babababa")); + std::unique_ptr<CPDF_Object> str_obj(new CPDF_String(nullptr, L"babababa")); CPDF_FileSpec file_spec1(str_obj.get()); file_spec1.SetFileName(test_data.input); // Check internal object value. |