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

Side by Side Diff: chrome/browser/permissions/permission_context_base_unittest.cc

Issue 2258763002: Add a feature-controlled persistence checkbox to geolocation prompts on desktop Views platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-infobardelegate-clean
Patch Set: Address comments Created 4 years, 4 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 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> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 }; 121 };
122 122
123 class PermissionContextBaseTests : public ChromeRenderViewHostTestHarness { 123 class PermissionContextBaseTests : public ChromeRenderViewHostTestHarness {
124 protected: 124 protected:
125 PermissionContextBaseTests() {} 125 PermissionContextBaseTests() {}
126 126
127 // Accept or dismiss the permission bubble or infobar. 127 // Accept or dismiss the permission bubble or infobar.
128 void RespondToPermission(TestPermissionContext* context, 128 void RespondToPermission(TestPermissionContext* context,
129 const PermissionRequestID& id, 129 const PermissionRequestID& id,
130 const GURL& url, 130 const GURL& url,
131 bool persist,
131 ContentSetting response) { 132 ContentSetting response) {
132 DCHECK(response == CONTENT_SETTING_ALLOW || 133 DCHECK(response == CONTENT_SETTING_ALLOW ||
133 response == CONTENT_SETTING_BLOCK || 134 response == CONTENT_SETTING_BLOCK ||
134 response == CONTENT_SETTING_ASK); 135 response == CONTENT_SETTING_ASK);
135 #if defined(OS_ANDROID) 136 #if defined(OS_ANDROID)
136 bool update_content_setting = response != CONTENT_SETTING_ASK;
137 PermissionAction decision = DISMISSED; 137 PermissionAction decision = DISMISSED;
138 if (response == CONTENT_SETTING_ALLOW) 138 if (response == CONTENT_SETTING_ALLOW)
139 decision = GRANTED; 139 decision = GRANTED;
140 else if (response == CONTENT_SETTING_BLOCK) 140 else if (response == CONTENT_SETTING_BLOCK)
141 decision = DENIED; 141 decision = DENIED;
142 context->GetInfoBarController()->OnPermissionSet( 142 context->GetInfoBarController()->OnPermissionSet(
143 id, url, url, false /* user_gesture */, update_content_setting, 143 id, url, url, false /* user_gesture */, persist, decision);
144 decision);
145 #else 144 #else
146 PermissionRequestManager* manager = 145 PermissionRequestManager* manager =
147 PermissionRequestManager::FromWebContents(web_contents()); 146 PermissionRequestManager::FromWebContents(web_contents());
147 manager->TogglePersist(persist);
148 switch (response) { 148 switch (response) {
149 case CONTENT_SETTING_ALLOW: 149 case CONTENT_SETTING_ALLOW:
150 manager->Accept(); 150 manager->Accept();
151 break; 151 break;
152 case CONTENT_SETTING_BLOCK: 152 case CONTENT_SETTING_BLOCK:
153 manager->Deny(); 153 manager->Deny();
154 break; 154 break;
155 case CONTENT_SETTING_ASK: 155 case CONTENT_SETTING_ASK:
156 manager->Closing(); 156 manager->Closing();
157 break; 157 break;
158 default: 158 default:
159 NOTREACHED(); 159 NOTREACHED();
160 } 160 }
161 #endif 161 #endif
162 } 162 }
163 163
164 void TestAskAndGrant_TestContent() { 164 void TestAskAndDecide_TestContent(content::PermissionType permission,
165 TestPermissionContext permission_context( 165 ContentSettingsType content_settings_type,
166 profile(), content::PermissionType::NOTIFICATIONS, 166 ContentSetting decision,
167 CONTENT_SETTINGS_TYPE_NOTIFICATIONS); 167 bool persist) {
168 GURL url("http://www.google.com"); 168 TestPermissionContext permission_context(profile(), permission,
169 content_settings_type);
170 GURL url("https://www.google.com");
169 NavigateAndCommit(url); 171 NavigateAndCommit(url);
170 base::HistogramTester histograms; 172 base::HistogramTester histograms;
171 173
172 const PermissionRequestID id( 174 const PermissionRequestID id(
173 web_contents()->GetRenderProcessHost()->GetID(), 175 web_contents()->GetRenderProcessHost()->GetID(),
174 web_contents()->GetMainFrame()->GetRoutingID(), 176 web_contents()->GetMainFrame()->GetRoutingID(),
175 -1); 177 -1);
176 permission_context.RequestPermission( 178 permission_context.RequestPermission(
177 web_contents(), 179 web_contents(),
178 id, url, true /* user_gesture */, 180 id, url, true /* user_gesture */,
179 base::Bind(&TestPermissionContext::TrackPermissionDecision, 181 base::Bind(&TestPermissionContext::TrackPermissionDecision,
180 base::Unretained(&permission_context))); 182 base::Unretained(&permission_context)));
181 183
182 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ALLOW); 184 RespondToPermission(&permission_context, id, url, persist, decision);
183 EXPECT_EQ(1u, permission_context.decisions().size()); 185 EXPECT_EQ(1u, permission_context.decisions().size());
184 EXPECT_EQ(CONTENT_SETTING_ALLOW, permission_context.decisions()[0]); 186 EXPECT_EQ(decision, permission_context.decisions()[0]);
185 EXPECT_TRUE(permission_context.tab_context_updated()); 187 EXPECT_TRUE(permission_context.tab_context_updated());
186 EXPECT_EQ(CONTENT_SETTING_ALLOW,
187 permission_context.GetContentSettingFromMap(url, url));
188 188
189 histograms.ExpectUniqueSample( 189 std::string decision_string = "";
190 "Permissions.Prompt.Accepted.PriorDismissCount.Notifications", 0, 1); 190 if (decision == CONTENT_SETTING_ALLOW)
191 histograms.ExpectUniqueSample( 191 decision_string = "Accepted";
192 "Permissions.Prompt.Accepted.PriorIgnoreCount.Notifications", 0, 1); 192 else if (decision == CONTENT_SETTING_BLOCK)
193 } 193 decision_string = "Denied";
194 else if (decision == CONTENT_SETTING_ASK)
195 decision_string = "Dismissed";
194 196
195 void TestAskAndDismiss_TestContent() { 197 if (decision_string.size()) {
raymes 2016/08/25 05:26:01 Prefer .empty() but is this ever empty? I think we
196 TestPermissionContext permission_context( 198 histograms.ExpectUniqueSample(
197 profile(), content::PermissionType::MIDI_SYSEX, 199 "Permissions.Prompt." + decision_string + ".PriorDismissCount." +
198 CONTENT_SETTINGS_TYPE_MIDI_SYSEX); 200 PermissionUtil::GetPermissionString(permission),
199 GURL url("http://www.google.es"); 201 0, 1);
200 NavigateAndCommit(url); 202 histograms.ExpectUniqueSample(
201 base::HistogramTester histograms; 203 "Permissions.Prompt." + decision_string + ".PriorIgnoreCount." +
204 PermissionUtil::GetPermissionString(permission),
205 0, 1);
206 }
202 207
203 const PermissionRequestID id( 208 if (persist) {
204 web_contents()->GetRenderProcessHost()->GetID(), 209 EXPECT_EQ(decision,
205 web_contents()->GetMainFrame()->GetRoutingID(), 210 permission_context.GetContentSettingFromMap(url, url));
206 -1); 211 } else {
207 permission_context.RequestPermission( 212 EXPECT_EQ(CONTENT_SETTING_ASK,
208 web_contents(), 213 permission_context.GetContentSettingFromMap(url, url));
209 id, url, true /* user_gesture */, 214 }
210 base::Bind(&TestPermissionContext::TrackPermissionDecision,
211 base::Unretained(&permission_context)));
212
213 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ASK);
214 EXPECT_EQ(1u, permission_context.decisions().size());
215 EXPECT_EQ(CONTENT_SETTING_ASK, permission_context.decisions()[0]);
216 EXPECT_TRUE(permission_context.tab_context_updated());
217 EXPECT_EQ(CONTENT_SETTING_ASK,
218 permission_context.GetContentSettingFromMap(url, url));
219
220 histograms.ExpectUniqueSample(
221 "Permissions.Prompt.Dismissed.PriorDismissCount.MidiSysEx", 0, 1);
222 histograms.ExpectUniqueSample(
223 "Permissions.Prompt.Dismissed.PriorIgnoreCount.MidiSysEx", 0, 1);
224 } 215 }
225 216
226 void DismissMultipleTimesAndExpectBlock( 217 void DismissMultipleTimesAndExpectBlock(
227 const GURL& url, 218 const GURL& url,
228 content::PermissionType permission_type, 219 content::PermissionType permission_type,
229 ContentSettingsType content_settings_type, 220 ContentSettingsType content_settings_type,
230 uint32_t iterations) { 221 uint32_t iterations) {
231 base::HistogramTester histograms; 222 base::HistogramTester histograms;
232 223
233 // Dismiss |iterations| times. The final dismiss should change the decision 224 // Dismiss |iterations| times. The final dismiss should change the decision
234 // from dismiss to block, and hence change the persisted content setting. 225 // from dismiss to block, and hence change the persisted content setting.
235 for (uint32_t i = 0; i < iterations; ++i) { 226 for (uint32_t i = 0; i < iterations; ++i) {
236 TestPermissionContext permission_context( 227 TestPermissionContext permission_context(
237 profile(), permission_type, content_settings_type); 228 profile(), permission_type, content_settings_type);
238 ContentSetting expected = 229 ContentSetting expected =
239 (i < (iterations - 1)) ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK; 230 (i < (iterations - 1)) ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK;
240 231
241 const PermissionRequestID id( 232 const PermissionRequestID id(
242 web_contents()->GetRenderProcessHost()->GetID(), 233 web_contents()->GetRenderProcessHost()->GetID(),
243 web_contents()->GetMainFrame()->GetRoutingID(), i); 234 web_contents()->GetMainFrame()->GetRoutingID(), i);
244 permission_context.RequestPermission( 235 permission_context.RequestPermission(
245 web_contents(), id, url, true /* user_gesture */, 236 web_contents(), id, url, true /* user_gesture */,
246 base::Bind(&TestPermissionContext::TrackPermissionDecision, 237 base::Bind(&TestPermissionContext::TrackPermissionDecision,
247 base::Unretained(&permission_context))); 238 base::Unretained(&permission_context)));
248 239
249 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ASK); 240 RespondToPermission(&permission_context, id, url, false, /* persist */
241 CONTENT_SETTING_ASK);
250 histograms.ExpectTotalCount( 242 histograms.ExpectTotalCount(
251 "Permissions.Prompt.Dismissed.PriorDismissCount." + 243 "Permissions.Prompt.Dismissed.PriorDismissCount." +
252 PermissionUtil::GetPermissionString(permission_type), 244 PermissionUtil::GetPermissionString(permission_type),
253 i + 1); 245 i + 1);
254 histograms.ExpectBucketCount( 246 histograms.ExpectBucketCount(
255 "Permissions.Prompt.Dismissed.PriorDismissCount." + 247 "Permissions.Prompt.Dismissed.PriorDismissCount." +
256 PermissionUtil::GetPermissionString(permission_type), 248 PermissionUtil::GetPermissionString(permission_type),
257 i, 1); 249 i, 1);
258 250
259 EXPECT_EQ(1u, permission_context.decisions().size()); 251 EXPECT_EQ(1u, permission_context.decisions().size());
(...skipping 22 matching lines...) Expand all
282 CONTENT_SETTINGS_TYPE_GEOLOCATION); 274 CONTENT_SETTINGS_TYPE_GEOLOCATION);
283 275
284 const PermissionRequestID id( 276 const PermissionRequestID id(
285 web_contents()->GetRenderProcessHost()->GetID(), 277 web_contents()->GetRenderProcessHost()->GetID(),
286 web_contents()->GetMainFrame()->GetRoutingID(), i); 278 web_contents()->GetMainFrame()->GetRoutingID(), i);
287 permission_context.RequestPermission( 279 permission_context.RequestPermission(
288 web_contents(), id, url, true /* user_gesture */, 280 web_contents(), id, url, true /* user_gesture */,
289 base::Bind(&TestPermissionContext::TrackPermissionDecision, 281 base::Bind(&TestPermissionContext::TrackPermissionDecision,
290 base::Unretained(&permission_context))); 282 base::Unretained(&permission_context)));
291 283
292 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ASK); 284 RespondToPermission(&permission_context, id, url, false, /* persist */
285 CONTENT_SETTING_ASK);
293 histograms.ExpectTotalCount( 286 histograms.ExpectTotalCount(
294 "Permissions.Prompt.Dismissed.PriorDismissCount.Geolocation", 287 "Permissions.Prompt.Dismissed.PriorDismissCount.Geolocation",
295 i + 1); 288 i + 1);
296 histograms.ExpectBucketCount( 289 histograms.ExpectBucketCount(
297 "Permissions.Prompt.Dismissed.PriorDismissCount.Geolocation", i, 1); 290 "Permissions.Prompt.Dismissed.PriorDismissCount.Geolocation", i, 1);
298 EXPECT_EQ(1u, permission_context.decisions().size()); 291 EXPECT_EQ(1u, permission_context.decisions().size());
299 EXPECT_EQ(CONTENT_SETTING_ASK, permission_context.decisions()[0]); 292 EXPECT_EQ(CONTENT_SETTING_ASK, permission_context.decisions()[0]);
300 EXPECT_TRUE(permission_context.tab_context_updated()); 293 EXPECT_TRUE(permission_context.tab_context_updated());
301 EXPECT_EQ(CONTENT_SETTING_ASK, 294 EXPECT_EQ(CONTENT_SETTING_ASK,
302 permission_context.GetContentSettingFromMap(url, url)); 295 permission_context.GetContentSettingFromMap(url, url));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 ContentSetting expected = 365 ContentSetting expected =
373 (i < 4) ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK; 366 (i < 4) ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK;
374 const PermissionRequestID id( 367 const PermissionRequestID id(
375 web_contents()->GetRenderProcessHost()->GetID(), 368 web_contents()->GetRenderProcessHost()->GetID(),
376 web_contents()->GetMainFrame()->GetRoutingID(), i); 369 web_contents()->GetMainFrame()->GetRoutingID(), i);
377 permission_context.RequestPermission( 370 permission_context.RequestPermission(
378 web_contents(), id, url, true /* user_gesture */, 371 web_contents(), id, url, true /* user_gesture */,
379 base::Bind(&TestPermissionContext::TrackPermissionDecision, 372 base::Bind(&TestPermissionContext::TrackPermissionDecision,
380 base::Unretained(&permission_context))); 373 base::Unretained(&permission_context)));
381 374
382 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ASK); 375 RespondToPermission(&permission_context, id, url, false, /* persist */
376 CONTENT_SETTING_ASK);
383 EXPECT_EQ(1u, permission_context.decisions().size()); 377 EXPECT_EQ(1u, permission_context.decisions().size());
384 EXPECT_EQ(expected, permission_context.decisions()[0]); 378 EXPECT_EQ(expected, permission_context.decisions()[0]);
385 EXPECT_TRUE(permission_context.tab_context_updated()); 379 EXPECT_TRUE(permission_context.tab_context_updated());
386 EXPECT_EQ(expected, 380 EXPECT_EQ(expected,
387 permission_context.GetContentSettingFromMap(url, url)); 381 permission_context.GetContentSettingFromMap(url, url));
388 382
389 histograms.ExpectTotalCount( 383 histograms.ExpectTotalCount(
390 "Permissions.Prompt.Dismissed.PriorDismissCount.MidiSysEx", i + 1); 384 "Permissions.Prompt.Dismissed.PriorDismissCount.MidiSysEx", i + 1);
391 histograms.ExpectBucketCount( 385 histograms.ExpectBucketCount(
392 "Permissions.Prompt.Dismissed.PriorDismissCount.MidiSysEx", i, 1); 386 "Permissions.Prompt.Dismissed.PriorDismissCount.MidiSysEx", i, 1);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 const PermissionRequestID id( 433 const PermissionRequestID id(
440 web_contents()->GetRenderProcessHost()->GetID(), 434 web_contents()->GetRenderProcessHost()->GetID(),
441 web_contents()->GetMainFrame()->GetRoutingID(), 435 web_contents()->GetMainFrame()->GetRoutingID(),
442 -1); 436 -1);
443 permission_context.RequestPermission( 437 permission_context.RequestPermission(
444 web_contents(), 438 web_contents(),
445 id, url, true /* user_gesture */, 439 id, url, true /* user_gesture */,
446 base::Bind(&TestPermissionContext::TrackPermissionDecision, 440 base::Bind(&TestPermissionContext::TrackPermissionDecision,
447 base::Unretained(&permission_context))); 441 base::Unretained(&permission_context)));
448 442
449 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ALLOW); 443 RespondToPermission(&permission_context, id, url, true, /* persist */
444 CONTENT_SETTING_ALLOW);
450 EXPECT_EQ(1u, permission_context.decisions().size()); 445 EXPECT_EQ(1u, permission_context.decisions().size());
451 EXPECT_EQ(CONTENT_SETTING_ALLOW, permission_context.decisions()[0]); 446 EXPECT_EQ(CONTENT_SETTING_ALLOW, permission_context.decisions()[0]);
452 EXPECT_TRUE(permission_context.tab_context_updated()); 447 EXPECT_TRUE(permission_context.tab_context_updated());
453 EXPECT_EQ(CONTENT_SETTING_ALLOW, 448 EXPECT_EQ(CONTENT_SETTING_ALLOW,
454 permission_context.GetContentSettingFromMap(url, url)); 449 permission_context.GetContentSettingFromMap(url, url));
455 450
456 // Try to reset permission. 451 // Try to reset permission.
457 permission_context.ResetPermission(url.GetOrigin(), url.GetOrigin()); 452 permission_context.ResetPermission(url.GetOrigin(), url.GetOrigin());
458 ContentSetting setting_after_reset = 453 ContentSetting setting_after_reset =
459 permission_context.GetContentSettingFromMap(url, url); 454 permission_context.GetContentSettingFromMap(url, url);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 web_contents(), id0, url, true /* user_gesture */, 497 web_contents(), id0, url, true /* user_gesture */,
503 base::Bind(&TestPermissionContext::TrackPermissionDecision, 498 base::Bind(&TestPermissionContext::TrackPermissionDecision,
504 base::Unretained(&permission_context))); 499 base::Unretained(&permission_context)));
505 permission_context.RequestPermission( 500 permission_context.RequestPermission(
506 web_contents(), id1, url, true /* user_gesture */, 501 web_contents(), id1, url, true /* user_gesture */,
507 base::Bind(&TestPermissionContext::TrackPermissionDecision, 502 base::Bind(&TestPermissionContext::TrackPermissionDecision,
508 base::Unretained(&permission_context))); 503 base::Unretained(&permission_context)));
509 504
510 EXPECT_EQ(0u, permission_context.decisions().size()); 505 EXPECT_EQ(0u, permission_context.decisions().size());
511 506
512 RespondToPermission(&permission_context, id0, url, response); 507 bool persist = (response == CONTENT_SETTING_ALLOW ||
508 response == CONTENT_SETTING_BLOCK);
509 RespondToPermission(&permission_context, id0, url, persist, response);
513 510
514 EXPECT_EQ(2u, permission_context.decisions().size()); 511 EXPECT_EQ(2u, permission_context.decisions().size());
515 EXPECT_EQ(response, permission_context.decisions()[0]); 512 EXPECT_EQ(response, permission_context.decisions()[0]);
516 EXPECT_EQ(response, permission_context.decisions()[1]); 513 EXPECT_EQ(response, permission_context.decisions()[1]);
517 EXPECT_TRUE(permission_context.tab_context_updated()); 514 EXPECT_TRUE(permission_context.tab_context_updated());
518 515
519 EXPECT_EQ(response, permission_context.GetContentSettingFromMap(url, url)); 516 EXPECT_EQ(response, permission_context.GetContentSettingFromMap(url, url));
520 } 517 }
521 518
522 private: 519 private:
523 // ChromeRenderViewHostTestHarness: 520 // ChromeRenderViewHostTestHarness:
524 void SetUp() override { 521 void SetUp() override {
525 ChromeRenderViewHostTestHarness::SetUp(); 522 ChromeRenderViewHostTestHarness::SetUp();
526 #if defined(OS_ANDROID) 523 #if defined(OS_ANDROID)
527 InfoBarService::CreateForWebContents(web_contents()); 524 InfoBarService::CreateForWebContents(web_contents());
528 #else 525 #else
529 PermissionRequestManager::CreateForWebContents(web_contents()); 526 PermissionRequestManager::CreateForWebContents(web_contents());
530 #endif 527 #endif
531 } 528 }
532 529
533 DISALLOW_COPY_AND_ASSIGN(PermissionContextBaseTests); 530 DISALLOW_COPY_AND_ASSIGN(PermissionContextBaseTests);
534 }; 531 };
535 532
536 // Simulates clicking Accept. The permission should be granted and 533 // Simulates clicking Accept. The permission should be granted and
537 // saved for future use. 534 // saved for future use.
538 TEST_F(PermissionContextBaseTests, TestAskAndGrant) { 535 TEST_F(PermissionContextBaseTests, TestAskAndGrantPersist) {
539 TestAskAndGrant_TestContent(); 536 TestAskAndDecide_TestContent(content::PermissionType::NOTIFICATIONS,
537 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
538 CONTENT_SETTING_ALLOW, true);
539 }
540
541 // Simulates clicking Accept. The permission should be granted, but not
542 // persisted.
543 TEST_F(PermissionContextBaseTests, TestAskAndGrantNoPersist) {
544 TestAskAndDecide_TestContent(content::PermissionType::NOTIFICATIONS,
545 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
546 CONTENT_SETTING_ALLOW, false);
547 }
548
549 // Simulates clicking Block. The permission should be denied and
550 // saved for future use.
551 TEST_F(PermissionContextBaseTests, TestAskAndBlockPersist) {
552 TestAskAndDecide_TestContent(content::PermissionType::GEOLOCATION,
553 CONTENT_SETTINGS_TYPE_GEOLOCATION,
554 CONTENT_SETTING_BLOCK, true);
555 }
556
557 // Simulates clicking Block. The permission should be denied, but not persisted.
558 TEST_F(PermissionContextBaseTests, TestAskAndBlockNoPersist) {
559 TestAskAndDecide_TestContent(content::PermissionType::GEOLOCATION,
560 CONTENT_SETTINGS_TYPE_GEOLOCATION,
561 CONTENT_SETTING_BLOCK, false);
540 } 562 }
541 563
542 // Simulates clicking Dismiss (X) in the infobar/bubble. 564 // Simulates clicking Dismiss (X) in the infobar/bubble.
543 // The permission should be denied but not saved for future use. 565 // The permission should be denied but not saved for future use.
544 TEST_F(PermissionContextBaseTests, TestAskAndDismiss) { 566 TEST_F(PermissionContextBaseTests, TestAskAndDismiss) {
545 TestAskAndDismiss_TestContent(); 567 TestAskAndDecide_TestContent(content::PermissionType::MIDI_SYSEX,
568 CONTENT_SETTINGS_TYPE_MIDI_SYSEX,
569 CONTENT_SETTING_ASK, false);
546 } 570 }
547 571
548 // Simulates clicking Dismiss (X) in the infobar/bubble with the block on too 572 // Simulates clicking Dismiss (X) in the infobar/bubble with the block on too
549 // many dismissals feature active. The permission should be blocked after 573 // many dismissals feature active. The permission should be blocked after
550 // several dismissals. 574 // several dismissals.
551 TEST_F(PermissionContextBaseTests, TestDismissUntilBlocked) { 575 TEST_F(PermissionContextBaseTests, TestDismissUntilBlocked) {
552 TestBlockOnSeveralDismissals_TestContent(); 576 TestBlockOnSeveralDismissals_TestContent();
553 } 577 }
554 578
555 // Test setting a custom number of dismissals before block via variations. 579 // Test setting a custom number of dismissals before block via variations.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 TestParallelRequests(CONTENT_SETTING_ALLOW); 665 TestParallelRequests(CONTENT_SETTING_ALLOW);
642 } 666 }
643 667
644 TEST_F(PermissionContextBaseTests, TestParallelRequestsBlocked) { 668 TEST_F(PermissionContextBaseTests, TestParallelRequestsBlocked) {
645 TestParallelRequests(CONTENT_SETTING_BLOCK); 669 TestParallelRequests(CONTENT_SETTING_BLOCK);
646 } 670 }
647 671
648 TEST_F(PermissionContextBaseTests, TestParallelRequestsDismissed) { 672 TEST_F(PermissionContextBaseTests, TestParallelRequestsDismissed) {
649 TestParallelRequests(CONTENT_SETTING_ASK); 673 TestParallelRequests(CONTENT_SETTING_ASK);
650 } 674 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_context_base.cc ('k') | chrome/browser/permissions/permission_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698