summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync_file_system
diff options
context:
space:
mode:
authornhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-17 17:51:51 +0000
committernhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-17 17:51:51 +0000
commitf84ae11a4f08c60692c5688458185f117d33779d (patch)
tree52ab76732e457021908857ab4f378be4d3d70028 /chrome/browser/sync_file_system
parent4c6fec6b90c4225b16dec499281ae570be2435ef (diff)
downloadchromium_src-f84ae11a4f08c60692c5688458185f117d33779d.zip
chromium_src-f84ae11a4f08c60692c5688458185f117d33779d.tar.gz
chromium_src-f84ae11a4f08c60692c5688458185f117d33779d.tar.bz2
SyncFS: Support resolveLocalFileSystemURL on SyncFileSystem
window.resolveLocalFileSystemURL is originally defined only for FileSystem API, but it'd be nice if it works on SyncFileSystem in a similar way. For that this change adds new IPC messages and interfaces. Blink side change depends on this: https://codereview.chromium.org/23537011/ BUG=177137 TEST=manual (Get FileSystemURL for a file on SyncFS, and then resolve it) TEST=unit_tests TEST=run_webkit_tests.sh http/tests/inspector/filesystem/\* TEST=run_webkit_tests.sh http/tests/inspector/filesystem/\* Review URL: https://chromiumcodereview.appspot.com/23856002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223635 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync_file_system')
-rw-r--r--chrome/browser/sync_file_system/local/local_file_sync_context.cc2
-rw-r--r--chrome/browser/sync_file_system/local/sync_file_system_backend.cc4
-rw-r--r--chrome/browser/sync_file_system/sync_file_system_service_factory.cc5
-rw-r--r--chrome/browser/sync_file_system/syncable_file_system_util_unittest.cc37
4 files changed, 4 insertions, 44 deletions
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context.cc b/chrome/browser/sync_file_system/local/local_file_sync_context.cc
index 227ce74..c8b937a 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_context.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_context.cc
@@ -495,8 +495,6 @@ void LocalFileSyncContext::InitializeFileSystemContextOnIOThread(
SyncFileSystemBackend::GetBackend(file_system_context);
DCHECK(backend);
if (!backend->change_tracker()) {
- // First registers the service name.
- RegisterSyncableFileSystem();
// Create and initialize LocalFileChangeTracker and call back this method
// later again.
std::set<GURL>* origins_with_changes = new std::set<GURL>;
diff --git a/chrome/browser/sync_file_system/local/sync_file_system_backend.cc b/chrome/browser/sync_file_system/local/sync_file_system_backend.cc
index 1c9eef5..6de402f 100644
--- a/chrome/browser/sync_file_system/local/sync_file_system_backend.cc
+++ b/chrome/browser/sync_file_system/local/sync_file_system_backend.cc
@@ -66,6 +66,10 @@ SyncFileSystemBackend::SyncFileSystemBackend(Profile* profile)
DCHECK(CalledOnUIThread());
if (profile)
profile_holder_.reset(new ProfileHolder(profile));
+
+ // Register the service name here to enable to crack an URL on SyncFileSystem
+ // even if SyncFileSystemService has not started yet.
+ RegisterSyncableFileSystem();
}
SyncFileSystemBackend::~SyncFileSystemBackend() {
diff --git a/chrome/browser/sync_file_system/sync_file_system_service_factory.cc b/chrome/browser/sync_file_system/sync_file_system_service_factory.cc
index 8c9112e..cf9b5be 100644
--- a/chrome/browser/sync_file_system/sync_file_system_service_factory.cc
+++ b/chrome/browser/sync_file_system/sync_file_system_service_factory.cc
@@ -71,8 +71,6 @@ SyncFileSystemServiceFactory::BuildServiceInstanceFor(
remote_file_service = mock_remote_file_service_.Pass();
} else if (CommandLine::ForCurrentProcess()->HasSwitch(
kEnableSyncFileSystemV2)) {
- RegisterSyncableFileSystem();
-
GURL base_drive_url(
google_apis::DriveApiUrlGenerator::kBaseUrlForProduction);
GURL base_download_url(
@@ -112,9 +110,6 @@ SyncFileSystemServiceFactory::BuildServiceInstanceFor(
sync_engine->Initialize();
remote_file_service = sync_engine.PassAs<RemoteFileSyncService>();
} else {
- // FileSystem needs to be registered before DriveFileSyncService runs
- // its initialization code.
- RegisterSyncableFileSystem();
remote_file_service =
DriveFileSyncService::Create(profile).PassAs<RemoteFileSyncService>();
}
diff --git a/chrome/browser/sync_file_system/syncable_file_system_util_unittest.cc b/chrome/browser/sync_file_system/syncable_file_system_util_unittest.cc
index 583bfe8..3cb27ec 100644
--- a/chrome/browser/sync_file_system/syncable_file_system_util_unittest.cc
+++ b/chrome/browser/sync_file_system/syncable_file_system_util_unittest.cc
@@ -111,43 +111,6 @@ TEST(SyncableFileSystemUtilTest,
RevokeSyncableFileSystem();
}
-TEST(SyncableFileSystemUtilTest, SerializeBeforeOpenFileSystem) {
- ScopedEnableSyncFSDirectoryOperation enable_directory_operation_;
- const std::string serialized = kSyncableFileSystemRootURI +
- CreateNormalizedFilePath(kPath).AsUTF8Unsafe();
- FileSystemURL deserialized;
- base::MessageLoop message_loop;
-
- // Setting up a full syncable filesystem environment.
- CannedSyncableFileSystem file_system(GURL(kOrigin),
- base::MessageLoopProxy::current().get(),
- base::MessageLoopProxy::current().get());
- file_system.SetUp();
- scoped_refptr<LocalFileSyncContext> sync_context =
- new LocalFileSyncContext(base::MessageLoopProxy::current().get(),
- base::MessageLoopProxy::current().get());
-
- // Before calling initialization we would not be able to get a valid
- // deserialized URL.
- EXPECT_FALSE(DeserializeSyncableFileSystemURL(serialized, &deserialized));
- EXPECT_FALSE(deserialized.is_valid());
-
- ASSERT_EQ(sync_file_system::SYNC_STATUS_OK,
- file_system.MaybeInitializeFileSystemContext(sync_context.get()));
-
- // After initialization this should be ok (even before opening the file
- // system).
- EXPECT_TRUE(DeserializeSyncableFileSystemURL(serialized, &deserialized));
- EXPECT_TRUE(deserialized.is_valid());
-
- // Shutting down.
- file_system.TearDown();
- RevokeSyncableFileSystem();
- sync_context->ShutdownOnUIThread();
- sync_context = NULL;
- base::MessageLoop::current()->RunUntilIdle();
-}
-
TEST(SyncableFileSystemUtilTest, SyncableFileSystemURL_IsParent) {
RegisterSyncableFileSystem();