chromeos: Remove unused code from GDataFileSystemTest

BUG=None
TEST=Compile

Review URL: https://chromiumcodereview.appspot.com/10735068

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146304 0039d316-1c4b-4281-b951-d872f2087c98
parent 6deb3705
...@@ -482,113 +482,6 @@ class GDataFileSystemTest : public testing::Test { ...@@ -482,113 +482,6 @@ class GDataFileSystemTest : public testing::Test {
test_util::RunBlockingPoolTask(); 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( void TestPin(
const std::string& resource_id, const std::string& resource_id,
const std::string& md5, const std::string& md5,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment