Chromium Code Reviews| Index: components/offline_pages/downloads/download_notifying_observer_unittest.cc |
| diff --git a/components/offline_pages/downloads/download_notifying_observer_unittest.cc b/components/offline_pages/downloads/download_notifying_observer_unittest.cc |
| index 7d6f66117adc45ea9ee2a5e818f27a5461cebcc6..ffe1decd703b3b351d61e0b367dd0d996d023e9b 100644 |
| --- a/components/offline_pages/downloads/download_notifying_observer_unittest.cc |
| +++ b/components/offline_pages/downloads/download_notifying_observer_unittest.cc |
| @@ -128,9 +128,22 @@ void DownloadNotifyingObserverTest::SetUp() { |
| policy_controller_.get())); |
| } |
| -TEST_F(DownloadNotifyingObserverTest, OnAdded) { |
| +TEST_F(DownloadNotifyingObserverTest, OnAddedAsAvailable) { |
| SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId, |
| kTestCreationTime, kTestUserRequested); |
| + request.set_request_state(SavePageRequest::RequestState::AVAILABLE); |
| + observer()->OnAdded(request); |
| + EXPECT_EQ(LastNotificationType::DOWNLOAD_INTERRUPTED, |
| + notifier()->last_notification_type()); |
| + EXPECT_EQ(kTestGuid, notifier()->download_item()->guid); |
| + EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url); |
| + EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time); |
| +} |
| + |
| +TEST_F(DownloadNotifyingObserverTest, OnAddedAsOffling) { |
|
fgorski
2016/11/29 17:50:59
Technically nothing prevents us from adding as pau
dougarnett
2016/11/29 20:43:30
Done.
|
| + SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId, |
| + kTestCreationTime, kTestUserRequested); |
| + request.set_request_state(SavePageRequest::RequestState::OFFLINING); |
| observer()->OnAdded(request); |
| EXPECT_EQ(LastNotificationType::DOWNLOAD_PROGRESS, |
| notifier()->last_notification_type()); |
| @@ -156,6 +169,18 @@ TEST_F(DownloadNotifyingObserverTest, OnChangedToAvailable) { |
| kTestCreationTime, kTestUserRequested); |
| request.set_request_state(SavePageRequest::RequestState::AVAILABLE); |
| observer()->OnChanged(request); |
| + EXPECT_EQ(LastNotificationType::DOWNLOAD_INTERRUPTED, |
| + notifier()->last_notification_type()); |
| + EXPECT_EQ(kTestGuid, notifier()->download_item()->guid); |
| + EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url); |
| + EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time); |
| +} |
| + |
| +TEST_F(DownloadNotifyingObserverTest, OnChangedToOfflining) { |
| + SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId, |
| + kTestCreationTime, kTestUserRequested); |
| + request.set_request_state(SavePageRequest::RequestState::OFFLINING); |
| + observer()->OnChanged(request); |
| EXPECT_EQ(LastNotificationType::DOWNLOAD_PROGRESS, |
| notifier()->last_notification_type()); |
| EXPECT_EQ(kTestGuid, notifier()->download_item()->guid); |