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

Unified Diff: chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc

Issue 148483009: [SyncFS] Force activate folder tracker on folder creation conflict case (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment update Created 6 years, 10 months 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/sync_file_system/drive_backend/drive_backend_sync_unittest.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc b/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc
index e001e768fd36ef67b818e350b297dadd0065975b..ca2bbe5fe0a2cf2cf9c558b28264caa5955e73b2 100644
--- a/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc
+++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc
@@ -972,5 +972,79 @@ TEST_F(DriveBackendSyncTest, ConflictTest_AddFolder_DeleteFolder) {
EXPECT_EQ(3u, CountTracker());
}
+TEST_F(DriveBackendSyncTest, ConflictTest_AddFolder_AddFile) {
+ std::string app_id = "example";
+
+ RegisterApp(app_id);
+ std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
+
+ AddLocalFolder(app_id, FPL("conflict_to_pending_remote"));
+ AddLocalFolder(app_id, FPL("conflict_to_existing_remote"));
+
+ EXPECT_EQ(google_apis::HTTP_SUCCESS,
+ fake_drive_service_helper()->AddFile(
+ app_root_folder_id, "conflict_to_pending_remote", "foo", NULL));
+
+ FetchRemoteChanges();
+
+ EXPECT_EQ(google_apis::HTTP_SUCCESS,
+ fake_drive_service_helper()->AddFile(
+ app_root_folder_id,
+ "conflict_to_existing_remote",
+ "foo",
+ NULL));
kinuko 2014/02/06 09:48:01 nit: can we match the style for line 984 and 990?
tzik 2014/02/07 04:43:53 Done.
+
+ EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
+ VerifyConsistency();
+
+ EXPECT_EQ(1u, CountApp());
+ EXPECT_EQ(3u, CountLocalFile(app_id));
+ VerifyLocalFolder(app_id, base::FilePath(FPL("conflict_to_pending_remote")));
+ VerifyLocalFolder(app_id, base::FilePath(FPL("conflict_to_existing_remote")));
+
+ EXPECT_EQ(4u, CountMetadata());
+ EXPECT_EQ(4u, CountTracker());
+}
+
+TEST_F(DriveBackendSyncTest, ConflictTest_AddFolder_DeleteFile) {
+ std::string app_id = "example";
+
+ RegisterApp(app_id);
+ std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
+
+ AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
+ AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
+
+ EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
+ VerifyConsistency();
+
+ RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
+ AddLocalFolder(app_id, FPL("conflict_to_pending_remote"));
+
+ RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
+ AddLocalFolder(app_id, FPL("conflict_to_existing_remote"));
+
+ EXPECT_EQ(google_apis::HTTP_NO_CONTENT,
+ fake_drive_service_helper()->DeleteResource(
+ GetFileIDByPath(app_id, FPL("conflict_to_pending_remote"))));
+
+ FetchRemoteChanges();
+
+ EXPECT_EQ(google_apis::HTTP_NO_CONTENT,
+ fake_drive_service_helper()->DeleteResource(
+ GetFileIDByPath(app_id, FPL("conflict_to_existing_remote"))));
+
+ EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
+ VerifyConsistency();
+
+ EXPECT_EQ(1u, CountApp());
+ EXPECT_EQ(3u, CountLocalFile(app_id));
+ VerifyLocalFolder(app_id, base::FilePath(FPL("conflict_to_pending_remote")));
+ VerifyLocalFolder(app_id, base::FilePath(FPL("conflict_to_existing_remote")));
+
+ EXPECT_EQ(4u, CountMetadata());
+ EXPECT_EQ(4u, CountTracker());
+}
+
} // namespace drive_backend
} // namespace sync_file_system

Powered by Google App Engine
This is Rietveld 408576698