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

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

Issue 2867103006: [Offline pages] Rename REMOVED to USER_CANCELED and add better foot note descriptions for histogram… (Closed)
Patch Set: rebase Created 3 years, 7 months 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/core/downloads/download_notifying_observer.h" 5 #include "components/offline_pages/core/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/core/background/save_page_request.h" 8 #include "components/offline_pages/core/background/save_page_request.h"
9 #include "components/offline_pages/core/client_namespace_constants.h" 9 #include "components/offline_pages/core/client_namespace_constants.h"
10 #include "components/offline_pages/core/client_policy_controller.h" 10 #include "components/offline_pages/core/client_policy_controller.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 EXPECT_EQ(LastNotificationType::DOWNLOAD_SUCCESSFUL, 204 EXPECT_EQ(LastNotificationType::DOWNLOAD_SUCCESSFUL,
205 notifier()->last_notification_type()); 205 notifier()->last_notification_type());
206 EXPECT_EQ(kTestGuid, notifier()->download_item()->guid); 206 EXPECT_EQ(kTestGuid, notifier()->download_item()->guid);
207 EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url); 207 EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url);
208 EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time); 208 EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time);
209 } 209 }
210 210
211 TEST_F(DownloadNotifyingObserverTest, OnCompletedCanceled) { 211 TEST_F(DownloadNotifyingObserverTest, OnCompletedCanceled) {
212 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId, 212 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId,
213 kTestCreationTime, kTestUserRequested); 213 kTestCreationTime, kTestUserRequested);
214 observer()->OnCompleted(request, 214 observer()->OnCompleted(
215 RequestNotifier::BackgroundSavePageResult::REMOVED); 215 request, RequestNotifier::BackgroundSavePageResult::USER_CANCELED);
216 EXPECT_EQ(LastNotificationType::DOWNLOAD_CANCELED, 216 EXPECT_EQ(LastNotificationType::DOWNLOAD_CANCELED,
217 notifier()->last_notification_type()); 217 notifier()->last_notification_type());
218 EXPECT_EQ(kTestGuid, notifier()->download_item()->guid); 218 EXPECT_EQ(kTestGuid, notifier()->download_item()->guid);
219 EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url); 219 EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url);
220 EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time); 220 EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time);
221 } 221 }
222 222
223 TEST_F(DownloadNotifyingObserverTest, OnCompletedFailure) { 223 TEST_F(DownloadNotifyingObserverTest, OnCompletedFailure) {
224 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId, 224 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), kTestClientId,
225 kTestCreationTime, kTestUserRequested); 225 kTestCreationTime, kTestUserRequested);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 for (auto name_space : name_spaces) { 275 for (auto name_space : name_spaces) {
276 ClientId invisible_client_id(name_space, kTestGuid); 276 ClientId invisible_client_id(name_space, kTestGuid);
277 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), invisible_client_id, 277 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), invisible_client_id,
278 kTestCreationTime, kTestUserRequested); 278 kTestCreationTime, kTestUserRequested);
279 observer()->OnAdded(request); 279 observer()->OnAdded(request);
280 EXPECT_EQ(LastNotificationType::NONE, notifier()->last_notification_type()); 280 EXPECT_EQ(LastNotificationType::NONE, notifier()->last_notification_type());
281 } 281 }
282 } 282 }
283 283
284 } // namespace offline_pages 284 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/core/downloads/download_notifying_observer.cc ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698