Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <stack> | 6 #include <stack> |
| 7 | 7 |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 965 VerifyConsistency(); | 965 VerifyConsistency(); |
| 966 | 966 |
| 967 EXPECT_EQ(1u, CountApp()); | 967 EXPECT_EQ(1u, CountApp()); |
| 968 EXPECT_EQ(2u, CountLocalFile(app_id)); | 968 EXPECT_EQ(2u, CountLocalFile(app_id)); |
| 969 VerifyLocalFolder(app_id, base::FilePath(FPL("conflict_to_pending_remote"))); | 969 VerifyLocalFolder(app_id, base::FilePath(FPL("conflict_to_pending_remote"))); |
| 970 | 970 |
| 971 EXPECT_EQ(3u, CountMetadata()); | 971 EXPECT_EQ(3u, CountMetadata()); |
| 972 EXPECT_EQ(3u, CountTracker()); | 972 EXPECT_EQ(3u, CountTracker()); |
| 973 } | 973 } |
| 974 | 974 |
| 975 TEST_F(DriveBackendSyncTest, ConflictTest_AddFolder_AddFile) { | |
| 976 std::string app_id = "example"; | |
| 977 | |
| 978 RegisterApp(app_id); | |
| 979 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL("")); | |
| 980 | |
| 981 AddLocalFolder(app_id, FPL("conflict_to_pending_remote")); | |
| 982 AddLocalFolder(app_id, FPL("conflict_to_existing_remote")); | |
| 983 | |
| 984 EXPECT_EQ(google_apis::HTTP_SUCCESS, | |
| 985 fake_drive_service_helper()->AddFile( | |
| 986 app_root_folder_id, "conflict_to_pending_remote", "foo", NULL)); | |
| 987 | |
| 988 FetchRemoteChanges(); | |
| 989 | |
| 990 EXPECT_EQ(google_apis::HTTP_SUCCESS, | |
| 991 fake_drive_service_helper()->AddFile( | |
| 992 app_root_folder_id, | |
| 993 "conflict_to_existing_remote", | |
| 994 "foo", | |
| 995 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.
| |
| 996 | |
| 997 EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone()); | |
| 998 VerifyConsistency(); | |
| 999 | |
| 1000 EXPECT_EQ(1u, CountApp()); | |
| 1001 EXPECT_EQ(3u, CountLocalFile(app_id)); | |
| 1002 VerifyLocalFolder(app_id, base::FilePath(FPL("conflict_to_pending_remote"))); | |
| 1003 VerifyLocalFolder(app_id, base::FilePath(FPL("conflict_to_existing_remote"))); | |
| 1004 | |
| 1005 EXPECT_EQ(4u, CountMetadata()); | |
| 1006 EXPECT_EQ(4u, CountTracker()); | |
| 1007 } | |
| 1008 | |
| 1009 TEST_F(DriveBackendSyncTest, ConflictTest_AddFolder_DeleteFile) { | |
| 1010 std::string app_id = "example"; | |
| 1011 | |
| 1012 RegisterApp(app_id); | |
| 1013 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL("")); | |
| 1014 | |
| 1015 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo"); | |
| 1016 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar"); | |
| 1017 | |
| 1018 EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone()); | |
| 1019 VerifyConsistency(); | |
| 1020 | |
| 1021 RemoveLocal(app_id, FPL("conflict_to_pending_remote")); | |
| 1022 AddLocalFolder(app_id, FPL("conflict_to_pending_remote")); | |
| 1023 | |
| 1024 RemoveLocal(app_id, FPL("conflict_to_existing_remote")); | |
| 1025 AddLocalFolder(app_id, FPL("conflict_to_existing_remote")); | |
| 1026 | |
| 1027 EXPECT_EQ(google_apis::HTTP_NO_CONTENT, | |
| 1028 fake_drive_service_helper()->DeleteResource( | |
| 1029 GetFileIDByPath(app_id, FPL("conflict_to_pending_remote")))); | |
| 1030 | |
| 1031 FetchRemoteChanges(); | |
| 1032 | |
| 1033 EXPECT_EQ(google_apis::HTTP_NO_CONTENT, | |
| 1034 fake_drive_service_helper()->DeleteResource( | |
| 1035 GetFileIDByPath(app_id, FPL("conflict_to_existing_remote")))); | |
| 1036 | |
| 1037 EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone()); | |
| 1038 VerifyConsistency(); | |
| 1039 | |
| 1040 EXPECT_EQ(1u, CountApp()); | |
| 1041 EXPECT_EQ(3u, CountLocalFile(app_id)); | |
| 1042 VerifyLocalFolder(app_id, base::FilePath(FPL("conflict_to_pending_remote"))); | |
| 1043 VerifyLocalFolder(app_id, base::FilePath(FPL("conflict_to_existing_remote"))); | |
| 1044 | |
| 1045 EXPECT_EQ(4u, CountMetadata()); | |
| 1046 EXPECT_EQ(4u, CountTracker()); | |
| 1047 } | |
| 1048 | |
| 975 } // namespace drive_backend | 1049 } // namespace drive_backend |
| 976 } // namespace sync_file_system | 1050 } // namespace sync_file_system |
| OLD | NEW |