Index: chrome/browser/chromeos/gdata/gdata_cache_metadata_unittest.cc |
diff --git a/chrome/browser/chromeos/gdata/gdata_cache_metadata_unittest.cc b/chrome/browser/chromeos/gdata/gdata_cache_metadata_unittest.cc |
index 4fada510f031deb79b264e0700fccdf76592d5e6..7bc149ab13d84589abd86f45de6e43348d0c220c 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_cache_metadata_unittest.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_cache_metadata_unittest.cc |
@@ -118,7 +118,7 @@ class GDataCacheMetadataMapTest : public testing::Test { |
const std::string& md5, |
int cache_state) { |
cache_map->insert(std::make_pair( |
- resource_id, GDataCache::CacheEntry(md5, cache_state))); |
+ resource_id, GDataCacheEntry(md5, cache_state))); |
} |
ScopedTempDir temp_dir_; |
@@ -140,18 +140,18 @@ TEST_F(GDataCacheMetadataMapTest, CacheTest) { |
std::string test_file_md5("test_file_md5"); |
GDataCache::CacheSubDirectoryType test_sub_dir_type = |
GDataCache::CACHE_TYPE_PERSISTENT; |
- int test_cache_state = (GDataCache::CACHE_STATE_PRESENT | |
- GDataCache::CACHE_STATE_PERSISTENT); |
+ int test_cache_state = (CACHE_STATE_PRESENT | |
+ CACHE_STATE_PERSISTENT); |
metadata_->UpdateCache( |
test_resource_id, |
- GDataCache::CacheEntry(test_file_md5, test_cache_state)); |
+ GDataCacheEntry(test_file_md5, test_cache_state)); |
// Test that the entry can be retrieved. |
- scoped_ptr<GDataCache::CacheEntry> cache_entry = |
+ scoped_ptr<GDataCacheEntry> cache_entry = |
metadata_->GetCacheEntry(test_resource_id, test_file_md5); |
ASSERT_TRUE(cache_entry.get()); |
EXPECT_EQ(test_file_md5, cache_entry->md5()); |
- EXPECT_EQ(test_sub_dir_type, cache_entry->GetSubDirectoryType()); |
+ EXPECT_EQ(test_sub_dir_type, GDataCache::GetSubDirectoryType(*cache_entry)); |
EXPECT_EQ(test_cache_state, cache_entry->cache_state()); |
// Empty md5 should also work. |
@@ -173,17 +173,17 @@ TEST_F(GDataCacheMetadataMapTest, CacheTest) { |
// Update all attributes. |
test_file_md5 = "test_file_md5_2"; |
test_sub_dir_type = GDataCache::CACHE_TYPE_TMP; |
- test_cache_state = GDataCache::CACHE_STATE_PINNED; |
+ test_cache_state = CACHE_STATE_PINNED; |
metadata_->UpdateCache( |
test_resource_id, |
- GDataCache::CacheEntry(test_file_md5, test_cache_state)); |
+ GDataCacheEntry(test_file_md5, test_cache_state)); |
// Make sure the values took. |
cache_entry = |
metadata_->GetCacheEntry(test_resource_id, test_file_md5).Pass(); |
ASSERT_TRUE(cache_entry.get()); |
EXPECT_EQ(test_file_md5, cache_entry->md5()); |
- EXPECT_EQ(test_sub_dir_type, cache_entry->GetSubDirectoryType()); |
+ EXPECT_EQ(test_sub_dir_type, GDataCache::GetSubDirectoryType(*cache_entry)); |
EXPECT_EQ(test_cache_state, cache_entry->cache_state()); |
// Empty m5 should work. |
@@ -195,17 +195,17 @@ TEST_F(GDataCacheMetadataMapTest, CacheTest) { |
// Test dirty cache. |
test_file_md5 = "test_file_md5_3"; |
test_sub_dir_type = GDataCache::CACHE_TYPE_TMP; |
- test_cache_state = GDataCache::CACHE_STATE_DIRTY; |
+ test_cache_state = CACHE_STATE_DIRTY; |
metadata_->UpdateCache( |
test_resource_id, |
- GDataCache::CacheEntry(test_file_md5, test_cache_state)); |
+ GDataCacheEntry(test_file_md5, test_cache_state)); |
// Make sure the values took. |
cache_entry = |
metadata_->GetCacheEntry(test_resource_id, test_file_md5).Pass(); |
ASSERT_TRUE(cache_entry.get()); |
EXPECT_EQ(test_file_md5, cache_entry->md5()); |
- EXPECT_EQ(test_sub_dir_type, cache_entry->GetSubDirectoryType()); |
+ EXPECT_EQ(test_sub_dir_type, GDataCache::GetSubDirectoryType(*cache_entry)); |
EXPECT_EQ(test_cache_state, cache_entry->cache_state()); |
// Empty md5 should work. |
@@ -230,26 +230,26 @@ TEST_F(GDataCacheMetadataMapTest, CacheTest) { |
test_resource_id = "test_resource_id_2"; |
test_file_md5 = "test_file_md5_4"; |
test_sub_dir_type = GDataCache::CACHE_TYPE_TMP; |
- test_cache_state = GDataCache::CACHE_STATE_PRESENT; |
+ test_cache_state = CACHE_STATE_PRESENT; |
metadata_->UpdateCache( |
test_resource_id, |
- GDataCache::CacheEntry(test_file_md5, test_cache_state)); |
+ GDataCacheEntry(test_file_md5, test_cache_state)); |
// Make sure the values took. |
cache_entry = |
metadata_->GetCacheEntry(test_resource_id, test_file_md5).Pass(); |
ASSERT_TRUE(cache_entry.get()); |
EXPECT_EQ(test_file_md5, cache_entry->md5()); |
- EXPECT_EQ(test_sub_dir_type, cache_entry->GetSubDirectoryType()); |
+ EXPECT_EQ(test_sub_dir_type, GDataCache::GetSubDirectoryType(*cache_entry)); |
EXPECT_EQ(test_cache_state, cache_entry->cache_state()); |
// Update with CACHE_STATE_NONE should evict the entry. |
test_file_md5 = "test_file_md5_5"; |
test_sub_dir_type = GDataCache::CACHE_TYPE_TMP; |
- test_cache_state = GDataCache::CACHE_STATE_NONE; |
+ test_cache_state = CACHE_STATE_NONE; |
metadata_->UpdateCache( |
test_resource_id, |
- GDataCache::CacheEntry(test_file_md5, test_cache_state)); |
+ GDataCacheEntry(test_file_md5, test_cache_state)); |
cache_entry = |
metadata_->GetCacheEntry(test_resource_id, std::string()).Pass(); |
@@ -278,14 +278,14 @@ TEST_F(GDataCacheMetadataMapTest, Initialization) { |
// Check contents in "persistent" directory. |
// |
// "id_foo" is present and pinned. |
- scoped_ptr<GDataCache::CacheEntry> cache_entry; |
+ scoped_ptr<GDataCacheEntry> cache_entry; |
cache_entry = metadata_->GetCacheEntry("id_foo", "md5foo"); |
ASSERT_TRUE(cache_entry.get()); |
EXPECT_EQ("md5foo", cache_entry->md5()); |
EXPECT_EQ(GDataCache::CACHE_TYPE_PERSISTENT, |
- cache_entry->GetSubDirectoryType()); |
- EXPECT_EQ(GDataCache::CACHE_STATE_PRESENT | GDataCache::CACHE_STATE_PINNED | |
- GDataCache::CACHE_STATE_PERSISTENT, |
+ GDataCache::GetSubDirectoryType(*cache_entry)); |
+ EXPECT_EQ(CACHE_STATE_PRESENT | CACHE_STATE_PINNED | |
+ CACHE_STATE_PERSISTENT, |
cache_entry->cache_state()); |
EXPECT_TRUE(PathExists(persistent_directory_.AppendASCII("id_foo.md5foo"))); |
EXPECT_TRUE(PathExists(pinned_directory_.AppendASCII("id_foo"))); |
@@ -297,9 +297,9 @@ TEST_F(GDataCacheMetadataMapTest, Initialization) { |
ASSERT_TRUE(cache_entry.get()); |
EXPECT_EQ("local", cache_entry->md5()); |
EXPECT_EQ(GDataCache::CACHE_TYPE_PERSISTENT, |
- cache_entry->GetSubDirectoryType()); |
- EXPECT_EQ(GDataCache::CACHE_STATE_PRESENT | GDataCache::CACHE_STATE_DIRTY | |
- GDataCache::CACHE_STATE_PERSISTENT, |
+ GDataCache::GetSubDirectoryType(*cache_entry)); |
+ EXPECT_EQ(CACHE_STATE_PRESENT | CACHE_STATE_DIRTY | |
+ CACHE_STATE_PERSISTENT, |
cache_entry->cache_state()); |
EXPECT_TRUE(PathExists(persistent_directory_.AppendASCII("id_bar.local"))); |
EXPECT_TRUE(PathExists(outgoing_directory_.AppendASCII("id_bar"))); |
@@ -325,8 +325,9 @@ TEST_F(GDataCacheMetadataMapTest, Initialization) { |
cache_entry = metadata_->GetCacheEntry("id_qux", "md5qux"); |
ASSERT_TRUE(cache_entry.get()); |
EXPECT_EQ("md5qux", cache_entry->md5()); |
- EXPECT_EQ(GDataCache::CACHE_TYPE_TMP, cache_entry->GetSubDirectoryType()); |
- EXPECT_EQ(GDataCache::CACHE_STATE_PRESENT, cache_entry->cache_state()); |
+ EXPECT_EQ(GDataCache::CACHE_TYPE_TMP, |
+ GDataCache::GetSubDirectoryType(*cache_entry)); |
+ EXPECT_EQ(CACHE_STATE_PRESENT, cache_entry->cache_state()); |
EXPECT_TRUE(PathExists(tmp_directory_.AppendASCII("id_qux.md5qux"))); |
// "id_quux" should be removed during cache initialization. |
@@ -345,7 +346,7 @@ TEST_F(GDataCacheMetadataMapTest, Initialization) { |
cache_entry = metadata_->GetCacheEntry("id_corge", ""); |
ASSERT_TRUE(cache_entry.get()); |
EXPECT_EQ("", cache_entry->md5()); |
- EXPECT_EQ(GDataCache::CACHE_STATE_PINNED, cache_entry->cache_state()); |
+ EXPECT_EQ(CACHE_STATE_PINNED, cache_entry->cache_state()); |
EXPECT_TRUE(IsLink(pinned_directory_.AppendASCII("id_corge"))); |
// "id_dangling" should be removed during cache initialization. |
@@ -372,21 +373,21 @@ TEST_F(GDataCacheMetadataMapTest, RemoveTemporaryFilesTest) { |
InsertIntoMap(&cache_map, |
"<resource_id_1>", |
"<md5>", |
- GDataCache::CACHE_STATE_PRESENT); |
+ CACHE_STATE_PRESENT); |
InsertIntoMap(&cache_map, |
"<resource_id_2>", |
"<md5>", |
- GDataCache::CACHE_STATE_PRESENT | |
- GDataCache::CACHE_STATE_PERSISTENT); |
+ CACHE_STATE_PRESENT | |
+ CACHE_STATE_PERSISTENT); |
InsertIntoMap(&cache_map, |
"<resource_id_3>", |
"<md5>", |
- GDataCache::CACHE_STATE_PRESENT | |
- GDataCache::CACHE_STATE_PERSISTENT); |
+ CACHE_STATE_PRESENT | |
+ CACHE_STATE_PERSISTENT); |
InsertIntoMap(&cache_map, |
"<resource_id_4>", |
"<md5>", |
- GDataCache::CACHE_STATE_PRESENT); |
+ CACHE_STATE_PRESENT); |
metadata_->cache_map_ = cache_map; |
metadata_->RemoveTemporaryFiles(); |