summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-26 07:47:36 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-26 07:47:36 +0000
commit1b0ce4c645e1e42ba605a8eb1638bd9788ffb7f8 (patch)
tree337805e0bc8561433802c12e0df8869b0688518e /chrome/browser
parent64578d1295422da4afb5a1dcb1745e8c1660630e (diff)
downloadchromium_src-1b0ce4c645e1e42ba605a8eb1638bd9788ffb7f8.zip
chromium_src-1b0ce4c645e1e42ba605a8eb1638bd9788ffb7f8.tar.gz
chromium_src-1b0ce4c645e1e42ba605a8eb1638bd9788ffb7f8.tar.bz2
drive: Remove MD5 argument from FileCache::GetCacheEntry()
Remove MD5 argument from FileCache::GetCacheEntry() and FileSystem::GetCacheEntryByResourceId(). BUG=248424 TEST=unit_tests R=hidehiko@chromium.org Review URL: https://codereview.chromium.org/20614003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213785 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chromeos/drive/dummy_file_system.h1
-rw-r--r--chrome/browser/chromeos/drive/fake_file_system.cc1
-rw-r--r--chrome/browser/chromeos/drive/fake_file_system.h1
-rw-r--r--chrome/browser/chromeos/drive/file_cache.cc28
-rw-r--r--chrome/browser/chromeos/drive/file_cache.h11
-rw-r--r--chrome/browser/chromeos/drive/file_cache_unittest.cc67
-rw-r--r--chrome/browser/chromeos/drive/file_system.cc14
-rw-r--r--chrome/browser/chromeos/drive/file_system.h1
-rw-r--r--chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system/download_operation.cc4
-rw-r--r--chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system/update_operation_unittest.cc3
-rw-r--r--chrome/browser/chromeos/drive/file_system_interface.h8
-rw-r--r--chrome/browser/chromeos/drive/file_system_unittest.cc12
-rw-r--r--chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc8
-rw-r--r--chrome/browser/chromeos/drive/sync_client_unittest.cc39
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc1
17 files changed, 74 insertions, 129 deletions
diff --git a/chrome/browser/chromeos/drive/dummy_file_system.h b/chrome/browser/chromeos/drive/dummy_file_system.h
index f614ce0..191be66 100644
--- a/chrome/browser/chromeos/drive/dummy_file_system.h
+++ b/chrome/browser/chromeos/drive/dummy_file_system.h
@@ -93,7 +93,6 @@ class DummyFileSystem : public FileSystemInterface {
const FileOperationCallback& callback) OVERRIDE {}
virtual void GetCacheEntryByResourceId(
const std::string& resource_id,
- const std::string& md5,
const GetCacheEntryCallback& callback) OVERRIDE {}
virtual void Reload() OVERRIDE {}
};
diff --git a/chrome/browser/chromeos/drive/fake_file_system.cc b/chrome/browser/chromeos/drive/fake_file_system.cc
index 1bb1ca3..40022c0 100644
--- a/chrome/browser/chromeos/drive/fake_file_system.cc
+++ b/chrome/browser/chromeos/drive/fake_file_system.cc
@@ -224,7 +224,6 @@ void FakeFileSystem::MarkCacheFileAsUnmounted(
void FakeFileSystem::GetCacheEntryByResourceId(
const std::string& resource_id,
- const std::string& md5,
const GetCacheEntryCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
}
diff --git a/chrome/browser/chromeos/drive/fake_file_system.h b/chrome/browser/chromeos/drive/fake_file_system.h
index c59975a..da005db 100644
--- a/chrome/browser/chromeos/drive/fake_file_system.h
+++ b/chrome/browser/chromeos/drive/fake_file_system.h
@@ -125,7 +125,6 @@ class FakeFileSystem : public FileSystemInterface {
const FileOperationCallback& callback) OVERRIDE;
virtual void GetCacheEntryByResourceId(
const std::string& resource_id,
- const std::string& md5,
const GetCacheEntryCallback& callback) OVERRIDE;
virtual void Reload() OVERRIDE;
diff --git a/chrome/browser/chromeos/drive/file_cache.cc b/chrome/browser/chromeos/drive/file_cache.cc
index 8ef2ab7..ed94c02 100644
--- a/chrome/browser/chromeos/drive/file_cache.cc
+++ b/chrome/browser/chromeos/drive/file_cache.cc
@@ -29,28 +29,6 @@ namespace {
typedef std::map<std::string, FileCacheEntry> CacheMap;
-// Returns true if |md5| matches the one in |cache_entry| with some
-// exceptions. See the function definition for details.
-bool CheckIfMd5Matches(const std::string& md5,
- const FileCacheEntry& cache_entry) {
- if (cache_entry.is_dirty()) {
- // If the entry is dirty, its MD5 may have been replaced by "local"
- // during cache initialization, so we don't compare MD5.
- return true;
- } else if (cache_entry.is_pinned() && cache_entry.md5().empty()) {
- // If the entry is pinned, it's ok for the entry to have an empty
- // MD5. This can happen if the pinned file is not fetched.
- return true;
- } else if (md5.empty()) {
- // If the MD5 matching is not requested, don't check MD5.
- return true;
- } else if (md5 == cache_entry.md5()) {
- // Otherwise, compare the MD5.
- return true;
- }
- return false;
-}
-
// Returns resource ID extracted from the path.
std::string GetResourceIdFromPath(const base::FilePath& path) {
return util::UnescapeCacheFileName(path.BaseName().AsUTF8Unsafe());
@@ -152,7 +130,6 @@ bool FileCache::IsUnderFileCacheDirectory(const base::FilePath& path) const {
}
void FileCache::GetCacheEntryOnUIThread(const std::string& resource_id,
- const std::string& md5,
const GetCacheEntryCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
@@ -164,19 +141,16 @@ void FileCache::GetCacheEntryOnUIThread(const std::string& resource_id,
base::Bind(&FileCache::GetCacheEntry,
base::Unretained(this),
resource_id,
- md5,
cache_entry),
base::Bind(
&RunGetCacheEntryCallback, callback, base::Owned(cache_entry)));
}
bool FileCache::GetCacheEntry(const std::string& resource_id,
- const std::string& md5,
FileCacheEntry* entry) {
DCHECK(entry);
AssertOnSequencedWorkerPool();
- return storage_->GetCacheEntry(resource_id, entry) &&
- CheckIfMd5Matches(md5, *entry);
+ return storage_->GetCacheEntry(resource_id, entry);
}
void FileCache::IterateOnUIThread(
diff --git a/chrome/browser/chromeos/drive/file_cache.h b/chrome/browser/chromeos/drive/file_cache.h
index 405341b..0c32481 100644
--- a/chrome/browser/chromeos/drive/file_cache.h
+++ b/chrome/browser/chromeos/drive/file_cache.h
@@ -98,20 +98,17 @@ class FileCache {
// Can be called on any thread.
bool IsUnderFileCacheDirectory(const base::FilePath& path) const;
- // Gets the cache entry for file corresponding to |resource_id| and |md5|
- // and runs |callback| with true and the entry found if entry exists in cache
- // map. Otherwise, runs |callback| with false.
- // |md5| can be empty if only matching |resource_id| is desired.
+ // Gets the cache entry for file corresponding to |resource_id| and runs
+ // |callback| with true and the entry found if entry exists in cache map.
+ // Otherwise, runs |callback| with false.
// |callback| must not be null.
// Must be called on the UI thread.
void GetCacheEntryOnUIThread(const std::string& resource_id,
- const std::string& md5,
const GetCacheEntryCallback& callback);
- // Gets the cache entry by the given resource ID and MD5.
+ // Gets the cache entry by the given resource ID.
// See also GetCacheEntryOnUIThread().
bool GetCacheEntry(const std::string& resource_id,
- const std::string& md5,
FileCacheEntry* entry);
// Runs Iterate() with |iteration_callback| on |blocking_task_runner_| and
diff --git a/chrome/browser/chromeos/drive/file_cache_unittest.cc b/chrome/browser/chromeos/drive/file_cache_unittest.cc
index 7db6e0a..f0ae710 100644
--- a/chrome/browser/chromeos/drive/file_cache_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_cache_unittest.cc
@@ -139,7 +139,14 @@ class FileCacheTestOnUIThread : public testing::Test {
FileCache::FILE_OPERATION_COPY,
google_apis::test_util::CreateCopyResultCallback(&error));
test_util::RunBlockingPoolTask();
- VerifyCacheFileState(error, resource_id, md5);
+
+ if (error == FILE_ERROR_OK) {
+ FileCacheEntry cache_entry;
+ EXPECT_TRUE(GetCacheEntryFromOriginThread(resource_id, &cache_entry));
+ EXPECT_EQ(md5, cache_entry.md5());
+ }
+
+ VerifyCacheFileState(error, resource_id);
}
void TestRemoveFromCache(const std::string& resource_id,
@@ -151,16 +158,14 @@ class FileCacheTestOnUIThread : public testing::Test {
resource_id,
google_apis::test_util::CreateCopyResultCallback(&error));
test_util::RunBlockingPoolTask();
- VerifyRemoveFromCache(error, resource_id, "");
+ VerifyRemoveFromCache(error, resource_id);
}
- void VerifyRemoveFromCache(FileError error,
- const std::string& resource_id,
- const std::string& md5) {
+ void VerifyRemoveFromCache(FileError error, const std::string& resource_id) {
EXPECT_EQ(expected_error_, error);
FileCacheEntry cache_entry;
- if (!GetCacheEntryFromOriginThread(resource_id, md5, &cache_entry)) {
+ if (!GetCacheEntryFromOriginThread(resource_id, &cache_entry)) {
EXPECT_EQ(FILE_ERROR_OK, error);
const base::FilePath path = cache_->GetCacheFilePath(resource_id);
@@ -179,7 +184,7 @@ class FileCacheTestOnUIThread : public testing::Test {
resource_id,
google_apis::test_util::CreateCopyResultCallback(&error));
test_util::RunBlockingPoolTask();
- VerifyCacheFileState(error, resource_id, std::string());
+ VerifyCacheFileState(error, resource_id);
}
void TestUnpin(const std::string& resource_id,
@@ -193,7 +198,7 @@ class FileCacheTestOnUIThread : public testing::Test {
resource_id,
google_apis::test_util::CreateCopyResultCallback(&error));
test_util::RunBlockingPoolTask();
- VerifyCacheFileState(error, resource_id, std::string());
+ VerifyCacheFileState(error, resource_id);
}
void TestMarkDirty(const std::string& resource_id,
@@ -208,7 +213,7 @@ class FileCacheTestOnUIThread : public testing::Test {
google_apis::test_util::CreateCopyResultCallback(&error));
test_util::RunBlockingPoolTask();
- VerifyCacheFileState(error, resource_id, std::string());
+ VerifyCacheFileState(error, resource_id);
// Verify filename.
if (error == FILE_ERROR_OK) {
@@ -242,7 +247,14 @@ class FileCacheTestOnUIThread : public testing::Test {
md5),
google_apis::test_util::CreateCopyResultCallback(&error));
test_util::RunBlockingPoolTask();
- VerifyCacheFileState(error, resource_id, md5);
+
+ if (error == FILE_ERROR_OK) {
+ FileCacheEntry cache_entry;
+ EXPECT_TRUE(GetCacheEntryFromOriginThread(resource_id, &cache_entry));
+ EXPECT_EQ(md5, cache_entry.md5());
+ }
+
+ VerifyCacheFileState(error, resource_id);
}
void TestMarkAsMounted(const std::string& resource_id,
@@ -252,8 +264,7 @@ class FileCacheTestOnUIThread : public testing::Test {
expected_cache_state_ = expected_cache_state;
FileCacheEntry entry;
- EXPECT_TRUE(GetCacheEntryFromOriginThread(resource_id, std::string(),
- &entry));
+ EXPECT_TRUE(GetCacheEntryFromOriginThread(resource_id, &entry));
FileError error = FILE_ERROR_OK;
base::FilePath cache_file_path;
@@ -292,15 +303,13 @@ class FileCacheTestOnUIThread : public testing::Test {
EXPECT_EQ(cache_file_path, cache_->GetCacheFilePath(resource_id));
}
- void VerifyCacheFileState(FileError error,
- const std::string& resource_id,
- const std::string& md5) {
+ void VerifyCacheFileState(FileError error, const std::string& resource_id) {
EXPECT_EQ(expected_error_, error);
// Verify cache map.
FileCacheEntry cache_entry;
const bool cache_entry_found =
- GetCacheEntryFromOriginThread(resource_id, md5, &cache_entry);
+ GetCacheEntryFromOriginThread(resource_id, &cache_entry);
if ((expected_cache_state_ & TEST_CACHE_STATE_PRESENT) ||
(expected_cache_state_ & TEST_CACHE_STATE_PINNED)) {
ASSERT_TRUE(cache_entry_found);
@@ -322,21 +331,19 @@ class FileCacheTestOnUIThread : public testing::Test {
// Helper function to call GetCacheEntry from origin thread.
bool GetCacheEntryFromOriginThread(const std::string& resource_id,
- const std::string& md5,
FileCacheEntry* cache_entry) {
bool result = false;
cache_->GetCacheEntryOnUIThread(
- resource_id, md5,
+ resource_id,
google_apis::test_util::CreateCopyResultCallback(&result, cache_entry));
test_util::RunBlockingPoolTask();
return result;
}
- // Returns true if the cache entry exists for the given resource ID and MD5.
- bool CacheEntryExists(const std::string& resource_id,
- const std::string& md5) {
+ // Returns true if the cache entry exists for the given resource ID.
+ bool CacheEntryExists(const std::string& resource_id) {
FileCacheEntry cache_entry;
- return GetCacheEntryFromOriginThread(resource_id, md5, &cache_entry);
+ return GetCacheEntryFromOriginThread(resource_id, &cache_entry);
}
// Returns the number of the cache files with name <resource_id>, and Confirm
@@ -687,7 +694,7 @@ TEST_F(FileCacheTestOnUIThread, MountUnmount) {
// Mark the file mounted.
TestMarkAsMounted(resource_id, FILE_ERROR_OK, TEST_CACHE_STATE_PRESENT);
- EXPECT_TRUE(CacheEntryExists(resource_id, md5));
+ EXPECT_TRUE(CacheEntryExists(resource_id));
// Try to remove the file.
TestRemoveFromCache(resource_id, FILE_ERROR_IN_USE);
@@ -703,7 +710,7 @@ TEST_F(FileCacheTestOnUIThread, MountUnmount) {
TestMarkAsUnmounted(resource_id, file_path, FILE_ERROR_OK,
TEST_CACHE_STATE_PRESENT);
- EXPECT_TRUE(CacheEntryExists(resource_id, md5));
+ EXPECT_TRUE(CacheEntryExists(resource_id));
// Try to remove the file.
TestRemoveFromCache(resource_id, FILE_ERROR_OK);
@@ -757,7 +764,7 @@ TEST_F(FileCacheTestOnUIThread, ClearAll) {
// Verify that all the cache is removed.
expected_error_ = FILE_ERROR_OK;
- VerifyRemoveFromCache(FILE_ERROR_OK, resource_id, md5);
+ VerifyRemoveFromCache(FILE_ERROR_OK, resource_id);
EXPECT_EQ(0U, CountCacheFiles(resource_id, md5));
}
@@ -866,7 +873,7 @@ TEST_F(FileCacheTest, ScanCacheFile) {
// Check contents of the cache.
FileCacheEntry cache_entry;
- EXPECT_TRUE(cache_->GetCacheEntry("id_foo", std::string(), &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry("id_foo", &cache_entry));
EXPECT_TRUE(cache_entry.is_present());
EXPECT_EQ(base::MD5String("foo"), cache_entry.md5());
}
@@ -900,10 +907,10 @@ TEST_F(FileCacheTest, FreeDiskSpaceIfNeededFor) {
// Only 'temporary' file gets removed.
FileCacheEntry entry;
- EXPECT_FALSE(cache_->GetCacheEntry(resource_id_tmp, md5_tmp, &entry));
+ EXPECT_FALSE(cache_->GetCacheEntry(resource_id_tmp, &entry));
EXPECT_FALSE(base::PathExists(tmp_path));
- EXPECT_TRUE(cache_->GetCacheEntry(resource_id_pinned, md5_pinned, &entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_id_pinned, &entry));
EXPECT_TRUE(base::PathExists(pinned_path));
// Returns false when disk space cannot be freed.
@@ -941,9 +948,9 @@ TEST_F(FileCacheTest, ImportOldDB) {
// Data is imported correctly.
FileCacheEntry entry;
- EXPECT_TRUE(cache_->GetCacheEntry(key1, std::string(), &entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(key1, &entry));
EXPECT_EQ(md5_1, entry.md5());
- EXPECT_TRUE(cache_->GetCacheEntry(key2, std::string(), &entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(key2, &entry));
EXPECT_EQ(md5_2, entry.md5());
}
diff --git a/chrome/browser/chromeos/drive/file_system.cc b/chrome/browser/chromeos/drive/file_system.cc
index 0962967..f5fae30 100644
--- a/chrome/browser/chromeos/drive/file_system.cc
+++ b/chrome/browser/chromeos/drive/file_system.cc
@@ -854,13 +854,12 @@ void FileSystem::MarkCacheFileAsUnmounted(
void FileSystem::GetCacheEntryByResourceId(
const std::string& resource_id,
- const std::string& md5,
const GetCacheEntryCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!resource_id.empty());
DCHECK(!callback.is_null());
- cache_->GetCacheEntryOnUIThread(resource_id, md5, callback);
+ cache_->GetCacheEntryOnUIThread(resource_id, callback);
}
void FileSystem::OnDisableDriveHostedFilesChanged() {
@@ -921,15 +920,12 @@ void FileSystem::CheckLocalModificationAndRun(
// Checks if the file is cached and modified locally.
const std::string resource_id = entry->resource_id();
- const std::string md5 = entry->file_specific_info().md5();
cache_->GetCacheEntryOnUIThread(
resource_id,
- md5,
- base::Bind(
- &FileSystem::CheckLocalModificationAndRunAfterGetCacheEntry,
- weak_ptr_factory_.GetWeakPtr(),
- base::Passed(&entry),
- callback));
+ base::Bind(&FileSystem::CheckLocalModificationAndRunAfterGetCacheEntry,
+ weak_ptr_factory_.GetWeakPtr(),
+ base::Passed(&entry),
+ callback));
}
void FileSystem::CheckLocalModificationAndRunAfterGetCacheEntry(
diff --git a/chrome/browser/chromeos/drive/file_system.h b/chrome/browser/chromeos/drive/file_system.h
index 2d471e3..d3c84e6 100644
--- a/chrome/browser/chromeos/drive/file_system.h
+++ b/chrome/browser/chromeos/drive/file_system.h
@@ -150,7 +150,6 @@ class FileSystem : public FileSystemInterface,
const FileOperationCallback& callback) OVERRIDE;
virtual void GetCacheEntryByResourceId(
const std::string& resource_id,
- const std::string& md5,
const GetCacheEntryCallback& callback) OVERRIDE;
virtual void Reload() OVERRIDE;
diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc
index aee7007..3451b3a 100644
--- a/chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc
@@ -60,7 +60,7 @@ TEST_F(CopyOperationTest, TransferFileFromLocalToRemote_RegularFile) {
FileCacheEntry cache_entry;
bool found = false;
cache()->GetCacheEntryOnUIThread(
- entry.resource_id(), std::string(),
+ entry.resource_id(),
google_apis::test_util::CreateCopyResultCallback(&found, &cache_entry));
test_util::RunBlockingPoolTask();
EXPECT_TRUE(found);
diff --git a/chrome/browser/chromeos/drive/file_system/download_operation.cc b/chrome/browser/chromeos/drive/file_system/download_operation.cc
index 0e01200..43fd3cf 100644
--- a/chrome/browser/chromeos/drive/file_system/download_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/download_operation.cc
@@ -68,9 +68,7 @@ FileError CheckPreConditionForEnsureFileDownloaded(
// Leave |cache_file_path| empty when no cache entry is found.
FileCacheEntry cache_entry;
- if (!cache->GetCacheEntry(entry->resource_id(),
- entry->file_specific_info().md5(),
- &cache_entry))
+ if (!cache->GetCacheEntry(entry->resource_id(), &cache_entry))
return FILE_ERROR_OK;
// Leave |cache_file_path| empty when the stored file is obsolete and has no
diff --git a/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc
index 3bf85c2..5fdddedd 100644
--- a/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc
@@ -148,7 +148,7 @@ TEST_F(DownloadOperationTest,
FileCacheEntry cache_entry;
bool result = true;
cache()->GetCacheEntryOnUIThread(
- "<resource_id>", "<md5>",
+ "<resource_id>",
google_apis::test_util::CreateCopyResultCallback(&result,
&cache_entry));
test_util::RunBlockingPoolTask();
diff --git a/chrome/browser/chromeos/drive/file_system/update_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/update_operation_unittest.cc
index 7ce3ebc..6bb010c 100644
--- a/chrome/browser/chromeos/drive/file_system/update_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/update_operation_unittest.cc
@@ -94,7 +94,6 @@ TEST_F(UpdateOperationTest, UpdateFileByResourceId_PersistentFile) {
FileCacheEntry cache_entry;
cache()->GetCacheEntryOnUIThread(
server_entry->resource_id(),
- server_entry->file_md5(),
google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry));
test_util::RunBlockingPoolTask();
ASSERT_TRUE(success);
@@ -169,7 +168,6 @@ TEST_F(UpdateOperationTest, UpdateFileByResourceId_Md5) {
FileCacheEntry cache_entry;
cache()->GetCacheEntryOnUIThread(
server_entry->resource_id(),
- server_entry->file_md5(),
google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry));
test_util::RunBlockingPoolTask();
ASSERT_TRUE(success);
@@ -201,7 +199,6 @@ TEST_F(UpdateOperationTest, UpdateFileByResourceId_Md5) {
success = false;
cache()->GetCacheEntryOnUIThread(
server_entry->resource_id(),
- server_entry->file_md5(),
google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry));
test_util::RunBlockingPoolTask();
ASSERT_TRUE(success);
diff --git a/chrome/browser/chromeos/drive/file_system_interface.h b/chrome/browser/chromeos/drive/file_system_interface.h
index 93b5324..5a554c9 100644
--- a/chrome/browser/chromeos/drive/file_system_interface.h
+++ b/chrome/browser/chromeos/drive/file_system_interface.h
@@ -412,14 +412,12 @@ class FileSystemInterface {
const base::FilePath& cache_file_path,
const FileOperationCallback& callback) = 0;
- // Gets the cache entry for file corresponding to |resource_id| and |md5|
- // and runs |callback| with true and the found entry if the entry exists
- // in the cache map. Otherwise, runs |callback| with false.
- // |md5| can be empty if only matching |resource_id| is desired.
+ // Gets the cache entry for file corresponding to |resource_id| and runs
+ // |callback| with true and the found entry if the entry exists in the cache
+ // map. Otherwise, runs |callback| with false.
// |callback| must not be null.
virtual void GetCacheEntryByResourceId(
const std::string& resource_id,
- const std::string& md5,
const GetCacheEntryCallback& callback) = 0;
// Reloads the resource metadata from the server.
diff --git a/chrome/browser/chromeos/drive/file_system_unittest.cc b/chrome/browser/chromeos/drive/file_system_unittest.cc
index 68d79c2..2f3baf3 100644
--- a/chrome/browser/chromeos/drive/file_system_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system_unittest.cc
@@ -666,8 +666,7 @@ TEST_F(FileSystemTest, PinAndUnpin) {
EXPECT_EQ(FILE_ERROR_OK, error);
FileCacheEntry cache_entry;
- EXPECT_TRUE(cache_->GetCacheEntry(
- entry->resource_id(), std::string(), &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(entry->resource_id(), &cache_entry));
EXPECT_TRUE(cache_entry.is_pinned());
EXPECT_TRUE(cache_entry.is_present());
@@ -678,8 +677,7 @@ TEST_F(FileSystemTest, PinAndUnpin) {
test_util::RunBlockingPoolTask();
EXPECT_EQ(FILE_ERROR_OK, error);
- EXPECT_TRUE(cache_->GetCacheEntry(
- entry->resource_id(), std::string(), &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(entry->resource_id(), &cache_entry));
EXPECT_FALSE(cache_entry.is_pinned());
// Pinned file gets synced and it results in entry state changes.
@@ -714,8 +712,7 @@ TEST_F(FileSystemTest, PinAndUnpin_NotSynced) {
// No cache file available because the sync was cancelled by Unpin().
FileCacheEntry cache_entry;
- EXPECT_FALSE(cache_->GetCacheEntry(
- entry->resource_id(), std::string(), &cache_entry));
+ EXPECT_FALSE(cache_->GetCacheEntry(entry->resource_id(), &cache_entry));
}
TEST_F(FileSystemTest, GetAvailableSpace) {
@@ -736,7 +733,6 @@ TEST_F(FileSystemTest, OpenAndCloseFile) {
const base::FilePath kFileInRoot(FILE_PATH_LITERAL("drive/root/File 1.txt"));
scoped_ptr<ResourceEntry> entry(GetResourceEntryByPathSync(kFileInRoot));
const std::string& file_resource_id = entry->resource_id();
- const std::string& md5 = entry->file_specific_info().md5();
// Open kFileInRoot ("drive/root/File 1.txt").
FileError error = FILE_ERROR_FAILED;
@@ -767,7 +763,7 @@ TEST_F(FileSystemTest, OpenAndCloseFile) {
EXPECT_EQ(kExpectedContent, cache_file_data);
FileCacheEntry cache_entry;
- EXPECT_TRUE(cache_->GetCacheEntry(file_resource_id, md5, &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(file_resource_id, &cache_entry));
EXPECT_TRUE(cache_entry.is_present());
EXPECT_TRUE(cache_entry.is_dirty());
diff --git a/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc b/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc
index 41e647b..99ee919 100644
--- a/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc
+++ b/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc
@@ -70,7 +70,7 @@ TEST_F(RemoveStaleCacheFilesTest, RemoveStaleCacheFiles) {
// Verify that the cache entry exists.
FileCacheEntry cache_entry;
- EXPECT_TRUE(cache_->GetCacheEntry(resource_id, md5, &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_id, &cache_entry));
ResourceEntry entry;
EXPECT_EQ(FILE_ERROR_NOT_FOUND,
@@ -80,7 +80,7 @@ TEST_F(RemoveStaleCacheFilesTest, RemoveStaleCacheFiles) {
RemoveStaleCacheFiles(cache_.get(), resource_metadata_.get());
// Verify that the cache entry is deleted.
- EXPECT_FALSE(cache_->GetCacheEntry(resource_id, md5, &cache_entry));
+ EXPECT_FALSE(cache_->GetCacheEntry(resource_id, &cache_entry));
}
TEST_F(RemoveStaleCacheFilesTest, DirtyCacheFiles) {
@@ -117,8 +117,8 @@ TEST_F(RemoveStaleCacheFilesTest, DirtyCacheFiles) {
// Dirty cache should be removed if and only if the entry does not exist in
// resource_metadata.
FileCacheEntry cache_entry;
- EXPECT_FALSE(cache_->GetCacheEntry(resource_id_1, md5_1, &cache_entry));
- EXPECT_TRUE(cache_->GetCacheEntry(resource_id_2, md5_2_cache, &cache_entry));
+ EXPECT_FALSE(cache_->GetCacheEntry(resource_id_1, &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_id_2, &cache_entry));
}
} // namespace internal
diff --git a/chrome/browser/chromeos/drive/sync_client_unittest.cc b/chrome/browser/chromeos/drive/sync_client_unittest.cc
index 6c0c8d6..4fe3ad1 100644
--- a/chrome/browser/chromeos/drive/sync_client_unittest.cc
+++ b/chrome/browser/chromeos/drive/sync_client_unittest.cc
@@ -217,21 +217,17 @@ TEST_F(SyncClientTest, StartProcessingBacklog) {
FileCacheEntry cache_entry;
// Pinned files get downloaded.
- EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["foo"], std::string(),
- &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["foo"], &cache_entry));
EXPECT_TRUE(cache_entry.is_present());
- EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["bar"], std::string(),
- &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["bar"], &cache_entry));
EXPECT_TRUE(cache_entry.is_present());
- EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["baz"], std::string(),
- &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["baz"], &cache_entry));
EXPECT_TRUE(cache_entry.is_present());
// Dirty file gets uploaded.
- EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["dirty"], std::string(),
- &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["dirty"], &cache_entry));
EXPECT_FALSE(cache_entry.is_dirty());
}
@@ -240,8 +236,7 @@ TEST_F(SyncClientTest, AddFetchTask) {
base::RunLoop().RunUntilIdle();
FileCacheEntry cache_entry;
- EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["foo"], std::string(),
- &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["foo"], &cache_entry));
EXPECT_TRUE(cache_entry.is_present());
}
@@ -253,8 +248,7 @@ TEST_F(SyncClientTest, AddFetchTaskAndCancelled) {
// The file should be unpinned if the user wants the download to be cancelled.
FileCacheEntry cache_entry;
- EXPECT_FALSE(cache_->GetCacheEntry(resource_ids_["foo"], std::string(),
- &cache_entry));
+ EXPECT_FALSE(cache_->GetCacheEntry(resource_ids_["foo"], &cache_entry));
}
TEST_F(SyncClientTest, RemoveFetchTask) {
@@ -268,16 +262,13 @@ TEST_F(SyncClientTest, RemoveFetchTask) {
// Only "bar" should be fetched.
FileCacheEntry cache_entry;
- EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["foo"], std::string(),
- &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["foo"], &cache_entry));
EXPECT_FALSE(cache_entry.is_present());
- EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["bar"], std::string(),
- &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["bar"], &cache_entry));
EXPECT_TRUE(cache_entry.is_present());
- EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["baz"], std::string(),
- &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["baz"], &cache_entry));
EXPECT_FALSE(cache_entry.is_present());
}
@@ -325,11 +316,9 @@ TEST_F(SyncClientTest, RetryOnDisconnection) {
// Not yet fetched nor uploaded.
FileCacheEntry cache_entry;
- EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["foo"], std::string(),
- &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["foo"], &cache_entry));
EXPECT_FALSE(cache_entry.is_present());
- EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["dirty"], std::string(),
- &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["dirty"], &cache_entry));
EXPECT_TRUE(cache_entry.is_dirty());
// Switch to online.
@@ -339,11 +328,9 @@ TEST_F(SyncClientTest, RetryOnDisconnection) {
base::RunLoop().RunUntilIdle();
// Fetched and uploaded.
- EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["foo"], std::string(),
- &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["foo"], &cache_entry));
EXPECT_TRUE(cache_entry.is_present());
- EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["dirty"], std::string(),
- &cache_entry));
+ EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["dirty"], &cache_entry));
EXPECT_FALSE(cache_entry.is_dirty());
}
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc
index 5f9e4ca..cbab985 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc
@@ -2357,7 +2357,6 @@ void GetDriveEntryPropertiesFunction::OnGetFileInfo(
integration_service->file_system()->GetCacheEntryByResourceId(
entry->resource_id(),
- file_specific_info.md5(),
base::Bind(&GetDriveEntryPropertiesFunction::CacheStateReceived, this));
}