Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer_unittest.cc

Issue 248853002: [NOCOMMIT] Make DriveService{Wrapper|Messenger} class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/remote_to_local_syncer.h " 5 #include "chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h "
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 typedef FakeRemoteChangeProcessor::URLToFileChangesMap URLToFileChangesMap; 48 typedef FakeRemoteChangeProcessor::URLToFileChangesMap URLToFileChangesMap;
49 49
50 RemoteToLocalSyncerTest() 50 RemoteToLocalSyncerTest()
51 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} 51 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {}
52 virtual ~RemoteToLocalSyncerTest() {} 52 virtual ~RemoteToLocalSyncerTest() {}
53 53
54 virtual void SetUp() OVERRIDE { 54 virtual void SetUp() OVERRIDE {
55 ASSERT_TRUE(database_dir_.CreateUniqueTempDir()); 55 ASSERT_TRUE(database_dir_.CreateUniqueTempDir());
56 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); 56 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default()));
57 57
58 fake_drive_service_.reset(new drive::FakeDriveService); 58 scoped_ptr<drive::FakeDriveService>
59 fake_drive_service(new drive::FakeDriveService);
59 60
60 drive_uploader_.reset( 61 drive_uploader_.reset(
61 new drive::DriveUploader(fake_drive_service_.get(), 62 new drive::DriveUploader(fake_drive_service.get(),
62 base::MessageLoopProxy::current().get())); 63 base::MessageLoopProxy::current().get()));
63 fake_drive_helper_.reset( 64 fake_drive_helper_.reset(
64 new FakeDriveServiceHelper(fake_drive_service_.get(), 65 new FakeDriveServiceHelper(fake_drive_service.get(),
65 drive_uploader_.get(), 66 drive_uploader_.get(),
66 kSyncRootFolderTitle)); 67 kSyncRootFolderTitle));
67 fake_remote_change_processor_.reset(new FakeRemoteChangeProcessor); 68 fake_remote_change_processor_.reset(new FakeRemoteChangeProcessor);
68 69
69 context_.reset(new SyncEngineContext(fake_drive_service_.get(), 70 context_.reset(new SyncEngineContext(
70 drive_uploader_.get(), 71 fake_drive_service.PassAs<drive::DriveServiceInterface>(),
71 base::MessageLoopProxy::current(), 72 drive_uploader_.get(),
72 base::MessageLoopProxy::current())); 73 base::MessageLoopProxy::current(),
74 base::MessageLoopProxy::current()));
73 context_->SetRemoteChangeProcessor(fake_remote_change_processor_.get()); 75 context_->SetRemoteChangeProcessor(fake_remote_change_processor_.get());
74 76
75 RegisterSyncableFileSystem(); 77 RegisterSyncableFileSystem();
76 78
77 sync_task_manager_.reset(new SyncTaskManager( 79 sync_task_manager_.reset(new SyncTaskManager(
78 base::WeakPtr<SyncTaskManager::Client>(), 80 base::WeakPtr<SyncTaskManager::Client>(),
79 10 /* max_parallel_task */)); 81 10 /* max_parallel_task */));
80 sync_task_manager_->Initialize(SYNC_STATUS_OK); 82 sync_task_manager_->Initialize(SYNC_STATUS_OK);
81 } 83 }
82 84
83 virtual void TearDown() OVERRIDE { 85 virtual void TearDown() OVERRIDE {
84 sync_task_manager_.reset(); 86 sync_task_manager_.reset();
85 87
86 RevokeSyncableFileSystem(); 88 RevokeSyncableFileSystem();
87 89
88 fake_remote_change_processor_.reset(); 90 fake_remote_change_processor_.reset();
89 fake_drive_helper_.reset(); 91 fake_drive_helper_.reset();
90 fake_drive_service_.reset();
91 drive_uploader_.reset(); 92 drive_uploader_.reset();
92 context_.reset(); 93 context_.reset();
93 base::RunLoop().RunUntilIdle(); 94 base::RunLoop().RunUntilIdle();
94 } 95 }
95 96
96 void InitializeMetadataDatabase() { 97 void InitializeMetadataDatabase() {
97 SyncEngineInitializer* initializer = 98 SyncEngineInitializer* initializer =
98 new SyncEngineInitializer( 99 new SyncEngineInitializer(
99 context_.get(), 100 context_.get(),
100 base::MessageLoopProxy::current(), 101 base::MessageLoopProxy::current(),
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 void VerifyConsistency() { 215 void VerifyConsistency() {
215 fake_remote_change_processor_->VerifyConsistency(expected_changes_); 216 fake_remote_change_processor_->VerifyConsistency(expected_changes_);
216 } 217 }
217 218
218 private: 219 private:
219 content::TestBrowserThreadBundle thread_bundle_; 220 content::TestBrowserThreadBundle thread_bundle_;
220 base::ScopedTempDir database_dir_; 221 base::ScopedTempDir database_dir_;
221 scoped_ptr<leveldb::Env> in_memory_env_; 222 scoped_ptr<leveldb::Env> in_memory_env_;
222 223
223 scoped_ptr<SyncEngineContext> context_; 224 scoped_ptr<SyncEngineContext> context_;
224 scoped_ptr<drive::FakeDriveService> fake_drive_service_;
225 scoped_ptr<drive::DriveUploaderInterface> drive_uploader_; 225 scoped_ptr<drive::DriveUploaderInterface> drive_uploader_;
226 scoped_ptr<FakeDriveServiceHelper> fake_drive_helper_; 226 scoped_ptr<FakeDriveServiceHelper> fake_drive_helper_;
227 scoped_ptr<FakeRemoteChangeProcessor> fake_remote_change_processor_; 227 scoped_ptr<FakeRemoteChangeProcessor> fake_remote_change_processor_;
228 228
229 scoped_ptr<SyncTaskManager> sync_task_manager_; 229 scoped_ptr<SyncTaskManager> sync_task_manager_;
230 230
231 URLToFileChangesMap expected_changes_; 231 URLToFileChangesMap expected_changes_;
232 232
233 DISALLOW_COPY_AND_ASSIGN(RemoteToLocalSyncerTest); 233 DISALLOW_COPY_AND_ASSIGN(RemoteToLocalSyncerTest);
234 }; 234 };
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 474
475 EXPECT_EQ(SYNC_STATUS_OK, ListChanges()); 475 EXPECT_EQ(SYNC_STATUS_OK, ListChanges());
476 RunSyncerUntilIdle(); 476 RunSyncerUntilIdle();
477 VerifyConsistency(); 477 VerifyConsistency();
478 478
479 // SyncEngine will re-register the app and resurrect the app root later. 479 // SyncEngine will re-register the app and resurrect the app root later.
480 } 480 }
481 481
482 } // namespace drive_backend 482 } // namespace drive_backend
483 } // namespace sync_file_system 483 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698