| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 DISALLOW_COPY_AND_ASSIGN(MockAttachmentUploader); | 169 DISALLOW_COPY_AND_ASSIGN(MockAttachmentUploader); |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 } // namespace | 172 } // namespace |
| 173 | 173 |
| 174 class AttachmentServiceImplTest : public testing::Test, | 174 class AttachmentServiceImplTest : public testing::Test, |
| 175 public AttachmentService::Delegate { | 175 public AttachmentService::Delegate { |
| 176 protected: | 176 protected: |
| 177 AttachmentServiceImplTest() {} | 177 AttachmentServiceImplTest() {} |
| 178 | 178 |
| 179 virtual void SetUp() override { | 179 void SetUp() override { |
| 180 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); | 180 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); |
| 181 InitializeAttachmentService(make_scoped_ptr(new MockAttachmentUploader()), | 181 InitializeAttachmentService(make_scoped_ptr(new MockAttachmentUploader()), |
| 182 make_scoped_ptr(new MockAttachmentDownloader()), | 182 make_scoped_ptr(new MockAttachmentDownloader()), |
| 183 this); | 183 this); |
| 184 } | 184 } |
| 185 | 185 |
| 186 virtual void TearDown() override { | 186 void TearDown() override { |
| 187 attachment_service_.reset(); | 187 attachment_service_.reset(); |
| 188 ASSERT_FALSE(attachment_store_); | 188 ASSERT_FALSE(attachment_store_); |
| 189 ASSERT_FALSE(attachment_uploader_); | 189 ASSERT_FALSE(attachment_uploader_); |
| 190 ASSERT_FALSE(attachment_downloader_); | 190 ASSERT_FALSE(attachment_downloader_); |
| 191 } | 191 } |
| 192 | 192 |
| 193 // AttachmentService::Delegate implementation. | 193 // AttachmentService::Delegate implementation. |
| 194 void OnAttachmentUploaded(const AttachmentId& attachment_id) override { | 194 void OnAttachmentUploaded(const AttachmentId& attachment_id) override { |
| 195 on_attachment_uploaded_list_.push_back(attachment_id); | 195 on_attachment_uploaded_list_.push_back(attachment_id); |
| 196 } | 196 } |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( | 586 net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( |
| 587 net::NetworkChangeNotifier::CONNECTION_WIFI); | 587 net::NetworkChangeNotifier::CONNECTION_WIFI); |
| 588 RunLoop(); | 588 RunLoop(); |
| 589 | 589 |
| 590 // No longer in backoff. | 590 // No longer in backoff. |
| 591 ASSERT_TRUE(mock_timer()->IsRunning()); | 591 ASSERT_TRUE(mock_timer()->IsRunning()); |
| 592 ASSERT_EQ(base::TimeDelta(), mock_timer()->GetCurrentDelay()); | 592 ASSERT_EQ(base::TimeDelta(), mock_timer()->GetCurrentDelay()); |
| 593 } | 593 } |
| 594 | 594 |
| 595 } // namespace syncer | 595 } // namespace syncer |
| OLD | NEW |