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

Unified Diff: ui/base/resource/data_pack_unittest.cc

Issue 7744017: Updated *.pak file format to support both UTF8 and UTF16 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modified mac-specific parts of the code. Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/resource/data_pack_literal.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/resource/data_pack_unittest.cc
diff --git a/ui/base/resource/data_pack_unittest.cc b/ui/base/resource/data_pack_unittest.cc
index fe3613c0140e2a3f9d0f3a3abc4e828b6893ab28..1c0bd7a106653c5dc51521eb2022f9267e408d6e 100644
--- a/ui/base/resource/data_pack_unittest.cc
+++ b/ui/base/resource/data_pack_unittest.cc
@@ -12,6 +12,12 @@
namespace ui {
+class DataPackTest
+ : public testing::TestWithParam<DataPack::TextEncodingType> {
+ public:
+ DataPackTest() {}
+};
+
extern const char kSamplePakContents[];
extern const size_t kSamplePakSize;
@@ -44,6 +50,13 @@ TEST(DataPackTest, Load) {
ASSERT_FALSE(pack.GetStringPiece(140, &data));
}
+INSTANTIATE_TEST_CASE_P(WriteBINARY, DataPackTest, ::testing::Values(
+ DataPack::BINARY));
+INSTANTIATE_TEST_CASE_P(WriteUTF8, DataPackTest, ::testing::Values(
+ DataPack::UTF8));
+INSTANTIATE_TEST_CASE_P(WriteUTF16, DataPackTest, ::testing::Values(
+ DataPack::UTF16));
+
TEST(DataPackTest, LoadFileWithTruncatedHeader) {
FilePath data_path;
PathService::Get(base::DIR_SOURCE_ROOT, &data_path);
@@ -54,7 +67,7 @@ TEST(DataPackTest, LoadFileWithTruncatedHeader) {
ASSERT_FALSE(pack.Load(data_path));
}
-TEST(DataPackTest, Write) {
+TEST_P(DataPackTest, Write) {
ScopedTempDir dir;
ASSERT_TRUE(dir.CreateUniqueTempDir());
FilePath file = dir.path().Append(FILE_PATH_LITERAL("data.pak"));
@@ -71,11 +84,12 @@ TEST(DataPackTest, Write) {
resources.insert(std::make_pair(15, base::StringPiece(fifteen)));
resources.insert(std::make_pair(3, base::StringPiece(three)));
resources.insert(std::make_pair(4, base::StringPiece(four)));
- ASSERT_TRUE(DataPack::WritePack(file, resources));
+ ASSERT_TRUE(DataPack::WritePack(file, resources, GetParam()));
// Now try to read the data back in.
DataPack pack;
ASSERT_TRUE(pack.Load(file));
+ EXPECT_EQ(pack.GetTextEncodingType(), GetParam());
base::StringPiece data;
ASSERT_TRUE(pack.GetStringPiece(1, &data));
« no previous file with comments | « ui/base/resource/data_pack_literal.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698