Chromium Code Reviews| Index: chrome/browser/chromeos/login/webview_login_browsertest.cc |
| diff --git a/chrome/browser/chromeos/login/webview_login_browsertest.cc b/chrome/browser/chromeos/login/webview_login_browsertest.cc |
| index 17c72b2a761495642e150e4763a5b498abf6b082..77ef4bb223f8bcaad2f8360e83f06369b443f48d 100644 |
| --- a/chrome/browser/chromeos/login/webview_login_browsertest.cc |
| +++ b/chrome/browser/chromeos/login/webview_login_browsertest.cc |
| @@ -9,6 +9,7 @@ |
| #include "chromeos/chromeos_switches.h" |
| #include "content/public/test/browser_test_utils.h" |
| #include "content/public/test/test_utils.h" |
| +#include "media/base/media_switches.h" |
| namespace chromeos { |
| @@ -19,6 +20,7 @@ class WebviewLoginTest : public OobeBaseTest { |
| void SetUpCommandLine(base::CommandLine* command_line) override { |
| command_line->AppendSwitch(switches::kOobeSkipPostLogin); |
| + command_line->AppendSwitch(::switches::kUseFakeDeviceForMediaStream); |
| OobeBaseTest::SetUpCommandLine(command_line); |
| } |
| @@ -131,4 +133,32 @@ IN_PROC_BROWSER_TEST_F(WebviewLoginTest, EmailPrefill) { |
| EXPECT_EQ(fake_gaia_->prefilled_email(), "user@example.com"); |
| } |
| +// Tests that requesting webcam access from the login screen works correctly. |
| +// This is needed for taking profile pictures. |
| +IN_PROC_BROWSER_TEST_F(WebviewLoginTest, RequestCamera) { |
|
achuithb
2017/04/05 00:55:36
Thanks for adding this.
|
| + WaitForGaiaPageLoad(); |
| + |
| + // Video devices should be allowed from the login screen. |
| + content::WebContents* web_contents = GetLoginUI()->GetWebContents(); |
| + bool getUserMediaSuccess = false; |
| + ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| + web_contents->GetMainFrame(), |
| + "navigator.getUserMedia(" |
| + " {video: true}," |
| + " function() { window.domAutomationController.send(true); }," |
| + " function() { window.domAutomationController.send(false); });", |
| + &getUserMediaSuccess)); |
| + ASSERT_TRUE(getUserMediaSuccess); |
|
emaxx
2017/04/06 02:41:47
nit: Replace with EXPECT_TRUE here and in other pl
raymes
2017/04/10 00:16:48
Done.
|
| + |
| + // Audio devices should be denied from the login screen. |
| + ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| + web_contents->GetMainFrame(), |
| + "navigator.getUserMedia(" |
| + " {audio: true}," |
| + " function() { window.domAutomationController.send(true); }," |
| + " function() { window.domAutomationController.send(false); });", |
| + &getUserMediaSuccess)); |
| + ASSERT_FALSE(getUserMediaSuccess); |
| +} |
| + |
| } // namespace chromeos |