Home | History | Annotate | Download | only in drive_backend

Lines Matching refs:app_id

166   fileapi::FileSystemURL CreateURL(const std::string& app_id,
168 return CreateURL(app_id, base::FilePath(path));
171 fileapi::FileSystemURL CreateURL(const std::string& app_id,
173 GURL origin = extensions::Extension::GetBaseURLFromExtensionId(app_id);
177 bool GetAppRootFolderID(const std::string& app_id,
187 app_id,
199 std::string GetFileIDByPath(const std::string& app_id,
201 return GetFileIDByPath(app_id, base::FilePath(path));
204 std::string GetFileIDByPath(const std::string& app_id,
216 app_id,
229 SyncStatusCode RegisterApp(const std::string& app_id) {
230 GURL origin = extensions::Extension::GetBaseURLFromExtensionId(app_id);
231 if (!ContainsKey(file_systems_, app_id)) {
250 file_systems_[app_id] = file_system;
263 void AddLocalFolder(const std::string& app_id,
265 ASSERT_TRUE(ContainsKey(file_systems_, app_id));
267 file_systems_[app_id]->CreateDirectory(
268 CreateURL(app_id, path)));
271 void AddOrUpdateLocalFile(const std::string& app_id,
274 fileapi::FileSystemURL url(CreateURL(app_id, path));
275 ASSERT_TRUE(ContainsKey(file_systems_, app_id));
276 EXPECT_EQ(base::File::FILE_OK, file_systems_[app_id]->CreateFile(url));
277 int64 bytes_written = file_systems_[app_id]->WriteString(url, content);
282 void UpdateLocalFile(const std::string& app_id,
285 ASSERT_TRUE(ContainsKey(file_systems_, app_id));
286 int64 bytes_written = file_systems_[app_id]->WriteString(
287 CreateURL(app_id, path), content);
292 void RemoveLocal(const std::string& app_id,
294 ASSERT_TRUE(ContainsKey(file_systems_, app_id));
296 file_systems_[app_id]->Remove(
297 CreateURL(app_id, path),
416 const std::string& app_id = itr->first;
417 SCOPED_TRACE(testing::Message() << "Verifying app: " << app_id);
419 ASSERT_TRUE(ContainsKey(app_root_by_title, app_id));
421 app_id, base::FilePath(),
422 app_root_by_title[app_id]->resource_id(),
427 void VerifyConsistencyForFolder(const std::string& app_id,
446 fileapi::FileSystemURL url(CreateURL(app_id, path));
455 CreateURL(app_id, path.Append(local_entry.name)));
465 VerifyConsistencyForFolder(app_id, entry_url.path(),
470 VerifyConsistencyForFile(app_id, entry_url.path(),
480 void VerifyConsistencyForFile(const std::string& app_id,
484 fileapi::FileSystemURL url(CreateURL(app_id, path));
496 size_t CountLocalFile(const std::string& app_id) {
497 if (!ContainsKey(file_systems_, app_id))
500 CannedSyncableFileSystem* file_system = file_systems_[app_id];
506 fileapi::FileSystemURL url(CreateURL(app_id, folders.top()));
523 void VerifyLocalFile(const std::string& app_id,
527 << "app_id = " << app_id
529 ASSERT_TRUE(ContainsKey(file_systems_, app_id));
531 file_systems_[app_id]->VerifyFile(
532 CreateURL(app_id, path), content));
535 void VerifyLocalFolder(const std::string& app_id,
538 << "app_id = " << app_id
540 ASSERT_TRUE(ContainsKey(file_systems_, app_id));
542 file_systems_[app_id]->DirectoryExists(CreateURL(app_id, path)));
616 std::string app_id = "example";
618 RegisterApp(app_id);
619 AddOrUpdateLocalFile(app_id, FPL("file"), "abcde");
625 EXPECT_EQ(2u, CountLocalFile(app_id));
626 VerifyLocalFile(app_id, FPL("file"), "abcde");
633 std::string app_id = "example";
634 RegisterApp(app_id);
637 EXPECT_TRUE(GetAppRootFolderID(app_id, &app_root_folder_id));
648 EXPECT_EQ(2u, CountLocalFile(app_id));
649 VerifyLocalFile(app_id, FPL("file"), "abcde");
656 std::string app_id = "example";
659 RegisterApp(app_id);
660 AddOrUpdateLocalFile(app_id, kPath, "abcde");
665 UpdateLocalFile(app_id, kPath, "1234567890");
671 EXPECT_EQ(2u, CountLocalFile(app_id));
672 VerifyLocalFile(app_id, FPL("file"), "1234567890");
679 std::string app_id = "example";
681 RegisterApp(app_id);
684 EXPECT_TRUE(GetAppRootFolderID(app_id, &app_root_folder_id));
700 EXPECT_EQ(2u, CountLocalFile(app_id));
701 VerifyLocalFile(app_id, FPL("file"), "1234567890");
708 std::string app_id = "example";
711 RegisterApp(app_id);
712 AddOrUpdateLocalFile(app_id, path, "abcde");
717 RemoveLocal(app_id, path);
723 EXPECT_EQ(1u, CountLocalFile(app_id));
730 std::string app_id = "example";
733 RegisterApp(app_id);
734 AddOrUpdateLocalFile(app_id, path, "abcde");
739 std::string file_id = GetFileIDByPath(app_id, path);
747 EXPECT_EQ(1u, CountLocalFile(app_id));
754 std::string app_id = "example";
757 RegisterApp(app_id);
758 AddOrUpdateLocalFile(app_id, path, "abcde");
763 std::string file_id = GetFileIDByPath(app_id, path);
772 EXPECT_EQ(2u, CountLocalFile(app_id));
773 VerifyLocalFile(app_id, FPL("renamed_file"), "abcde");
780 std::string app_id = "example";
783 RegisterApp(app_id);
784 AddOrUpdateLocalFile(app_id, path, "abcde");
789 std::string file_id = GetFileIDByPath(app_id, path);
806 EXPECT_EQ(2u, CountLocalFile(app_id));
807 VerifyLocalFile(app_id, FPL("file"), "abcde");
814 std::string app_id = "example";
817 RegisterApp(app_id);
818 AddLocalFolder(app_id, FPL("folder_src"));
819 AddLocalFolder(app_id, FPL("folder_dest"));
820 AddOrUpdateLocalFile(app_id, FPL("folder_src/file"), "abcde");
825 std::string file_id = GetFileIDByPath(app_id, FPL("folder_src/file"));
826 std::string src_folder_id = GetFileIDByPath(app_id, FPL("folder_src"));
827 std::string dest_folder_id = GetFileIDByPath(app_id, FPL("folder_dest"));
839 EXPECT_EQ(4u, CountLocalFile(app_id));
840 VerifyLocalFolder(app_id, FPL("folder_dest"));
841 VerifyLocalFile(app_id, FPL("folder_dest/file"), "abcde");
884 std::string app_id = "example";
886 RegisterApp(app_id);
888 AddLocalFolder(app_id, FPL("folder_src"));
889 AddOrUpdateLocalFile(app_id, FPL("folder_src/file_orphaned"), "abcde");
890 AddOrUpdateLocalFile(app_id, FPL("folder_src/file_under_sync_root"), "123");
891 AddOrUpdateLocalFile(app_id, FPL("folder_src/file_under_drive_root"), "hoge");
897 GetFileIDByPath(app_id, FPL("folder_src/file_orphaned"));
899 GetFileIDByPath(app_id, FPL("folder_src/file_under_sync_root"));
901 GetFileIDByPath(app_id, FPL("folder_src/file_under_drive_root"));
903 std::string folder_id = GetFileIDByPath(app_id, FPL("folder_src"));
931 EXPECT_EQ(2u, CountLocalFile(app_id));
938 std::string app_id = "example";
940 RegisterApp(app_id);
942 AddLocalFolder(app_id, FPL("parent1"));
943 AddLocalFolder(app_id, FPL("parent2"));
944 AddOrUpdateLocalFile(app_id, FPL("parent1/file"), "abcde");
949 std::string file_id = GetFileIDByPath(app_id, FPL("parent1/file"));
950 std::string parent2_folder_id = GetFileIDByPath(app_id, FPL("parent2"));
959 EXPECT_EQ(4u, CountLocalFile(app_id));
960 VerifyLocalFolder(app_id, FPL("parent1"));
961 VerifyLocalFolder(app_id, FPL("parent2"));
962 VerifyLocalFile(app_id, FPL("parent1/file"), "abcde");
969 std::string app_id = "example";
971 RegisterApp(app_id);
973 AddLocalFolder(app_id, FPL("folder"));
974 AddLocalFolder(app_id, FPL("folder_temp"));
975 AddOrUpdateLocalFile(app_id, FPL("folder/file"), "abcde");
980 std::string file_id = GetFileIDByPath(app_id, FPL("folder/file"));
981 std::string folder_id = GetFileIDByPath(app_id, FPL("folder"));
982 std::string folder_temp_id = GetFileIDByPath(app_id, FPL("folder_temp"));
1005 EXPECT_EQ(4u, CountLocalFile(app_id));
1006 VerifyLocalFolder(app_id, FPL("folder"));
1007 VerifyLocalFile(app_id, FPL("folder/file"), "abcde");
1014 std::string app_id = "example";
1016 RegisterApp(app_id);
1017 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1019 AddLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1020 AddLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1039 EXPECT_EQ(3u, CountLocalFile(app_id));
1040 VerifyLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1041 VerifyLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1048 std::string app_id = "example";
1050 RegisterApp(app_id);
1052 AddLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1053 AddLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1059 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1060 AddLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1061 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1062 AddLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1066 GetFileIDByPath(app_id, FPL("conflict_to_pending_remote"))));
1072 GetFileIDByPath(app_id, FPL("conflict_to_existing_remote"))));
1078 EXPECT_EQ(2u, CountLocalFile(app_id));
1079 VerifyLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1086 std::string app_id = "example";
1088 RegisterApp(app_id);
1089 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1091 AddLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1092 AddLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1119 EXPECT_EQ(3u, CountLocalFile(app_id));
1120 VerifyLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1121 VerifyLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1128 std::string app_id = "example";
1130 RegisterApp(app_id);
1131 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1133 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1134 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1140 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1141 AddLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1143 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1144 AddLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1148 GetFileIDByPath(app_id, FPL("conflict_to_pending_remote"))));
1154 GetFileIDByPath(app_id, FPL("conflict_to_existing_remote"))));
1160 EXPECT_EQ(3u, CountLocalFile(app_id));
1161 VerifyLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1162 VerifyLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1169 std::string app_id = "example";
1171 RegisterApp(app_id);
1172 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1173 AddLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1174 AddLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1176 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1177 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1196 EXPECT_EQ(3u, CountLocalFile(app_id));
1197 VerifyLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1198 VerifyLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1205 std::string app_id = "example";
1207 RegisterApp(app_id);
1208 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1210 AddLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1211 AddLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1217 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1218 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1222 GetFileIDByPath(app_id, FPL("conflict_to_pending_remote"))));
1228 GetFileIDByPath(app_id, FPL("conflict_to_existing_remote"))));
1234 EXPECT_EQ(1u, CountLocalFile(app_id));
1241 std::string app_id = "example";
1243 RegisterApp(app_id);
1244 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1246 AddLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1247 AddLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1248 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1249 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1266 EXPECT_EQ(3u, CountLocalFile(app_id));
1267 VerifyLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1268 VerifyLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1275 std::string app_id = "example";
1277 RegisterApp(app_id);
1278 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1279 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1280 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1286 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1287 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1291 GetFileIDByPath(app_id, FPL("conflict_to_pending_remote"))));
1297 GetFileIDByPath(app_id, FPL("conflict_to_existing_remote"))));
1303 EXPECT_EQ(1u, CountLocalFile(app_id));
1310 std::string app_id = "example";
1312 RegisterApp(app_id);
1313 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1315 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1316 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1343 EXPECT_EQ(3u, CountLocalFile(app_id));
1344 VerifyLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1345 VerifyLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1352 std::string app_id = "example";
1354 RegisterApp(app_id);
1355 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1357 AddLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1358 AddLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1364 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1365 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1366 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1367 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1371 GetFileIDByPath(app_id, FPL("conflict_to_pending_remote"))));
1377 GetFileIDByPath(app_id, FPL("conflict_to_existing_remote"))));
1383 EXPECT_EQ(3u, CountLocalFile(app_id));
1384 VerifyLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1385 VerifyLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1392 std::string app_id = "example";
1394 RegisterApp(app_id);
1396 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1397 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "hoge");
1398 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "fuga");
1425 EXPECT_EQ(3u, CountLocalFile(app_id));
1426 VerifyLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1427 VerifyLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1434 std::string app_id = "example";
1436 RegisterApp(app_id);
1438 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1439 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1445 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1446 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1447 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "hoge");
1448 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "fuga");
1452 GetFileIDByPath(app_id, FPL("conflict_to_pending_remote"))));
1458 GetFileIDByPath(app_id, FPL("conflict_to_existing_remote"))));
1464 EXPECT_EQ(3u, CountLocalFile(app_id));
1465 VerifyLocalFile(app_id, FPL("conflict_to_pending_remote"), "hoge");
1466 VerifyLocalFile(app_id, FPL("conflict_to_existing_remote"), "fuga");
1473 std::string app_id = "example";
1475 RegisterApp(app_id);
1477 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1478 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1484 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "hoge");
1485 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "fuga");
1489 GetFileIDByPath(app_id, FPL("conflict_to_pending_remote"))));
1495 GetFileIDByPath(app_id, FPL("conflict_to_existing_remote"))));
1501 EXPECT_EQ(3u, CountLocalFile(app_id));
1502 VerifyLocalFile(app_id, FPL("conflict_to_pending_remote"), "hoge");
1503 VerifyLocalFile(app_id, FPL("conflict_to_existing_remote"), "fuga");
1510 std::string app_id = "example";
1512 RegisterApp(app_id);
1514 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1515 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1516 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1522 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1523 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1539 EXPECT_EQ(3u, CountLocalFile(app_id));
1540 VerifyLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1541 VerifyLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1548 std::string app_id = "example";
1550 RegisterApp(app_id);
1552 AddLocalFolder(app_id, FPL("conflict_to_pending_remote"));
1553 AddLocalFolder(app_id, FPL("conflict_to_existing_remote"));
1559 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1560 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1562 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1563 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1565 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1566 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1570 GetFileIDByPath(app_id, FPL("conflict_to_pending_remote"))));
1576 GetFileIDByPath(app_id, FPL("conflict_to_existing_remote"))));
1582 EXPECT_EQ(1u, CountLocalFile(app_id));
1589 std::string app_id = "example";
1591 RegisterApp(app_id);
1593 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1594 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1595 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1596 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1597 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1615 EXPECT_EQ(3u, CountLocalFile(app_id));
1616 VerifyLocalFile(app_id, FPL("conflict_to_pending_remote"), "hoge");
1617 VerifyLocalFile(app_id, FPL("conflict_to_existing_remote"), "fuga");
1624 std::string app_id = "example";
1626 RegisterApp(app_id);
1628 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1629 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1630 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1636 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1637 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1641 GetFileIDByPath(app_id, FPL("conflict_to_pending_remote")),
1648 GetFileIDByPath(app_id, FPL("conflict_to_existing_remote")),
1655 EXPECT_EQ(3u, CountLocalFile(app_id));
1656 VerifyLocalFile(app_id, FPL("conflict_to_pending_remote"), "hoge");
1657 VerifyLocalFile(app_id, FPL("conflict_to_existing_remote"), "fuga");
1664 std::string app_id = "example";
1666 RegisterApp(app_id);
1668 std::string app_root_folder_id = GetFileIDByPath(app_id, FPL(""));
1669 AddOrUpdateLocalFile(app_id, FPL("conflict_to_pending_remote"), "foo");
1670 AddOrUpdateLocalFile(app_id, FPL("conflict_to_existing_remote"), "bar");
1676 RemoveLocal(app_id, FPL("conflict_to_pending_remote"));
1677 RemoveLocal(app_id, FPL("conflict_to_existing_remote"));
1681 GetFileIDByPath(app_id, FPL("conflict_to_pending_remote"))));
1687 GetFileIDByPath(app_id, FPL("conflict_to_existing_remote"))));
1693 EXPECT_EQ(1u, CountLocalFile(app_id));