| 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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone()); | 942 EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone()); |
| 943 VerifyConsistency(); | 943 VerifyConsistency(); |
| 944 | 944 |
| 945 EXPECT_EQ(1u, CountApp()); | 945 EXPECT_EQ(1u, CountApp()); |
| 946 EXPECT_EQ(2u, CountLocalFile(app_id)); | 946 EXPECT_EQ(2u, CountLocalFile(app_id)); |
| 947 | 947 |
| 948 EXPECT_EQ(4u, CountMetadata()); | 948 EXPECT_EQ(4u, CountMetadata()); |
| 949 EXPECT_EQ(4u, CountTracker()); | 949 EXPECT_EQ(4u, CountTracker()); |
| 950 } | 950 } |
| 951 | 951 |
| 952 TEST_F(DriveBackendSyncTest, ReorganizeToMultipleParents) { | 952 #if defined(OS_WIN) |
| 953 // http://crbug.com/396388 |
| 954 #define MAYBE_ReorganizeToMultipleParents DISABLED_ReorganizeToMultipleParents |
| 955 #else |
| 956 #define MAYBE_ReorganizeToMultipleParents ReorganizeToMultipleParents |
| 957 #endif |
| 958 TEST_F(DriveBackendSyncTest, MAYBE_ReorganizeToMultipleParents) { |
| 953 std::string app_id = "example"; | 959 std::string app_id = "example"; |
| 954 | 960 |
| 955 RegisterApp(app_id); | 961 RegisterApp(app_id); |
| 956 | 962 |
| 957 AddLocalFolder(app_id, FPL("parent1")); | 963 AddLocalFolder(app_id, FPL("parent1")); |
| 958 AddLocalFolder(app_id, FPL("parent2")); | 964 AddLocalFolder(app_id, FPL("parent2")); |
| 959 AddOrUpdateLocalFile(app_id, FPL("parent1/file"), "abcde"); | 965 AddOrUpdateLocalFile(app_id, FPL("parent1/file"), "abcde"); |
| 960 | 966 |
| 961 EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone()); | 967 EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone()); |
| 962 VerifyConsistency(); | 968 VerifyConsistency(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 VerifyConsistency(); | 1023 VerifyConsistency(); |
| 1018 | 1024 |
| 1019 EXPECT_EQ(1u, CountApp()); | 1025 EXPECT_EQ(1u, CountApp()); |
| 1020 EXPECT_EQ(4u, CountLocalFile(app_id)); | 1026 EXPECT_EQ(4u, CountLocalFile(app_id)); |
| 1021 VerifyLocalFolder(app_id, FPL("folder")); | 1027 VerifyLocalFolder(app_id, FPL("folder")); |
| 1022 VerifyLocalFile(app_id, FPL("folder/file"), "abcde"); | 1028 VerifyLocalFile(app_id, FPL("folder/file"), "abcde"); |
| 1023 | 1029 |
| 1024 EXPECT_EQ(5u, CountMetadata()); | 1030 EXPECT_EQ(5u, CountMetadata()); |
| 1025 EXPECT_EQ(5u, CountTracker()); | 1031 EXPECT_EQ(5u, CountTracker()); |
| 1026 } | 1032 } |
| 1027 | 1033 #if defined(OS_WIN) |
| 1028 TEST_F(DriveBackendSyncTest, ConflictTest_AddFolder_AddFolder) { | 1034 // http://crbug.com/396388 |
| 1035 #define MAYBE_ConflictTest_ConflictTest_AddFolder_AddFolder DISABLED_ConflictTes
t_ConflictTest_AddFolder_AddFolder |
| 1036 #else |
| 1037 #define MAYBE_ConflictTest_ConflictTest_AddFolder_AddFolder ConflictTest_Conflic
tTest_AddFolder_AddFolder |
| 1038 #endif |
| 1039 TEST_F(DriveBackendSyncTest, MAYBE_ConflictTest_ConflictTest_AddFolder_AddFolder
) { |
| 1029 std::string app_id = "example"; | 1040 std::string app_id = "example"; |
| 1030 | 1041 |
| 1031 RegisterApp(app_id); | 1042 RegisterApp(app_id); |
| 1032 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL("")); | 1043 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL("")); |
| 1033 | 1044 |
| 1034 AddLocalFolder(app_id, FPL("conflict_to_pending_remote")); | 1045 AddLocalFolder(app_id, FPL("conflict_to_pending_remote")); |
| 1035 AddLocalFolder(app_id, FPL("conflict_to_existing_remote")); | 1046 AddLocalFolder(app_id, FPL("conflict_to_existing_remote")); |
| 1036 | 1047 |
| 1037 std::string remote_folder_id; | 1048 std::string remote_folder_id; |
| 1038 EXPECT_EQ(google_apis::HTTP_CREATED, | 1049 EXPECT_EQ(google_apis::HTTP_CREATED, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 VerifyConsistency(); | 1101 VerifyConsistency(); |
| 1091 | 1102 |
| 1092 EXPECT_EQ(1u, CountApp()); | 1103 EXPECT_EQ(1u, CountApp()); |
| 1093 EXPECT_EQ(2u, CountLocalFile(app_id)); | 1104 EXPECT_EQ(2u, CountLocalFile(app_id)); |
| 1094 VerifyLocalFolder(app_id, FPL("conflict_to_pending_remote")); | 1105 VerifyLocalFolder(app_id, FPL("conflict_to_pending_remote")); |
| 1095 | 1106 |
| 1096 EXPECT_EQ(3u, CountMetadata()); | 1107 EXPECT_EQ(3u, CountMetadata()); |
| 1097 EXPECT_EQ(3u, CountTracker()); | 1108 EXPECT_EQ(3u, CountTracker()); |
| 1098 } | 1109 } |
| 1099 | 1110 |
| 1100 TEST_F(DriveBackendSyncTest, ConflictTest_AddFolder_AddFile) { | 1111 #if defined(OS_WIN) |
| 1112 // http://crbug.com/396388 |
| 1113 #define MAYBE_ConflictTest_AddFolder_AddFile DISABLED_ConflictTest_AddFolder_Add
File |
| 1114 #else |
| 1115 #define MAYBE_ConflictTest_AddFolder_AddFile ConflictTest_AddFolder_AddFile |
| 1116 #endif |
| 1117 TEST_F(DriveBackendSyncTest, MAYBE_ConflictTest_AddFolder_AddFile) { |
| 1101 std::string app_id = "example"; | 1118 std::string app_id = "example"; |
| 1102 | 1119 |
| 1103 RegisterApp(app_id); | 1120 RegisterApp(app_id); |
| 1104 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL("")); | 1121 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL("")); |
| 1105 | 1122 |
| 1106 AddLocalFolder(app_id, FPL("conflict_to_pending_remote")); | 1123 AddLocalFolder(app_id, FPL("conflict_to_pending_remote")); |
| 1107 AddLocalFolder(app_id, FPL("conflict_to_existing_remote")); | 1124 AddLocalFolder(app_id, FPL("conflict_to_existing_remote")); |
| 1108 | 1125 |
| 1109 std::string file_id; | 1126 std::string file_id; |
| 1110 EXPECT_EQ(google_apis::HTTP_SUCCESS, | 1127 EXPECT_EQ(google_apis::HTTP_SUCCESS, |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone()); | 1331 EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone()); |
| 1315 VerifyConsistency(); | 1332 VerifyConsistency(); |
| 1316 | 1333 |
| 1317 EXPECT_EQ(1u, CountApp()); | 1334 EXPECT_EQ(1u, CountApp()); |
| 1318 EXPECT_EQ(1u, CountLocalFile(app_id)); | 1335 EXPECT_EQ(1u, CountLocalFile(app_id)); |
| 1319 | 1336 |
| 1320 EXPECT_EQ(2u, CountMetadata()); | 1337 EXPECT_EQ(2u, CountMetadata()); |
| 1321 EXPECT_EQ(2u, CountTracker()); | 1338 EXPECT_EQ(2u, CountTracker()); |
| 1322 } | 1339 } |
| 1323 | 1340 |
| 1324 TEST_F(DriveBackendSyncTest, ConflictTest_AddFile_AddFolder) { | 1341 #if defined(OS_WIN) |
| 1342 // http://crbug.com/396388 |
| 1343 #define MAYBE_ConflictTest_AddFile_AddFolder DISABLED_ConflictTest_AddFile_AddFo
lder |
| 1344 #else |
| 1345 #define MAYBE_ConflictTest_AddFile_AddFolder ConflictTest_AddFile_AddFolder |
| 1346 #endif |
| 1347 TEST_F(DriveBackendSyncTest, MAYBE_ConflictTest_AddFile_AddFolder) { |
| 1325 std::string app_id = "example"; | 1348 std::string app_id = "example"; |
| 1326 | 1349 |
| 1327 RegisterApp(app_id); | 1350 RegisterApp(app_id); |
| 1328 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL("")); | 1351 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL("")); |
| 1329 | 1352 |
| 1330 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo"); | 1353 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo"); |
| 1331 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar"); | 1354 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar"); |
| 1332 | 1355 |
| 1333 std::string file_id; | 1356 std::string file_id; |
| 1334 EXPECT_EQ(google_apis::HTTP_CREATED, | 1357 EXPECT_EQ(google_apis::HTTP_CREATED, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 | 1419 |
| 1397 EXPECT_EQ(1u, CountApp()); | 1420 EXPECT_EQ(1u, CountApp()); |
| 1398 EXPECT_EQ(3u, CountLocalFile(app_id)); | 1421 EXPECT_EQ(3u, CountLocalFile(app_id)); |
| 1399 VerifyLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo"); | 1422 VerifyLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo"); |
| 1400 VerifyLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar"); | 1423 VerifyLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar"); |
| 1401 | 1424 |
| 1402 EXPECT_EQ(4u, CountMetadata()); | 1425 EXPECT_EQ(4u, CountMetadata()); |
| 1403 EXPECT_EQ(4u, CountTracker()); | 1426 EXPECT_EQ(4u, CountTracker()); |
| 1404 } | 1427 } |
| 1405 | 1428 |
| 1406 TEST_F(DriveBackendSyncTest, ConflictTest_AddFile_AddFile) { | 1429 #if defined(OS_WIN) |
| 1430 // http://crbug.com/396388 |
| 1431 #define MAYBE_ConflictTest_AddFile_AddFile DISABLED_ConflictTest_AddFile_AddFile |
| 1432 #else |
| 1433 #define MAYBE_ConflictTest_AddFile_AddFile ConflictTest_AddFile_AddFile |
| 1434 #endif |
| 1435 TEST_F(DriveBackendSyncTest, MAYBE_ConflictTest_AddFile_AddFile) { |
| 1407 std::string app_id = "example"; | 1436 std::string app_id = "example"; |
| 1408 | 1437 |
| 1409 RegisterApp(app_id); | 1438 RegisterApp(app_id); |
| 1410 | 1439 |
| 1411 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL("")); | 1440 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL("")); |
| 1412 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "hoge"); | 1441 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "hoge"); |
| 1413 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "fuga"); | 1442 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "fuga"); |
| 1414 | 1443 |
| 1415 std::string file_id; | 1444 std::string file_id; |
| 1416 EXPECT_EQ(google_apis::HTTP_SUCCESS, | 1445 EXPECT_EQ(google_apis::HTTP_SUCCESS, |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1706 | 1735 |
| 1707 EXPECT_EQ(1u, CountApp()); | 1736 EXPECT_EQ(1u, CountApp()); |
| 1708 EXPECT_EQ(1u, CountLocalFile(app_id)); | 1737 EXPECT_EQ(1u, CountLocalFile(app_id)); |
| 1709 | 1738 |
| 1710 EXPECT_EQ(2u, CountMetadata()); | 1739 EXPECT_EQ(2u, CountMetadata()); |
| 1711 EXPECT_EQ(2u, CountTracker()); | 1740 EXPECT_EQ(2u, CountTracker()); |
| 1712 } | 1741 } |
| 1713 | 1742 |
| 1714 } // namespace drive_backend | 1743 } // namespace drive_backend |
| 1715 } // namespace sync_file_system | 1744 } // namespace sync_file_system |
| OLD | NEW |