| 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..6943b129c08b952a6c79809c625d1209373645c7 100644
|
| --- a/components/offline_pages/downloads/download_notifying_observer_unittest.cc
|
| +++ b/components/offline_pages/downloads/download_notifying_observer_unittest.cc
|
| @@ -128,17 +128,38 @@ 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_PROGRESS,
|
| + 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) {
|
| + 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());
|
| + EXPECT_EQ(kTestGuid, notifier()->download_item()->guid);
|
| +}
|
| +
|
| +TEST_F(DownloadNotifyingObserverTest, OnAddedAsPaused) {
|
| + SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId,
|
| + kTestCreationTime, kTestUserRequested);
|
| + request.set_request_state(SavePageRequest::RequestState::PAUSED);
|
| + observer()->OnAdded(request);
|
| + EXPECT_EQ(LastNotificationType::DOWNLOAD_PAUSED,
|
| + notifier()->last_notification_type());
|
| + EXPECT_EQ(kTestGuid, notifier()->download_item()->guid);
|
| +}
|
| +
|
| TEST_F(DownloadNotifyingObserverTest, OnChangedToPaused) {
|
| SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId,
|
| kTestCreationTime, kTestUserRequested);
|
| @@ -156,6 +177,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);
|
|
|