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

Side by Side Diff: chrome/browser/extensions/api/sync_file_system/sync_file_system_browsertest.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stdint.h> 5 #include <stdint.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 18 matching lines...) Expand all
29 namespace { 29 namespace {
30 30
31 class FakeDriveServiceFactory 31 class FakeDriveServiceFactory
32 : public drive_backend::SyncEngine::DriveServiceFactory { 32 : public drive_backend::SyncEngine::DriveServiceFactory {
33 public: 33 public:
34 explicit FakeDriveServiceFactory( 34 explicit FakeDriveServiceFactory(
35 drive::FakeDriveService::ChangeObserver* change_observer) 35 drive::FakeDriveService::ChangeObserver* change_observer)
36 : change_observer_(change_observer) {} 36 : change_observer_(change_observer) {}
37 ~FakeDriveServiceFactory() override {} 37 ~FakeDriveServiceFactory() override {}
38 38
39 scoped_ptr<drive::DriveServiceInterface> CreateDriveService( 39 std::unique_ptr<drive::DriveServiceInterface> CreateDriveService(
40 OAuth2TokenService* oauth2_token_service, 40 OAuth2TokenService* oauth2_token_service,
41 net::URLRequestContextGetter* url_request_context_getter, 41 net::URLRequestContextGetter* url_request_context_getter,
42 base::SequencedTaskRunner* blocking_task_runner) override { 42 base::SequencedTaskRunner* blocking_task_runner) override {
43 scoped_ptr<drive::FakeDriveService> drive_service( 43 std::unique_ptr<drive::FakeDriveService> drive_service(
44 new drive::FakeDriveService); 44 new drive::FakeDriveService);
45 drive_service->AddChangeObserver(change_observer_); 45 drive_service->AddChangeObserver(change_observer_);
46 return std::move(drive_service); 46 return std::move(drive_service);
47 } 47 }
48 48
49 private: 49 private:
50 drive::FakeDriveService::ChangeObserver* change_observer_; 50 drive::FakeDriveService::ChangeObserver* change_observer_;
51 51
52 DISALLOW_COPY_AND_ASSIGN(FakeDriveServiceFactory); 52 DISALLOW_COPY_AND_ASSIGN(FakeDriveServiceFactory);
53 }; 53 };
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 void SetUpOnMainThread() override { 86 void SetUpOnMainThread() override {
87 ASSERT_TRUE(base_dir_.CreateUniqueTempDir()); 87 ASSERT_TRUE(base_dir_.CreateUniqueTempDir());
88 88
89 SyncFileSystemServiceFactory* factory = 89 SyncFileSystemServiceFactory* factory =
90 SyncFileSystemServiceFactory::GetInstance(); 90 SyncFileSystemServiceFactory::GetInstance();
91 91
92 content::BrowserContext* context = browser()->profile(); 92 content::BrowserContext* context = browser()->profile();
93 ExtensionServiceInterface* extension_service = 93 ExtensionServiceInterface* extension_service =
94 extensions::ExtensionSystem::Get(context)->extension_service(); 94 extensions::ExtensionSystem::Get(context)->extension_service();
95 95
96 scoped_ptr<drive_backend::SyncEngine::DriveServiceFactory> 96 std::unique_ptr<drive_backend::SyncEngine::DriveServiceFactory>
97 drive_service_factory(new FakeDriveServiceFactory(this)); 97 drive_service_factory(new FakeDriveServiceFactory(this));
98 98
99 fake_signin_manager_.reset(new FakeSigninManagerForTesting( 99 fake_signin_manager_.reset(new FakeSigninManagerForTesting(
100 browser()->profile())); 100 browser()->profile()));
101 101
102 remote_service_ = new drive_backend::SyncEngine( 102 remote_service_ = new drive_backend::SyncEngine(
103 base::ThreadTaskRunnerHandle::Get(), // ui_task_runner 103 base::ThreadTaskRunnerHandle::Get(), // ui_task_runner
104 MakeSequencedTaskRunner(), MakeSequencedTaskRunner(), 104 MakeSequencedTaskRunner(), MakeSequencedTaskRunner(),
105 content::BrowserThread::GetBlockingPool(), base_dir_.path(), 105 content::BrowserThread::GetBlockingPool(), base_dir_.path(),
106 NULL, // task_logger 106 NULL, // task_logger
107 NULL, // notification_manager 107 NULL, // notification_manager
108 extension_service, 108 extension_service,
109 fake_signin_manager_.get(), // signin_manager 109 fake_signin_manager_.get(), // signin_manager
110 NULL, // token_service 110 NULL, // token_service
111 NULL, // request_context 111 NULL, // request_context
112 std::move(drive_service_factory), in_memory_env_.get()); 112 std::move(drive_service_factory), in_memory_env_.get());
113 remote_service_->SetSyncEnabled(true); 113 remote_service_->SetSyncEnabled(true);
114 factory->set_mock_remote_file_service( 114 factory->set_mock_remote_file_service(
115 scoped_ptr<RemoteFileSyncService>(remote_service_)); 115 std::unique_ptr<RemoteFileSyncService>(remote_service_));
116 } 116 }
117 117
118 // drive::FakeDriveService::ChangeObserver override. 118 // drive::FakeDriveService::ChangeObserver override.
119 void OnNewChangeAvailable() override { 119 void OnNewChangeAvailable() override {
120 sync_engine()->OnNotificationReceived(); 120 sync_engine()->OnNotificationReceived();
121 } 121 }
122 122
123 SyncFileSystemService* sync_file_system_service() { 123 SyncFileSystemService* sync_file_system_service() {
124 return SyncFileSystemServiceFactory::GetForProfile(browser()->profile()); 124 return SyncFileSystemServiceFactory::GetForProfile(browser()->profile());
125 } 125 }
(...skipping 17 matching lines...) Expand all
143 } 143 }
144 144
145 void WaitUntilIdle() { 145 void WaitUntilIdle() {
146 base::RunLoop run_loop; 146 base::RunLoop run_loop;
147 sync_file_system_service()->CallOnIdleForTesting(run_loop.QuitClosure()); 147 sync_file_system_service()->CallOnIdleForTesting(run_loop.QuitClosure());
148 run_loop.Run(); 148 run_loop.Run();
149 } 149 }
150 150
151 private: 151 private:
152 base::ScopedTempDir base_dir_; 152 base::ScopedTempDir base_dir_;
153 scoped_ptr<leveldb::Env> in_memory_env_; 153 std::unique_ptr<leveldb::Env> in_memory_env_;
154 154
155 scoped_ptr<FakeSigninManagerForTesting> fake_signin_manager_; 155 std::unique_ptr<FakeSigninManagerForTesting> fake_signin_manager_;
156 156
157 drive_backend::SyncEngine* remote_service_; 157 drive_backend::SyncEngine* remote_service_;
158 158
159 int64_t real_minimum_preserved_space_; 159 int64_t real_minimum_preserved_space_;
160 160
161 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemTest); 161 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemTest);
162 }; 162 };
163 163
164 IN_PROC_BROWSER_TEST_F(SyncFileSystemTest, AuthorizationTest) { 164 IN_PROC_BROWSER_TEST_F(SyncFileSystemTest, AuthorizationTest) {
165 ExtensionTestMessageListener open_failure( 165 ExtensionTestMessageListener open_failure(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 sync_engine()->GoogleSigninSucceeded("test_account", "tester", "testing"); 204 sync_engine()->GoogleSigninSucceeded("test_account", "tester", "testing");
205 WaitUntilIdle(); 205 WaitUntilIdle();
206 206
207 bar_created.Reply("resume"); 207 bar_created.Reply("resume");
208 208
209 EXPECT_TRUE(catcher.GetNextResult()); 209 EXPECT_TRUE(catcher.GetNextResult());
210 } 210 }
211 211
212 } // namespace sync_file_system 212 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698