Index: chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc |
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc |
index 000a134e428cd451ef1941407bfcf41e5fc6b4d0..742c792c954585f9aa18fa5accab74bb29c055ff 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc |
@@ -482,113 +482,6 @@ class GDataFileSystemTest : public testing::Test { |
test_util::RunBlockingPoolTask(); |
} |
- void TestRemoveFromCache(const std::string& resource_id, |
- base::PlatformFileError expected_error) { |
- expected_error_ = expected_error; |
- |
- cache_->RemoveOnUIThread( |
- resource_id, |
- base::Bind(&GDataFileSystemTest::VerifyRemoveFromCache, |
- base::Unretained(this))); |
- |
- test_util::RunBlockingPoolTask(); |
- } |
- |
- void VerifyRemoveFromCache(base::PlatformFileError error, |
- const std::string& resource_id, |
- const std::string& md5) { |
- ++num_callback_invocations_; |
- |
- EXPECT_EQ(expected_error_, error); |
- |
- // Verify cache map. |
- scoped_ptr<GDataCacheEntry> cache_entry = |
- GetCacheEntryFromOriginThread(resource_id, md5); |
- if (cache_entry.get()) |
- EXPECT_TRUE(cache_entry->IsDirty()); |
- |
- // If entry doesn't exist, verify that: |
- // - no files with "<resource_id>.* exists in persistent and tmp dirs |
- // - no "<resource_id>" symlink exists in pinned and outgoing dirs. |
- std::vector<PathToVerify> paths_to_verify; |
- paths_to_verify.push_back( // Index 0: CACHE_TYPE_TMP. |
- PathToVerify(cache_->GetCacheFilePath(resource_id, "*", |
- GDataCache::CACHE_TYPE_TMP, |
- GDataCache::CACHED_FILE_FROM_SERVER), FilePath())); |
- paths_to_verify.push_back( // Index 1: CACHE_TYPE_PERSISTENT. |
- PathToVerify(cache_->GetCacheFilePath(resource_id, "*", |
- GDataCache::CACHE_TYPE_PERSISTENT, |
- GDataCache::CACHED_FILE_FROM_SERVER), FilePath())); |
- paths_to_verify.push_back( // Index 2: CACHE_TYPE_PINNED. |
- PathToVerify(cache_->GetCacheFilePath(resource_id, "", |
- GDataCache::CACHE_TYPE_PINNED, |
- GDataCache::CACHED_FILE_FROM_SERVER), FilePath())); |
- paths_to_verify.push_back( // Index 3: CACHE_TYPE_OUTGOING. |
- PathToVerify(cache_->GetCacheFilePath(resource_id, "", |
- GDataCache::CACHE_TYPE_OUTGOING, |
- GDataCache::CACHED_FILE_FROM_SERVER), FilePath())); |
- if (!cache_entry.get()) { |
- for (size_t i = 0; i < paths_to_verify.size(); ++i) { |
- file_util::FileEnumerator enumerator( |
- paths_to_verify[i].path_to_scan.DirName(), false /* not recursive*/, |
- static_cast<file_util::FileEnumerator::FileType>( |
- file_util::FileEnumerator::FILES | |
- file_util::FileEnumerator::SHOW_SYM_LINKS), |
- paths_to_verify[i].path_to_scan.BaseName().value()); |
- EXPECT_TRUE(enumerator.Next().empty()); |
- } |
- } else { |
- // Entry is dirty, verify that: |
- // - no files with "<resource_id>.*" exist in tmp dir |
- // - only 1 "<resource_id>.local" exists in persistent dir |
- // - only 1 <resource_id> exists in outgoing dir |
- // - if entry is pinned, only 1 <resource_id> exists in pinned dir. |
- |
- // Change expected_existing_path of CACHE_TYPE_PERSISTENT (index 1). |
- paths_to_verify[1].expected_existing_path = |
- GetCacheFilePath(resource_id, |
- std::string(), |
- GDataCache::CACHE_TYPE_PERSISTENT, |
- GDataCache::CACHED_FILE_LOCALLY_MODIFIED); |
- |
- // Change expected_existing_path of CACHE_TYPE_OUTGOING (index 3). |
- paths_to_verify[3].expected_existing_path = |
- GetCacheFilePath(resource_id, |
- std::string(), |
- GDataCache::CACHE_TYPE_OUTGOING, |
- GDataCache::CACHED_FILE_FROM_SERVER); |
- |
- if (cache_entry->IsPinned()) { |
- // Change expected_existing_path of CACHE_TYPE_PINNED (index 2). |
- paths_to_verify[2].expected_existing_path = |
- GetCacheFilePath(resource_id, |
- std::string(), |
- GDataCache::CACHE_TYPE_PINNED, |
- GDataCache::CACHED_FILE_FROM_SERVER); |
- } |
- |
- for (size_t i = 0; i < paths_to_verify.size(); ++i) { |
- const struct PathToVerify& verify = paths_to_verify[i]; |
- file_util::FileEnumerator enumerator( |
- verify.path_to_scan.DirName(), false /* not recursive*/, |
- static_cast<file_util::FileEnumerator::FileType>( |
- file_util::FileEnumerator::FILES | |
- file_util::FileEnumerator::SHOW_SYM_LINKS), |
- verify.path_to_scan.BaseName().value()); |
- size_t num_files_found = 0; |
- for (FilePath current = enumerator.Next(); !current.empty(); |
- current = enumerator.Next()) { |
- ++num_files_found; |
- EXPECT_EQ(verify.expected_existing_path, current); |
- } |
- if (verify.expected_existing_path.empty()) |
- EXPECT_EQ(0U, num_files_found); |
- else |
- EXPECT_EQ(1U, num_files_found); |
- } |
- } |
- } |
- |
void TestPin( |
const std::string& resource_id, |
const std::string& md5, |