diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-11 22:09:55 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-11 22:09:55 +0000 |
commit | 75cbb35fa7fb6ce0a511612ec91998c053247be8 (patch) | |
tree | 5abee27b2c5f2c60e5017aa6c00b43d9fe2376f4 /base/data_pack_unittest.cc | |
parent | 9fa8c2f5e9581c2e521fd28aadedc4c77b9b2150 (diff) | |
download | chromium_src-75cbb35fa7fb6ce0a511612ec91998c053247be8.zip chromium_src-75cbb35fa7fb6ce0a511612ec91998c053247be8.tar.gz chromium_src-75cbb35fa7fb6ce0a511612ec91998c053247be8.tar.bz2 |
Revert "Completely redo how themes are stored on disk and processed at install
time," as it fails valgrind tests.
This reverts commit 86faccd1028937a69ccc718718fd48c06c0cd471 (r34379).
Review URL: http://codereview.chromium.org/490025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34385 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/data_pack_unittest.cc')
-rw-r--r-- | base/data_pack_unittest.cc | 54 |
1 files changed, 11 insertions, 43 deletions
diff --git a/base/data_pack_unittest.cc b/base/data_pack_unittest.cc index d089b28..a62acf0 100644 --- a/base/data_pack_unittest.cc +++ b/base/data_pack_unittest.cc @@ -5,20 +5,24 @@ #include "base/data_pack.h" #include "base/file_path.h" -#include "base/file_util.h" #include "base/path_service.h" -#include "base/scoped_temp_dir.h" #include "base/string_piece.h" #include "testing/gtest/include/gtest/gtest.h" -TEST(DataPackTest, Load) { - FilePath data_path; - PathService::Get(base::DIR_SOURCE_ROOT, &data_path); - data_path = data_path.Append( +class DataPackTest : public testing::Test { + public: + DataPackTest() { + PathService::Get(base::DIR_SOURCE_ROOT, &data_path_); + data_path_ = data_path_.Append( FILE_PATH_LITERAL("base/data/data_pack_unittest/sample.pak")); + } + FilePath data_path_; +}; + +TEST_F(DataPackTest, Load) { base::DataPack pack; - ASSERT_TRUE(pack.Load(data_path)); + ASSERT_TRUE(pack.Load(data_path_)); base::StringPiece data; ASSERT_TRUE(pack.GetStringPiece(4, &data)); @@ -35,39 +39,3 @@ TEST(DataPackTest, Load) { // Try looking up an invalid key. ASSERT_FALSE(pack.GetStringPiece(140, &data)); } - -TEST(DataPackTest, Write) { - ScopedTempDir dir; - ASSERT_TRUE(dir.CreateUniqueTempDir()); - FilePath file = dir.path().Append(FILE_PATH_LITERAL("data.pak")); - - std::string one("one"); - std::string two("two"); - std::string three("three"); - std::string four("four"); - std::string fifteen("fifteen"); - - std::map<uint32, base::StringPiece> resources; - resources.insert(std::make_pair(1, base::StringPiece(one))); - resources.insert(std::make_pair(2, base::StringPiece(two))); - 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(base::DataPack::WritePack(file, resources)); - - // Now try to read the data back in. - base::DataPack pack; - ASSERT_TRUE(pack.Load(file)); - - base::StringPiece data; - ASSERT_TRUE(pack.GetStringPiece(1, &data)); - EXPECT_EQ(one, data); - ASSERT_TRUE(pack.GetStringPiece(2, &data)); - EXPECT_EQ(two, data); - ASSERT_TRUE(pack.GetStringPiece(3, &data)); - EXPECT_EQ(three, data); - ASSERT_TRUE(pack.GetStringPiece(4, &data)); - EXPECT_EQ(four, data); - ASSERT_TRUE(pack.GetStringPiece(15, &data)); - EXPECT_EQ(fifteen, data); -} |