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

Side by Side Diff: chrome/browser/chromeos/login/login_browsertest.cc

Issue 2420123002: Remove dependency from SignInBrowsertest on tracing events watching (Closed)
Patch Set: use WindowedNotificationObserver Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/common/system/tray/system_tray.h" 5 #include "ash/common/system/tray/system_tray.h"
6 #include "ash/shell.h" 6 #include "ash/shell.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/chromeos/login/login_manager_test.h" 13 #include "chrome/browser/chromeos/login/login_manager_test.h"
14 #include "chrome/browser/chromeos/login/login_wizard.h" 14 #include "chrome/browser/chromeos/login/login_wizard.h"
15 #include "chrome/browser/chromeos/login/startup_utils.h" 15 #include "chrome/browser/chromeos/login/startup_utils.h"
16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
17 #include "chrome/browser/chromeos/login/wizard_controller.h" 17 #include "chrome/browser/chromeos/login/wizard_controller.h"
18 #include "chrome/browser/chromeos/settings/cros_settings.h" 18 #include "chrome/browser/chromeos/settings/cros_settings.h"
19 #include "chrome/browser/profiles/profile_manager.h" 19 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/profiles/profiles_state.h" 20 #include "chrome/browser/profiles/profiles_state.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/common/chrome_constants.h" 22 #include "chrome/common/chrome_constants.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/test/base/in_process_browser_test.h" 24 #include "chrome/test/base/in_process_browser_test.h"
25 #include "chrome/test/base/interactive_test_utils.h" 25 #include "chrome/test/base/interactive_test_utils.h"
26 #include "chrome/test/base/tracing.h"
27 #include "chromeos/chromeos_switches.h" 26 #include "chromeos/chromeos_switches.h"
28 #include "chromeos/login/user_names.h" 27 #include "chromeos/login/user_names.h"
29 #include "chromeos/settings/cros_settings_names.h" 28 #include "chromeos/settings/cros_settings_names.h"
30 #include "components/signin/core/account_id/account_id.h" 29 #include "components/signin/core/account_id/account_id.h"
31 #include "content/public/test/browser_test_utils.h" 30 #include "content/public/test/browser_test_utils.h"
32 #include "content/public/test/test_utils.h" 31 #include "content/public/test/test_utils.h"
33 #include "extensions/browser/extension_system.h" 32 #include "extensions/browser/extension_system.h"
34 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
35 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
36 35
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 78 }
80 79
81 void TearDownOnMainThread() override { 80 void TearDownOnMainThread() override {
82 // Close the login manager, which otherwise holds a KeepAlive that is not 81 // Close the login manager, which otherwise holds a KeepAlive that is not
83 // cleared in time by the end of the test. 82 // cleared in time by the end of the test.
84 LoginDisplayHost::default_host()->Finalize(); 83 LoginDisplayHost::default_host()->Finalize();
85 } 84 }
86 85
87 void SetUpOnMainThread() override { 86 void SetUpOnMainThread() override {
88 LoginDisplayHostImpl::DisableRestrictiveProxyCheckForTest(); 87 LoginDisplayHostImpl::DisableRestrictiveProxyCheckForTest();
89
90 ASSERT_TRUE(tracing::BeginTracingWithWatch(
91 "ui", "ui", "ShowLoginWebUI", 1));
92 } 88 }
93 }; 89 };
94 90
95 class LoginTest : public LoginManagerTest { 91 class LoginTest : public LoginManagerTest {
96 public: 92 public:
97 LoginTest() : LoginManagerTest(true) {} 93 LoginTest() : LoginManagerTest(true) {}
98 ~LoginTest() override {} 94 ~LoginTest() override {}
99 95
100 void StartGaiaAuthOffline() { 96 void StartGaiaAuthOffline() {
101 content::DOMMessageQueue message_queue; 97 content::DOMMessageQueue message_queue;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); 234 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible());
239 235
240 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( 236 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(
241 FROM_HERE, LoginDisplayHost::default_host()); 237 FROM_HERE, LoginDisplayHost::default_host());
242 238
243 TestSystemTrayIsVisible(); 239 TestSystemTrayIsVisible();
244 } 240 }
245 241
246 // Verifies that the webui for login comes up successfully. 242 // Verifies that the webui for login comes up successfully.
247 IN_PROC_BROWSER_TEST_F(LoginSigninTest, WebUIVisible) { 243 IN_PROC_BROWSER_TEST_F(LoginSigninTest, WebUIVisible) {
248 base::TimeDelta no_timeout; 244 content::WindowedNotificationObserver(
249 EXPECT_TRUE(tracing::WaitForWatchEvent(no_timeout)); 245 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
250 std::string json_events; 246 content::NotificationService::AllSources())
251 ASSERT_TRUE(tracing::EndTracing(&json_events)); 247 .Wait();
252 } 248 }
253 249
254 250
255 IN_PROC_BROWSER_TEST_F(LoginTest, PRE_GaiaAuthOffline) { 251 IN_PROC_BROWSER_TEST_F(LoginTest, PRE_GaiaAuthOffline) {
256 RegisterUser(kTestUser); 252 RegisterUser(kTestUser);
257 StartupUtils::MarkOobeCompleted(); 253 StartupUtils::MarkOobeCompleted();
258 CrosSettings::Get()->SetBoolean(kAccountsPrefShowUserNamesOnSignIn, false); 254 CrosSettings::Get()->SetBoolean(kAccountsPrefShowUserNamesOnSignIn, false);
259 } 255 }
260 256
261 IN_PROC_BROWSER_TEST_F(LoginTest, GaiaAuthOffline) { 257 IN_PROC_BROWSER_TEST_F(LoginTest, GaiaAuthOffline) {
262 PrepareOfflineLogin(); 258 PrepareOfflineLogin();
263 content::WindowedNotificationObserver session_start_waiter( 259 content::WindowedNotificationObserver session_start_waiter(
264 chrome::NOTIFICATION_SESSION_STARTED, 260 chrome::NOTIFICATION_SESSION_STARTED,
265 content::NotificationService::AllSources()); 261 content::NotificationService::AllSources());
266 SubmitGaiaAuthOfflineForm(kTestUser, kPassword); 262 SubmitGaiaAuthOfflineForm(kTestUser, kPassword);
267 session_start_waiter.Wait(); 263 session_start_waiter.Wait();
268 264
269 TestSystemTrayIsVisible(); 265 TestSystemTrayIsVisible();
270 } 266 }
271 267
272 } // namespace chromeos 268 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698