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

Side by Side Diff: chrome/browser/geolocation/geolocation_permission_context_unittest.cc

Issue 955383003: ContentBrowserClient::RequestPermission replies with PermissionStatus instead of bool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android geolocation breakage Created 5 years, 9 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 (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 "chrome/browser/geolocation/geolocation_permission_context.h" 5 #include "chrome/browser/geolocation/geolocation_permission_context.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 InfoBarService* infobar_service_for_tab(int tab) { 122 InfoBarService* infobar_service_for_tab(int tab) {
123 return InfoBarService::FromWebContents(extra_tabs_[tab]); 123 return InfoBarService::FromWebContents(extra_tabs_[tab]);
124 } 124 }
125 125
126 void RequestGeolocationPermission(content::WebContents* web_contents, 126 void RequestGeolocationPermission(content::WebContents* web_contents,
127 const PermissionRequestID& id, 127 const PermissionRequestID& id,
128 const GURL& requesting_frame, 128 const GURL& requesting_frame,
129 bool user_gesture); 129 bool user_gesture);
130 130
131 void PermissionResponse(const PermissionRequestID& id, 131 void PermissionResponse(const PermissionRequestID& id,
132 bool allowed); 132 ContentSetting content_setting);
133 void CheckPermissionMessageSent(int bridge_id, bool allowed); 133 void CheckPermissionMessageSent(int bridge_id, bool allowed);
134 void CheckPermissionMessageSentForTab(int tab, int bridge_id, bool allowed); 134 void CheckPermissionMessageSentForTab(int tab, int bridge_id, bool allowed);
135 void CheckPermissionMessageSentInternal(MockRenderProcessHost* process, 135 void CheckPermissionMessageSentInternal(MockRenderProcessHost* process,
136 int bridge_id, 136 int bridge_id,
137 bool allowed); 137 bool allowed);
138 void AddNewTab(const GURL& url); 138 void AddNewTab(const GURL& url);
139 void CheckTabContentsState(const GURL& requesting_frame, 139 void CheckTabContentsState(const GURL& requesting_frame,
140 ContentSetting expected_content_setting); 140 ContentSetting expected_content_setting);
141 size_t GetBubblesQueueSize(PermissionBubbleManager* manager); 141 size_t GetBubblesQueueSize(PermissionBubbleManager* manager);
142 void AcceptBubble(PermissionBubbleManager* manager); 142 void AcceptBubble(PermissionBubbleManager* manager);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 bool user_gesture) { 183 bool user_gesture) {
184 geolocation_permission_context_->RequestPermission( 184 geolocation_permission_context_->RequestPermission(
185 web_contents, id, requesting_frame, user_gesture, 185 web_contents, id, requesting_frame, user_gesture,
186 base::Bind(&GeolocationPermissionContextTests::PermissionResponse, 186 base::Bind(&GeolocationPermissionContextTests::PermissionResponse,
187 base::Unretained(this), id)); 187 base::Unretained(this), id));
188 content::RunAllBlockingPoolTasksUntilIdle(); 188 content::RunAllBlockingPoolTasksUntilIdle();
189 } 189 }
190 190
191 void GeolocationPermissionContextTests::PermissionResponse( 191 void GeolocationPermissionContextTests::PermissionResponse(
192 const PermissionRequestID& id, 192 const PermissionRequestID& id,
193 bool allowed) { 193 ContentSetting content_setting) {
194 responses_[id.render_process_id()] = std::make_pair(id.bridge_id(), allowed); 194 responses_[id.render_process_id()] =
195 std::make_pair(id.bridge_id(), content_setting == CONTENT_SETTING_ALLOW);
195 } 196 }
196 197
197 void GeolocationPermissionContextTests::CheckPermissionMessageSent( 198 void GeolocationPermissionContextTests::CheckPermissionMessageSent(
198 int bridge_id, 199 int bridge_id,
199 bool allowed) { 200 bool allowed) {
200 CheckPermissionMessageSentInternal(process(), bridge_id, allowed); 201 CheckPermissionMessageSentInternal(process(), bridge_id, allowed);
201 } 202 }
202 203
203 void GeolocationPermissionContextTests::CheckPermissionMessageSentForTab( 204 void GeolocationPermissionContextTests::CheckPermissionMessageSentForTab(
204 int tab, 205 int tab,
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 13); 969 13);
969 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), 970 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(),
970 requesting_frame_0.GetOrigin(), 971 requesting_frame_0.GetOrigin(),
971 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 972 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
972 11); 973 11);
973 } 974 }
974 975
975 INSTANTIATE_TEST_CASE_P(GeolocationPermissionContextTestsWithAndWithoutBubbles, 976 INSTANTIATE_TEST_CASE_P(GeolocationPermissionContextTestsWithAndWithoutBubbles,
976 GeolocationPermissionContextParamTests, 977 GeolocationPermissionContextParamTests,
977 ::testing::Values(false, true)); 978 ::testing::Values(false, true));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698