| Index: chrome/browser/chromeos/drive/file_cache_unittest.cc
|
| diff --git a/chrome/browser/chromeos/drive/file_cache_unittest.cc b/chrome/browser/chromeos/drive/file_cache_unittest.cc
|
| index ad21ac79eb1d4baacbf47b0b60a65d409d06f233..307f6164cc1a67cab12ceca2089bdffeb75667cf 100644
|
| --- a/chrome/browser/chromeos/drive/file_cache_unittest.cc
|
| +++ b/chrome/browser/chromeos/drive/file_cache_unittest.cc
|
| @@ -132,26 +132,6 @@ class FileCacheTestOnUIThread : public testing::Test {
|
| VerifyCacheFileState(error, resource_id, md5);
|
| }
|
|
|
| - void TestStoreLocallyModifiedToCache(
|
| - const std::string& resource_id,
|
| - const std::string& md5,
|
| - const base::FilePath& source_path,
|
| - FileError expected_error,
|
| - int expected_cache_state,
|
| - FileCache::CacheSubDirectoryType expected_sub_dir_type) {
|
| - expected_error_ = expected_error;
|
| - expected_cache_state_ = expected_cache_state;
|
| - expected_sub_dir_type_ = expected_sub_dir_type;
|
| -
|
| - FileError error = FILE_ERROR_OK;
|
| - cache_->StoreLocallyModifiedOnUIThread(
|
| - resource_id, md5, source_path,
|
| - FileCache::FILE_OPERATION_COPY,
|
| - google_apis::test_util::CreateCopyResultCallback(&error));
|
| - google_apis::test_util::RunBlockingPoolTask();
|
| - VerifyCacheFileState(error, resource_id, md5);
|
| - }
|
| -
|
| void TestRemoveFromCache(const std::string& resource_id,
|
| FileError expected_error) {
|
| expected_error_ = expected_error;
|
| @@ -286,24 +266,6 @@ class FileCacheTestOnUIThread : public testing::Test {
|
| }
|
| }
|
|
|
| - void TestCommitDirty(
|
| - const std::string& resource_id,
|
| - const std::string& md5,
|
| - FileError expected_error,
|
| - int expected_cache_state,
|
| - FileCache::CacheSubDirectoryType expected_sub_dir_type) {
|
| - expected_error_ = expected_error;
|
| - expected_cache_state_ = expected_cache_state;
|
| - expected_sub_dir_type_ = expected_sub_dir_type;
|
| -
|
| - FileError error = FILE_ERROR_OK;
|
| - cache_->CommitDirtyOnUIThread(
|
| - resource_id, md5,
|
| - google_apis::test_util::CreateCopyResultCallback(&error));
|
| - google_apis::test_util::RunBlockingPoolTask();
|
| - VerifyCacheFileState(error, resource_id, md5);
|
| - }
|
| -
|
| void TestClearDirty(
|
| const std::string& resource_id,
|
| const std::string& md5,
|
| @@ -563,21 +525,6 @@ TEST_F(FileCacheTestOnUIThread, StoreToCacheSimple) {
|
| EXPECT_EQ(1U, CountCacheFiles(resource_id, md5));
|
| }
|
|
|
| -TEST_F(FileCacheTestOnUIThread, LocallyModifiedSimple) {
|
| - std::string resource_id("pdf:1a2b");
|
| - std::string md5("abcdef0123456789");
|
| -
|
| - const int kDirtyCacheState =
|
| - test_util::TEST_CACHE_STATE_PRESENT |
|
| - test_util::TEST_CACHE_STATE_DIRTY |
|
| - test_util::TEST_CACHE_STATE_PERSISTENT;
|
| -
|
| - EXPECT_CALL(*mock_cache_observer_, OnCacheCommitted(resource_id)).Times(1);
|
| - TestStoreLocallyModifiedToCache(
|
| - resource_id, md5,
|
| - dummy_file_path_,
|
| - FILE_ERROR_OK, kDirtyCacheState, FileCache::CACHE_TYPE_PERSISTENT);
|
| -}
|
|
|
| TEST_F(FileCacheTestOnUIThread, GetFromCacheSimple) {
|
| std::string resource_id("pdf:1a2b");
|
| @@ -777,7 +724,6 @@ TEST_F(FileCacheTestOnUIThread, RemoveFromCachePinned) {
|
| TEST_F(FileCacheTestOnUIThread, DirtyCacheSimple) {
|
| std::string resource_id("pdf:1a2b");
|
| std::string md5("abcdef0123456789");
|
| - EXPECT_CALL(*mock_cache_observer_, OnCacheCommitted(resource_id)).Times(1);
|
|
|
| // First store a file to cache.
|
| TestStoreToCache(resource_id, md5, dummy_file_path_,
|
| @@ -791,13 +737,6 @@ TEST_F(FileCacheTestOnUIThread, DirtyCacheSimple) {
|
| test_util::TEST_CACHE_STATE_PERSISTENT,
|
| FileCache::CACHE_TYPE_PERSISTENT);
|
|
|
| - // Commit the file dirty.
|
| - TestCommitDirty(resource_id, md5, FILE_ERROR_OK,
|
| - test_util::TEST_CACHE_STATE_PRESENT |
|
| - test_util::TEST_CACHE_STATE_DIRTY |
|
| - test_util::TEST_CACHE_STATE_PERSISTENT,
|
| - FileCache::CACHE_TYPE_PERSISTENT);
|
| -
|
| // Clear dirty state of the file.
|
| TestClearDirty(resource_id, md5, FILE_ERROR_OK,
|
| test_util::TEST_CACHE_STATE_PRESENT,
|
| @@ -808,7 +747,6 @@ TEST_F(FileCacheTestOnUIThread, DirtyCachePinned) {
|
| std::string resource_id("pdf:1a2b");
|
| std::string md5("abcdef0123456789");
|
| EXPECT_CALL(*mock_cache_observer_, OnCachePinned(resource_id, md5)).Times(1);
|
| - EXPECT_CALL(*mock_cache_observer_, OnCacheCommitted(resource_id)).Times(1);
|
|
|
| // First store a file to cache and pin it.
|
| TestStoreToCache(resource_id, md5, dummy_file_path_,
|
| @@ -828,14 +766,6 @@ TEST_F(FileCacheTestOnUIThread, DirtyCachePinned) {
|
| test_util::TEST_CACHE_STATE_PERSISTENT,
|
| FileCache::CACHE_TYPE_PERSISTENT);
|
|
|
| - // Commit the file dirty.
|
| - TestCommitDirty(resource_id, md5, FILE_ERROR_OK,
|
| - test_util::TEST_CACHE_STATE_PRESENT |
|
| - test_util::TEST_CACHE_STATE_DIRTY |
|
| - test_util::TEST_CACHE_STATE_PINNED |
|
| - test_util::TEST_CACHE_STATE_PERSISTENT,
|
| - FileCache::CACHE_TYPE_PERSISTENT);
|
| -
|
| // Clear dirty state of the file.
|
| TestClearDirty(resource_id, md5, FILE_ERROR_OK,
|
| test_util::TEST_CACHE_STATE_PRESENT |
|
| @@ -896,7 +826,6 @@ TEST_F(FileCacheTestOnUIThread, PinAndUnpinDirtyCache) {
|
| TEST_F(FileCacheTestOnUIThread, DirtyCacheRepetitive) {
|
| std::string resource_id("pdf:1a2b");
|
| std::string md5("abcdef0123456789");
|
| - EXPECT_CALL(*mock_cache_observer_, OnCacheCommitted(resource_id)).Times(3);
|
|
|
| // First store a file to cache.
|
| TestStoreToCache(resource_id, md5, dummy_file_path_,
|
| @@ -917,34 +846,6 @@ TEST_F(FileCacheTestOnUIThread, DirtyCacheRepetitive) {
|
| test_util::TEST_CACHE_STATE_PERSISTENT,
|
| FileCache::CACHE_TYPE_PERSISTENT);
|
|
|
| - // Commit the file dirty.
|
| - TestCommitDirty(resource_id, md5, FILE_ERROR_OK,
|
| - test_util::TEST_CACHE_STATE_PRESENT |
|
| - test_util::TEST_CACHE_STATE_DIRTY |
|
| - test_util::TEST_CACHE_STATE_PERSISTENT,
|
| - FileCache::CACHE_TYPE_PERSISTENT);
|
| -
|
| - // Again, commit the file dirty. Nothing should change.
|
| - TestCommitDirty(resource_id, md5, FILE_ERROR_OK,
|
| - test_util::TEST_CACHE_STATE_PRESENT |
|
| - test_util::TEST_CACHE_STATE_DIRTY |
|
| - test_util::TEST_CACHE_STATE_PERSISTENT,
|
| - FileCache::CACHE_TYPE_PERSISTENT);
|
| -
|
| - // Mark the file dirty again after it's being committed.
|
| - TestMarkDirty(resource_id, md5, FILE_ERROR_OK,
|
| - test_util::TEST_CACHE_STATE_PRESENT |
|
| - test_util::TEST_CACHE_STATE_DIRTY |
|
| - test_util::TEST_CACHE_STATE_PERSISTENT,
|
| - FileCache::CACHE_TYPE_PERSISTENT);
|
| -
|
| - // Commit the file dirty.
|
| - TestCommitDirty(resource_id, md5, FILE_ERROR_OK,
|
| - test_util::TEST_CACHE_STATE_PRESENT |
|
| - test_util::TEST_CACHE_STATE_DIRTY |
|
| - test_util::TEST_CACHE_STATE_PERSISTENT,
|
| - FileCache::CACHE_TYPE_PERSISTENT);
|
| -
|
| // Clear dirty state of the file.
|
| TestClearDirty(resource_id, md5, FILE_ERROR_OK,
|
| test_util::TEST_CACHE_STATE_PRESENT,
|
| @@ -1000,7 +901,6 @@ TEST_F(FileCacheTestOnUIThread, RemoveFromDirtyCache) {
|
| std::string resource_id("pdf:1a2b");
|
| std::string md5("abcdef0123456789");
|
| EXPECT_CALL(*mock_cache_observer_, OnCachePinned(resource_id, md5)).Times(1);
|
| - EXPECT_CALL(*mock_cache_observer_, OnCacheCommitted(resource_id)).Times(1);
|
|
|
| // Store a file to cache, pin it, mark it dirty and commit it.
|
| TestStoreToCache(resource_id, md5, dummy_file_path_,
|
| @@ -1017,12 +917,6 @@ TEST_F(FileCacheTestOnUIThread, RemoveFromDirtyCache) {
|
| test_util::TEST_CACHE_STATE_DIRTY |
|
| test_util::TEST_CACHE_STATE_PERSISTENT,
|
| FileCache::CACHE_TYPE_PERSISTENT);
|
| - TestCommitDirty(resource_id, md5, FILE_ERROR_OK,
|
| - test_util::TEST_CACHE_STATE_PRESENT |
|
| - test_util::TEST_CACHE_STATE_PINNED |
|
| - test_util::TEST_CACHE_STATE_DIRTY |
|
| - test_util::TEST_CACHE_STATE_PERSISTENT,
|
| - FileCache::CACHE_TYPE_PERSISTENT);
|
|
|
| // Try to remove the file. Since file is dirty, it should not be removed.
|
| TestRemoveFromCache(resource_id, FILE_ERROR_OK);
|
| @@ -1076,10 +970,6 @@ TEST_F(FileCacheTestOnUIThread, Iterate) {
|
| OnCachePinned(cache_resources[i].resource_id,
|
| cache_resources[i].md5)).Times(1);
|
| }
|
| - if (cache_resources[i].is_dirty) {
|
| - EXPECT_CALL(*mock_cache_observer_,
|
| - OnCacheCommitted(cache_resources[i].resource_id)).Times(1);
|
| - }
|
| }
|
| ASSERT_TRUE(test_util::PrepareTestCacheResources(
|
| cache_.get(),
|
|
|