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

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

Issue 2295593002: [Offline Pages] Check for the appropriate namespace when showing notifications. (Closed)
Patch Set: Add comment. Created 4 years, 3 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/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
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, NamespacesNotVisibleInUI) {
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698