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

Unified Diff: chrome/browser/policy/policy_browsertest.cc

Issue 2746853002: Change MediaStreamDevicesController::RequestPermissions to use the requesting WebContents (Closed)
Patch Set: Change MediaStreamDevicesController::RequestPermissions to use the requesting WebContents 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/permissions/permission_request_manager_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/policy_browsertest.cc
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index e337a926fa2dbc38b02b70b00bdad5f90da7dc78..04f4dfd51e4de610808a48036d4d6ef55871167c 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -3158,6 +3158,26 @@ class MediaStreamDevicesControllerBrowserTest
}
virtual ~MediaStreamDevicesControllerBrowserTest() {}
+ void SetUpOnMainThread() override {
+ PolicyTest::SetUpOnMainThread();
+ ui_test_utils::NavigateToURL(browser(), request_url_);
+ }
+
+ content::MediaStreamRequest CreateRequest(
+ content::MediaStreamType audio_request_type,
+ content::MediaStreamType video_request_type) {
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ EXPECT_EQ(request_url_,
+ web_contents->GetMainFrame()->GetLastCommittedURL());
+ int render_process_id = web_contents->GetRenderProcessHost()->GetID();
+ int render_frame_id = web_contents->GetMainFrame()->GetRoutingID();
+ return content::MediaStreamRequest(
+ render_process_id, render_frame_id, 0, request_url_.GetOrigin(), false,
+ content::MEDIA_DEVICE_ACCESS, std::string(), std::string(),
+ audio_request_type, video_request_type, false);
+ }
+
// Configure a given policy map. The |policy_name| is the name of either the
// audio or video capture allow policy and must never be NULL.
// |whitelist_policy| and |allow_rule| are optional. If NULL, no whitelist
@@ -3201,14 +3221,12 @@ class MediaStreamDevicesControllerBrowserTest
}
void FinishAudioTest() {
- content::MediaStreamRequest request(
- 0, 0, 0, request_url_.GetOrigin(), false, content::MEDIA_DEVICE_ACCESS,
- std::string(), std::string(), content::MEDIA_DEVICE_AUDIO_CAPTURE,
- content::MEDIA_NO_SERVICE, false);
+ content::MediaStreamRequest request(CreateRequest(
+ content::MEDIA_DEVICE_AUDIO_CAPTURE, content::MEDIA_NO_SERVICE));
// TODO(raymes): Test MEDIA_DEVICE_OPEN (Pepper) which grants both webcam
// and microphone permissions at the same time.
MediaStreamDevicesController::RequestPermissionsWithDelegate(
- browser()->tab_strip_model()->GetActiveWebContents(), request,
+ request,
base::Bind(&MediaStreamDevicesControllerBrowserTest::Accept,
base::Unretained(this)),
&prompt_delegate_);
@@ -3217,14 +3235,12 @@ class MediaStreamDevicesControllerBrowserTest
}
void FinishVideoTest() {
- content::MediaStreamRequest request(
- 0, 0, 0, request_url_.GetOrigin(), false, content::MEDIA_DEVICE_ACCESS,
- std::string(), std::string(), content::MEDIA_NO_SERVICE,
- content::MEDIA_DEVICE_VIDEO_CAPTURE, false);
+ content::MediaStreamRequest request(CreateRequest(
+ content::MEDIA_NO_SERVICE, content::MEDIA_DEVICE_VIDEO_CAPTURE));
// TODO(raymes): Test MEDIA_DEVICE_OPEN (Pepper) which grants both webcam
// and microphone permissions at the same time.
MediaStreamDevicesController::RequestPermissionsWithDelegate(
- browser()->tab_strip_model()->GetActiveWebContents(), request,
+ request,
base::Bind(&MediaStreamDevicesControllerBrowserTest::Accept,
base::Unretained(this)),
&prompt_delegate_);
« no previous file with comments | « chrome/browser/permissions/permission_request_manager_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698