OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/file_util.h" |
| 7 #include "base/files/file_path.h" |
| 8 #include "base/path_service.h" |
6 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
7 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 12 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
10 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 13 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
11 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 14 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
12 #include "chrome/browser/chromeos/login/user.h" | 15 #include "chrome/browser/chromeos/login/user.h" |
13 #include "chrome/browser/chromeos/login/user_manager.h" | 16 #include "chrome/browser/chromeos/login/user_manager.h" |
14 #include "chrome/browser/chromeos/login/webui_login_display.h" | 17 #include "chrome/browser/chromeos/login/webui_login_display.h" |
15 #include "chrome/browser/chromeos/login/wizard_controller.h" | 18 #include "chrome/browser/chromeos/login/wizard_controller.h" |
16 #include "chrome/browser/lifetime/application_lifetime.h" | 19 #include "chrome/browser/lifetime/application_lifetime.h" |
| 20 #include "chrome/common/chrome_paths.h" |
17 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 22 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "chromeos/chromeos_switches.h" | 23 #include "chromeos/chromeos_switches.h" |
20 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
21 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
22 #include "content/public/test/browser_test_utils.h" | 26 #include "content/public/test/browser_test_utils.h" |
23 #include "content/public/test/test_utils.h" | 27 #include "content/public/test/test_utils.h" |
24 #include "google_apis/gaia/fake_gaia.h" | 28 #include "google_apis/gaia/fake_gaia.h" |
25 #include "google_apis/gaia/gaia_switches.h" | 29 #include "google_apis/gaia/gaia_switches.h" |
26 #include "net/base/url_util.h" | 30 #include "net/base/url_util.h" |
(...skipping 18 matching lines...) Expand all Loading... |
45 const char kTestAuthLoginAccessToken[] = "fake-access-token"; | 49 const char kTestAuthLoginAccessToken[] = "fake-access-token"; |
46 const char kTestRefreshToken[] = "fake-refresh-token"; | 50 const char kTestRefreshToken[] = "fake-refresh-token"; |
47 const char kTestSessionSIDCookie[] = "fake-session-SID-cookie"; | 51 const char kTestSessionSIDCookie[] = "fake-session-SID-cookie"; |
48 const char kTestSessionLSIDCookie[] = "fake-session-LSID-cookie"; | 52 const char kTestSessionLSIDCookie[] = "fake-session-LSID-cookie"; |
49 | 53 |
50 const char kAnotherUserEmail[] = "alice@example.com"; | 54 const char kAnotherUserEmail[] = "alice@example.com"; |
51 const char kUserEmail[] = "bob@example.com"; | 55 const char kUserEmail[] = "bob@example.com"; |
52 | 56 |
53 const char kRelayState[] = "RelayState"; | 57 const char kRelayState[] = "RelayState"; |
54 | 58 |
55 const char kDefaultIdpHtml[] = | |
56 "<form id=IdPForm method=post action=\"$Post\">" | |
57 "<input type=hidden name=RelayState value=\"$RelayState\">" | |
58 "User: <input type=text id=Email name=Email>" | |
59 "Password: <input type=password id=Password name=Password>" | |
60 "<input id=Submit type=submit>" | |
61 "</form>"; | |
62 | |
63 // FakeSamlIdp serves IdP auth form and the form submission. The form is | 59 // FakeSamlIdp serves IdP auth form and the form submission. The form is |
64 // served with the template's RelayState placeholder expanded to the real | 60 // served with the template's RelayState placeholder expanded to the real |
65 // RelayState parameter from request. The form submission redirects back to | 61 // RelayState parameter from request. The form submission redirects back to |
66 // FakeGaia with the same RelayState. | 62 // FakeGaia with the same RelayState. |
67 class FakeSamlIdp { | 63 class FakeSamlIdp { |
68 public: | 64 public: |
69 FakeSamlIdp() : html_template_(kDefaultIdpHtml) {} | 65 FakeSamlIdp(); |
70 ~FakeSamlIdp() {} | 66 ~FakeSamlIdp(); |
71 | 67 |
72 void SetUp(const std::string& base_path, const GURL& gaia_url) { | 68 void SetUp(const std::string& base_path, const GURL& gaia_url); |
73 base_path_= base_path; | 69 |
74 post_path_ = base_path + "Auth"; | 70 void SetLoginHTMLTemplate(const std::string& template_file); |
75 gaia_assertion_url_ = gaia_url.Resolve("/SSO"); | 71 void SetLoginAuthHTMLTemplate(const std::string& template_file); |
| 72 |
| 73 scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request); |
| 74 |
| 75 private: |
| 76 scoped_ptr<HttpResponse> BuildHTMLResponse(const std::string& html_template, |
| 77 const std::string& relay_state, |
| 78 const std::string& next_path); |
| 79 |
| 80 base::FilePath html_template_dir_; |
| 81 |
| 82 std::string login_path_; |
| 83 std::string login_auth_path_; |
| 84 |
| 85 std::string login_html_template_; |
| 86 std::string login_auth_html_template_; |
| 87 GURL gaia_assertion_url_; |
| 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(FakeSamlIdp); |
| 90 }; |
| 91 |
| 92 FakeSamlIdp::FakeSamlIdp() { |
| 93 } |
| 94 |
| 95 FakeSamlIdp::~FakeSamlIdp() { |
| 96 } |
| 97 |
| 98 void FakeSamlIdp::SetUp(const std::string& base_path, const GURL& gaia_url) { |
| 99 base::FilePath test_data_dir; |
| 100 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); |
| 101 html_template_dir_ = test_data_dir.Append("login"); |
| 102 |
| 103 login_path_= base_path; |
| 104 login_auth_path_ = base_path + "Auth"; |
| 105 gaia_assertion_url_ = gaia_url.Resolve("/SSO"); |
| 106 } |
| 107 |
| 108 void FakeSamlIdp::SetLoginHTMLTemplate(const std::string& template_file) { |
| 109 EXPECT_TRUE(base::ReadFileToString( |
| 110 html_template_dir_.Append(template_file), |
| 111 &login_html_template_)); |
| 112 } |
| 113 |
| 114 void FakeSamlIdp::SetLoginAuthHTMLTemplate(const std::string& template_file) { |
| 115 EXPECT_TRUE(base::ReadFileToString( |
| 116 html_template_dir_.Append(template_file), |
| 117 &login_auth_html_template_)); |
| 118 } |
| 119 |
| 120 scoped_ptr<HttpResponse> FakeSamlIdp::HandleRequest( |
| 121 const HttpRequest& request) { |
| 122 // The scheme and host of the URL is actually not important but required to |
| 123 // get a valid GURL in order to parse |request.relative_url|. |
| 124 GURL request_url = GURL("http://localhost").Resolve(request.relative_url); |
| 125 std::string request_path = request_url.path(); |
| 126 |
| 127 if (request_path == login_path_) { |
| 128 std::string relay_state; |
| 129 net::GetValueForKeyInQuery(request_url, kRelayState, &relay_state); |
| 130 return BuildHTMLResponse(login_html_template_, |
| 131 relay_state, |
| 132 login_auth_path_); |
76 } | 133 } |
77 | 134 |
78 scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { | 135 if (request_path != login_auth_path_) { |
79 // The scheme and host of the URL is actually not important but required to | 136 // Request not understood. |
80 // get a valid GURL in order to parse |request.relative_url|. | 137 return scoped_ptr<HttpResponse>(); |
81 GURL request_url = GURL("http://localhost").Resolve(request.relative_url); | |
82 std::string request_path = request_url.path(); | |
83 | |
84 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); | |
85 if (request_path == base_path_) { | |
86 std::string relay_state; | |
87 net::GetValueForKeyInQuery(request_url, kRelayState, &relay_state); | |
88 | |
89 std::string response_html = html_template_; | |
90 ReplaceSubstringsAfterOffset( | |
91 &response_html, 0, "$RelayState", relay_state); | |
92 ReplaceSubstringsAfterOffset( | |
93 &response_html, 0, "$Post", post_path_); | |
94 | |
95 http_response->set_code(net::HTTP_OK); | |
96 http_response->set_content(response_html); | |
97 http_response->set_content_type("text/html"); | |
98 } else if (request_path == post_path_) { | |
99 std::string relay_state; | |
100 FakeGaia::GetQueryParameter(request.content, kRelayState, &relay_state); | |
101 | |
102 GURL redirect_url = gaia_assertion_url_; | |
103 redirect_url = net::AppendQueryParameter( | |
104 redirect_url, "SAMLResponse", "fake_response"); | |
105 redirect_url = net::AppendQueryParameter( | |
106 redirect_url, kRelayState, relay_state); | |
107 | |
108 http_response->set_code(net::HTTP_TEMPORARY_REDIRECT); | |
109 http_response->AddCustomHeader("Location", redirect_url.spec()); | |
110 } else { | |
111 // Request not understood. | |
112 return scoped_ptr<HttpResponse>(); | |
113 } | |
114 | |
115 return http_response.PassAs<HttpResponse>(); | |
116 } | 138 } |
117 | 139 |
118 void set_html_template(const std::string& html_template) { | 140 std::string relay_state; |
119 html_template_ = html_template; | 141 FakeGaia::GetQueryParameter(request.content, kRelayState, &relay_state); |
| 142 GURL redirect_url = gaia_assertion_url_; |
| 143 |
| 144 if (!login_auth_html_template_.empty()) { |
| 145 return BuildHTMLResponse(login_auth_html_template_, |
| 146 relay_state, |
| 147 redirect_url.spec()); |
120 } | 148 } |
121 | 149 |
122 private: | 150 redirect_url = net::AppendQueryParameter( |
123 std::string base_path_; | 151 redirect_url, "SAMLResponse", "fake_response"); |
124 std::string post_path_; | 152 redirect_url = net::AppendQueryParameter( |
125 std::string html_template_; | 153 redirect_url, kRelayState, relay_state); |
126 | 154 |
127 GURL gaia_assertion_url_; | 155 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); |
128 DISALLOW_COPY_AND_ASSIGN(FakeSamlIdp); | 156 http_response->set_code(net::HTTP_TEMPORARY_REDIRECT); |
129 }; | 157 http_response->AddCustomHeader("Location", redirect_url.spec()); |
| 158 return http_response.PassAs<HttpResponse>(); |
| 159 } |
| 160 |
| 161 scoped_ptr<HttpResponse> FakeSamlIdp::BuildHTMLResponse( |
| 162 const std::string& html_template, |
| 163 const std::string& relay_state, |
| 164 const std::string& next_path) { |
| 165 std::string response_html = html_template; |
| 166 ReplaceSubstringsAfterOffset(&response_html, 0, "$RelayState", relay_state); |
| 167 ReplaceSubstringsAfterOffset(&response_html, 0, "$Post", next_path); |
| 168 |
| 169 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); |
| 170 http_response->set_code(net::HTTP_OK); |
| 171 http_response->set_content(response_html); |
| 172 http_response->set_content_type("text/html"); |
| 173 |
| 174 return http_response.PassAs<HttpResponse>(); |
| 175 } |
130 | 176 |
131 } // namespace | 177 } // namespace |
132 | 178 |
133 class SamlTest : public InProcessBrowserTest { | 179 class SamlTest : public InProcessBrowserTest { |
134 public: | 180 public: |
135 SamlTest() : saml_load_injected_(false) {} | 181 SamlTest() : saml_load_injected_(false) {} |
136 virtual ~SamlTest() {} | 182 virtual ~SamlTest() {} |
137 | 183 |
138 virtual void SetUp() OVERRIDE { | 184 virtual void SetUp() OVERRIDE { |
139 // Start embedded test server here so that we can get server base url | 185 // Start embedded test server here so that we can get server base url |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 354 |
309 bool saml_load_injected_; | 355 bool saml_load_injected_; |
310 | 356 |
311 DISALLOW_COPY_AND_ASSIGN(SamlTest); | 357 DISALLOW_COPY_AND_ASSIGN(SamlTest); |
312 }; | 358 }; |
313 | 359 |
314 // Tests that signin frame should have 'saml' class and 'cancel' button is | 360 // Tests that signin frame should have 'saml' class and 'cancel' button is |
315 // visible when SAML IdP page is loaded. And 'cancel' button goes back to | 361 // visible when SAML IdP page is loaded. And 'cancel' button goes back to |
316 // gaia on clicking. | 362 // gaia on clicking. |
317 IN_PROC_BROWSER_TEST_F(SamlTest, SamlUI) { | 363 IN_PROC_BROWSER_TEST_F(SamlTest, SamlUI) { |
| 364 fake_saml_idp()->SetLoginHTMLTemplate("saml_login.html"); |
318 StartSamlAndWaitForIdpPageLoad(kUserEmail); | 365 StartSamlAndWaitForIdpPageLoad(kUserEmail); |
319 | 366 |
320 // Saml flow UI expectations. | 367 // Saml flow UI expectations. |
321 JsExpect("$('gaia-signin').classList.contains('saml')"); | 368 JsExpect("$('gaia-signin').classList.contains('saml')"); |
322 JsExpect("!$('cancel-add-user-button').hidden"); | 369 JsExpect("!$('cancel-add-user-button').hidden"); |
323 | 370 |
324 // Click on 'cancel'. | 371 // Click on 'cancel'. |
325 content::DOMMessageQueue message_queue; // Observe before 'cancel'. | 372 content::DOMMessageQueue message_queue; // Observe before 'cancel'. |
326 ASSERT_TRUE(content::ExecuteScript( | 373 ASSERT_TRUE(content::ExecuteScript( |
327 GetLoginUI()->GetWebContents(), | 374 GetLoginUI()->GetWebContents(), |
328 "$('cancel-add-user-button').click();")); | 375 "$('cancel-add-user-button').click();")); |
329 | 376 |
330 // Auth flow should change back to Gaia. | 377 // Auth flow should change back to Gaia. |
331 std::string message; | 378 std::string message; |
332 do { | 379 do { |
333 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 380 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
334 } while (message != "\"GaiaLoaded\""); | 381 } while (message != "\"GaiaLoaded\""); |
335 | 382 |
336 // Saml flow is gone. | 383 // Saml flow is gone. |
337 JsExpect("!$('gaia-signin').classList.contains('saml')"); | 384 JsExpect("!$('gaia-signin').classList.contains('saml')"); |
338 } | 385 } |
339 | 386 |
340 // Tests the single password scraped flow. | 387 // Tests the sign-in flow when the credentials passing API is used. |
341 IN_PROC_BROWSER_TEST_F(SamlTest, ScrapedSingle) { | 388 IN_PROC_BROWSER_TEST_F(SamlTest, CredentialPassingAPI) { |
| 389 fake_saml_idp()->SetLoginHTMLTemplate("saml_api_login.html"); |
| 390 fake_saml_idp()->SetLoginAuthHTMLTemplate("saml_api_login_auth.html"); |
342 StartSamlAndWaitForIdpPageLoad(kUserEmail); | 391 StartSamlAndWaitForIdpPageLoad(kUserEmail); |
343 | 392 |
344 // Fill-in the SAML IdP form and submit. | 393 // Fill-in the SAML IdP form and submit. |
345 SetSignFormField("Email", "fake_user"); | 394 SetSignFormField("Email", "fake_user"); |
346 SetSignFormField("Password", "fake_password"); | 395 SetSignFormField("Password", "fake_password"); |
347 ExecuteJsInSigninFrame("document.getElementById('IdPForm').submit();"); | 396 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); |
| 397 |
| 398 // Login should finish login and a session should start. |
| 399 content::WindowedNotificationObserver( |
| 400 chrome::NOTIFICATION_SESSION_STARTED, |
| 401 content::NotificationService::AllSources()).Wait(); |
| 402 } |
| 403 |
| 404 // Tests the single password scraped flow. |
| 405 IN_PROC_BROWSER_TEST_F(SamlTest, ScrapedSingle) { |
| 406 fake_saml_idp()->SetLoginHTMLTemplate("saml_login.html"); |
| 407 StartSamlAndWaitForIdpPageLoad(kUserEmail); |
| 408 |
| 409 // Fill-in the SAML IdP form and submit. |
| 410 SetSignFormField("Email", "fake_user"); |
| 411 SetSignFormField("Password", "fake_password"); |
| 412 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); |
348 | 413 |
349 // Lands on confirm password screen. | 414 // Lands on confirm password screen. |
350 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); | 415 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); |
351 | 416 |
352 // Enter an unknown password should go back to confirm password screen. | 417 // Enter an unknown password should go back to confirm password screen. |
353 SendConfirmPassword("wrong_password"); | 418 SendConfirmPassword("wrong_password"); |
354 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); | 419 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); |
355 | 420 |
356 // Enter a known password should finish login and start session. | 421 // Enter a known password should finish login and start session. |
357 SendConfirmPassword("fake_password"); | 422 SendConfirmPassword("fake_password"); |
358 content::WindowedNotificationObserver( | 423 content::WindowedNotificationObserver( |
359 chrome::NOTIFICATION_SESSION_STARTED, | 424 chrome::NOTIFICATION_SESSION_STARTED, |
360 content::NotificationService::AllSources()).Wait(); | 425 content::NotificationService::AllSources()).Wait(); |
361 } | 426 } |
362 | 427 |
363 // Tests the multiple password scraped flow. | 428 // Tests the multiple password scraped flow. |
364 IN_PROC_BROWSER_TEST_F(SamlTest, ScrapedMultiple) { | 429 IN_PROC_BROWSER_TEST_F(SamlTest, ScrapedMultiple) { |
365 fake_saml_idp()->set_html_template( | 430 fake_saml_idp()->SetLoginHTMLTemplate("saml_login_two_passwords.html"); |
366 "<form id=IdPForm method=post action=\"$Post\">" | |
367 "<input type=hidden name=RelayState value=\"$RelayState\">" | |
368 "User: <input type=text id=Email name=Email>" | |
369 "Password: <input type=password id=Password name=Password>" | |
370 "Password: <input type=password id=Password1 name=Password1>" | |
371 "<input id=Submit type=submit>" | |
372 "</form>"); | |
373 | 431 |
374 StartSamlAndWaitForIdpPageLoad(kUserEmail); | 432 StartSamlAndWaitForIdpPageLoad(kUserEmail); |
375 | 433 |
376 SetSignFormField("Email", "fake_user"); | 434 SetSignFormField("Email", "fake_user"); |
377 SetSignFormField("Password", "fake_password"); | 435 SetSignFormField("Password", "fake_password"); |
378 SetSignFormField("Password1", "password1"); | 436 SetSignFormField("Password1", "password1"); |
379 ExecuteJsInSigninFrame("document.getElementById('IdPForm').submit();"); | 437 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); |
380 | 438 |
381 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); | 439 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); |
382 | 440 |
383 // Either scraped password should be able to sign-in. | 441 // Either scraped password should be able to sign-in. |
384 SendConfirmPassword("password1"); | 442 SendConfirmPassword("password1"); |
385 content::WindowedNotificationObserver( | 443 content::WindowedNotificationObserver( |
386 chrome::NOTIFICATION_SESSION_STARTED, | 444 chrome::NOTIFICATION_SESSION_STARTED, |
387 content::NotificationService::AllSources()).Wait(); | 445 content::NotificationService::AllSources()).Wait(); |
388 } | 446 } |
389 | 447 |
390 // Tests the no password scraped flow. | 448 // Tests the no password scraped flow. |
391 IN_PROC_BROWSER_TEST_F(SamlTest, ScrapedNone) { | 449 IN_PROC_BROWSER_TEST_F(SamlTest, ScrapedNone) { |
392 fake_saml_idp()->set_html_template( | 450 fake_saml_idp()->SetLoginHTMLTemplate("saml_login_no_passwords.html"); |
393 "<form id=IdPForm method=post action=\"$Post\">" | |
394 "<input type=hidden name=RelayState value=\"$RelayState\">" | |
395 "User: <input type=text id=Email name=Email>" | |
396 "<input id=Submit type=submit>" | |
397 "</form>"); | |
398 | 451 |
399 StartSamlAndWaitForIdpPageLoad(kUserEmail); | 452 StartSamlAndWaitForIdpPageLoad(kUserEmail); |
400 | 453 |
401 SetSignFormField("Email", "fake_user"); | 454 SetSignFormField("Email", "fake_user"); |
402 ExecuteJsInSigninFrame("document.getElementById('IdPForm').submit();"); | 455 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); |
403 | 456 |
404 OobeScreenWaiter(OobeDisplay::SCREEN_MESSAGE_BOX).Wait(); | 457 OobeScreenWaiter(OobeDisplay::SCREEN_MESSAGE_BOX).Wait(); |
405 JsExpect( | 458 JsExpect( |
406 "$('message-box-title').textContent == " | 459 "$('message-box-title').textContent == " |
407 "loadTimeData.getString('noPasswordWarningTitle')"); | 460 "loadTimeData.getString('noPasswordWarningTitle')"); |
408 } | 461 } |
409 | 462 |
410 // Types |alice@example.com| into the GAIA login form but then authenticates as | 463 // Types |alice@example.com| into the GAIA login form but then authenticates as |
411 // |bob@example.com| via SAML. Verifies that the logged-in user is correctly | 464 // |bob@example.com| via SAML. Verifies that the logged-in user is correctly |
412 // identified as Bob. | 465 // identified as Bob. |
413 IN_PROC_BROWSER_TEST_F(SamlTest, UseAutenticatedUserEmailAddress) { | 466 IN_PROC_BROWSER_TEST_F(SamlTest, UseAutenticatedUserEmailAddress) { |
| 467 fake_saml_idp()->SetLoginHTMLTemplate("saml_login.html"); |
414 // Type |alice@example.com| into the GAIA login form. | 468 // Type |alice@example.com| into the GAIA login form. |
415 StartSamlAndWaitForIdpPageLoad(kAnotherUserEmail); | 469 StartSamlAndWaitForIdpPageLoad(kAnotherUserEmail); |
416 | 470 |
417 // Authenticate as bob@example.com via SAML (the |Email| provided here is | 471 // Authenticate as bob@example.com via SAML (the |Email| provided here is |
418 // irrelevant - the authenticated user's e-mail address that FakeGAIA | 472 // irrelevant - the authenticated user's e-mail address that FakeGAIA |
419 // reports was set via SetMergeSessionParams()). | 473 // reports was set via SetMergeSessionParams()). |
420 SetSignFormField("Email", "fake_user"); | 474 SetSignFormField("Email", "fake_user"); |
421 SetSignFormField("Password", "fake_password"); | 475 SetSignFormField("Password", "fake_password"); |
422 ExecuteJsInSigninFrame("document.getElementById('IdPForm').submit();"); | 476 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); |
423 | 477 |
424 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); | 478 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); |
425 | 479 |
426 SendConfirmPassword("fake_password"); | 480 SendConfirmPassword("fake_password"); |
427 content::WindowedNotificationObserver( | 481 content::WindowedNotificationObserver( |
428 chrome::NOTIFICATION_SESSION_STARTED, | 482 chrome::NOTIFICATION_SESSION_STARTED, |
429 content::NotificationService::AllSources()).Wait(); | 483 content::NotificationService::AllSources()).Wait(); |
430 const User* user = UserManager::Get()->GetActiveUser(); | 484 const User* user = UserManager::Get()->GetActiveUser(); |
431 ASSERT_TRUE(user); | 485 ASSERT_TRUE(user); |
432 EXPECT_EQ(kUserEmail, user->email()); | 486 EXPECT_EQ(kUserEmail, user->email()); |
433 } | 487 } |
434 | 488 |
435 | 489 |
436 } // namespace chromeos | 490 } // namespace chromeos |
OLD | NEW |