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

Side by Side Diff: chrome/browser/chromeos/hats/hats_notification_controller_unittest.cc

Issue 2776933006: CrOS: Do not allow notifications to be added during shutdown. (Closed)
Patch Set: Trybots. Created 3 years, 8 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 "chrome/browser/chromeos/hats/hats_notification_controller.h" 5 #include "chrome/browser/chromeos/hats/hats_notification_controller.h"
6 6
7 #include "base/strings/string_split.h" 7 #include "base/strings/string_split.h"
8 #include "chrome/browser/notifications/message_center_notification_manager.h" 8 #include "chrome/browser/notifications/message_center_notification_manager.h"
9 #include "chrome/browser/notifications/notification.h" 9 #include "chrome/browser/notifications/notification.h"
10 #include "chrome/browser/notifications/notification_ui_manager.h" 10 #include "chrome/browser/notifications/notification_ui_manager.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 g_browser_process->notification_ui_manager()); 105 g_browser_process->notification_ui_manager());
106 manager->SetMessageCenterTrayDelegateForTest( 106 manager->SetMessageCenterTrayDelegateForTest(
107 new message_center::FakeMessageCenterTrayDelegate( 107 new message_center::FakeMessageCenterTrayDelegate(
108 message_center::MessageCenter::Get())); 108 message_center::MessageCenter::Get()));
109 109
110 network_portal_detector::InitializeForTesting( 110 network_portal_detector::InitializeForTesting(
111 &mock_network_portal_detector_); 111 &mock_network_portal_detector_);
112 } 112 }
113 113
114 void TearDown() override { 114 void TearDown() override {
115 g_browser_process->notification_ui_manager()->CancelAll(); 115 g_browser_process->notification_ui_manager()->StartShutdown();
116 profile_manager_.reset(); 116 profile_manager_.reset();
117 network_portal_detector::InitializeForTesting(nullptr); 117 network_portal_detector::InitializeForTesting(nullptr);
118 BrowserWithTestWindowTest::TearDown(); 118 BrowserWithTestWindowTest::TearDown();
119 } 119 }
120 120
121 scoped_refptr<HatsNotificationController> InstantiateHatsController() { 121 scoped_refptr<HatsNotificationController> InstantiateHatsController() {
122 MockImageFetcher* mock_image_fetcher_ = new MockImageFetcher; 122 MockImageFetcher* mock_image_fetcher_ = new MockImageFetcher;
123 // The initialization will fail since the function IsNewDevice() will return 123 // The initialization will fail since the function IsNewDevice() will return
124 // true. 124 // true.
125 scoped_refptr<HatsNotificationController> hats_notification_controller = 125 scoped_refptr<HatsNotificationController> hats_notification_controller =
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 ASSERT_TRUE(base::Time::FromInternalValue(new_timestamp) > 280 ASSERT_TRUE(base::Time::FromInternalValue(new_timestamp) >
281 base::Time::FromInternalValue(now_timestamp)); 281 base::Time::FromInternalValue(now_timestamp));
282 282
283 // Destructor for HatsController removes self from observer list. 283 // Destructor for HatsController removes self from observer list.
284 EXPECT_CALL(mock_network_portal_detector_, 284 EXPECT_CALL(mock_network_portal_detector_,
285 RemoveObserver(hats_notification_controller.get())) 285 RemoveObserver(hats_notification_controller.get()))
286 .Times(1); 286 .Times(1);
287 } 287 }
288 288
289 } // namespace chromeos 289 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698