OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/permissions/permission_context_base.h" | 5 #include "chrome/browser/permissions/permission_context_base.h" |
6 | 6 |
| 7 #include <vector> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
11 #include "base/test/mock_entropy_provider.h" | 13 #include "base/test/mock_entropy_provider.h" |
12 #include "build/build_config.h" | 14 #include "build/build_config.h" |
13 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 15 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
14 #include "chrome/browser/infobars/infobar_service.h" | 16 #include "chrome/browser/infobars/infobar_service.h" |
15 #include "chrome/browser/permissions/permission_queue_controller.h" | 17 #include "chrome/browser/permissions/permission_queue_controller.h" |
16 #include "chrome/browser/permissions/permission_request_id.h" | 18 #include "chrome/browser/permissions/permission_request_id.h" |
17 #include "chrome/browser/permissions/permission_util.h" | 19 #include "chrome/browser/permissions/permission_util.h" |
18 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 20 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
19 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 22 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
21 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
22 #include "components/content_settings/core/browser/host_content_settings_map.h" | 24 #include "components/content_settings/core/browser/host_content_settings_map.h" |
23 #include "components/content_settings/core/common/content_settings.h" | 25 #include "components/content_settings/core/common/content_settings.h" |
24 #include "components/content_settings/core/common/content_settings_types.h" | 26 #include "components/content_settings/core/common/content_settings_types.h" |
25 #include "components/variations/variations_associated_data.h" | 27 #include "components/variations/variations_associated_data.h" |
26 #include "content/public/browser/permission_type.h" | 28 #include "content/public/browser/permission_type.h" |
27 #include "content/public/browser/render_frame_host.h" | 29 #include "content/public/browser/render_frame_host.h" |
28 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
29 #include "content/public/test/mock_render_process_host.h" | 31 #include "content/public/test/mock_render_process_host.h" |
30 #include "content/public/test/web_contents_tester.h" | |
31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
32 | 33 |
33 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
34 #include "chrome/browser/permissions/permission_queue_controller.h" | 35 #include "chrome/browser/permissions/permission_queue_controller.h" |
35 #else | 36 #else |
36 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 37 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
37 #endif | 38 #endif |
38 | 39 |
39 const char* kPermissionsKillSwitchFieldStudy = | 40 const char* kPermissionsKillSwitchFieldStudy = |
40 PermissionContextBase::kPermissionsKillSwitchFieldStudy; | 41 PermissionContextBase::kPermissionsKillSwitchFieldStudy; |
41 const char* kPermissionsKillSwitchBlockedValue = | 42 const char* kPermissionsKillSwitchBlockedValue = |
42 PermissionContextBase::kPermissionsKillSwitchBlockedValue; | 43 PermissionContextBase::kPermissionsKillSwitchBlockedValue; |
43 const char kPermissionsKillSwitchTestGroup[] = "TestGroup"; | 44 const char kPermissionsKillSwitchTestGroup[] = "TestGroup"; |
44 | 45 |
45 class TestPermissionContext : public PermissionContextBase { | 46 class TestPermissionContext : public PermissionContextBase { |
46 public: | 47 public: |
47 TestPermissionContext(Profile* profile, | 48 TestPermissionContext(Profile* profile, |
48 const content::PermissionType permission_type, | 49 const content::PermissionType permission_type, |
49 const ContentSettingsType content_settings_type) | 50 const ContentSettingsType content_settings_type) |
50 : PermissionContextBase(profile, permission_type, content_settings_type), | 51 : PermissionContextBase(profile, permission_type, content_settings_type), |
51 permission_set_(false), | |
52 permission_granted_(false), | |
53 tab_context_updated_(false), | 52 tab_context_updated_(false), |
54 field_trial_list_( | 53 field_trial_list_( |
55 new base::FieldTrialList(new base::MockEntropyProvider)) {} | 54 new base::FieldTrialList(new base::MockEntropyProvider)) {} |
56 | 55 |
57 ~TestPermissionContext() override {} | 56 ~TestPermissionContext() override {} |
58 | 57 |
59 #if defined(OS_ANDROID) | 58 #if defined(OS_ANDROID) |
60 PermissionQueueController* GetInfoBarController() { | 59 PermissionQueueController* GetInfoBarController() { |
61 return GetQueueController(); | 60 return GetQueueController(); |
62 } | 61 } |
63 #endif | 62 #endif |
64 | 63 |
65 bool permission_granted() { | 64 const std::vector<ContentSetting>& decisions() { return decisions_; } |
66 return permission_granted_; | |
67 } | |
68 | |
69 bool permission_set() { | |
70 return permission_set_; | |
71 } | |
72 | 65 |
73 bool tab_context_updated() { | 66 bool tab_context_updated() { |
74 return tab_context_updated_; | 67 return tab_context_updated_; |
75 } | 68 } |
76 | 69 |
77 void TrackPermissionDecision(ContentSetting content_setting) { | 70 void TrackPermissionDecision(ContentSetting content_setting) { |
78 permission_set_ = true; | 71 decisions_.push_back(content_setting); |
79 permission_granted_ = content_setting == CONTENT_SETTING_ALLOW; | |
80 } | 72 } |
81 | 73 |
82 void ResetFieldTrialList() { | 74 void ResetFieldTrialList() { |
83 // Destroy the existing FieldTrialList before creating a new one to avoid | 75 // Destroy the existing FieldTrialList before creating a new one to avoid |
84 // a DCHECK. | 76 // a DCHECK. |
85 field_trial_list_.reset(); | 77 field_trial_list_.reset(); |
86 field_trial_list_.reset(new base::FieldTrialList( | 78 field_trial_list_.reset(new base::FieldTrialList( |
87 new base::MockEntropyProvider)); | 79 new base::MockEntropyProvider)); |
88 variations::testing::ClearAllVariationParams(); | 80 variations::testing::ClearAllVariationParams(); |
89 } | 81 } |
(...skipping 10 matching lines...) Expand all Loading... |
100 const GURL& requesting_origin, | 92 const GURL& requesting_origin, |
101 bool allowed) override { | 93 bool allowed) override { |
102 tab_context_updated_ = true; | 94 tab_context_updated_ = true; |
103 } | 95 } |
104 | 96 |
105 bool IsRestrictedToSecureOrigins() const override { | 97 bool IsRestrictedToSecureOrigins() const override { |
106 return false; | 98 return false; |
107 } | 99 } |
108 | 100 |
109 private: | 101 private: |
110 bool permission_set_; | 102 std::vector<ContentSetting> decisions_; |
111 bool permission_granted_; | 103 bool tab_context_updated_; |
112 bool tab_context_updated_; | 104 scoped_ptr<base::FieldTrialList> field_trial_list_; |
113 scoped_ptr<base::FieldTrialList> field_trial_list_; | |
114 }; | 105 }; |
115 | 106 |
116 class PermissionContextBaseTests : public ChromeRenderViewHostTestHarness { | 107 class PermissionContextBaseTests : public ChromeRenderViewHostTestHarness { |
117 protected: | 108 protected: |
118 PermissionContextBaseTests() {} | 109 PermissionContextBaseTests() {} |
119 | 110 |
120 // Accept or dismiss the permission bubble or infobar. | 111 // Accept or dismiss the permission bubble or infobar. |
121 void RespondToPermission(TestPermissionContext* context, | 112 void RespondToPermission(TestPermissionContext* context, |
122 const PermissionRequestID& id, | 113 const PermissionRequestID& id, |
123 const GURL& url, | 114 const GURL& url, |
124 bool accept) { | 115 ContentSetting response) { |
| 116 DCHECK(response == CONTENT_SETTING_ALLOW || |
| 117 response == CONTENT_SETTING_BLOCK || |
| 118 response == CONTENT_SETTING_ASK); |
125 #if defined(OS_ANDROID) | 119 #if defined(OS_ANDROID) |
126 context->GetInfoBarController()->OnPermissionSet(id, url, url, accept, | 120 bool update_content_setting = response != CONTENT_SETTING_ASK; |
127 accept); | 121 bool allowed = response == CONTENT_SETTING_ALLOW; |
| 122 context->GetInfoBarController()->OnPermissionSet( |
| 123 id, url, url, update_content_setting, allowed); |
128 #else | 124 #else |
129 PermissionBubbleManager* manager = | 125 PermissionBubbleManager* manager = |
130 PermissionBubbleManager::FromWebContents(web_contents()); | 126 PermissionBubbleManager::FromWebContents(web_contents()); |
131 if (accept) | 127 switch (response) { |
132 manager->Accept(); | 128 case CONTENT_SETTING_ALLOW: |
133 else | 129 manager->Accept(); |
134 manager->Closing(); | 130 break; |
| 131 case CONTENT_SETTING_BLOCK: |
| 132 manager->Deny(); |
| 133 break; |
| 134 case CONTENT_SETTING_ASK: |
| 135 manager->Closing(); |
| 136 break; |
| 137 default: |
| 138 NOTREACHED(); |
| 139 } |
135 #endif | 140 #endif |
136 } | 141 } |
137 | 142 |
138 void TestAskAndGrant_TestContent() { | 143 void TestAskAndGrant_TestContent() { |
139 TestPermissionContext permission_context( | 144 TestPermissionContext permission_context( |
140 profile(), content::PermissionType::NOTIFICATIONS, | 145 profile(), content::PermissionType::NOTIFICATIONS, |
141 CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | 146 CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
142 GURL url("http://www.google.com"); | 147 GURL url("http://www.google.com"); |
143 content::WebContentsTester::For(web_contents())->NavigateAndCommit(url); | 148 NavigateAndCommit(url); |
144 | 149 |
145 const PermissionRequestID id( | 150 const PermissionRequestID id( |
146 web_contents()->GetRenderProcessHost()->GetID(), | 151 web_contents()->GetRenderProcessHost()->GetID(), |
147 web_contents()->GetMainFrame()->GetRoutingID(), | 152 web_contents()->GetMainFrame()->GetRoutingID(), |
148 -1); | 153 -1); |
149 permission_context.RequestPermission( | 154 permission_context.RequestPermission( |
150 web_contents(), | 155 web_contents(), |
151 id, url, true, | 156 id, url, true, |
152 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 157 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
153 base::Unretained(&permission_context))); | 158 base::Unretained(&permission_context))); |
154 | 159 |
155 RespondToPermission(&permission_context, id, url, true); | 160 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ALLOW); |
156 EXPECT_TRUE(permission_context.permission_set()); | 161 EXPECT_EQ(1u, permission_context.decisions().size()); |
157 EXPECT_TRUE(permission_context.permission_granted()); | 162 EXPECT_EQ(CONTENT_SETTING_ALLOW, permission_context.decisions()[0]); |
158 EXPECT_TRUE(permission_context.tab_context_updated()); | 163 EXPECT_TRUE(permission_context.tab_context_updated()); |
159 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 164 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
160 permission_context.GetContentSettingFromMap(url, url)); | 165 permission_context.GetContentSettingFromMap(url, url)); |
161 } | 166 } |
162 | 167 |
163 void TestAskAndDismiss_TestContent() { | 168 void TestAskAndDismiss_TestContent() { |
164 TestPermissionContext permission_context( | 169 TestPermissionContext permission_context( |
165 profile(), content::PermissionType::MIDI_SYSEX, | 170 profile(), content::PermissionType::MIDI_SYSEX, |
166 CONTENT_SETTINGS_TYPE_MIDI_SYSEX); | 171 CONTENT_SETTINGS_TYPE_MIDI_SYSEX); |
167 GURL url("http://www.google.es"); | 172 GURL url("http://www.google.es"); |
168 content::WebContentsTester::For(web_contents())->NavigateAndCommit(url); | 173 NavigateAndCommit(url); |
169 | 174 |
170 const PermissionRequestID id( | 175 const PermissionRequestID id( |
171 web_contents()->GetRenderProcessHost()->GetID(), | 176 web_contents()->GetRenderProcessHost()->GetID(), |
172 web_contents()->GetMainFrame()->GetRoutingID(), | 177 web_contents()->GetMainFrame()->GetRoutingID(), |
173 -1); | 178 -1); |
174 permission_context.RequestPermission( | 179 permission_context.RequestPermission( |
175 web_contents(), | 180 web_contents(), |
176 id, url, true, | 181 id, url, true, |
177 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 182 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
178 base::Unretained(&permission_context))); | 183 base::Unretained(&permission_context))); |
179 | 184 |
180 RespondToPermission(&permission_context, id, url, false); | 185 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ASK); |
181 EXPECT_TRUE(permission_context.permission_set()); | 186 EXPECT_EQ(1u, permission_context.decisions().size()); |
182 EXPECT_FALSE(permission_context.permission_granted()); | 187 EXPECT_EQ(CONTENT_SETTING_ASK, permission_context.decisions()[0]); |
183 EXPECT_TRUE(permission_context.tab_context_updated()); | 188 EXPECT_TRUE(permission_context.tab_context_updated()); |
184 EXPECT_EQ(CONTENT_SETTING_ASK, | 189 EXPECT_EQ(CONTENT_SETTING_ASK, |
185 permission_context.GetContentSettingFromMap(url, url)); | 190 permission_context.GetContentSettingFromMap(url, url)); |
186 } | 191 } |
187 | 192 |
188 void TestRequestPermissionInvalidUrl( | 193 void TestRequestPermissionInvalidUrl( |
189 content::PermissionType permission_type, | 194 content::PermissionType permission_type, |
190 ContentSettingsType content_settings_type) { | 195 ContentSettingsType content_settings_type) { |
191 TestPermissionContext permission_context(profile(), permission_type, | 196 TestPermissionContext permission_context(profile(), permission_type, |
192 content_settings_type); | 197 content_settings_type); |
193 GURL url; | 198 GURL url; |
194 ASSERT_FALSE(url.is_valid()); | 199 ASSERT_FALSE(url.is_valid()); |
195 content::WebContentsTester::For(web_contents())->NavigateAndCommit(url); | 200 NavigateAndCommit(url); |
196 | 201 |
197 const PermissionRequestID id( | 202 const PermissionRequestID id( |
198 web_contents()->GetRenderProcessHost()->GetID(), | 203 web_contents()->GetRenderProcessHost()->GetID(), |
199 web_contents()->GetMainFrame()->GetRoutingID(), | 204 web_contents()->GetMainFrame()->GetRoutingID(), |
200 -1); | 205 -1); |
201 permission_context.RequestPermission( | 206 permission_context.RequestPermission( |
202 web_contents(), | 207 web_contents(), |
203 id, url, true, | 208 id, url, true, |
204 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 209 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
205 base::Unretained(&permission_context))); | 210 base::Unretained(&permission_context))); |
206 | 211 |
207 EXPECT_TRUE(permission_context.permission_set()); | 212 EXPECT_EQ(1u, permission_context.decisions().size()); |
208 EXPECT_FALSE(permission_context.permission_granted()); | 213 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.decisions()[0]); |
209 EXPECT_TRUE(permission_context.tab_context_updated()); | 214 EXPECT_TRUE(permission_context.tab_context_updated()); |
210 EXPECT_EQ(CONTENT_SETTING_ASK, | 215 EXPECT_EQ(CONTENT_SETTING_ASK, |
211 permission_context.GetContentSettingFromMap(url, url)); | 216 permission_context.GetContentSettingFromMap(url, url)); |
212 } | 217 } |
213 | 218 |
214 void TestGrantAndRevoke_TestContent(content::PermissionType permission_type, | 219 void TestGrantAndRevoke_TestContent(content::PermissionType permission_type, |
215 ContentSettingsType content_settings_type, | 220 ContentSettingsType content_settings_type, |
216 ContentSetting expected_default) { | 221 ContentSetting expected_default) { |
217 TestPermissionContext permission_context(profile(), permission_type, | 222 TestPermissionContext permission_context(profile(), permission_type, |
218 content_settings_type); | 223 content_settings_type); |
219 GURL url("https://www.google.com"); | 224 GURL url("https://www.google.com"); |
220 content::WebContentsTester::For(web_contents())->NavigateAndCommit(url); | 225 NavigateAndCommit(url); |
221 | 226 |
222 const PermissionRequestID id( | 227 const PermissionRequestID id( |
223 web_contents()->GetRenderProcessHost()->GetID(), | 228 web_contents()->GetRenderProcessHost()->GetID(), |
224 web_contents()->GetMainFrame()->GetRoutingID(), | 229 web_contents()->GetMainFrame()->GetRoutingID(), |
225 -1); | 230 -1); |
226 permission_context.RequestPermission( | 231 permission_context.RequestPermission( |
227 web_contents(), | 232 web_contents(), |
228 id, url, true, | 233 id, url, true, |
229 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 234 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
230 base::Unretained(&permission_context))); | 235 base::Unretained(&permission_context))); |
231 | 236 |
232 RespondToPermission(&permission_context, id, url, true); | 237 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ALLOW); |
233 EXPECT_TRUE(permission_context.permission_set()); | 238 EXPECT_EQ(1u, permission_context.decisions().size()); |
234 EXPECT_TRUE(permission_context.permission_granted()); | 239 EXPECT_EQ(CONTENT_SETTING_ALLOW, permission_context.decisions()[0]); |
235 EXPECT_TRUE(permission_context.tab_context_updated()); | 240 EXPECT_TRUE(permission_context.tab_context_updated()); |
236 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 241 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
237 permission_context.GetContentSettingFromMap(url, url)); | 242 permission_context.GetContentSettingFromMap(url, url)); |
238 | 243 |
239 // Try to reset permission. | 244 // Try to reset permission. |
240 permission_context.ResetPermission(url.GetOrigin(), url.GetOrigin()); | 245 permission_context.ResetPermission(url.GetOrigin(), url.GetOrigin()); |
241 ContentSetting setting_after_reset = | 246 ContentSetting setting_after_reset = |
242 permission_context.GetContentSettingFromMap(url, url); | 247 permission_context.GetContentSettingFromMap(url, url); |
243 ContentSetting default_setting = | 248 ContentSetting default_setting = |
244 HostContentSettingsMapFactory::GetForProfile(profile()) | 249 HostContentSettingsMapFactory::GetForProfile(profile()) |
(...skipping 13 matching lines...) Expand all Loading... |
258 params[PermissionUtil::GetPermissionString(permission_type)] = | 263 params[PermissionUtil::GetPermissionString(permission_type)] = |
259 kPermissionsKillSwitchBlockedValue; | 264 kPermissionsKillSwitchBlockedValue; |
260 variations::AssociateVariationParams( | 265 variations::AssociateVariationParams( |
261 kPermissionsKillSwitchFieldStudy, kPermissionsKillSwitchTestGroup, | 266 kPermissionsKillSwitchFieldStudy, kPermissionsKillSwitchTestGroup, |
262 params); | 267 params); |
263 base::FieldTrialList::CreateFieldTrial(kPermissionsKillSwitchFieldStudy, | 268 base::FieldTrialList::CreateFieldTrial(kPermissionsKillSwitchFieldStudy, |
264 kPermissionsKillSwitchTestGroup); | 269 kPermissionsKillSwitchTestGroup); |
265 EXPECT_TRUE(permission_context.IsPermissionKillSwitchOn()); | 270 EXPECT_TRUE(permission_context.IsPermissionKillSwitchOn()); |
266 } | 271 } |
267 | 272 |
| 273 // Don't call this more than once in the same test, as it persists data to |
| 274 // HostContentSettingsMap. |
| 275 void TestParallelRequests(ContentSetting response) { |
| 276 TestPermissionContext permission_context( |
| 277 profile(), content::PermissionType::NOTIFICATIONS, |
| 278 CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
| 279 GURL url("http://www.google.com"); |
| 280 NavigateAndCommit(url); |
| 281 |
| 282 const PermissionRequestID id0( |
| 283 web_contents()->GetRenderProcessHost()->GetID(), |
| 284 web_contents()->GetMainFrame()->GetRoutingID(), 0); |
| 285 const PermissionRequestID id1( |
| 286 web_contents()->GetRenderProcessHost()->GetID(), |
| 287 web_contents()->GetMainFrame()->GetRoutingID(), 1); |
| 288 |
| 289 permission_context.RequestPermission( |
| 290 web_contents(), id0, url, true, |
| 291 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
| 292 base::Unretained(&permission_context))); |
| 293 permission_context.RequestPermission( |
| 294 web_contents(), id1, url, true, |
| 295 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
| 296 base::Unretained(&permission_context))); |
| 297 |
| 298 EXPECT_EQ(0u, permission_context.decisions().size()); |
| 299 |
| 300 RespondToPermission(&permission_context, id0, url, response); |
| 301 |
| 302 EXPECT_EQ(2u, permission_context.decisions().size()); |
| 303 EXPECT_EQ(response, permission_context.decisions()[0]); |
| 304 EXPECT_EQ(response, permission_context.decisions()[1]); |
| 305 EXPECT_TRUE(permission_context.tab_context_updated()); |
| 306 |
| 307 EXPECT_EQ(response, permission_context.GetContentSettingFromMap(url, url)); |
| 308 } |
| 309 |
268 private: | 310 private: |
269 // ChromeRenderViewHostTestHarness: | 311 // ChromeRenderViewHostTestHarness: |
270 void SetUp() override { | 312 void SetUp() override { |
271 ChromeRenderViewHostTestHarness::SetUp(); | 313 ChromeRenderViewHostTestHarness::SetUp(); |
272 #if defined(OS_ANDROID) | 314 #if defined(OS_ANDROID) |
273 InfoBarService::CreateForWebContents(web_contents()); | 315 InfoBarService::CreateForWebContents(web_contents()); |
274 #else | 316 #else |
275 PermissionBubbleManager::CreateForWebContents(web_contents()); | 317 PermissionBubbleManager::CreateForWebContents(web_contents()); |
276 #endif | 318 #endif |
277 } | 319 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 408 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
367 TestGlobalPermissionsKillSwitch( | 409 TestGlobalPermissionsKillSwitch( |
368 content::PermissionType::PROTECTED_MEDIA_IDENTIFIER, | 410 content::PermissionType::PROTECTED_MEDIA_IDENTIFIER, |
369 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); | 411 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); |
370 #endif | 412 #endif |
371 TestGlobalPermissionsKillSwitch(content::PermissionType::AUDIO_CAPTURE, | 413 TestGlobalPermissionsKillSwitch(content::PermissionType::AUDIO_CAPTURE, |
372 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); | 414 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
373 TestGlobalPermissionsKillSwitch(content::PermissionType::VIDEO_CAPTURE, | 415 TestGlobalPermissionsKillSwitch(content::PermissionType::VIDEO_CAPTURE, |
374 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 416 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
375 } | 417 } |
| 418 |
| 419 TEST_F(PermissionContextBaseTests, TestParallelRequestsAllowed) { |
| 420 TestParallelRequests(CONTENT_SETTING_ALLOW); |
| 421 } |
| 422 |
| 423 TEST_F(PermissionContextBaseTests, TestParallelRequestsBlocked) { |
| 424 TestParallelRequests(CONTENT_SETTING_BLOCK); |
| 425 } |
| 426 |
| 427 TEST_F(PermissionContextBaseTests, TestParallelRequestsDismissed) { |
| 428 TestParallelRequests(CONTENT_SETTING_ASK); |
| 429 } |
OLD | NEW |