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

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: 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
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d6211796342a564c59bc1a466c674f4d35d5669f 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,77 @@ 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));
+
+ 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
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698