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

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

Issue 2226633002: Add a feature to display a persistence toggle for permission prompts on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits, verbal change to make it geolocation-only 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ContentSetting response) { 131 ContentSetting response) {
132 DCHECK(response == CONTENT_SETTING_ALLOW || 132 DCHECK(response == CONTENT_SETTING_ALLOW ||
133 response == CONTENT_SETTING_BLOCK || 133 response == CONTENT_SETTING_BLOCK ||
134 response == CONTENT_SETTING_ASK); 134 response == CONTENT_SETTING_ASK);
135 #if defined(OS_ANDROID) 135 #if defined(OS_ANDROID)
136 bool update_content_setting = response != CONTENT_SETTING_ASK; 136 bool update_content_setting = response != CONTENT_SETTING_ASK;
137 bool allowed = response == CONTENT_SETTING_ALLOW; 137 PermissionAction decision = DISMISSED;
138 if (response == CONTENT_SETTING_ALLOW)
139 decision = GRANTED;
140 else if (response == CONTENT_SETTING_BLOCK)
141 decision = DENIED;
138 context->GetInfoBarController()->OnPermissionSet( 142 context->GetInfoBarController()->OnPermissionSet(
139 id, url, url, false /* user_gesture */, update_content_setting, 143 id, url, url, false /* user_gesture */, update_content_setting,
140 allowed); 144 decision);
141 #else 145 #else
142 PermissionRequestManager* manager = 146 PermissionRequestManager* manager =
143 PermissionRequestManager::FromWebContents(web_contents()); 147 PermissionRequestManager::FromWebContents(web_contents());
144 switch (response) { 148 switch (response) {
145 case CONTENT_SETTING_ALLOW: 149 case CONTENT_SETTING_ALLOW:
146 manager->Accept(); 150 manager->Accept();
147 break; 151 break;
148 case CONTENT_SETTING_BLOCK: 152 case CONTENT_SETTING_BLOCK:
149 manager->Deny(); 153 manager->Deny();
150 break; 154 break;
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 TestParallelRequests(CONTENT_SETTING_ALLOW); 616 TestParallelRequests(CONTENT_SETTING_ALLOW);
613 } 617 }
614 618
615 TEST_F(PermissionContextBaseTests, TestParallelRequestsBlocked) { 619 TEST_F(PermissionContextBaseTests, TestParallelRequestsBlocked) {
616 TestParallelRequests(CONTENT_SETTING_BLOCK); 620 TestParallelRequests(CONTENT_SETTING_BLOCK);
617 } 621 }
618 622
619 TEST_F(PermissionContextBaseTests, TestParallelRequestsDismissed) { 623 TEST_F(PermissionContextBaseTests, TestParallelRequestsDismissed) {
620 TestParallelRequests(CONTENT_SETTING_ASK); 624 TestParallelRequests(CONTENT_SETTING_ASK);
621 } 625 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698