OLD | NEW |
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 <cstring> | 5 #include <cstring> |
6 #include <memory> | 6 #include <memory> |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 fake_gaia_->SetFakeMergeSessionParams( | 351 fake_gaia_->SetFakeMergeSessionParams( |
352 kFirstSAMLUserEmail, kTestAuthSIDCookie1, kTestAuthLSIDCookie1); | 352 kFirstSAMLUserEmail, kTestAuthSIDCookie1, kTestAuthLSIDCookie1); |
353 | 353 |
354 embedded_test_server()->RegisterRequestHandler(base::Bind( | 354 embedded_test_server()->RegisterRequestHandler(base::Bind( |
355 &FakeSamlIdp::HandleRequest, base::Unretained(&fake_saml_idp_))); | 355 &FakeSamlIdp::HandleRequest, base::Unretained(&fake_saml_idp_))); |
356 | 356 |
357 OobeBaseTest::SetUpOnMainThread(); | 357 OobeBaseTest::SetUpOnMainThread(); |
358 } | 358 } |
359 | 359 |
360 void SetupAuthFlowChangeListener() { | 360 void SetupAuthFlowChangeListener() { |
361 ASSERT_TRUE(content::ExecuteScript( | 361 content::ExecuteUnmodifiedScript( |
362 GetLoginUI()->GetWebContents(), | 362 GetLoginUI()->GetWebContents(), |
363 "$('gaia-signin').gaiaAuthHost_.addEventListener('authFlowChange'," | 363 "$('gaia-signin').gaiaAuthHost_.addEventListener('authFlowChange'," |
364 "function f() {" | 364 " function f() {" |
365 "$('gaia-signin').gaiaAuthHost_.removeEventListener(" | 365 " $('gaia-signin').gaiaAuthHost_.removeEventListener(" |
366 "'authFlowChange', f);" | 366 " 'authFlowChange', f);" |
367 "window.domAutomationController.setAutomationId(0);" | 367 " window.domAutomationController.setAutomationId(0);" |
368 "window.domAutomationController.send(" | 368 " window.domAutomationController.send(" |
369 "$('gaia-signin').isSAML() ? 'SamlLoaded' : 'GaiaLoaded');" | 369 " $('gaia-signin').isSAML() ? 'SamlLoaded' : 'GaiaLoaded');" |
370 "});")); | 370 " });"); |
371 } | 371 } |
372 | 372 |
373 virtual void StartSamlAndWaitForIdpPageLoad(const std::string& gaia_email) { | 373 virtual void StartSamlAndWaitForIdpPageLoad(const std::string& gaia_email) { |
374 WaitForSigninScreen(); | 374 WaitForSigninScreen(); |
375 | 375 |
376 SetupAuthFlowChangeListener(); | 376 SetupAuthFlowChangeListener(); |
377 | 377 |
378 content::DOMMessageQueue message_queue; // Start observe before SAML. | 378 content::DOMMessageQueue message_queue; // Start observe before SAML. |
379 GetLoginDisplay()->ShowSigninScreenForCreds(gaia_email, ""); | 379 GetLoginDisplay()->ShowSigninScreenForCreds(gaia_email, ""); |
380 | 380 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 JsExpect("$('gaia-signin').classList.contains('full-width')"); | 456 JsExpect("$('gaia-signin').classList.contains('full-width')"); |
457 JsExpect("!$('saml-notice-container').hidden"); | 457 JsExpect("!$('saml-notice-container').hidden"); |
458 std::string js = "$('saml-notice-message').textContent.indexOf('$Host') > -1"; | 458 std::string js = "$('saml-notice-message').textContent.indexOf('$Host') > -1"; |
459 base::ReplaceSubstringsAfterOffset(&js, 0, "$Host", kIdPHost); | 459 base::ReplaceSubstringsAfterOffset(&js, 0, "$Host", kIdPHost); |
460 JsExpect(js); | 460 JsExpect(js); |
461 | 461 |
462 SetupAuthFlowChangeListener(); | 462 SetupAuthFlowChangeListener(); |
463 | 463 |
464 // Click on 'cancel'. | 464 // Click on 'cancel'. |
465 content::DOMMessageQueue message_queue; // Observe before 'cancel'. | 465 content::DOMMessageQueue message_queue; // Observe before 'cancel'. |
466 ASSERT_TRUE( | 466 content::ExecuteUnmodifiedScript( |
467 content::ExecuteScript(GetLoginUI()->GetWebContents(), | 467 GetLoginUI()->GetWebContents(), |
468 "$('gaia-navigation').$.closeButton.click();")); | 468 "$('gaia-navigation').$.closeButton.click();"); |
469 | 469 |
470 // Auth flow should change back to Gaia. | 470 // Auth flow should change back to Gaia. |
471 std::string message; | 471 std::string message; |
472 do { | 472 do { |
473 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 473 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
474 } while (message != "\"GaiaLoaded\""); | 474 } while (message != "\"GaiaLoaded\""); |
475 | 475 |
476 // Saml flow is gone. | 476 // Saml flow is gone. |
477 JsExpect("!$('gaia-signin').classList.contains('full-width')"); | 477 JsExpect("!$('gaia-signin').classList.contains('full-width')"); |
478 } | 478 } |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 ->SetContentSettingDefaultScope(url3, url3, | 1477 ->SetContentSettingDefaultScope(url3, url3, |
1478 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, | 1478 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
1479 std::string(), CONTENT_SETTING_ALLOW); | 1479 std::string(), CONTENT_SETTING_ALLOW); |
1480 | 1480 |
1481 EXPECT_FALSE( | 1481 EXPECT_FALSE( |
1482 MediaCaptureDevicesDispatcher::GetInstance()->CheckMediaAccessPermission( | 1482 MediaCaptureDevicesDispatcher::GetInstance()->CheckMediaAccessPermission( |
1483 web_contents, url3, content::MEDIA_DEVICE_VIDEO_CAPTURE)); | 1483 web_contents, url3, content::MEDIA_DEVICE_VIDEO_CAPTURE)); |
1484 } | 1484 } |
1485 | 1485 |
1486 } // namespace chromeos | 1486 } // namespace chromeos |
OLD | NEW |