diff options
author | nhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-19 05:04:11 +0000 |
---|---|---|
committer | nhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-19 05:04:11 +0000 |
commit | 3626042aa75cdd18e80ed14bbd68e77bfbd98b96 (patch) | |
tree | bb5328d54c1bfb69d6d4712a168f40f553510eb7 /chrome/browser/sync_file_system | |
parent | fbc10befb84a7245a3a746fb9489473896bd4159 (diff) | |
download | chromium_src-3626042aa75cdd18e80ed14bbd68e77bfbd98b96.zip chromium_src-3626042aa75cdd18e80ed14bbd68e77bfbd98b96.tar.gz chromium_src-3626042aa75cdd18e80ed14bbd68e77bfbd98b96.tar.bz2 |
Revert 223635 "SyncFS: Support resolveLocalFileSystemURL on Sync..."
> 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
BUG=294502
TBR=nhiroki@chromium.org
Review URL: https://codereview.chromium.org/23558016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224038 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync_file_system')
4 files changed, 44 insertions, 4 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 c8b937a..227ce74 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,6 +495,8 @@ 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 6de402f..1c9eef5 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,10 +66,6 @@ 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 87bdea8..186aaa3 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,6 +71,8 @@ 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( @@ -113,6 +115,9 @@ 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 3cb27ec..583bfe8 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,6 +111,43 @@ 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(); |