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

Unified Diff: chrome/browser/chromeos/login/webview_login_browsertest.cc

Issue 2746873004: Move ChromeOS login media access logic into a MediaAccessHandler (Closed)
Patch Set: Move ChromeOS login media access logic into a MediaAccessHandler Created 3 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 side-by-side diff with in-line comments
Download patch
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..98826f9a6f6b4dd8fec56e942348f352976c645f 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) {
+ 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));
+ EXPECT_TRUE(getUserMediaSuccess);
+
+ // 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));
+ EXPECT_FALSE(getUserMediaSuccess);
+}
+
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/ui/webui_login_view.cc ('k') | chrome/browser/media/chromeos_login_media_access_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698