| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/test/test_mock_time_task_runner.h" | 10 #include "base/test/test_mock_time_task_runner.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 EXPECT_CALL(provider1, OpenItem(id1)).Times(1); | 292 EXPECT_CALL(provider1, OpenItem(id1)).Times(1); |
| 293 EXPECT_CALL(provider2, OpenItem(id2)).Times(1); | 293 EXPECT_CALL(provider2, OpenItem(id2)).Times(1); |
| 294 EXPECT_CALL(provider1, RemoveItem(id1)).Times(1); | 294 EXPECT_CALL(provider1, RemoveItem(id1)).Times(1); |
| 295 EXPECT_CALL(provider2, RemoveItem(id2)).Times(1); | 295 EXPECT_CALL(provider2, RemoveItem(id2)).Times(1); |
| 296 EXPECT_CALL(provider1, CancelDownload(id1)).Times(1); | 296 EXPECT_CALL(provider1, CancelDownload(id1)).Times(1); |
| 297 EXPECT_CALL(provider2, CancelDownload(id2)).Times(1); | 297 EXPECT_CALL(provider2, CancelDownload(id2)).Times(1); |
| 298 EXPECT_CALL(provider1, ResumeDownload(id1)).Times(1); | 298 EXPECT_CALL(provider1, ResumeDownload(id1)).Times(1); |
| 299 EXPECT_CALL(provider2, ResumeDownload(id2)).Times(1); | 299 EXPECT_CALL(provider2, ResumeDownload(id2)).Times(1); |
| 300 EXPECT_CALL(provider1, PauseDownload(id1)).Times(1); | 300 EXPECT_CALL(provider1, PauseDownload(id1)).Times(1); |
| 301 EXPECT_CALL(provider2, PauseDownload(id2)).Times(1); | 301 EXPECT_CALL(provider2, PauseDownload(id2)).Times(1); |
| 302 EXPECT_CALL(provider1, GetVisualsForItem(id1, _)).Times(1); |
| 303 EXPECT_CALL(provider2, GetVisualsForItem(id2, _)).Times(1); |
| 302 aggregator_.OpenItem(id1); | 304 aggregator_.OpenItem(id1); |
| 303 aggregator_.OpenItem(id2); | 305 aggregator_.OpenItem(id2); |
| 304 aggregator_.RemoveItem(id1); | 306 aggregator_.RemoveItem(id1); |
| 305 aggregator_.RemoveItem(id2); | 307 aggregator_.RemoveItem(id2); |
| 306 aggregator_.CancelDownload(id1); | 308 aggregator_.CancelDownload(id1); |
| 307 aggregator_.CancelDownload(id2); | 309 aggregator_.CancelDownload(id2); |
| 308 aggregator_.ResumeDownload(id1); | 310 aggregator_.ResumeDownload(id1); |
| 309 aggregator_.ResumeDownload(id2); | 311 aggregator_.ResumeDownload(id2); |
| 310 aggregator_.PauseDownload(id1); | 312 aggregator_.PauseDownload(id1); |
| 311 aggregator_.PauseDownload(id2); | 313 aggregator_.PauseDownload(id2); |
| 314 aggregator_.GetVisualsForItem(id1, OfflineContentProvider::VisualsCallback()); |
| 315 aggregator_.GetVisualsForItem(id2, OfflineContentProvider::VisualsCallback()); |
| 312 } | 316 } |
| 313 | 317 |
| 314 TEST_F(OfflineContentAggregatorTest, ActionPropagatesAfterInitialize) { | 318 TEST_F(OfflineContentAggregatorTest, ActionPropagatesAfterInitialize) { |
| 315 ScopedMockOfflineContentProvider provider1("1", &aggregator_); | 319 ScopedMockOfflineContentProvider provider1("1", &aggregator_); |
| 316 ScopedMockOfflineContentProvider provider2("2", &aggregator_); | 320 ScopedMockOfflineContentProvider provider2("2", &aggregator_); |
| 317 | 321 |
| 318 ContentId id1("1", "A"); | 322 ContentId id1("1", "A"); |
| 319 ContentId id2("2", "B"); | 323 ContentId id2("2", "B"); |
| 320 ContentId id3("2", "C"); | 324 ContentId id3("2", "C"); |
| 321 | 325 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 EXPECT_TRUE(provider.HasObserver(&aggregator_)); | 472 EXPECT_TRUE(provider.HasObserver(&aggregator_)); |
| 469 EXPECT_EQ(nullptr, aggregator_.GetItemById(id1)); | 473 EXPECT_EQ(nullptr, aggregator_.GetItemById(id1)); |
| 470 EXPECT_EQ(&item2, aggregator_.GetItemById(id2)); | 474 EXPECT_EQ(&item2, aggregator_.GetItemById(id2)); |
| 471 | 475 |
| 472 aggregator_.UnregisterProvider("2"); | 476 aggregator_.UnregisterProvider("2"); |
| 473 EXPECT_FALSE(provider.HasObserver(&aggregator_)); | 477 EXPECT_FALSE(provider.HasObserver(&aggregator_)); |
| 474 } | 478 } |
| 475 | 479 |
| 476 } // namespace | 480 } // namespace |
| 477 } // namespace offline_items_collection | 481 } // namespace offline_items_collection |
| OLD | NEW |