| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h
" | 5 #include "chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h
" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 class LocalToRemoteSyncerTest : public testing::Test { | 49 class LocalToRemoteSyncerTest : public testing::Test { |
| 50 public: | 50 public: |
| 51 LocalToRemoteSyncerTest() | 51 LocalToRemoteSyncerTest() |
| 52 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} | 52 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} |
| 53 virtual ~LocalToRemoteSyncerTest() {} | 53 virtual ~LocalToRemoteSyncerTest() {} |
| 54 | 54 |
| 55 virtual void SetUp() OVERRIDE { | 55 virtual void SetUp() OVERRIDE { |
| 56 ASSERT_TRUE(database_dir_.CreateUniqueTempDir()); | 56 ASSERT_TRUE(database_dir_.CreateUniqueTempDir()); |
| 57 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); | 57 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); |
| 58 | 58 |
| 59 fake_drive_service_.reset(new FakeDriveServiceWrapper); | 59 scoped_ptr<FakeDriveServiceWrapper> |
| 60 fake_drive_service(new FakeDriveServiceWrapper); |
| 60 | 61 |
| 61 drive_uploader_.reset(new FakeDriveUploader(fake_drive_service_.get())); | 62 drive_uploader_.reset(new FakeDriveUploader(fake_drive_service.get())); |
| 62 fake_drive_helper_.reset(new FakeDriveServiceHelper( | 63 fake_drive_helper_.reset(new FakeDriveServiceHelper( |
| 63 fake_drive_service_.get(), | 64 fake_drive_service.get(), |
| 64 drive_uploader_.get(), | 65 drive_uploader_.get(), |
| 65 kSyncRootFolderTitle)); | 66 kSyncRootFolderTitle)); |
| 66 fake_remote_change_processor_.reset(new FakeRemoteChangeProcessor); | 67 fake_remote_change_processor_.reset(new FakeRemoteChangeProcessor); |
| 67 | 68 |
| 68 context_.reset(new SyncEngineContext( | 69 context_.reset(new SyncEngineContext( |
| 69 fake_drive_service_.get(), | 70 fake_drive_service.PassAs<drive::DriveServiceInterface>(), |
| 70 drive_uploader_.get(), | 71 drive_uploader_.get(), |
| 71 base::MessageLoopProxy::current(), | 72 base::MessageLoopProxy::current(), |
| 72 base::MessageLoopProxy::current())); | 73 base::MessageLoopProxy::current())); |
| 73 context_->SetRemoteChangeProcessor(fake_remote_change_processor_.get()); | 74 context_->SetRemoteChangeProcessor(fake_remote_change_processor_.get()); |
| 74 | 75 |
| 75 RegisterSyncableFileSystem(); | 76 RegisterSyncableFileSystem(); |
| 76 | 77 |
| 77 sync_task_manager_.reset(new SyncTaskManager( | 78 sync_task_manager_.reset(new SyncTaskManager( |
| 78 base::WeakPtr<SyncTaskManager::Client>(), | 79 base::WeakPtr<SyncTaskManager::Client>(), |
| 79 10 /* maximum_background_task */)); | 80 10 /* maximum_background_task */)); |
| 80 sync_task_manager_->Initialize(SYNC_STATUS_OK); | 81 sync_task_manager_->Initialize(SYNC_STATUS_OK); |
| 81 } | 82 } |
| 82 | 83 |
| 83 virtual void TearDown() OVERRIDE { | 84 virtual void TearDown() OVERRIDE { |
| 84 sync_task_manager_.reset(); | 85 sync_task_manager_.reset(); |
| 85 fake_drive_service_.reset(); | |
| 86 drive_uploader_.reset(); | 86 drive_uploader_.reset(); |
| 87 | 87 |
| 88 RevokeSyncableFileSystem(); | 88 RevokeSyncableFileSystem(); |
| 89 | 89 |
| 90 fake_remote_change_processor_.reset(); | 90 fake_remote_change_processor_.reset(); |
| 91 fake_drive_helper_.reset(); | 91 fake_drive_helper_.reset(); |
| 92 context_.reset(); | 92 context_.reset(); |
| 93 base::RunLoop().RunUntilIdle(); | 93 base::RunLoop().RunUntilIdle(); |
| 94 } | 94 } |
| 95 | 95 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 fake_drive_helper_->SearchByTitle( | 235 fake_drive_helper_->SearchByTitle( |
| 236 parent_folder_id, title, &entries)); | 236 parent_folder_id, title, &entries)); |
| 237 EXPECT_TRUE(entries.empty()); | 237 EXPECT_TRUE(entries.empty()); |
| 238 } | 238 } |
| 239 | 239 |
| 240 private: | 240 private: |
| 241 content::TestBrowserThreadBundle thread_bundle_; | 241 content::TestBrowserThreadBundle thread_bundle_; |
| 242 base::ScopedTempDir database_dir_; | 242 base::ScopedTempDir database_dir_; |
| 243 scoped_ptr<leveldb::Env> in_memory_env_; | 243 scoped_ptr<leveldb::Env> in_memory_env_; |
| 244 | 244 |
| 245 scoped_ptr<FakeDriveServiceWrapper> fake_drive_service_; | |
| 246 scoped_ptr<drive::DriveUploaderInterface> drive_uploader_; | 245 scoped_ptr<drive::DriveUploaderInterface> drive_uploader_; |
| 247 scoped_ptr<SyncEngineContext> context_; | 246 scoped_ptr<SyncEngineContext> context_; |
| 248 scoped_ptr<FakeDriveServiceHelper> fake_drive_helper_; | 247 scoped_ptr<FakeDriveServiceHelper> fake_drive_helper_; |
| 249 scoped_ptr<MetadataDatabase> metadata_database_; | 248 scoped_ptr<MetadataDatabase> metadata_database_; |
| 250 scoped_ptr<FakeRemoteChangeProcessor> fake_remote_change_processor_; | 249 scoped_ptr<FakeRemoteChangeProcessor> fake_remote_change_processor_; |
| 251 scoped_ptr<SyncTaskManager> sync_task_manager_; | 250 scoped_ptr<SyncTaskManager> sync_task_manager_; |
| 252 | 251 |
| 253 DISALLOW_COPY_AND_ASSIGN(LocalToRemoteSyncerTest); | 252 DISALLOW_COPY_AND_ASSIGN(LocalToRemoteSyncerTest); |
| 254 }; | 253 }; |
| 255 | 254 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 EXPECT_EQ(SYNC_STATUS_UNKNOWN_ORIGIN, RunLocalToRemoteSyncer( | 533 EXPECT_EQ(SYNC_STATUS_UNKNOWN_ORIGIN, RunLocalToRemoteSyncer( |
| 535 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, | 534 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, |
| 536 SYNC_FILE_TYPE_DIRECTORY), | 535 SYNC_FILE_TYPE_DIRECTORY), |
| 537 URL(kOrigin, "foo"))); | 536 URL(kOrigin, "foo"))); |
| 538 | 537 |
| 539 // SyncEngine will re-register the app and resurrect the app root later. | 538 // SyncEngine will re-register the app and resurrect the app root later. |
| 540 } | 539 } |
| 541 | 540 |
| 542 } // namespace drive_backend | 541 } // namespace drive_backend |
| 543 } // namespace sync_file_system | 542 } // namespace sync_file_system |
| OLD | NEW |