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

Side by Side Diff: ui/base/resource/data_pack_unittest.cc

Issue 288323003: ui: Fix the path of DIR_TEST_DATA key. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no assert_true Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/base/ui_base_paths.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/files/file.h" 6 #include "base/files/file.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/base/resource/data_pack.h" 12 #include "ui/base/resource/data_pack.h"
13 #include "ui/base/ui_base_paths.h"
13 14
14 namespace ui { 15 namespace ui {
15 16
16 class DataPackTest 17 class DataPackTest
17 : public testing::TestWithParam<DataPack::TextEncodingType> { 18 : public testing::TestWithParam<DataPack::TextEncodingType> {
18 public: 19 public:
19 DataPackTest() {} 20 DataPackTest() {}
20 }; 21 };
21 22
22 extern const char kSamplePakContents[]; 23 extern const char kSamplePakContents[];
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 92
92 INSTANTIATE_TEST_CASE_P(WriteBINARY, DataPackTest, ::testing::Values( 93 INSTANTIATE_TEST_CASE_P(WriteBINARY, DataPackTest, ::testing::Values(
93 DataPack::BINARY)); 94 DataPack::BINARY));
94 INSTANTIATE_TEST_CASE_P(WriteUTF8, DataPackTest, ::testing::Values( 95 INSTANTIATE_TEST_CASE_P(WriteUTF8, DataPackTest, ::testing::Values(
95 DataPack::UTF8)); 96 DataPack::UTF8));
96 INSTANTIATE_TEST_CASE_P(WriteUTF16, DataPackTest, ::testing::Values( 97 INSTANTIATE_TEST_CASE_P(WriteUTF16, DataPackTest, ::testing::Values(
97 DataPack::UTF16)); 98 DataPack::UTF16));
98 99
99 TEST(DataPackTest, LoadFileWithTruncatedHeader) { 100 TEST(DataPackTest, LoadFileWithTruncatedHeader) {
100 base::FilePath data_path; 101 base::FilePath data_path;
101 PathService::Get(base::DIR_SOURCE_ROOT, &data_path); 102 // TODO(tfarina): This fails on ios_dbg_simulator. Investigate and add
102 data_path = data_path.Append(FILE_PATH_LITERAL( 103 // ASSERT_TRUE to PathService::Get() call again.
103 "ui/base/test/data/data_pack_unittest/truncated-header.pak")); 104 PathService::Get(UI_DIR_TEST_DATA, &data_path);
105 data_path = data_path.AppendASCII("data_pack_unittest/truncated-header.pak");
104 106
105 DataPack pack(SCALE_FACTOR_100P); 107 DataPack pack(SCALE_FACTOR_100P);
106 ASSERT_FALSE(pack.LoadFromPath(data_path)); 108 ASSERT_FALSE(pack.LoadFromPath(data_path));
107 } 109 }
108 110
109 TEST_P(DataPackTest, Write) { 111 TEST_P(DataPackTest, Write) {
110 base::ScopedTempDir dir; 112 base::ScopedTempDir dir;
111 ASSERT_TRUE(dir.CreateUniqueTempDir()); 113 ASSERT_TRUE(dir.CreateUniqueTempDir());
112 base::FilePath file = dir.path().Append(FILE_PATH_LITERAL("data.pak")); 114 base::FilePath file = dir.path().Append(FILE_PATH_LITERAL("data.pak"));
113 115
(...skipping 23 matching lines...) Expand all
137 EXPECT_EQ(two, data); 139 EXPECT_EQ(two, data);
138 ASSERT_TRUE(pack.GetStringPiece(3, &data)); 140 ASSERT_TRUE(pack.GetStringPiece(3, &data));
139 EXPECT_EQ(three, data); 141 EXPECT_EQ(three, data);
140 ASSERT_TRUE(pack.GetStringPiece(4, &data)); 142 ASSERT_TRUE(pack.GetStringPiece(4, &data));
141 EXPECT_EQ(four, data); 143 EXPECT_EQ(four, data);
142 ASSERT_TRUE(pack.GetStringPiece(15, &data)); 144 ASSERT_TRUE(pack.GetStringPiece(15, &data));
143 EXPECT_EQ(fifteen, data); 145 EXPECT_EQ(fifteen, data);
144 } 146 }
145 147
146 } // namespace ui 148 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/base/ui_base_paths.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698