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

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 SAML access logic into MediaAccessHandler Created 3 years, 9 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/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..661c61d87173d142f7026f87c9b702c9306f70eb 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,44 @@ 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_EQ(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_EQ(
Sergey Ulanov 2017/03/15 22:48:30 EXPECT_TRUE(..) Same for other EXPECT_EQ() in this
raymes 2017/03/16 02:30:37 Thanks, done.
+ 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_EQ(
+ 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_EQ(
Sergey Ulanov 2017/03/15 22:48:30 EXPECT_FALSE
raymes 2017/03/16 02:30:37 Done.
+ 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_EQ(
+ false,
+ MediaCaptureDevicesDispatcher::GetInstance()->CheckMediaAccessPermission(
+ web_contents, url3, content::MEDIA_DEVICE_VIDEO_CAPTURE));
}
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698