| OLD | NEW |
| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 attachment_store_ = attachment_store->AsWeakPtr(); | 188 attachment_store_ = attachment_store->AsWeakPtr(); |
| 189 | 189 |
| 190 if (uploader.get()) { | 190 if (uploader.get()) { |
| 191 attachment_uploader_ = uploader->AsWeakPtr(); | 191 attachment_uploader_ = uploader->AsWeakPtr(); |
| 192 } | 192 } |
| 193 if (downloader.get()) { | 193 if (downloader.get()) { |
| 194 attachment_downloader_ = downloader->AsWeakPtr(); | 194 attachment_downloader_ = downloader->AsWeakPtr(); |
| 195 } | 195 } |
| 196 attachment_service_.reset( | 196 attachment_service_.reset( |
| 197 new AttachmentServiceImpl(attachment_store, | 197 new AttachmentServiceImpl(attachment_store, |
| 198 uploader.PassAs<AttachmentUploader>(), | 198 uploader.Pass(), |
| 199 downloader.PassAs<AttachmentDownloader>(), | 199 downloader.Pass(), |
| 200 delegate, | 200 delegate, |
| 201 base::TimeDelta::FromMinutes(1), | 201 base::TimeDelta::FromMinutes(1), |
| 202 base::TimeDelta::FromMinutes(8))); | 202 base::TimeDelta::FromMinutes(8))); |
| 203 | 203 |
| 204 scoped_ptr<base::MockTimer> timer_to_pass( | 204 scoped_ptr<base::MockTimer> timer_to_pass( |
| 205 new base::MockTimer(false, false)); | 205 new base::MockTimer(false, false)); |
| 206 mock_timer_ = timer_to_pass.get(); | 206 mock_timer_ = timer_to_pass.get(); |
| 207 attachment_service_->SetTimerForTest(timer_to_pass.PassAs<base::Timer>()); | 207 attachment_service_->SetTimerForTest(timer_to_pass.Pass()); |
| 208 } | 208 } |
| 209 | 209 |
| 210 AttachmentService* attachment_service() { return attachment_service_.get(); } | 210 AttachmentService* attachment_service() { return attachment_service_.get(); } |
| 211 | 211 |
| 212 base::MockTimer* mock_timer() { return mock_timer_; } | 212 base::MockTimer* mock_timer() { return mock_timer_; } |
| 213 | 213 |
| 214 AttachmentService::GetOrDownloadCallback download_callback() { | 214 AttachmentService::GetOrDownloadCallback download_callback() { |
| 215 return base::Bind(&AttachmentServiceImplTest::DownloadDone, | 215 return base::Bind(&AttachmentServiceImplTest::DownloadDone, |
| 216 base::Unretained(this)); | 216 base::Unretained(this)); |
| 217 } | 217 } |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( | 549 net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( |
| 550 net::NetworkChangeNotifier::CONNECTION_WIFI); | 550 net::NetworkChangeNotifier::CONNECTION_WIFI); |
| 551 RunLoop(); | 551 RunLoop(); |
| 552 | 552 |
| 553 // No longer in backoff. | 553 // No longer in backoff. |
| 554 ASSERT_TRUE(mock_timer()->IsRunning()); | 554 ASSERT_TRUE(mock_timer()->IsRunning()); |
| 555 ASSERT_EQ(base::TimeDelta(), mock_timer()->GetCurrentDelay()); | 555 ASSERT_EQ(base::TimeDelta(), mock_timer()->GetCurrentDelay()); |
| 556 } | 556 } |
| 557 | 557 |
| 558 } // namespace syncer | 558 } // namespace syncer |
| OLD | NEW |