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

Side by Side Diff: sync/internal_api/attachments/attachment_service_impl_unittest.cc

Issue 1539843002: Convert Pass()→std::move() in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up Created 4 years, 12 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 "sync/internal_api/public/attachments/attachment_service_impl.h" 5 #include "sync/internal_api/public/attachments/attachment_service_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 scoped_ptr<MockAttachmentDownloader> downloader, 225 scoped_ptr<MockAttachmentDownloader> downloader,
226 AttachmentService::Delegate* delegate) { 226 AttachmentService::Delegate* delegate) {
227 // Initialize mock attachment store 227 // Initialize mock attachment store
228 scoped_refptr<base::SingleThreadTaskRunner> runner = 228 scoped_refptr<base::SingleThreadTaskRunner> runner =
229 base::ThreadTaskRunnerHandle::Get(); 229 base::ThreadTaskRunnerHandle::Get();
230 scoped_ptr<MockAttachmentStoreBackend> attachment_store_backend( 230 scoped_ptr<MockAttachmentStoreBackend> attachment_store_backend(
231 new MockAttachmentStoreBackend(runner)); 231 new MockAttachmentStoreBackend(runner));
232 attachment_store_backend_ = attachment_store_backend->AsWeakPtr(); 232 attachment_store_backend_ = attachment_store_backend->AsWeakPtr();
233 scoped_ptr<AttachmentStore> attachment_store = 233 scoped_ptr<AttachmentStore> attachment_store =
234 AttachmentStore::CreateMockStoreForTest( 234 AttachmentStore::CreateMockStoreForTest(
235 attachment_store_backend.Pass()); 235 std::move(attachment_store_backend));
236 236
237 if (uploader.get()) { 237 if (uploader.get()) {
238 attachment_uploader_ = uploader->AsWeakPtr(); 238 attachment_uploader_ = uploader->AsWeakPtr();
239 } 239 }
240 if (downloader.get()) { 240 if (downloader.get()) {
241 attachment_downloader_ = downloader->AsWeakPtr(); 241 attachment_downloader_ = downloader->AsWeakPtr();
242 } 242 }
243 attachment_service_.reset(new AttachmentServiceImpl( 243 attachment_service_.reset(new AttachmentServiceImpl(
244 attachment_store->CreateAttachmentStoreForSync(), uploader.Pass(), 244 attachment_store->CreateAttachmentStoreForSync(), std::move(uploader),
245 downloader.Pass(), delegate, base::TimeDelta::FromMinutes(1), 245 std::move(downloader), delegate, base::TimeDelta::FromMinutes(1),
246 base::TimeDelta::FromMinutes(8))); 246 base::TimeDelta::FromMinutes(8)));
247 247
248 scoped_ptr<base::MockTimer> timer_to_pass( 248 scoped_ptr<base::MockTimer> timer_to_pass(
249 new base::MockTimer(false, false)); 249 new base::MockTimer(false, false));
250 mock_timer_ = timer_to_pass.get(); 250 mock_timer_ = timer_to_pass.get();
251 attachment_service_->SetTimerForTest(timer_to_pass.Pass()); 251 attachment_service_->SetTimerForTest(std::move(timer_to_pass));
252 } 252 }
253 253
254 AttachmentService* attachment_service() { return attachment_service_.get(); } 254 AttachmentService* attachment_service() { return attachment_service_.get(); }
255 255
256 base::MockTimer* mock_timer() { return mock_timer_; } 256 base::MockTimer* mock_timer() { return mock_timer_; }
257 257
258 AttachmentService::GetOrDownloadCallback download_callback() { 258 AttachmentService::GetOrDownloadCallback download_callback() {
259 return base::Bind(&AttachmentServiceImplTest::DownloadDone, 259 return base::Bind(&AttachmentServiceImplTest::DownloadDone,
260 base::Unretained(this)); 260 base::Unretained(this));
261 } 261 }
262 262
263 void DownloadDone(const AttachmentService::GetOrDownloadResult& result, 263 void DownloadDone(const AttachmentService::GetOrDownloadResult& result,
264 scoped_ptr<AttachmentMap> attachments) { 264 scoped_ptr<AttachmentMap> attachments) {
265 download_results_.push_back(result); 265 download_results_.push_back(result);
266 last_download_attachments_ = attachments.Pass(); 266 last_download_attachments_ = std::move(attachments);
267 } 267 }
268 268
269 void RunLoop() { 269 void RunLoop() {
270 base::RunLoop run_loop; 270 base::RunLoop run_loop;
271 run_loop.RunUntilIdle(); 271 run_loop.RunUntilIdle();
272 } 272 }
273 273
274 void RunLoopAndFireTimer() { 274 void RunLoopAndFireTimer() {
275 RunLoop(); 275 RunLoop();
276 if (mock_timer()->IsRunning()) { 276 if (mock_timer()->IsRunning()) {
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( 632 net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests(
633 net::NetworkChangeNotifier::CONNECTION_WIFI); 633 net::NetworkChangeNotifier::CONNECTION_WIFI);
634 RunLoop(); 634 RunLoop();
635 635
636 // No longer in backoff. 636 // No longer in backoff.
637 ASSERT_TRUE(mock_timer()->IsRunning()); 637 ASSERT_TRUE(mock_timer()->IsRunning());
638 ASSERT_EQ(base::TimeDelta(), mock_timer()->GetCurrentDelay()); 638 ASSERT_EQ(base::TimeDelta(), mock_timer()->GetCurrentDelay());
639 } 639 }
640 640
641 } // namespace syncer 641 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698