Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3084)

Unified Diff: chrome/browser/chromeos/drive/sync_client_unittest.cc

Issue 68543002: drive: Support offline delete (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move to drive/other and mark as deleted Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 c5a50197bebdde52f25ec6d51ce0cc8524ca87c0..7cb48b987e7374365aada61b55c9b89e24e72c5e 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) {
« chrome/browser/chromeos/drive/sync_client.cc ('K') | « chrome/browser/chromeos/drive/sync_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698