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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 795703003: Don't auto allow access to media devices unless a the security origin of the requester is the same … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win compile. Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after
3356 scoped_ptr<content::MediaStreamUI> ui) { 3356 scoped_ptr<content::MediaStreamUI> ui) {
3357 if (policy_value_ || request_url_allowed_via_whitelist_) { 3357 if (policy_value_ || request_url_allowed_via_whitelist_) {
3358 ASSERT_EQ(1U, devices.size()); 3358 ASSERT_EQ(1U, devices.size());
3359 ASSERT_EQ("fake_dev", devices[0].id); 3359 ASSERT_EQ("fake_dev", devices[0].id);
3360 } else { 3360 } else {
3361 ASSERT_EQ(0U, devices.size()); 3361 ASSERT_EQ(0U, devices.size());
3362 } 3362 }
3363 } 3363 }
3364 3364
3365 void FinishAudioTest() { 3365 void FinishAudioTest() {
3366 content::MediaStreamRequest request(0, 0, 0, 3366 content::MediaStreamRequest request(0, 0, 0, std::string(),
3367 request_url_.GetOrigin(), false, 3367 request_url_.GetOrigin(), false,
3368 content::MEDIA_DEVICE_ACCESS, 3368 content::MEDIA_DEVICE_ACCESS,
3369 std::string(), std::string(), 3369 std::string(), std::string(),
3370 content::MEDIA_DEVICE_AUDIO_CAPTURE, 3370 content::MEDIA_DEVICE_AUDIO_CAPTURE,
3371 content::MEDIA_NO_SERVICE); 3371 content::MEDIA_NO_SERVICE);
3372 // TODO(raymes): Test MEDIA_DEVICE_OPEN (Pepper) which grants both webcam 3372 // TODO(raymes): Test MEDIA_DEVICE_OPEN (Pepper) which grants both webcam
3373 // and microphone permissions at the same time. 3373 // and microphone permissions at the same time.
3374 MediaStreamDevicesController controller( 3374 MediaStreamDevicesController controller(
3375 browser()->tab_strip_model()->GetActiveWebContents(), request, 3375 browser()->tab_strip_model()->GetActiveWebContents(), request,
3376 base::Bind(&MediaStreamDevicesControllerBrowserTest::Accept, this)); 3376 base::Bind(&MediaStreamDevicesControllerBrowserTest::Accept, this));
3377 controller.Accept(false); 3377 controller.Accept(false);
3378 3378
3379 base::MessageLoop::current()->QuitWhenIdle(); 3379 base::MessageLoop::current()->QuitWhenIdle();
3380 } 3380 }
3381 3381
3382 void FinishVideoTest() { 3382 void FinishVideoTest() {
3383 // TODO(raymes): Test MEDIA_DEVICE_OPEN (Pepper) which grants both webcam 3383 // TODO(raymes): Test MEDIA_DEVICE_OPEN (Pepper) which grants both webcam
3384 // and microphone permissions at the same time. 3384 // and microphone permissions at the same time.
3385 content::MediaStreamRequest request(0, 0, 0, 3385 content::MediaStreamRequest request(0, 0, 0, std::string(),
3386 request_url_.GetOrigin(), false, 3386 request_url_.GetOrigin(), false,
3387 content::MEDIA_DEVICE_ACCESS, 3387 content::MEDIA_DEVICE_ACCESS,
3388 std::string(), 3388 std::string(),
3389 std::string(), 3389 std::string(),
3390 content::MEDIA_NO_SERVICE, 3390 content::MEDIA_NO_SERVICE,
3391 content::MEDIA_DEVICE_VIDEO_CAPTURE); 3391 content::MEDIA_DEVICE_VIDEO_CAPTURE);
3392 MediaStreamDevicesController controller( 3392 MediaStreamDevicesController controller(
3393 browser()->tab_strip_model()->GetActiveWebContents(), request, 3393 browser()->tab_strip_model()->GetActiveWebContents(), request,
3394 base::Bind(&MediaStreamDevicesControllerBrowserTest::Accept, this)); 3394 base::Bind(&MediaStreamDevicesControllerBrowserTest::Accept, this));
3395 controller.Accept(false); 3395 controller.Accept(false);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 3625 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
3626 browser2->tab_strip_model()->GetActiveWebContents(), 3626 browser2->tab_strip_model()->GetActiveWebContents(),
3627 "domAutomationController.send(window.showModalDialog !== undefined);", 3627 "domAutomationController.send(window.showModalDialog !== undefined);",
3628 &result)); 3628 &result));
3629 EXPECT_TRUE(result); 3629 EXPECT_TRUE(result);
3630 } 3630 }
3631 3631
3632 #endif // !defined(CHROME_OS) 3632 #endif // !defined(CHROME_OS)
3633 3633
3634 } // namespace policy 3634 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698