Chromium Code Reviews| 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/downloads/offline_page_download_notifier.h" | 10 #include "components/offline_pages/downloads/offline_page_download_notifier.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 notifier()->Reset(); | 221 notifier()->Reset(); |
| 222 observer()->OnCompleted( | 222 observer()->OnCompleted( |
| 223 request, RequestNotifier::SavePageStatus::RETRY_COUNT_EXCEEDED); | 223 request, RequestNotifier::SavePageStatus::RETRY_COUNT_EXCEEDED); |
| 224 EXPECT_EQ(LastNotificationType::DOWNLOAD_FAILED, | 224 EXPECT_EQ(LastNotificationType::DOWNLOAD_FAILED, |
| 225 notifier()->last_notification_type()); | 225 notifier()->last_notification_type()); |
| 226 EXPECT_EQ(kTestGuid, notifier()->download_item()->guid); | 226 EXPECT_EQ(kTestGuid, notifier()->download_item()->guid); |
| 227 EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url); | 227 EXPECT_EQ(GURL(kTestUrl), notifier()->download_item()->url); |
| 228 EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time); | 228 EXPECT_EQ(kTestCreationTime, notifier()->download_item()->start_time); |
| 229 } | 229 } |
| 230 | 230 |
| 231 TEST_F(DownloadNotifyingObserverTest, VisibleInUI) { | |
|
fgorski
2016/08/30 16:21:29
nit: NamepsacesNotVisibleInUI
dewittj
2016/08/30 16:29:08
Done.
| |
| 232 std::vector<std::string> name_spaces = { | |
| 233 kBookmarkNamespace, kLastNNamespace, kCCTNamespace, | |
| 234 kNTPSuggestionsNamespace, kDefaultNamespace}; | |
| 235 | |
| 236 for (auto name_space : name_spaces) { | |
| 237 ClientId invisible_client_id(name_space, kTestGuid); | |
| 238 SavePageRequest request(kTestOfflineId, GURL(kTestUrl), invisible_client_id, | |
| 239 kTestCreationTime, kTestUserRequested); | |
| 240 observer()->OnAdded(request); | |
| 241 EXPECT_EQ(LastNotificationType::NONE, notifier()->last_notification_type()); | |
| 242 } | |
| 243 } | |
| 244 | |
| 231 } // namespace offline_pages | 245 } // namespace offline_pages |
| OLD | NEW |