| OLD | NEW |
| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 observer()->OnCompleted( | 229 observer()->OnCompleted( |
| 230 request, RequestNotifier::BackgroundSavePageResult::RETRY_COUNT_EXCEEDED); | 230 request, RequestNotifier::BackgroundSavePageResult::RETRY_COUNT_EXCEEDED); |
| 231 EXPECT_EQ(LastNotificationType::DOWNLOAD_FAILED, | 231 EXPECT_EQ(LastNotificationType::DOWNLOAD_FAILED, |
| 232 notifier()->last_notification_type()); | 232 notifier()->last_notification_type()); |
| 233 EXPECT_EQ(kTestGuid, notifier()->download_item()->guid); | 233 EXPECT_EQ(kTestGuid, notifier()->download_item()->guid); |
| 234 EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url); | 234 EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url); |
| 235 EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time); | 235 EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time); |
| 236 } | 236 } |
| 237 | 237 |
| 238 TEST_F(DownloadNotifyingObserverTest, NamespacesNotVisibleInUI) { | 238 TEST_F(DownloadNotifyingObserverTest, NamespacesNotVisibleInUI) { |
| 239 std::vector<std::string> name_spaces = { | 239 std::vector<std::string> name_spaces = {kBookmarkNamespace, kLastNNamespace, |
| 240 kBookmarkNamespace, kLastNNamespace, kCCTNamespace, | 240 kCCTNamespace, kDefaultNamespace}; |
| 241 kNTPSuggestionsNamespace, kDefaultNamespace}; | |
| 242 | 241 |
| 243 for (auto name_space : name_spaces) { | 242 for (auto name_space : name_spaces) { |
| 244 ClientId invisible_client_id(name_space, kTestGuid); | 243 ClientId invisible_client_id(name_space, kTestGuid); |
| 245 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), invisible_client_id, | 244 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), invisible_client_id, |
| 246 kTestCreationTime, kTestUserRequested); | 245 kTestCreationTime, kTestUserRequested); |
| 247 observer()->OnAdded(request); | 246 observer()->OnAdded(request); |
| 248 EXPECT_EQ(LastNotificationType::NONE, notifier()->last_notification_type()); | 247 EXPECT_EQ(LastNotificationType::NONE, notifier()->last_notification_type()); |
| 249 } | 248 } |
| 250 } | 249 } |
| 251 | 250 |
| 252 } // namespace offline_pages | 251 } // namespace offline_pages |
| OLD | NEW |