OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/offline_items_collection/core/offline_content_aggregator.h" | 5 #include "components/offline_items_collection/core/offline_content_aggregator.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/test/test_mock_time_task_runner.h" | 8 #include "base/test/test_mock_time_task_runner.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 OfflineContentProvider::OfflineItemList items; | 98 OfflineContentProvider::OfflineItemList items; |
99 items.push_back(item); | 99 items.push_back(item); |
100 | 100 |
101 testing::InSequence sequence; | 101 testing::InSequence sequence; |
102 EXPECT_CALL(observer, OnItemsAvailable(&provider_)); | 102 EXPECT_CALL(observer, OnItemsAvailable(&provider_)); |
103 EXPECT_CALL(wrapped_provider_, OpenItem(id)); | 103 EXPECT_CALL(wrapped_provider_, OpenItem(id)); |
104 EXPECT_CALL(wrapped_provider_, RemoveItem(id)); | 104 EXPECT_CALL(wrapped_provider_, RemoveItem(id)); |
105 EXPECT_CALL(wrapped_provider_, CancelDownload(id)); | 105 EXPECT_CALL(wrapped_provider_, CancelDownload(id)); |
106 EXPECT_CALL(wrapped_provider_, PauseDownload(id)); | 106 EXPECT_CALL(wrapped_provider_, PauseDownload(id)); |
107 EXPECT_CALL(wrapped_provider_, ResumeDownload(id)); | 107 EXPECT_CALL(wrapped_provider_, ResumeDownload(id)); |
| 108 EXPECT_CALL(wrapped_provider_, GetVisualsForItem(id, _)); |
108 EXPECT_CALL(wrapped_provider_, GetItemById(id)).WillRepeatedly(Return(&item)); | 109 EXPECT_CALL(wrapped_provider_, GetItemById(id)).WillRepeatedly(Return(&item)); |
109 EXPECT_CALL(wrapped_provider_, GetAllItems()).WillRepeatedly(Return(items)); | 110 EXPECT_CALL(wrapped_provider_, GetAllItems()).WillRepeatedly(Return(items)); |
110 | |
111 wrapped_provider_.NotifyOnItemsAvailable(); | 111 wrapped_provider_.NotifyOnItemsAvailable(); |
112 provider_.OpenItem(id); | 112 provider_.OpenItem(id); |
113 provider_.RemoveItem(id); | 113 provider_.RemoveItem(id); |
114 provider_.CancelDownload(id); | 114 provider_.CancelDownload(id); |
115 provider_.PauseDownload(id); | 115 provider_.PauseDownload(id); |
116 provider_.ResumeDownload(id); | 116 provider_.ResumeDownload(id); |
| 117 provider_.GetVisualsForItem(id, OfflineContentProvider::VisualsCallback()); |
117 EXPECT_EQ(&item, provider_.GetItemById(id)); | 118 EXPECT_EQ(&item, provider_.GetItemById(id)); |
118 EXPECT_EQ(items, provider_.GetAllItems()); | 119 EXPECT_EQ(items, provider_.GetAllItems()); |
119 } | 120 } |
120 | 121 |
121 TEST_F(ThrottledOfflineContentProviderTest, TestRemoveCancelsUpdate) { | 122 TEST_F(ThrottledOfflineContentProviderTest, TestRemoveCancelsUpdate) { |
122 ScopedMockOfflineContentProvider::ScopedMockObserver observer(&provider_); | 123 ScopedMockOfflineContentProvider::ScopedMockObserver observer(&provider_); |
123 | 124 |
124 ContentId id("1", "A"); | 125 ContentId id("1", "A"); |
125 OfflineItem item(id); | 126 OfflineItem item(id); |
126 | 127 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 271 } |
271 | 272 |
272 { | 273 { |
273 EXPECT_CALL(observer, OnItemUpdated(updated_item)).Times(1); | 274 EXPECT_CALL(observer, OnItemUpdated(updated_item)).Times(1); |
274 task_runner_->FastForwardUntilNoTasksRemain(); | 275 task_runner_->FastForwardUntilNoTasksRemain(); |
275 } | 276 } |
276 } | 277 } |
277 | 278 |
278 } // namespace | 279 } // namespace |
279 } // namespace offline_items_collection; | 280 } // namespace offline_items_collection; |
OLD | NEW |