| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" | 5 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" |
| 6 #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" | 6 #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" |
| 7 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" | 7 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" |
| 8 #include "core/fpdfapi/fpdf_parser/cpdf_name.h" | 8 #include "core/fpdfapi/fpdf_parser/cpdf_name.h" |
| 9 #include "core/fpdfapi/fpdf_parser/cpdf_null.h" | 9 #include "core/fpdfapi/fpdf_parser/cpdf_null.h" |
| 10 #include "core/fpdfapi/fpdf_parser/cpdf_number.h" | 10 #include "core/fpdfapi/fpdf_parser/cpdf_number.h" |
| 11 #include "core/fpdfapi/fpdf_parser/cpdf_reference.h" | 11 #include "core/fpdfapi/fpdf_parser/cpdf_reference.h" |
| 12 #include "core/fpdfapi/fpdf_parser/cpdf_stream.h" | 12 #include "core/fpdfapi/fpdf_parser/cpdf_stream.h" |
| 13 #include "core/fpdfapi/fpdf_parser/cpdf_string.h" | 13 #include "core/fpdfapi/fpdf_parser/cpdf_string.h" |
| 14 | 14 |
| 15 #include <memory> | 15 #include <memory> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h" | 19 #include "core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h" |
| 20 #include "core/fxcrt/include/fx_basic.h" | 20 #include "core/fxcrt/fx_basic.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 using ScopedArray = std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>>; | 25 using ScopedArray = std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>>; |
| 26 using ScopedDict = | 26 using ScopedDict = |
| 27 std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>>; | 27 std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>>; |
| 28 | 28 |
| 29 void TestArrayAccessors(const CPDF_Array* arr, | 29 void TestArrayAccessors(const CPDF_Array* arr, |
| 30 size_t index, | 30 size_t index, |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 // Cloned object should be the same as the original. | 830 // Cloned object should be the same as the original. |
| 831 ASSERT_TRUE(cloned_dict); | 831 ASSERT_TRUE(cloned_dict); |
| 832 CPDF_Object* cloned_arr = cloned_dict->GetObjectFor("arr"); | 832 CPDF_Object* cloned_arr = cloned_dict->GetObjectFor("arr"); |
| 833 ASSERT_TRUE(cloned_arr); | 833 ASSERT_TRUE(cloned_arr); |
| 834 ASSERT_TRUE(cloned_arr->IsArray()); | 834 ASSERT_TRUE(cloned_arr->IsArray()); |
| 835 EXPECT_EQ(1u, cloned_arr->AsArray()->GetCount()); | 835 EXPECT_EQ(1u, cloned_arr->AsArray()->GetCount()); |
| 836 // Recursively referenced object is not cloned. | 836 // Recursively referenced object is not cloned. |
| 837 EXPECT_EQ(nullptr, cloned_arr->AsArray()->GetObjectAt(0)); | 837 EXPECT_EQ(nullptr, cloned_arr->AsArray()->GetObjectAt(0)); |
| 838 } | 838 } |
| 839 } | 839 } |
| OLD | NEW |