| 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" |
| 11 #include "base/timer/mock_timer.h" | 11 #include "base/timer/mock_timer.h" |
| 12 #include "sync/internal_api/public/attachments/fake_attachment_downloader.h" | 12 #include "sync/internal_api/public/attachments/fake_attachment_downloader.h" |
| 13 #include "sync/internal_api/public/attachments/fake_attachment_uploader.h" | 13 #include "sync/internal_api/public/attachments/fake_attachment_uploader.h" |
| 14 #include "testing/gmock/include/gmock/gmock-matchers.h" | 14 #include "testing/gmock/include/gmock/gmock-matchers.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 namespace syncer { | 17 namespace syncer { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 class MockAttachmentStore : public AttachmentStore, | 21 class MockAttachmentStore : public AttachmentStore, |
| 22 public base::SupportsWeakPtr<MockAttachmentStore> { | 22 public base::SupportsWeakPtr<MockAttachmentStore> { |
| 23 public: | 23 public: |
| 24 MockAttachmentStore() {} | 24 MockAttachmentStore() {} |
| 25 | 25 |
| 26 virtual void Load(const LoadCallback& callback) override {} |
| 27 |
| 26 virtual void Read(const AttachmentIdList& ids, | 28 virtual void Read(const AttachmentIdList& ids, |
| 27 const ReadCallback& callback) override { | 29 const ReadCallback& callback) override { |
| 28 read_ids.push_back(ids); | 30 read_ids.push_back(ids); |
| 29 read_callbacks.push_back(callback); | 31 read_callbacks.push_back(callback); |
| 30 } | 32 } |
| 31 | 33 |
| 32 virtual void Write(const AttachmentList& attachments, | 34 virtual void Write(const AttachmentList& attachments, |
| 33 const WriteCallback& callback) override { | 35 const WriteCallback& callback) override { |
| 34 write_attachments.push_back(attachments); | 36 write_attachments.push_back(attachments); |
| 35 write_callbacks.push_back(callback); | 37 write_callbacks.push_back(callback); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( | 551 net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( |
| 550 net::NetworkChangeNotifier::CONNECTION_WIFI); | 552 net::NetworkChangeNotifier::CONNECTION_WIFI); |
| 551 RunLoop(); | 553 RunLoop(); |
| 552 | 554 |
| 553 // No longer in backoff. | 555 // No longer in backoff. |
| 554 ASSERT_TRUE(mock_timer()->IsRunning()); | 556 ASSERT_TRUE(mock_timer()->IsRunning()); |
| 555 ASSERT_EQ(base::TimeDelta(), mock_timer()->GetCurrentDelay()); | 557 ASSERT_EQ(base::TimeDelta(), mock_timer()->GetCurrentDelay()); |
| 556 } | 558 } |
| 557 | 559 |
| 558 } // namespace syncer | 560 } // namespace syncer |
| OLD | NEW |