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

Side by Side Diff: chrome/browser/push_messaging/push_messaging_browsertest.cc

Issue 2952163002: Remove InProcessBrowserTest::SetUpOnMainThread() calls. (Closed)
Patch Set: rebase Created 3 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 gcm_service_->driver()); 157 gcm_service_->driver());
158 158
159 push_service_ = 159 push_service_ =
160 PushMessagingServiceFactory::GetForProfile(GetBrowser()->profile()); 160 PushMessagingServiceFactory::GetForProfile(GetBrowser()->profile());
161 display_service_.reset(new MessageCenterDisplayService( 161 display_service_.reset(new MessageCenterDisplayService(
162 GetBrowser()->profile(), notification_manager_.get())); 162 GetBrowser()->profile(), notification_manager_.get()));
163 notification_service()->SetNotificationDisplayServiceForTesting( 163 notification_service()->SetNotificationDisplayServiceForTesting(
164 display_service_.get()); 164 display_service_.get());
165 165
166 LoadTestPage(); 166 LoadTestPage();
167 InProcessBrowserTest::SetUpOnMainThread();
168 } 167 }
169 168
170 // Calls should be wrapped in the ASSERT_NO_FATAL_FAILURE() macro. 169 // Calls should be wrapped in the ASSERT_NO_FATAL_FAILURE() macro.
171 void RestartPushService() { 170 void RestartPushService() {
172 Profile* profile = GetBrowser()->profile(); 171 Profile* profile = GetBrowser()->profile();
173 PushMessagingServiceFactory::GetInstance()->SetTestingFactory(profile, 172 PushMessagingServiceFactory::GetInstance()->SetTestingFactory(profile,
174 nullptr); 173 nullptr);
175 ASSERT_EQ(nullptr, PushMessagingServiceFactory::GetForProfile(profile)); 174 ASSERT_EQ(nullptr, PushMessagingServiceFactory::GetForProfile(profile));
176 PushMessagingServiceFactory::GetInstance()->RestoreFactoryForTests(profile); 175 PushMessagingServiceFactory::GetInstance()->RestoreFactoryForTests(profile);
177 PushMessagingServiceImpl::InitializeForProfile(profile); 176 PushMessagingServiceImpl::InitializeForProfile(profile);
(...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2405 push_service()->SetUnsubscribeCallbackForTesting(run_loop.QuitClosure()); 2404 push_service()->SetUnsubscribeCallbackForTesting(run_loop.QuitClosure());
2406 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); 2405 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result));
2407 EXPECT_EQ("unsubscribe result: true", script_result); 2406 EXPECT_EQ("unsubscribe result: true", script_result);
2408 // Background mode is only guaranteed to have updated once the unsubscribe 2407 // Background mode is only guaranteed to have updated once the unsubscribe
2409 // callback for testing has been run (PushSubscription.unsubscribe() usually 2408 // callback for testing has been run (PushSubscription.unsubscribe() usually
2410 // resolves before that, in order to avoid blocking on network retries etc). 2409 // resolves before that, in order to avoid blocking on network retries etc).
2411 run_loop.Run(); 2410 run_loop.Run();
2412 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); 2411 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive());
2413 } 2412 }
2414 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) 2413 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698