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

Side by Side Diff: app/data_pack_unittest.cc

Issue 5992006: Move data pack from base to app (it's just part of the resource bundle system... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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 | « app/data_pack.cc ('k') | app/resource_bundle.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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/data_pack.h" 5 #include "app/data_pack.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
11 #include "base/string_piece.h" 11 #include "base/string_piece.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace app {
15
14 TEST(DataPackTest, Load) { 16 TEST(DataPackTest, Load) {
15 FilePath data_path; 17 FilePath data_path;
16 PathService::Get(base::DIR_SOURCE_ROOT, &data_path); 18 PathService::Get(base::DIR_SOURCE_ROOT, &data_path);
17 data_path = data_path.Append( 19 data_path = data_path.Append(
18 FILE_PATH_LITERAL("base/data/data_pack_unittest/sample.pak")); 20 FILE_PATH_LITERAL("app/test/data/data_pack_unittest/sample.pak"));
19 21
20 base::DataPack pack; 22 base::DataPack pack;
21 ASSERT_TRUE(pack.Load(data_path)); 23 ASSERT_TRUE(pack.Load(data_path));
22 24
23 base::StringPiece data; 25 base::StringPiece data;
24 ASSERT_TRUE(pack.GetStringPiece(4, &data)); 26 ASSERT_TRUE(pack.GetStringPiece(4, &data));
25 EXPECT_EQ("this is id 4", data); 27 EXPECT_EQ("this is id 4", data);
26 ASSERT_TRUE(pack.GetStringPiece(6, &data)); 28 ASSERT_TRUE(pack.GetStringPiece(6, &data));
27 EXPECT_EQ("this is id 6", data); 29 EXPECT_EQ("this is id 6", data);
28 30
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 EXPECT_EQ(one, data); 66 EXPECT_EQ(one, data);
65 ASSERT_TRUE(pack.GetStringPiece(2, &data)); 67 ASSERT_TRUE(pack.GetStringPiece(2, &data));
66 EXPECT_EQ(two, data); 68 EXPECT_EQ(two, data);
67 ASSERT_TRUE(pack.GetStringPiece(3, &data)); 69 ASSERT_TRUE(pack.GetStringPiece(3, &data));
68 EXPECT_EQ(three, data); 70 EXPECT_EQ(three, data);
69 ASSERT_TRUE(pack.GetStringPiece(4, &data)); 71 ASSERT_TRUE(pack.GetStringPiece(4, &data));
70 EXPECT_EQ(four, data); 72 EXPECT_EQ(four, data);
71 ASSERT_TRUE(pack.GetStringPiece(15, &data)); 73 ASSERT_TRUE(pack.GetStringPiece(15, &data));
72 EXPECT_EQ(fifteen, data); 74 EXPECT_EQ(fifteen, data);
73 } 75 }
76
77 } // namespace app
OLDNEW
« no previous file with comments | « app/data_pack.cc ('k') | app/resource_bundle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698