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

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: Updated. Created 9 years, 4 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
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 0f4809784a0afa22d3433ee040c575ab487c20c1..82c72f462ef32fa575ab6203ec5882a6ed4743e8 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:
tony 2011/08/30 21:19:58 Nit: 1 space indent
marcvs 2011/08/30 22:17:22 Done.
+ DataPackTest() {}
tony 2011/08/30 21:19:58 Nit: 2 space indent
marcvs 2011/08/30 22:17:22 Done.
+};
+
TEST(DataPackTest, Load) {
FilePath data_path;
PathService::Get(base::DIR_SOURCE_ROOT, &data_path);
@@ -37,7 +43,14 @@ TEST(DataPackTest, Load) {
ASSERT_FALSE(pack.GetStringPiece(140, &data));
}
-TEST(DataPackTest, Write) {
+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));
tony 2011/08/30 21:19:58 Nice, I didn't know about these gtest macros.
+
+TEST_P(DataPackTest, Write) {
ScopedTempDir dir;
ASSERT_TRUE(dir.CreateUniqueTempDir());
FilePath file = dir.path().Append(FILE_PATH_LITERAL("data.pak"));
@@ -54,11 +67,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));

Powered by Google App Engine
This is Rietveld 408576698