| 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> | 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 Loading... |
| 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 | 172 |
| 171 const PermissionRequestID id( | 173 const PermissionRequestID id( |
| 172 web_contents()->GetRenderProcessHost()->GetID(), | 174 web_contents()->GetRenderProcessHost()->GetID(), |
| 173 web_contents()->GetMainFrame()->GetRoutingID(), | 175 web_contents()->GetMainFrame()->GetRoutingID(), |
| 174 -1); | 176 -1); |
| 175 permission_context.RequestPermission( | 177 permission_context.RequestPermission( |
| 176 web_contents(), | 178 web_contents(), |
| 177 id, url, true /* user_gesture */, | 179 id, url, true /* user_gesture */, |
| 178 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 180 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
| 179 base::Unretained(&permission_context))); | 181 base::Unretained(&permission_context))); |
| 180 | 182 |
| 181 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ALLOW); | 183 RespondToPermission(&permission_context, id, url, persist, decision); |
| 182 EXPECT_EQ(1u, permission_context.decisions().size()); | 184 EXPECT_EQ(1u, permission_context.decisions().size()); |
| 183 EXPECT_EQ(CONTENT_SETTING_ALLOW, permission_context.decisions()[0]); | 185 EXPECT_EQ(decision, permission_context.decisions()[0]); |
| 184 EXPECT_TRUE(permission_context.tab_context_updated()); | 186 EXPECT_TRUE(permission_context.tab_context_updated()); |
| 185 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 187 if (persist) { |
| 186 permission_context.GetContentSettingFromMap(url, url)); | 188 EXPECT_EQ(decision, |
| 189 permission_context.GetContentSettingFromMap(url, url)); |
| 190 } else { |
| 191 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 192 permission_context.GetContentSettingFromMap(url, url)); |
| 193 } |
| 187 } | 194 } |
| 188 | 195 |
| 189 void TestAskAndDismiss_TestContent() { | 196 void TestAskAndDismiss_TestContent() { |
| 190 TestPermissionContext permission_context( | 197 TestPermissionContext permission_context( |
| 191 profile(), content::PermissionType::MIDI_SYSEX, | 198 profile(), content::PermissionType::MIDI_SYSEX, |
| 192 CONTENT_SETTINGS_TYPE_MIDI_SYSEX); | 199 CONTENT_SETTINGS_TYPE_MIDI_SYSEX); |
| 193 GURL url("http://www.google.es"); | 200 GURL url("http://www.google.es"); |
| 194 NavigateAndCommit(url); | 201 NavigateAndCommit(url); |
| 195 | 202 |
| 196 const PermissionRequestID id( | 203 const PermissionRequestID id( |
| 197 web_contents()->GetRenderProcessHost()->GetID(), | 204 web_contents()->GetRenderProcessHost()->GetID(), |
| 198 web_contents()->GetMainFrame()->GetRoutingID(), | 205 web_contents()->GetMainFrame()->GetRoutingID(), |
| 199 -1); | 206 -1); |
| 200 permission_context.RequestPermission( | 207 permission_context.RequestPermission( |
| 201 web_contents(), | 208 web_contents(), |
| 202 id, url, true /* user_gesture */, | 209 id, url, true /* user_gesture */, |
| 203 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 210 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
| 204 base::Unretained(&permission_context))); | 211 base::Unretained(&permission_context))); |
| 205 | 212 |
| 206 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ASK); | 213 RespondToPermission(&permission_context, id, url, false, |
| 214 CONTENT_SETTING_ASK); |
| 207 EXPECT_EQ(1u, permission_context.decisions().size()); | 215 EXPECT_EQ(1u, permission_context.decisions().size()); |
| 208 EXPECT_EQ(CONTENT_SETTING_ASK, permission_context.decisions()[0]); | 216 EXPECT_EQ(CONTENT_SETTING_ASK, permission_context.decisions()[0]); |
| 209 EXPECT_TRUE(permission_context.tab_context_updated()); | 217 EXPECT_TRUE(permission_context.tab_context_updated()); |
| 210 EXPECT_EQ(CONTENT_SETTING_ASK, | 218 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 211 permission_context.GetContentSettingFromMap(url, url)); | 219 permission_context.GetContentSettingFromMap(url, url)); |
| 212 } | 220 } |
| 213 | 221 |
| 214 void DismissMultipleTimesAndExpectBlock( | 222 void DismissMultipleTimesAndExpectBlock( |
| 215 const GURL& url, | 223 const GURL& url, |
| 216 content::PermissionType permission_type, | 224 content::PermissionType permission_type, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 227 (i < (iterations - 1)) ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK; | 235 (i < (iterations - 1)) ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK; |
| 228 | 236 |
| 229 const PermissionRequestID id( | 237 const PermissionRequestID id( |
| 230 web_contents()->GetRenderProcessHost()->GetID(), | 238 web_contents()->GetRenderProcessHost()->GetID(), |
| 231 web_contents()->GetMainFrame()->GetRoutingID(), i); | 239 web_contents()->GetMainFrame()->GetRoutingID(), i); |
| 232 permission_context.RequestPermission( | 240 permission_context.RequestPermission( |
| 233 web_contents(), id, url, true /* user_gesture */, | 241 web_contents(), id, url, true /* user_gesture */, |
| 234 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 242 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
| 235 base::Unretained(&permission_context))); | 243 base::Unretained(&permission_context))); |
| 236 | 244 |
| 237 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ASK); | 245 RespondToPermission(&permission_context, id, url, false, |
| 246 CONTENT_SETTING_ASK); |
| 238 histograms.ExpectTotalCount( | 247 histograms.ExpectTotalCount( |
| 239 "Permissions.Prompt.DismissCount." + | 248 "Permissions.Prompt.DismissCount." + |
| 240 PermissionUtil::GetPermissionString(permission_type), | 249 PermissionUtil::GetPermissionString(permission_type), |
| 241 i + 1); | 250 i + 1); |
| 242 | 251 |
| 243 EXPECT_EQ(1u, permission_context.decisions().size()); | 252 EXPECT_EQ(1u, permission_context.decisions().size()); |
| 244 EXPECT_EQ(expected, permission_context.decisions()[0]); | 253 EXPECT_EQ(expected, permission_context.decisions()[0]); |
| 245 EXPECT_TRUE(permission_context.tab_context_updated()); | 254 EXPECT_TRUE(permission_context.tab_context_updated()); |
| 246 EXPECT_EQ(expected, | 255 EXPECT_EQ(expected, |
| 247 permission_context.GetContentSettingFromMap(url, url)); | 256 permission_context.GetContentSettingFromMap(url, url)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 266 CONTENT_SETTINGS_TYPE_GEOLOCATION); | 275 CONTENT_SETTINGS_TYPE_GEOLOCATION); |
| 267 | 276 |
| 268 const PermissionRequestID id( | 277 const PermissionRequestID id( |
| 269 web_contents()->GetRenderProcessHost()->GetID(), | 278 web_contents()->GetRenderProcessHost()->GetID(), |
| 270 web_contents()->GetMainFrame()->GetRoutingID(), i); | 279 web_contents()->GetMainFrame()->GetRoutingID(), i); |
| 271 permission_context.RequestPermission( | 280 permission_context.RequestPermission( |
| 272 web_contents(), id, url, true /* user_gesture */, | 281 web_contents(), id, url, true /* user_gesture */, |
| 273 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 282 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
| 274 base::Unretained(&permission_context))); | 283 base::Unretained(&permission_context))); |
| 275 | 284 |
| 276 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ASK); | 285 RespondToPermission(&permission_context, id, url, false, |
| 286 CONTENT_SETTING_ASK); |
| 277 histograms.ExpectTotalCount("Permissions.Prompt.DismissCount.Geolocation", | 287 histograms.ExpectTotalCount("Permissions.Prompt.DismissCount.Geolocation", |
| 278 i + 1); | 288 i + 1); |
| 279 EXPECT_EQ(1u, permission_context.decisions().size()); | 289 EXPECT_EQ(1u, permission_context.decisions().size()); |
| 280 EXPECT_EQ(CONTENT_SETTING_ASK, permission_context.decisions()[0]); | 290 EXPECT_EQ(CONTENT_SETTING_ASK, permission_context.decisions()[0]); |
| 281 EXPECT_TRUE(permission_context.tab_context_updated()); | 291 EXPECT_TRUE(permission_context.tab_context_updated()); |
| 282 EXPECT_EQ(CONTENT_SETTING_ASK, | 292 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 283 permission_context.GetContentSettingFromMap(url, url)); | 293 permission_context.GetContentSettingFromMap(url, url)); |
| 284 } | 294 } |
| 285 | 295 |
| 286 // Flush the dismissal counts. Enable the block on too many dismissals | 296 // Flush the dismissal counts. Enable the block on too many dismissals |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 ContentSetting expected = | 362 ContentSetting expected = |
| 353 (i < 4) ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK; | 363 (i < 4) ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK; |
| 354 const PermissionRequestID id( | 364 const PermissionRequestID id( |
| 355 web_contents()->GetRenderProcessHost()->GetID(), | 365 web_contents()->GetRenderProcessHost()->GetID(), |
| 356 web_contents()->GetMainFrame()->GetRoutingID(), i); | 366 web_contents()->GetMainFrame()->GetRoutingID(), i); |
| 357 permission_context.RequestPermission( | 367 permission_context.RequestPermission( |
| 358 web_contents(), id, url, true /* user_gesture */, | 368 web_contents(), id, url, true /* user_gesture */, |
| 359 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 369 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
| 360 base::Unretained(&permission_context))); | 370 base::Unretained(&permission_context))); |
| 361 | 371 |
| 362 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ASK); | 372 RespondToPermission(&permission_context, id, url, false, |
| 373 CONTENT_SETTING_ASK); |
| 363 EXPECT_EQ(1u, permission_context.decisions().size()); | 374 EXPECT_EQ(1u, permission_context.decisions().size()); |
| 364 EXPECT_EQ(expected, permission_context.decisions()[0]); | 375 EXPECT_EQ(expected, permission_context.decisions()[0]); |
| 365 EXPECT_TRUE(permission_context.tab_context_updated()); | 376 EXPECT_TRUE(permission_context.tab_context_updated()); |
| 366 EXPECT_EQ(expected, | 377 EXPECT_EQ(expected, |
| 367 permission_context.GetContentSettingFromMap(url, url)); | 378 permission_context.GetContentSettingFromMap(url, url)); |
| 368 } | 379 } |
| 369 | 380 |
| 370 // Ensure that we finish in the block state. | 381 // Ensure that we finish in the block state. |
| 371 TestPermissionContext permission_context( | 382 TestPermissionContext permission_context( |
| 372 profile(), content::PermissionType::MIDI_SYSEX, | 383 profile(), content::PermissionType::MIDI_SYSEX, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 const PermissionRequestID id( | 425 const PermissionRequestID id( |
| 415 web_contents()->GetRenderProcessHost()->GetID(), | 426 web_contents()->GetRenderProcessHost()->GetID(), |
| 416 web_contents()->GetMainFrame()->GetRoutingID(), | 427 web_contents()->GetMainFrame()->GetRoutingID(), |
| 417 -1); | 428 -1); |
| 418 permission_context.RequestPermission( | 429 permission_context.RequestPermission( |
| 419 web_contents(), | 430 web_contents(), |
| 420 id, url, true /* user_gesture */, | 431 id, url, true /* user_gesture */, |
| 421 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 432 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
| 422 base::Unretained(&permission_context))); | 433 base::Unretained(&permission_context))); |
| 423 | 434 |
| 424 RespondToPermission(&permission_context, id, url, CONTENT_SETTING_ALLOW); | 435 RespondToPermission(&permission_context, id, url, true, |
| 436 CONTENT_SETTING_ALLOW); |
| 425 EXPECT_EQ(1u, permission_context.decisions().size()); | 437 EXPECT_EQ(1u, permission_context.decisions().size()); |
| 426 EXPECT_EQ(CONTENT_SETTING_ALLOW, permission_context.decisions()[0]); | 438 EXPECT_EQ(CONTENT_SETTING_ALLOW, permission_context.decisions()[0]); |
| 427 EXPECT_TRUE(permission_context.tab_context_updated()); | 439 EXPECT_TRUE(permission_context.tab_context_updated()); |
| 428 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 440 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 429 permission_context.GetContentSettingFromMap(url, url)); | 441 permission_context.GetContentSettingFromMap(url, url)); |
| 430 | 442 |
| 431 // Try to reset permission. | 443 // Try to reset permission. |
| 432 permission_context.ResetPermission(url.GetOrigin(), url.GetOrigin()); | 444 permission_context.ResetPermission(url.GetOrigin(), url.GetOrigin()); |
| 433 ContentSetting setting_after_reset = | 445 ContentSetting setting_after_reset = |
| 434 permission_context.GetContentSettingFromMap(url, url); | 446 permission_context.GetContentSettingFromMap(url, url); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 web_contents(), id0, url, true /* user_gesture */, | 489 web_contents(), id0, url, true /* user_gesture */, |
| 478 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 490 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
| 479 base::Unretained(&permission_context))); | 491 base::Unretained(&permission_context))); |
| 480 permission_context.RequestPermission( | 492 permission_context.RequestPermission( |
| 481 web_contents(), id1, url, true /* user_gesture */, | 493 web_contents(), id1, url, true /* user_gesture */, |
| 482 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 494 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
| 483 base::Unretained(&permission_context))); | 495 base::Unretained(&permission_context))); |
| 484 | 496 |
| 485 EXPECT_EQ(0u, permission_context.decisions().size()); | 497 EXPECT_EQ(0u, permission_context.decisions().size()); |
| 486 | 498 |
| 487 RespondToPermission(&permission_context, id0, url, response); | 499 bool persist = (response == CONTENT_SETTING_ALLOW || |
| 500 response == CONTENT_SETTING_BLOCK); |
| 501 RespondToPermission(&permission_context, id0, url, persist, response); |
| 488 | 502 |
| 489 EXPECT_EQ(2u, permission_context.decisions().size()); | 503 EXPECT_EQ(2u, permission_context.decisions().size()); |
| 490 EXPECT_EQ(response, permission_context.decisions()[0]); | 504 EXPECT_EQ(response, permission_context.decisions()[0]); |
| 491 EXPECT_EQ(response, permission_context.decisions()[1]); | 505 EXPECT_EQ(response, permission_context.decisions()[1]); |
| 492 EXPECT_TRUE(permission_context.tab_context_updated()); | 506 EXPECT_TRUE(permission_context.tab_context_updated()); |
| 493 | 507 |
| 494 EXPECT_EQ(response, permission_context.GetContentSettingFromMap(url, url)); | 508 EXPECT_EQ(response, permission_context.GetContentSettingFromMap(url, url)); |
| 495 } | 509 } |
| 496 | 510 |
| 497 private: | 511 private: |
| 498 // ChromeRenderViewHostTestHarness: | 512 // ChromeRenderViewHostTestHarness: |
| 499 void SetUp() override { | 513 void SetUp() override { |
| 500 ChromeRenderViewHostTestHarness::SetUp(); | 514 ChromeRenderViewHostTestHarness::SetUp(); |
| 501 #if defined(OS_ANDROID) | 515 #if defined(OS_ANDROID) |
| 502 InfoBarService::CreateForWebContents(web_contents()); | 516 InfoBarService::CreateForWebContents(web_contents()); |
| 503 #else | 517 #else |
| 504 PermissionRequestManager::CreateForWebContents(web_contents()); | 518 PermissionRequestManager::CreateForWebContents(web_contents()); |
| 505 #endif | 519 #endif |
| 506 } | 520 } |
| 507 | 521 |
| 508 DISALLOW_COPY_AND_ASSIGN(PermissionContextBaseTests); | 522 DISALLOW_COPY_AND_ASSIGN(PermissionContextBaseTests); |
| 509 }; | 523 }; |
| 510 | 524 |
| 511 // Simulates clicking Accept. The permission should be granted and | 525 // Simulates clicking Accept. The permission should be granted and |
| 512 // saved for future use. | 526 // saved for future use. |
| 513 TEST_F(PermissionContextBaseTests, TestAskAndGrant) { | 527 TEST_F(PermissionContextBaseTests, TestAskAndGrantPersist) { |
| 514 TestAskAndGrant_TestContent(); | 528 TestAskAndDecide_TestContent(content::PermissionType::NOTIFICATIONS, |
| 529 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| 530 CONTENT_SETTING_ALLOW, true); |
| 531 } |
| 532 |
| 533 // Simulates clicking Accept. The permission should be granted, but not |
| 534 // persisted. |
| 535 TEST_F(PermissionContextBaseTests, TestAskAndGrantNoPersist) { |
| 536 TestAskAndDecide_TestContent(content::PermissionType::NOTIFICATIONS, |
| 537 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| 538 CONTENT_SETTING_ALLOW, false); |
| 539 } |
| 540 |
| 541 // Simulates clicking Block. The permission should be denied and |
| 542 // saved for future use. |
| 543 TEST_F(PermissionContextBaseTests, TestAskAndBlockPersist) { |
| 544 TestAskAndDecide_TestContent(content::PermissionType::GEOLOCATION, |
| 545 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
| 546 CONTENT_SETTING_BLOCK, true); |
| 547 } |
| 548 |
| 549 // Simulates clicking Block. The permission should be denied, but not persisted. |
| 550 TEST_F(PermissionContextBaseTests, TestAskAndBlockNoPersist) { |
| 551 TestAskAndDecide_TestContent(content::PermissionType::GEOLOCATION, |
| 552 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
| 553 CONTENT_SETTING_BLOCK, false); |
| 515 } | 554 } |
| 516 | 555 |
| 517 // Simulates clicking Dismiss (X) in the infobar/bubble. | 556 // Simulates clicking Dismiss (X) in the infobar/bubble. |
| 518 // The permission should be denied but not saved for future use. | 557 // The permission should be denied but not saved for future use. |
| 519 TEST_F(PermissionContextBaseTests, TestAskAndDismiss) { | 558 TEST_F(PermissionContextBaseTests, TestAskAndDismiss) { |
| 520 TestAskAndDismiss_TestContent(); | 559 TestAskAndDismiss_TestContent(); |
| 521 } | 560 } |
| 522 | 561 |
| 523 // Simulates clicking Dismiss (X) in the infobar/bubble with the block on too | 562 // Simulates clicking Dismiss (X) in the infobar/bubble with the block on too |
| 524 // many dismissals feature active. The permission should be blocked after | 563 // many dismissals feature active. The permission should be blocked after |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 TestParallelRequests(CONTENT_SETTING_ALLOW); | 655 TestParallelRequests(CONTENT_SETTING_ALLOW); |
| 617 } | 656 } |
| 618 | 657 |
| 619 TEST_F(PermissionContextBaseTests, TestParallelRequestsBlocked) { | 658 TEST_F(PermissionContextBaseTests, TestParallelRequestsBlocked) { |
| 620 TestParallelRequests(CONTENT_SETTING_BLOCK); | 659 TestParallelRequests(CONTENT_SETTING_BLOCK); |
| 621 } | 660 } |
| 622 | 661 |
| 623 TEST_F(PermissionContextBaseTests, TestParallelRequestsDismissed) { | 662 TEST_F(PermissionContextBaseTests, TestParallelRequestsDismissed) { |
| 624 TestParallelRequests(CONTENT_SETTING_ASK); | 663 TestParallelRequests(CONTENT_SETTING_ASK); |
| 625 } | 664 } |
| OLD | NEW |