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

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

Issue 1828803003: Media permissions: Remove plumbing for insecure pepper requests in Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments and fix tests Created 4 years, 6 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
« no previous file with comments | « chrome/browser/media/permission_bubble_media_access_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 // BookmarkBarEnabled has policy ID 82. 3245 // BookmarkBarEnabled has policy ID 82.
3246 EXPECT_NE(std::string::npos, text.find("<br>82 ---")); 3246 EXPECT_NE(std::string::npos, text.find("<br>82 ---"));
3247 } 3247 }
3248 3248
3249 class MediaStreamDevicesControllerBrowserTest 3249 class MediaStreamDevicesControllerBrowserTest
3250 : public PolicyTest, 3250 : public PolicyTest,
3251 public testing::WithParamInterface<bool> { 3251 public testing::WithParamInterface<bool> {
3252 public: 3252 public:
3253 MediaStreamDevicesControllerBrowserTest() 3253 MediaStreamDevicesControllerBrowserTest()
3254 : request_url_allowed_via_whitelist_(false), 3254 : request_url_allowed_via_whitelist_(false),
3255 request_url_("http://www.example.com/foo") { 3255 request_url_("https://www.example.com/foo") {
3256 policy_value_ = GetParam(); 3256 policy_value_ = GetParam();
3257 } 3257 }
3258 virtual ~MediaStreamDevicesControllerBrowserTest() {} 3258 virtual ~MediaStreamDevicesControllerBrowserTest() {}
3259 3259
3260 // Configure a given policy map. The |policy_name| is the name of either the 3260 // Configure a given policy map. The |policy_name| is the name of either the
3261 // audio or video capture allow policy and must never be NULL. 3261 // audio or video capture allow policy and must never be NULL.
3262 // |whitelist_policy| and |allow_rule| are optional. If NULL, no whitelist 3262 // |whitelist_policy| and |allow_rule| are optional. If NULL, no whitelist
3263 // policy is set. If non-NULL, the whitelist policy is set to contain either 3263 // policy is set. If non-NULL, the whitelist policy is set to contain either
3264 // the |allow_rule| (if non-NULL) or an "allow all" wildcard. 3264 // the |allow_rule| (if non-NULL) or an "allow all" wildcard.
3265 void ConfigurePolicyMap(PolicyMap* policies, const char* policy_name, 3265 void ConfigurePolicyMap(PolicyMap* policies, const char* policy_name,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
3338 } 3338 }
3339 3339
3340 bool policy_value_; 3340 bool policy_value_;
3341 bool request_url_allowed_via_whitelist_; 3341 bool request_url_allowed_via_whitelist_;
3342 GURL request_url_; 3342 GURL request_url_;
3343 static const char kExampleRequestPattern[]; 3343 static const char kExampleRequestPattern[];
3344 }; 3344 };
3345 3345
3346 // static 3346 // static
3347 const char MediaStreamDevicesControllerBrowserTest::kExampleRequestPattern[] = 3347 const char MediaStreamDevicesControllerBrowserTest::kExampleRequestPattern[] =
3348 "http://[*.]example.com/"; 3348 "https://[*.]example.com/";
3349 3349
3350 IN_PROC_BROWSER_TEST_P(MediaStreamDevicesControllerBrowserTest, 3350 IN_PROC_BROWSER_TEST_P(MediaStreamDevicesControllerBrowserTest,
3351 AudioCaptureAllowed) { 3351 AudioCaptureAllowed) {
3352 content::MediaStreamDevices audio_devices; 3352 content::MediaStreamDevices audio_devices;
3353 content::MediaStreamDevice fake_audio_device( 3353 content::MediaStreamDevice fake_audio_device(
3354 content::MEDIA_DEVICE_AUDIO_CAPTURE, "fake_dev", "Fake Audio Device"); 3354 content::MEDIA_DEVICE_AUDIO_CAPTURE, "fake_dev", "Fake Audio Device");
3355 audio_devices.push_back(fake_audio_device); 3355 audio_devices.push_back(fake_audio_device);
3356 3356
3357 PolicyMap policies; 3357 PolicyMap policies;
3358 ConfigurePolicyMap(&policies, key::kAudioCaptureAllowed, NULL, NULL); 3358 ConfigurePolicyMap(&policies, key::kAudioCaptureAllowed, NULL, NULL);
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
4031 4031
4032 SetEmptyPolicy(); 4032 SetEmptyPolicy();
4033 // Policy not set. 4033 // Policy not set.
4034 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); 4034 CheckSystemTimezoneAutomaticDetectionPolicyUnset();
4035 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); 4035 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false));
4036 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); 4036 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests());
4037 } 4037 }
4038 #endif // defined(OS_CHROMEOS) 4038 #endif // defined(OS_CHROMEOS)
4039 4039
4040 } // namespace policy 4040 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/media/permission_bubble_media_access_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698