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

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

Issue 1079083002: [cros New-GAIA] Webview login and new GAIA endpoint enabled by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/chromeos/login/login_manager_test.h" 10 #include "chrome/browser/chromeos/login/login_manager_test.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return true; 50 return true;
51 } 51 }
52 52
53 LoginHandler* login_handler_; 53 LoginHandler* login_handler_;
54 54
55 DISALLOW_COPY_AND_ASSIGN(ProxyAuthDialogWaiter); 55 DISALLOW_COPY_AND_ASSIGN(ProxyAuthDialogWaiter);
56 }; 56 };
57 57
58 } // namespace 58 } // namespace
59 59
60 class ProxyAuthOnUserBoardScreenTest : public LoginManagerTest { 60 class ProxyAuthOnUserBoardScreenTest
61 : public LoginManagerTest,
62 public testing::WithParamInterface<bool> {
61 public: 63 public:
62 ProxyAuthOnUserBoardScreenTest() 64 ProxyAuthOnUserBoardScreenTest()
63 : LoginManagerTest(true /* should_launch_browser */), 65 : LoginManagerTest(true /* should_launch_browser */),
64 proxy_server_(net::SpawnedTestServer::TYPE_BASIC_AUTH_PROXY, 66 proxy_server_(net::SpawnedTestServer::TYPE_BASIC_AUTH_PROXY,
65 net::SpawnedTestServer::kLocalhost, 67 net::SpawnedTestServer::kLocalhost,
66 base::FilePath()) {} 68 base::FilePath()) {
69 // TODO(paulmeyer): Re-enable webview version of this test
70 // (uncomment this line) once http://crbug.com/452452 is fixed.
71 // use_webview_ = GetParam();
72 }
67 73
68 ~ProxyAuthOnUserBoardScreenTest() override {} 74 ~ProxyAuthOnUserBoardScreenTest() override {}
69 75
70 void SetUp() override { 76 void SetUp() override {
71 ASSERT_TRUE(proxy_server_.Start()); 77 ASSERT_TRUE(proxy_server_.Start());
72 LoginManagerTest::SetUp(); 78 LoginManagerTest::SetUp();
73 } 79 }
74 80
75 void SetUpCommandLine(base::CommandLine* command_line) override { 81 void SetUpCommandLine(base::CommandLine* command_line) override {
76 LoginManagerTest::SetUpCommandLine(command_line); 82 LoginManagerTest::SetUpCommandLine(command_line);
77 command_line->AppendSwitchASCII(::switches::kProxyServer, 83 command_line->AppendSwitchASCII(::switches::kProxyServer,
78 proxy_server_.host_port_pair().ToString()); 84 proxy_server_.host_port_pair().ToString());
79 } 85 }
80 86
81 private: 87 private:
82 net::SpawnedTestServer proxy_server_; 88 net::SpawnedTestServer proxy_server_;
83 89
84 DISALLOW_COPY_AND_ASSIGN(ProxyAuthOnUserBoardScreenTest); 90 DISALLOW_COPY_AND_ASSIGN(ProxyAuthOnUserBoardScreenTest);
85 }; 91 };
86 92
87 IN_PROC_BROWSER_TEST_F(ProxyAuthOnUserBoardScreenTest, 93 IN_PROC_BROWSER_TEST_P(ProxyAuthOnUserBoardScreenTest,
88 PRE_ProxyAuthDialogOnUserBoardScreen) { 94 PRE_ProxyAuthDialogOnUserBoardScreen) {
89 RegisterUser("test-user@gmail.com"); 95 RegisterUser("test-user@gmail.com");
90 StartupUtils::MarkOobeCompleted(); 96 StartupUtils::MarkOobeCompleted();
91 } 97 }
92 98
93 IN_PROC_BROWSER_TEST_F(ProxyAuthOnUserBoardScreenTest, 99 IN_PROC_BROWSER_TEST_P(ProxyAuthOnUserBoardScreenTest,
94 ProxyAuthDialogOnUserBoardScreen) { 100 ProxyAuthDialogOnUserBoardScreen) {
95 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host(); 101 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host();
96 WebUILoginView* web_ui_login_view = login_display_host->GetWebUILoginView(); 102 WebUILoginView* web_ui_login_view = login_display_host->GetWebUILoginView();
97 OobeUI* oobe_ui = 103 OobeUI* oobe_ui =
98 static_cast<OobeUI*>(web_ui_login_view->GetWebUI()->GetController()); 104 static_cast<OobeUI*>(web_ui_login_view->GetWebUI()->GetController());
99 105
100 { 106 {
101 OobeScreenWaiter screen_waiter(OobeDisplay::SCREEN_ACCOUNT_PICKER); 107 OobeScreenWaiter screen_waiter(OobeDisplay::SCREEN_ACCOUNT_PICKER);
102 ProxyAuthDialogWaiter auth_dialog_waiter; 108 ProxyAuthDialogWaiter auth_dialog_waiter;
103 screen_waiter.Wait(); 109 screen_waiter.Wait();
104 auth_dialog_waiter.Wait(); 110 auth_dialog_waiter.Wait();
105 111
106 ASSERT_TRUE(auth_dialog_waiter.login_handler()); 112 ASSERT_TRUE(auth_dialog_waiter.login_handler());
107 auth_dialog_waiter.login_handler()->CancelAuth(); 113 auth_dialog_waiter.login_handler()->CancelAuth();
108 } 114 }
109 115
110 { 116 {
111 OobeScreenWaiter screen_waiter(OobeDisplay::SCREEN_GAIA_SIGNIN); 117 OobeScreenWaiter screen_waiter(OobeDisplay::SCREEN_GAIA_SIGNIN);
112 ProxyAuthDialogWaiter auth_dialog_waiter; 118 ProxyAuthDialogWaiter auth_dialog_waiter;
113 ASSERT_TRUE(content::ExecuteScript(oobe_ui->web_ui()->GetWebContents(), 119 ASSERT_TRUE(content::ExecuteScript(oobe_ui->web_ui()->GetWebContents(),
114 "window.domAutomationController.send(!!(" 120 "window.domAutomationController.send(!!("
115 "$('add-user-button').click()" 121 "$('add-user-button').click()"
116 "));")); 122 "));"));
117 screen_waiter.Wait(); 123 screen_waiter.Wait();
118 auth_dialog_waiter.Wait(); 124 auth_dialog_waiter.Wait();
119 ASSERT_TRUE(auth_dialog_waiter.login_handler()); 125 ASSERT_TRUE(auth_dialog_waiter.login_handler());
120 } 126 }
121 } 127 }
122 128
129 INSTANTIATE_TEST_CASE_P(ProxyAuthOnUserBoardScreenTestSuite,
130 ProxyAuthOnUserBoardScreenTest,
131 testing::Bool());
132
123 } // namespace chromeos 133 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698