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

Side by Side Diff: core/fpdfdoc/cpdf_filespec_unittest.cpp

Issue 2384883003: Remove CPDF_Object::Release() in favor of direct delete (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
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 <memory> 5 #include <memory>
6 #include <vector> 6 #include <vector>
7 7
8 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" 8 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h"
9 #include "core/fpdfapi/fpdf_parser/cpdf_name.h" 9 #include "core/fpdfapi/fpdf_parser/cpdf_name.h"
10 #include "core/fpdfapi/fpdf_parser/cpdf_string.h" 10 #include "core/fpdfapi/fpdf_parser/cpdf_string.h"
11 #include "core/fpdfdoc/cpdf_filespec.h" 11 #include "core/fpdfdoc/cpdf_filespec.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "testing/test_support.h" 13 #include "testing/test_support.h"
14 14
15 namespace { 15 namespace {
16 16
17 using ScopedObj = std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>>; 17 using ScopedObj = std::unique_ptr<CPDF_Object>;
18 using ScopedDict = 18 using ScopedDict = std::unique_ptr<CPDF_Dictionary>;
19 std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>>;
20 } 19 }
21 20
22 TEST(cpdf_filespec, EncodeDecodeFileName) { 21 TEST(cpdf_filespec, EncodeDecodeFileName) {
23 std::vector<pdfium::NullTermWstrFuncTestData> test_data = { 22 std::vector<pdfium::NullTermWstrFuncTestData> test_data = {
24 // Empty src string. 23 // Empty src string.
25 {L"", L""}, 24 {L"", L""},
26 // only file name. 25 // only file name.
27 {L"test.pdf", L"test.pdf"}, 26 {L"test.pdf", L"test.pdf"},
28 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 27 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
29 // With drive identifier. 28 // With drive identifier.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 file_spec2.SetFileName(test_data.input); 159 file_spec2.SetFileName(test_data.input);
161 // Check internal object value. 160 // Check internal object value.
162 file_name = dict_obj->GetUnicodeTextFor("F"); 161 file_name = dict_obj->GetUnicodeTextFor("F");
163 EXPECT_TRUE(file_name == test_data.expected); 162 EXPECT_TRUE(file_name == test_data.expected);
164 file_name = dict_obj->GetUnicodeTextFor("UF"); 163 file_name = dict_obj->GetUnicodeTextFor("UF");
165 EXPECT_TRUE(file_name == test_data.expected); 164 EXPECT_TRUE(file_name == test_data.expected);
166 // Check we can get the file name back. 165 // Check we can get the file name back.
167 EXPECT_TRUE(file_spec2.GetFileName(&file_name)); 166 EXPECT_TRUE(file_spec2.GetFileName(&file_name));
168 EXPECT_TRUE(file_name == test_data.input); 167 EXPECT_TRUE(file_name == test_data.input);
169 } 168 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698