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

Unified Diff: chrome/browser/chromeos/login/saml/saml_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
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/chromeos/login/ui/webui_login_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/saml/saml_browsertest.cc
diff --git a/chrome/browser/chromeos/login/saml/saml_browsertest.cc b/chrome/browser/chromeos/login/saml/saml_browsertest.cc
index 35216ecf761abf4a8babd00d8555f9e9215da6a8..b46f31a64a9a3e9aed7ef3710526b7831ad7794c 100644
--- a/chrome/browser/chromeos/login/saml/saml_browsertest.cc
+++ b/chrome/browser/chromeos/login/saml/saml_browsertest.cc
@@ -42,7 +42,7 @@
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
-#include "chrome/browser/media/webrtc/media_permission.h"
+#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "chrome/browser/policy/test/local_policy_test_server.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/signin/signin_utils.h"
@@ -1442,48 +1442,37 @@ IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, TestLoginMediaPermission) {
WaitForSigninScreen();
content::WebContents* web_contents = GetLoginUI()->GetWebContents();
- Profile* profile =
- Profile::FromBrowserContext(web_contents->GetBrowserContext());
- content::MediaStreamRequestResult reason;
// Mic should always be blocked.
- {
- MediaPermission permission(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, url1,
- url1, profile, web_contents);
- EXPECT_EQ(CONTENT_SETTING_BLOCK, permission.GetPermissionStatus(&reason));
- }
+ EXPECT_FALSE(
+ MediaCaptureDevicesDispatcher::GetInstance()->CheckMediaAccessPermission(
+ web_contents, url1, content::MEDIA_DEVICE_AUDIO_CAPTURE));
// Camera should be allowed if allowed by the whitelist, otherwise blocked.
- {
- MediaPermission permission(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, url1,
- url1, profile, web_contents);
- EXPECT_EQ(CONTENT_SETTING_ALLOW, permission.GetPermissionStatus(&reason));
- }
+ EXPECT_TRUE(
+ MediaCaptureDevicesDispatcher::GetInstance()->CheckMediaAccessPermission(
+ web_contents, url1, content::MEDIA_DEVICE_VIDEO_CAPTURE));
- {
- MediaPermission permission(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, url2,
- url2, profile, web_contents);
- EXPECT_EQ(CONTENT_SETTING_ALLOW, permission.GetPermissionStatus(&reason));
- }
+ EXPECT_TRUE(
+ MediaCaptureDevicesDispatcher::GetInstance()->CheckMediaAccessPermission(
+ web_contents, url2, content::MEDIA_DEVICE_VIDEO_CAPTURE));
- {
- MediaPermission permission(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, url3,
- url3, profile, web_contents);
- EXPECT_EQ(CONTENT_SETTING_BLOCK, permission.GetPermissionStatus(&reason));
- }
+ EXPECT_FALSE(
+ MediaCaptureDevicesDispatcher::GetInstance()->CheckMediaAccessPermission(
+ web_contents, url3, content::MEDIA_DEVICE_VIDEO_CAPTURE));
// Camera should be blocked in the login screen, even if it's allowed via
// content setting.
- {
- HostContentSettingsMapFactory::GetForProfile(profile)
- ->SetContentSettingDefaultScope(
- url3, url3, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string(),
- CONTENT_SETTING_ALLOW);
-
- MediaPermission permission(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, url3,
- url3, profile, web_contents);
- EXPECT_EQ(CONTENT_SETTING_BLOCK, permission.GetPermissionStatus(&reason));
- }
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ HostContentSettingsMapFactory::GetForProfile(profile)
+ ->SetContentSettingDefaultScope(url3, url3,
+ CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
+ std::string(), CONTENT_SETTING_ALLOW);
+
+ EXPECT_FALSE(
+ MediaCaptureDevicesDispatcher::GetInstance()->CheckMediaAccessPermission(
+ web_contents, url3, content::MEDIA_DEVICE_VIDEO_CAPTURE));
}
} // namespace chromeos
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/chromeos/login/ui/webui_login_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698