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

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

Powered by Google App Engine
This is Rietveld 408576698