Index: chrome/browser/chromeos/drive/sync_client_unittest.cc |
diff --git a/chrome/browser/chromeos/drive/sync_client_unittest.cc b/chrome/browser/chromeos/drive/sync_client_unittest.cc |
index d6a80c8cef6472a025ea753bcb4dc622045cc290..d0ccb4b6278969f5d144406f9f3f4ca3649aeb1b 100644 |
--- a/chrome/browser/chromeos/drive/sync_client_unittest.cc |
+++ b/chrome/browser/chromeos/drive/sync_client_unittest.cc |
@@ -17,6 +17,7 @@ |
#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" |
#include "chrome/browser/chromeos/drive/file_cache.h" |
#include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
+#include "chrome/browser/chromeos/drive/file_system/remove_operation.h" |
#include "chrome/browser/chromeos/drive/job_scheduler.h" |
#include "chrome/browser/chromeos/drive/resource_entry_conversion.h" |
#include "chrome/browser/chromeos/drive/resource_metadata.h" |
@@ -160,6 +161,7 @@ class SyncClientTest : public testing::Test { |
ASSERT_NO_FATAL_FAILURE(AddFileEntry("baz")); |
ASSERT_NO_FATAL_FAILURE(AddFileEntry("fetched")); |
ASSERT_NO_FATAL_FAILURE(AddFileEntry("dirty")); |
+ ASSERT_NO_FATAL_FAILURE(AddFileEntry("removed")); |
// Load data from the service to the metadata. |
FileError error = FILE_ERROR_FAILED; |
@@ -194,6 +196,16 @@ class SyncClientTest : public testing::Test { |
EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(GetLocalId("dirty"))); |
EXPECT_EQ(FILE_ERROR_OK, cache_->MarkDirty(GetLocalId("dirty"))); |
+ // Prepare a removed file. |
+ file_system::RemoveOperation remove_operation( |
+ base::MessageLoopProxy::current().get(), &observer_, metadata_.get(), |
+ cache_.get()); |
+ remove_operation.Remove( |
+ metadata_->GetFilePath(GetLocalId("removed")), |
+ false, // is_recursive |
+ google_apis::test_util::CreateCopyResultCallback(&error)); |
+ base::RunLoop().RunUntilIdle(); |
+ EXPECT_EQ(FILE_ERROR_OK, error); |
} |
protected: |
@@ -240,6 +252,18 @@ TEST_F(SyncClientTest, StartProcessingBacklog) { |
// Dirty file gets uploaded. |
EXPECT_TRUE(cache_->GetCacheEntry(GetLocalId("dirty"), &cache_entry)); |
EXPECT_FALSE(cache_entry.is_dirty()); |
+ |
+ // Removed entry is not found. |
+ google_apis::GDataErrorCode status = google_apis::GDATA_OTHER_ERROR; |
+ scoped_ptr<google_apis::ResourceEntry> resource_entry; |
+ drive_service_->GetResourceEntry( |
+ resource_ids_["removed"], |
+ google_apis::test_util::CreateCopyResultCallback(&status, |
+ &resource_entry)); |
+ base::RunLoop().RunUntilIdle(); |
+ EXPECT_EQ(google_apis::HTTP_SUCCESS, status); |
+ ASSERT_TRUE(resource_entry); |
+ EXPECT_TRUE(resource_entry->deleted()); |
} |
TEST_F(SyncClientTest, AddFetchTask) { |