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

Unified Diff: core/fpdfapi/parser/cpdf_array_unittest.cpp

Issue 2484033002: Return unique_ptr from CPDF_Object::Clone(). (Closed)
Patch Set: std::move() it 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/fpdfapi/parser/cpdf_array.cpp ('k') | core/fpdfapi/parser/cpdf_boolean.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_array_unittest.cpp
diff --git a/core/fpdfapi/parser/cpdf_array_unittest.cpp b/core/fpdfapi/parser/cpdf_array_unittest.cpp
index b1a46056667c56c709f3863fa0ddc2b72be4c1f2..acb1bd89a9357d170274ce5a700c82f1d55cbb1c 100644
--- a/core/fpdfapi/parser/cpdf_array_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_array_unittest.cpp
@@ -87,7 +87,7 @@ TEST(cpdf_array, Clone) {
std::unique_ptr<CPDF_Array> arr(new CPDF_Array);
for (size_t i = 0; i < FX_ArraySize(elems); ++i)
arr->InsertAt(i, new CPDF_Number(elems[i]));
- std::unique_ptr<CPDF_Array> arr2(arr->Clone()->AsArray());
+ std::unique_ptr<CPDF_Array> arr2 = ToArray(arr->Clone());
EXPECT_EQ(arr->GetCount(), arr2->GetCount());
for (size_t i = 0; i < FX_ArraySize(elems); ++i) {
// Clone() always create new objects.
@@ -120,10 +120,10 @@ TEST(cpdf_array, Clone) {
ASSERT_EQ(kNumOfRows, arr->GetCount());
// Not dereferencing reference objects means just creating new references
// instead of new copies of direct objects.
- std::unique_ptr<CPDF_Array> arr1(arr->Clone()->AsArray());
+ std::unique_ptr<CPDF_Array> arr1 = ToArray(arr->Clone());
EXPECT_EQ(arr->GetCount(), arr1->GetCount());
// Dereferencing reference objects creates new copies of direct objects.
- std::unique_ptr<CPDF_Array> arr2(arr->CloneDirectObject()->AsArray());
+ std::unique_ptr<CPDF_Array> arr2 = ToArray(arr->CloneDirectObject());
EXPECT_EQ(arr->GetCount(), arr2->GetCount());
for (size_t i = 0; i < kNumOfRows; ++i) {
CPDF_Array* arr_elem = arr->GetObjectAt(i)->AsArray();
« no previous file with comments | « core/fpdfapi/parser/cpdf_array.cpp ('k') | core/fpdfapi/parser/cpdf_boolean.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698