Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Side by Side Diff: components/offline_pages/downloads/download_notifying_observer_unittest.cc

Issue 2521353005: [OfflinePages] Call NotifyInterrupted for pending requests (Closed)
Patch Set: Fix test Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_pages/downloads/download_notifying_observer.h" 5 #include "components/offline_pages/downloads/download_notifying_observer.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "components/offline_pages/background/save_page_request.h" 8 #include "components/offline_pages/background/save_page_request.h"
9 #include "components/offline_pages/client_namespace_constants.h" 9 #include "components/offline_pages/client_namespace_constants.h"
10 #include "components/offline_pages/client_policy_controller.h" 10 #include "components/offline_pages/client_policy_controller.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 EXPECT_EQ(kTestGuid, notifier()->download_item()->guid); 149 EXPECT_EQ(kTestGuid, notifier()->download_item()->guid);
150 EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url); 150 EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url);
151 EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time); 151 EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time);
152 } 152 }
153 153
154 TEST_F(DownloadNotifyingObserverTest, OnChangedToAvailable) { 154 TEST_F(DownloadNotifyingObserverTest, OnChangedToAvailable) {
155 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId, 155 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId,
156 kTestCreationTime, kTestUserRequested); 156 kTestCreationTime, kTestUserRequested);
157 request.set_request_state(SavePageRequest::RequestState::AVAILABLE); 157 request.set_request_state(SavePageRequest::RequestState::AVAILABLE);
158 observer()->OnChanged(request); 158 observer()->OnChanged(request);
159 EXPECT_EQ(LastNotificationType::DOWNLOAD_PROGRESS, 159 EXPECT_EQ(LastNotificationType::DOWNLOAD_INTERRUPTED,
160 notifier()->last_notification_type()); 160 notifier()->last_notification_type());
161 EXPECT_EQ(kTestGuid, notifier()->download_item()->guid); 161 EXPECT_EQ(kTestGuid, notifier()->download_item()->guid);
162 EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url); 162 EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url);
163 EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time); 163 EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time);
164 } 164 }
165 165
166 TEST_F(DownloadNotifyingObserverTest, OnCompletedSuccess) { 166 TEST_F(DownloadNotifyingObserverTest, OnCompletedSuccess) {
167 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId, 167 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId,
168 kTestCreationTime, kTestUserRequested); 168 kTestCreationTime, kTestUserRequested);
169 observer()->OnCompleted(request, 169 observer()->OnCompleted(request,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 for (auto name_space : name_spaces) { 242 for (auto name_space : name_spaces) {
243 ClientId invisible_client_id(name_space, kTestGuid); 243 ClientId invisible_client_id(name_space, kTestGuid);
244 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), invisible_client_id, 244 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), invisible_client_id,
245 kTestCreationTime, kTestUserRequested); 245 kTestCreationTime, kTestUserRequested);
246 observer()->OnAdded(request); 246 observer()->OnAdded(request);
247 EXPECT_EQ(LastNotificationType::NONE, notifier()->last_notification_type()); 247 EXPECT_EQ(LastNotificationType::NONE, notifier()->last_notification_type());
248 } 248 }
249 } 249 }
250 250
251 } // namespace offline_pages 251 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698