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

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

Issue 924043002: Revert of Update geolocation permission tests for the permission bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h"
13 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
14 #include "base/id_map.h" 13 #include "base/id_map.h"
15 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
16 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
17 #include "base/test/simple_test_clock.h" 16 #include "base/test/simple_test_clock.h"
18 #include "base/time/clock.h" 17 #include "base/time/clock.h"
19 #include "chrome/browser/chrome_notification_types.h" 18 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 19 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
21 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" 20 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h"
22 #include "chrome/browser/infobars/infobar_service.h" 21 #include "chrome/browser/infobars/infobar_service.h"
23 #include "chrome/browser/ui/website_settings/mock_permission_bubble_view.h"
24 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
25 #include "chrome/browser/ui/website_settings/permission_bubble_request.h"
26 #include "chrome/common/chrome_switches.h"
27 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 22 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
28 #include "chrome/test/base/testing_profile.h" 23 #include "chrome/test/base/testing_profile.h"
29 #include "components/content_settings/core/browser/host_content_settings_map.h" 24 #include "components/content_settings/core/browser/host_content_settings_map.h"
30 #include "components/content_settings/core/common/permission_request_id.h" 25 #include "components/content_settings/core/common/permission_request_id.h"
31 #include "components/infobars/core/confirm_infobar_delegate.h" 26 #include "components/infobars/core/confirm_infobar_delegate.h"
32 #include "components/infobars/core/infobar.h" 27 #include "components/infobars/core/infobar.h"
33 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
34 #include "content/public/browser/navigation_details.h" 29 #include "content/public/browser/navigation_details.h"
35 #include "content/public/browser/notification_observer.h" 30 #include "content/public/browser/notification_observer.h"
36 #include "content/public/browser/notification_registrar.h" 31 #include "content/public/browser/notification_registrar.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 PermissionRequestID RequestIDForTab(int tab, int bridge_id); 113 PermissionRequestID RequestIDForTab(int tab, int bridge_id);
119 InfoBarService* infobar_service() { 114 InfoBarService* infobar_service() {
120 return InfoBarService::FromWebContents(web_contents()); 115 return InfoBarService::FromWebContents(web_contents());
121 } 116 }
122 InfoBarService* infobar_service_for_tab(int tab) { 117 InfoBarService* infobar_service_for_tab(int tab) {
123 return InfoBarService::FromWebContents(extra_tabs_[tab]); 118 return InfoBarService::FromWebContents(extra_tabs_[tab]);
124 } 119 }
125 120
126 void RequestGeolocationPermission(content::WebContents* web_contents, 121 void RequestGeolocationPermission(content::WebContents* web_contents,
127 const PermissionRequestID& id, 122 const PermissionRequestID& id,
128 const GURL& requesting_frame, 123 const GURL& requesting_frame);
129 bool user_gesture);
130 124
131 void PermissionResponse(const PermissionRequestID& id, 125 void PermissionResponse(const PermissionRequestID& id,
132 bool allowed); 126 bool allowed);
133 void CheckPermissionMessageSent(int bridge_id, bool allowed); 127 void CheckPermissionMessageSent(int bridge_id, bool allowed);
134 void CheckPermissionMessageSentForTab(int tab, int bridge_id, bool allowed); 128 void CheckPermissionMessageSentForTab(int tab, int bridge_id, bool allowed);
135 void CheckPermissionMessageSentInternal(MockRenderProcessHost* process, 129 void CheckPermissionMessageSentInternal(MockRenderProcessHost* process,
136 int bridge_id, 130 int bridge_id,
137 bool allowed); 131 bool allowed);
138 void AddNewTab(const GURL& url); 132 void AddNewTab(const GURL& url);
139 void CheckTabContentsState(const GURL& requesting_frame, 133 void CheckTabContentsState(const GURL& requesting_frame,
140 ContentSetting expected_content_setting); 134 ContentSetting expected_content_setting);
141 size_t GetBubblesQueueSize(PermissionBubbleManager* manager);
142 void AcceptBubble(PermissionBubbleManager* manager);
143 void DenyBubble(PermissionBubbleManager* manager);
144 void CloseBubble(PermissionBubbleManager* manager);
145 void BubbleManagerDocumentLoadCompleted();
146 void BubbleManagerDocumentLoadCompleted(content::WebContents* web_contents);
147 ContentSetting GetGeolocationContentSetting(GURL frame_0, GURL frame_1);
148 135
149 // owned by the browser context 136 // owned by the browser context
150 GeolocationPermissionContext* geolocation_permission_context_; 137 GeolocationPermissionContext* geolocation_permission_context_;
151 ClosedInfoBarTracker closed_infobar_tracker_; 138 ClosedInfoBarTracker closed_infobar_tracker_;
152 MockPermissionBubbleView bubble_view_;
153 ScopedVector<content::WebContents> extra_tabs_; 139 ScopedVector<content::WebContents> extra_tabs_;
154 140
155 // A map between renderer child id and a pair represending the bridge id and 141 // A map between renderer child id and a pair represending the bridge id and
156 // whether the requested permission was allowed. 142 // whether the requested permission was allowed.
157 base::hash_map<int, std::pair<int, bool> > responses_; 143 base::hash_map<int, std::pair<int, bool> > responses_;
158 }; 144 };
159 145
160 PermissionRequestID GeolocationPermissionContextTests::RequestID( 146 PermissionRequestID GeolocationPermissionContextTests::RequestID(
161 int bridge_id) { 147 int bridge_id) {
162 return PermissionRequestID( 148 return PermissionRequestID(
163 web_contents()->GetRenderProcessHost()->GetID(), 149 web_contents()->GetRenderProcessHost()->GetID(),
164 web_contents()->GetRenderViewHost()->GetRoutingID(), 150 web_contents()->GetRenderViewHost()->GetRoutingID(),
165 bridge_id, 151 bridge_id,
166 GURL()); 152 GURL());
167 } 153 }
168 154
169 PermissionRequestID GeolocationPermissionContextTests::RequestIDForTab( 155 PermissionRequestID GeolocationPermissionContextTests::RequestIDForTab(
170 int tab, 156 int tab,
171 int bridge_id) { 157 int bridge_id) {
172 return PermissionRequestID( 158 return PermissionRequestID(
173 extra_tabs_[tab]->GetRenderProcessHost()->GetID(), 159 extra_tabs_[tab]->GetRenderProcessHost()->GetID(),
174 extra_tabs_[tab]->GetRenderViewHost()->GetRoutingID(), 160 extra_tabs_[tab]->GetRenderViewHost()->GetRoutingID(),
175 bridge_id, 161 bridge_id,
176 GURL()); 162 GURL());
177 } 163 }
178 164
179 void GeolocationPermissionContextTests::RequestGeolocationPermission( 165 void GeolocationPermissionContextTests::RequestGeolocationPermission(
180 content::WebContents* web_contents, 166 content::WebContents* web_contents,
181 const PermissionRequestID& id, 167 const PermissionRequestID& id,
182 const GURL& requesting_frame, 168 const GURL& requesting_frame) {
183 bool user_gesture) {
184 geolocation_permission_context_->RequestPermission( 169 geolocation_permission_context_->RequestPermission(
185 web_contents, id, requesting_frame, user_gesture, 170 web_contents, id, requesting_frame, false,
186 base::Bind(&GeolocationPermissionContextTests::PermissionResponse, 171 base::Bind(&GeolocationPermissionContextTests::PermissionResponse,
187 base::Unretained(this), id)); 172 base::Unretained(this), id));
188 content::RunAllBlockingPoolTasksUntilIdle(); 173 content::RunAllBlockingPoolTasksUntilIdle();
189 } 174 }
190 175
191 void GeolocationPermissionContextTests::PermissionResponse( 176 void GeolocationPermissionContextTests::PermissionResponse(
192 const PermissionRequestID& id, 177 const PermissionRequestID& id,
193 bool allowed) { 178 bool allowed) {
194 responses_[id.render_process_id()] = std::make_pair(id.bridge_id(), allowed); 179 responses_[id.render_process_id()] = std::make_pair(id.bridge_id(), allowed);
195 } 180 }
(...skipping 29 matching lines...) Expand all
225 new_tab->GetController().LoadURL( 210 new_tab->GetController().LoadURL(
226 url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 211 url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
227 content::RenderFrameHostTester::For(new_tab->GetMainFrame()) 212 content::RenderFrameHostTester::For(new_tab->GetMainFrame())
228 ->SendNavigate(extra_tabs_.size() + 1, url); 213 ->SendNavigate(extra_tabs_.size() + 1, url);
229 214
230 // Set up required helpers, and make this be as "tabby" as the code requires. 215 // Set up required helpers, and make this be as "tabby" as the code requires.
231 #if defined(ENABLE_EXTENSIONS) 216 #if defined(ENABLE_EXTENSIONS)
232 extensions::SetViewType(new_tab, extensions::VIEW_TYPE_TAB_CONTENTS); 217 extensions::SetViewType(new_tab, extensions::VIEW_TYPE_TAB_CONTENTS);
233 #endif 218 #endif
234 InfoBarService::CreateForWebContents(new_tab); 219 InfoBarService::CreateForWebContents(new_tab);
235 PermissionBubbleManager::CreateForWebContents(new_tab);
236 PermissionBubbleManager::FromWebContents(new_tab)->SetView(&bubble_view_);
237 220
238 extra_tabs_.push_back(new_tab); 221 extra_tabs_.push_back(new_tab);
239 } 222 }
240 223
241 void GeolocationPermissionContextTests::CheckTabContentsState( 224 void GeolocationPermissionContextTests::CheckTabContentsState(
242 const GURL& requesting_frame, 225 const GURL& requesting_frame,
243 ContentSetting expected_content_setting) { 226 ContentSetting expected_content_setting) {
244 TabSpecificContentSettings* content_settings = 227 TabSpecificContentSettings* content_settings =
245 TabSpecificContentSettings::FromWebContents(web_contents()); 228 TabSpecificContentSettings::FromWebContents(web_contents());
246 const ContentSettingsUsagesState::StateMap& state_map = 229 const ContentSettingsUsagesState::StateMap& state_map =
(...skipping 18 matching lines...) Expand all
265 TabSpecificContentSettings::CreateForWebContents(web_contents()); 248 TabSpecificContentSettings::CreateForWebContents(web_contents());
266 geolocation_permission_context_ = 249 geolocation_permission_context_ =
267 GeolocationPermissionContextFactory::GetForProfile(profile()); 250 GeolocationPermissionContextFactory::GetForProfile(profile());
268 #if defined(OS_ANDROID) 251 #if defined(OS_ANDROID)
269 static_cast<GeolocationPermissionContextAndroid*>( 252 static_cast<GeolocationPermissionContextAndroid*>(
270 geolocation_permission_context_) 253 geolocation_permission_context_)
271 ->SetLocationSettingsForTesting( 254 ->SetLocationSettingsForTesting(
272 scoped_ptr<LocationSettings>(new MockLocationSettings())); 255 scoped_ptr<LocationSettings>(new MockLocationSettings()));
273 MockLocationSettings::SetLocationStatus(true, true); 256 MockLocationSettings::SetLocationStatus(true, true);
274 #endif 257 #endif
275 PermissionBubbleManager::CreateForWebContents(web_contents());
276 PermissionBubbleManager::FromWebContents(web_contents())->SetView(
277 &bubble_view_);
278 } 258 }
279 259
280 void GeolocationPermissionContextTests::TearDown() { 260 void GeolocationPermissionContextTests::TearDown() {
281 extra_tabs_.clear(); 261 extra_tabs_.clear();
282 ChromeRenderViewHostTestHarness::TearDown(); 262 ChromeRenderViewHostTestHarness::TearDown();
283 } 263 }
284 264
285 size_t GeolocationPermissionContextTests::GetBubblesQueueSize(
286 PermissionBubbleManager* manager) {
287 return manager->requests_.size();
288 }
289
290 void GeolocationPermissionContextTests::AcceptBubble(
291 PermissionBubbleManager* manager) {
292 manager->Accept();
293 }
294
295 void GeolocationPermissionContextTests::DenyBubble(
296 PermissionBubbleManager* manager) {
297 manager->Deny();
298 }
299
300 void GeolocationPermissionContextTests::CloseBubble(
301 PermissionBubbleManager* manager) {
302 manager->Closing();
303 }
304
305 void GeolocationPermissionContextTests::BubbleManagerDocumentLoadCompleted() {
306 GeolocationPermissionContextTests::BubbleManagerDocumentLoadCompleted(
307 web_contents());
308 }
309
310 void GeolocationPermissionContextTests::BubbleManagerDocumentLoadCompleted(
311 content::WebContents* web_contents) {
312 PermissionBubbleManager::FromWebContents(web_contents)->
313 DocumentOnLoadCompletedInMainFrame();
314 }
315
316 ContentSetting GeolocationPermissionContextTests::GetGeolocationContentSetting(
317 GURL frame_0, GURL frame_1) {
318 return profile()->GetHostContentSettingsMap()->GetContentSetting(
319 frame_0, frame_1, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string());
320 }
321
322 // Needed to parameterize the tests for both infobars & permission bubbles.
323 class GeolocationPermissionContextParamTests :
324 public GeolocationPermissionContextTests,
325 public ::testing::WithParamInterface<bool> {
326 protected:
327 GeolocationPermissionContextParamTests() {}
328 ~GeolocationPermissionContextParamTests() override {}
329
330 bool BubbleEnabled() const {
331 #if defined (OS_ANDROID)
332 return false;
333 #else
334 return GetParam();
335 #endif
336 }
337
338 void SetUp() override {
339 GeolocationPermissionContextTests::SetUp();
340 #if !defined(OS_ANDROID)
341 if (BubbleEnabled()) {
342 base::CommandLine::ForCurrentProcess()->AppendSwitch(
343 switches::kEnablePermissionsBubbles);
344 EXPECT_TRUE(PermissionBubbleManager::Enabled());
345 } else {
346 base::CommandLine::ForCurrentProcess()->AppendSwitch(
347 switches::kDisablePermissionsBubbles);
348 EXPECT_FALSE(PermissionBubbleManager::Enabled());
349 }
350 #endif
351 }
352
353 size_t GetNumberOfPrompts() {
354 if (BubbleEnabled()) {
355 PermissionBubbleManager* manager =
356 PermissionBubbleManager::FromWebContents(web_contents());
357 return GetBubblesQueueSize(manager);
358 } else {
359 return infobar_service()->infobar_count();
360 }
361 }
362
363 void AcceptPrompt() {
364 if (BubbleEnabled()) {
365 PermissionBubbleManager* manager =
366 PermissionBubbleManager::FromWebContents(web_contents());
367 AcceptBubble(manager);
368 } else {
369 infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
370 ConfirmInfoBarDelegate* infobar_delegate =
371 infobar->delegate()->AsConfirmInfoBarDelegate();
372 infobar_delegate->Accept();
373 }
374 }
375
376 base::string16 GetPromptText() {
377 if (BubbleEnabled()) {
378 PermissionBubbleManager* manager =
379 PermissionBubbleManager::FromWebContents(web_contents());
380 return manager->requests_.front()->GetMessageText();
381 }
382 infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
383 ConfirmInfoBarDelegate* infobar_delegate =
384 infobar->delegate()->AsConfirmInfoBarDelegate();
385 return infobar_delegate->GetMessageText();
386 }
387 private:
388 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextParamTests);
389 };
390
391 // Tests ---------------------------------------------------------------------- 265 // Tests ----------------------------------------------------------------------
392 266
393 TEST_P(GeolocationPermissionContextParamTests, SinglePermissionInfobar) { 267 TEST_F(GeolocationPermissionContextTests, SinglePermission) {
394 if (BubbleEnabled()) return;
395
396 GURL requesting_frame("http://www.example.com/geolocation"); 268 GURL requesting_frame("http://www.example.com/geolocation");
397 NavigateAndCommit(requesting_frame); 269 NavigateAndCommit(requesting_frame);
398 EXPECT_EQ(0U, infobar_service()->infobar_count()); 270 EXPECT_EQ(0U, infobar_service()->infobar_count());
399 RequestGeolocationPermission( 271 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
400 web_contents(), RequestID(0), requesting_frame, true);
401 ASSERT_EQ(1U, infobar_service()->infobar_count()); 272 ASSERT_EQ(1U, infobar_service()->infobar_count());
402 infobars::InfoBar* infobar = infobar_service()->infobar_at(0); 273 infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
403 ConfirmInfoBarDelegate* infobar_delegate = 274 ConfirmInfoBarDelegate* infobar_delegate =
404 infobar->delegate()->AsConfirmInfoBarDelegate(); 275 infobar->delegate()->AsConfirmInfoBarDelegate();
405 ASSERT_TRUE(infobar_delegate); 276 ASSERT_TRUE(infobar_delegate);
406 infobar_delegate->Cancel(); 277 infobar_delegate->Cancel();
407 infobar_service()->RemoveInfoBar(infobar); 278 infobar_service()->RemoveInfoBar(infobar);
408 EXPECT_EQ(1U, closed_infobar_tracker_.size()); 279 EXPECT_EQ(1U, closed_infobar_tracker_.size());
409 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar)); 280 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar));
410 } 281 }
411 282
412 TEST_P(GeolocationPermissionContextParamTests, SinglePermissionBubble) {
413 if (!BubbleEnabled()) return;
414
415 GURL requesting_frame("http://www.example.com/geolocation");
416 NavigateAndCommit(requesting_frame);
417 BubbleManagerDocumentLoadCompleted();
418
419 EXPECT_EQ(0U, GetNumberOfPrompts());
420 RequestGeolocationPermission(
421 web_contents(), RequestID(0), requesting_frame, true);
422 ASSERT_EQ(1U, GetNumberOfPrompts());
423 }
424
425 #if defined(OS_ANDROID) 283 #if defined(OS_ANDROID)
426 // Infobar-only tests; Android doesn't support permission bubbles.
427 TEST_F(GeolocationPermissionContextTests, GeolocationEnabledDisabled) { 284 TEST_F(GeolocationPermissionContextTests, GeolocationEnabledDisabled) {
428 GURL requesting_frame("http://www.example.com/geolocation"); 285 GURL requesting_frame("http://www.example.com/geolocation");
429 NavigateAndCommit(requesting_frame); 286 NavigateAndCommit(requesting_frame);
430 MockLocationSettings::SetLocationStatus(true, true); 287 MockLocationSettings::SetLocationStatus(true, true);
431 EXPECT_EQ(0U, infobar_service()->infobar_count()); 288 EXPECT_EQ(0U, infobar_service()->infobar_count());
432 RequestGeolocationPermission( 289 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
433 web_contents(), RequestID(0), requesting_frame, true);
434 EXPECT_EQ(1U, infobar_service()->infobar_count()); 290 EXPECT_EQ(1U, infobar_service()->infobar_count());
435 ConfirmInfoBarDelegate* infobar_delegate_0 = 291 ConfirmInfoBarDelegate* infobar_delegate_0 =
436 infobar_service()->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate(); 292 infobar_service()->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate();
437 ASSERT_TRUE(infobar_delegate_0); 293 ASSERT_TRUE(infobar_delegate_0);
438 base::string16 text_0 = infobar_delegate_0->GetButtonLabel( 294 base::string16 text_0 = infobar_delegate_0->GetButtonLabel(
439 ConfirmInfoBarDelegate::BUTTON_OK); 295 ConfirmInfoBarDelegate::BUTTON_OK);
440 296
441 Reload(); 297 Reload();
442 MockLocationSettings::SetLocationStatus(true, false); 298 MockLocationSettings::SetLocationStatus(true, false);
443 EXPECT_EQ(0U, infobar_service()->infobar_count()); 299 EXPECT_EQ(0U, infobar_service()->infobar_count());
444 RequestGeolocationPermission( 300 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
445 web_contents(), RequestID(0), requesting_frame, true);
446 EXPECT_EQ(0U, infobar_service()->infobar_count()); 301 EXPECT_EQ(0U, infobar_service()->infobar_count());
447 } 302 }
448 303
449 TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsEnabled) { 304 TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsEnabled) {
450 GURL requesting_frame("http://www.example.com/geolocation"); 305 GURL requesting_frame("http://www.example.com/geolocation");
451 NavigateAndCommit(requesting_frame); 306 NavigateAndCommit(requesting_frame);
452 MockLocationSettings::SetLocationStatus(true, true); 307 MockLocationSettings::SetLocationStatus(true, true);
453 EXPECT_EQ(0U, infobar_service()->infobar_count()); 308 EXPECT_EQ(0U, infobar_service()->infobar_count());
454 RequestGeolocationPermission( 309 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
455 web_contents(), RequestID(0), requesting_frame, true);
456 EXPECT_EQ(1U, infobar_service()->infobar_count()); 310 EXPECT_EQ(1U, infobar_service()->infobar_count());
457 ConfirmInfoBarDelegate* infobar_delegate = 311 ConfirmInfoBarDelegate* infobar_delegate =
458 infobar_service()->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate(); 312 infobar_service()->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate();
459 ASSERT_TRUE(infobar_delegate); 313 ASSERT_TRUE(infobar_delegate);
460 infobar_delegate->Accept(); 314 infobar_delegate->Accept();
461 CheckTabContentsState(requesting_frame, CONTENT_SETTING_ALLOW); 315 CheckTabContentsState(requesting_frame, CONTENT_SETTING_ALLOW);
462 CheckPermissionMessageSent(0, true); 316 CheckPermissionMessageSent(0, true);
463 } 317 }
464 318
465 TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsDisabled) { 319 TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsDisabled) {
466 GURL requesting_frame("http://www.example.com/geolocation"); 320 GURL requesting_frame("http://www.example.com/geolocation");
467 NavigateAndCommit(requesting_frame); 321 NavigateAndCommit(requesting_frame);
468 MockLocationSettings::SetLocationStatus(true, false); 322 MockLocationSettings::SetLocationStatus(true, false);
469 EXPECT_EQ(0U, infobar_service()->infobar_count()); 323 EXPECT_EQ(0U, infobar_service()->infobar_count());
470 RequestGeolocationPermission( 324 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
471 web_contents(), RequestID(0), requesting_frame, true);
472 EXPECT_EQ(0U, infobar_service()->infobar_count()); 325 EXPECT_EQ(0U, infobar_service()->infobar_count());
473 } 326 }
474 #endif 327 #endif
475 328
476 TEST_P(GeolocationPermissionContextParamTests, QueuedPermission) { 329 TEST_F(GeolocationPermissionContextTests, QueuedPermission) {
477 GURL requesting_frame_0("http://www.example.com/geolocation"); 330 GURL requesting_frame_0("http://www.example.com/geolocation");
478 GURL requesting_frame_1("http://www.example-2.com/geolocation"); 331 GURL requesting_frame_1("http://www.example-2.com/geolocation");
479 EXPECT_EQ( 332 EXPECT_EQ(CONTENT_SETTING_ASK,
480 CONTENT_SETTING_ASK, 333 profile()->GetHostContentSettingsMap()->GetContentSetting(
481 GetGeolocationContentSetting(requesting_frame_0, requesting_frame_1)); 334 requesting_frame_0, requesting_frame_0,
482 EXPECT_EQ( 335 CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
483 CONTENT_SETTING_ASK, 336 EXPECT_EQ(CONTENT_SETTING_ASK,
484 GetGeolocationContentSetting(requesting_frame_1, requesting_frame_1)); 337 profile()->GetHostContentSettingsMap()->GetContentSetting(
338 requesting_frame_1, requesting_frame_0,
339 CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
485 340
486 NavigateAndCommit(requesting_frame_0); 341 NavigateAndCommit(requesting_frame_0);
487 if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted(); 342 EXPECT_EQ(0U, infobar_service()->infobar_count());
488
489 // Check that no permission requests have happened yet.
490 EXPECT_EQ(0U, GetNumberOfPrompts());
491
492 // Request permission for two frames. 343 // Request permission for two frames.
493 RequestGeolocationPermission( 344 RequestGeolocationPermission(
494 web_contents(), RequestID(0), requesting_frame_0, true); 345 web_contents(), RequestID(0), requesting_frame_0);
495 RequestGeolocationPermission( 346 RequestGeolocationPermission(
496 web_contents(), RequestID(1), requesting_frame_1, true); 347 web_contents(), RequestID(1), requesting_frame_1);
497 // Ensure only one infobar is created. 348 // Ensure only one infobar is created.
498 ASSERT_EQ(1U, GetNumberOfPrompts()); 349 ASSERT_EQ(1U, infobar_service()->infobar_count());
499 base::string16 text_0 = GetPromptText(); 350 infobars::InfoBar* infobar_0 = infobar_service()->infobar_at(0);
351 ConfirmInfoBarDelegate* infobar_delegate_0 =
352 infobar_0->delegate()->AsConfirmInfoBarDelegate();
353 ASSERT_TRUE(infobar_delegate_0);
354 base::string16 text_0 = infobar_delegate_0->GetMessageText();
500 355
501 // Accept the first frame. 356 // Accept the first frame.
502 AcceptPrompt(); 357 infobar_delegate_0->Accept();
503 CheckTabContentsState(requesting_frame_0, CONTENT_SETTING_ALLOW); 358 CheckTabContentsState(requesting_frame_0, CONTENT_SETTING_ALLOW);
504 CheckPermissionMessageSent(0, true); 359 CheckPermissionMessageSent(0, true);
505 360
506 if (!BubbleEnabled()) { 361 infobar_service()->RemoveInfoBar(infobar_0);
507 infobars::InfoBar* infobar_0 = infobar_service()->infobar_at(0); 362 EXPECT_EQ(1U, closed_infobar_tracker_.size());
508 infobar_service()->RemoveInfoBar(infobar_0); 363 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_0));
509 EXPECT_EQ(1U, closed_infobar_tracker_.size()); 364 closed_infobar_tracker_.Clear();
510 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_0));
511 closed_infobar_tracker_.Clear();
512 }
513
514 // Now we should have a new infobar for the second frame. 365 // Now we should have a new infobar for the second frame.
515 ASSERT_EQ(1U, GetNumberOfPrompts()); 366 ASSERT_EQ(1U, infobar_service()->infobar_count());
516 base::string16 text_1 = GetPromptText(); 367
517 368 infobars::InfoBar* infobar_1 = infobar_service()->infobar_at(0);
518 // Check that the messages differ. 369 ConfirmInfoBarDelegate* infobar_delegate_1 =
370 infobar_1->delegate()->AsConfirmInfoBarDelegate();
371 ASSERT_TRUE(infobar_delegate_1);
372 base::string16 text_1 = infobar_delegate_1->GetMessageText();
519 EXPECT_NE(text_0, text_1); 373 EXPECT_NE(text_0, text_1);
520 374
521 // Cancel (block) this frame. 375 // Cancel (block) this frame.
522 if (BubbleEnabled()) { 376 infobar_delegate_1->Cancel();
523 PermissionBubbleManager* manager =
524 PermissionBubbleManager::FromWebContents(web_contents());
525 DenyBubble(manager);
526 } else {
527 infobars::InfoBar* infobar_1 = infobar_service()->infobar_at(0);
528 infobar_1->delegate()->AsConfirmInfoBarDelegate()->Cancel();
529 }
530 CheckTabContentsState(requesting_frame_1, CONTENT_SETTING_BLOCK); 377 CheckTabContentsState(requesting_frame_1, CONTENT_SETTING_BLOCK);
531 CheckPermissionMessageSent(1, false); 378 CheckPermissionMessageSent(1, false);
532 379 infobar_service()->RemoveInfoBar(infobar_1);
380 EXPECT_EQ(1U, closed_infobar_tracker_.size());
381 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_1));
382 EXPECT_EQ(0U, infobar_service()->infobar_count());
533 // Ensure the persisted permissions are ok. 383 // Ensure the persisted permissions are ok.
534 EXPECT_EQ( 384 EXPECT_EQ(CONTENT_SETTING_ALLOW,
535 CONTENT_SETTING_ALLOW, 385 profile()->GetHostContentSettingsMap()->GetContentSetting(
536 GetGeolocationContentSetting(requesting_frame_0, requesting_frame_0)); 386 requesting_frame_0, requesting_frame_0,
537 EXPECT_EQ( 387 CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
538 CONTENT_SETTING_BLOCK, 388
539 GetGeolocationContentSetting(requesting_frame_1, requesting_frame_0)); 389 EXPECT_EQ(CONTENT_SETTING_BLOCK,
540 } 390 profile()->GetHostContentSettingsMap()->GetContentSetting(
541 391 requesting_frame_1, requesting_frame_0,
542 TEST_P(GeolocationPermissionContextParamTests, HashIsIgnored) { 392 CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
393 }
394
395 TEST_F(GeolocationPermissionContextTests, HashIsIgnored) {
543 GURL url_a("http://www.example.com/geolocation#a"); 396 GURL url_a("http://www.example.com/geolocation#a");
544 GURL url_b("http://www.example.com/geolocation#b"); 397 GURL url_b("http://www.example.com/geolocation#b");
545 398
546 // Navigate to the first url. 399 // Navigate to the first url and check permission is requested.
547 NavigateAndCommit(url_a); 400 NavigateAndCommit(url_a);
548 if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted(); 401 EXPECT_EQ(0U, infobar_service()->infobar_count());
549 402 RequestGeolocationPermission(web_contents(), RequestID(0), url_a);
550 // Check permission is requested. 403 ASSERT_EQ(1U, infobar_service()->infobar_count());
551 ASSERT_EQ(0U, GetNumberOfPrompts()); 404 infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
552 RequestGeolocationPermission( 405 ConfirmInfoBarDelegate* infobar_delegate =
553 web_contents(), RequestID(0), url_a, BubbleEnabled()); 406 infobar->delegate()->AsConfirmInfoBarDelegate();
554 ASSERT_EQ(1U, GetNumberOfPrompts()); 407 ASSERT_TRUE(infobar_delegate);
555 408
556 // Change the hash, we'll still be on the same page. 409 // Change the hash, we'll still be on the same page.
557 NavigateAndCommit(url_b); 410 NavigateAndCommit(url_b);
558 if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted();
559 411
560 // Accept. 412 // Accept.
561 AcceptPrompt(); 413 infobar_delegate->Accept();
562 CheckTabContentsState(url_a, CONTENT_SETTING_ALLOW); 414 CheckTabContentsState(url_a, CONTENT_SETTING_ALLOW);
563 CheckTabContentsState(url_b, CONTENT_SETTING_ALLOW); 415 CheckTabContentsState(url_b, CONTENT_SETTING_ALLOW);
564 CheckPermissionMessageSent(0, true); 416 CheckPermissionMessageSent(0, true);
565 417
566 // Cleanup. 418 // Cleanup.
567 if (!BubbleEnabled()) { 419 infobar_service()->RemoveInfoBar(infobar);
568 infobars::InfoBar* infobar = infobar_service()->infobar_at(0); 420 EXPECT_EQ(1U, closed_infobar_tracker_.size());
569 infobar_service()->RemoveInfoBar(infobar); 421 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar));
570 EXPECT_EQ(1U, closed_infobar_tracker_.size()); 422 }
571 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar)); 423
572 } 424 TEST_F(GeolocationPermissionContextTests, PermissionForFileScheme) {
573 }
574
575 TEST_P(GeolocationPermissionContextParamTests, PermissionForFileScheme) {
576 // TODO(felt): The bubble is rejecting file:// permission requests.
577 // Fix and enable this test. crbug.com/444047
578 if (BubbleEnabled()) return;
579
580 GURL requesting_frame("file://example/geolocation.html"); 425 GURL requesting_frame("file://example/geolocation.html");
581 NavigateAndCommit(requesting_frame); 426 NavigateAndCommit(requesting_frame);
582 if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted(); 427 EXPECT_EQ(0U, infobar_service()->infobar_count());
583 428 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
584 // Check permission is requested. 429 EXPECT_EQ(1U, infobar_service()->infobar_count());
585 ASSERT_EQ(0U, GetNumberOfPrompts()); 430 infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
586 RequestGeolocationPermission( 431 ConfirmInfoBarDelegate* infobar_delegate =
587 web_contents(), RequestID(0), requesting_frame, true); 432 infobar->delegate()->AsConfirmInfoBarDelegate();
588 EXPECT_EQ(1U, GetNumberOfPrompts()); 433 ASSERT_TRUE(infobar_delegate);
589
590 // Accept the frame. 434 // Accept the frame.
591 AcceptPrompt(); 435 infobar_delegate->Accept();
592 CheckTabContentsState(requesting_frame, CONTENT_SETTING_ALLOW); 436 CheckTabContentsState(requesting_frame, CONTENT_SETTING_ALLOW);
593 CheckPermissionMessageSent(0, true); 437 CheckPermissionMessageSent(0, true);
438 infobar_service()->RemoveInfoBar(infobar);
594 439
595 // Make sure the setting is not stored. 440 // Make sure the setting is not stored.
596 EXPECT_EQ( 441 EXPECT_EQ(CONTENT_SETTING_ASK,
597 CONTENT_SETTING_ASK, 442 profile()->GetHostContentSettingsMap()->GetContentSetting(
598 GetGeolocationContentSetting(requesting_frame, requesting_frame)); 443 requesting_frame,
599 } 444 requesting_frame,
600 445 CONTENT_SETTINGS_TYPE_GEOLOCATION,
601 TEST_P(GeolocationPermissionContextParamTests, 446 std::string()));
602 CancelGeolocationPermissionRequest) { 447 }
603 GURL frame_0("http://www.example.com/geolocation"); 448
604 GURL frame_1("http://www.example-2.com/geolocation"); 449 TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) {
605 EXPECT_EQ( 450 GURL requesting_frame_0("http://www.example.com/geolocation");
606 CONTENT_SETTING_ASK, GetGeolocationContentSetting(frame_0, frame_0)); 451 GURL requesting_frame_1("http://www.example-2.com/geolocation");
607 EXPECT_EQ( 452 EXPECT_EQ(CONTENT_SETTING_ASK,
608 CONTENT_SETTING_ASK, GetGeolocationContentSetting(frame_1, frame_0)); 453 profile()->GetHostContentSettingsMap()->GetContentSetting(
609 454 requesting_frame_0, requesting_frame_0,
610 NavigateAndCommit(frame_0); 455 CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
611 if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted(); 456
612 457 EXPECT_EQ(CONTENT_SETTING_ASK,
613 ASSERT_EQ(0U, GetNumberOfPrompts()); 458 profile()->GetHostContentSettingsMap()->GetContentSetting(
459 requesting_frame_1, requesting_frame_0,
460 CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
461
462 NavigateAndCommit(requesting_frame_0);
463 EXPECT_EQ(0U, infobar_service()->infobar_count());
614 464
615 // Request permission for two frames. 465 // Request permission for two frames.
616 RequestGeolocationPermission( 466 RequestGeolocationPermission(
617 web_contents(), RequestID(0), frame_0, true); 467 web_contents(), RequestID(0), requesting_frame_0);
618 RequestGeolocationPermission( 468 RequestGeolocationPermission(
619 web_contents(), RequestID(1), frame_1, true); 469 web_contents(), RequestID(1), requesting_frame_1);
620 470 ASSERT_EQ(1U, infobar_service()->infobar_count());
621 // Get the first permission request text. 471
622 ASSERT_EQ(1U, GetNumberOfPrompts()); 472 infobars::InfoBar* infobar_0 = infobar_service()->infobar_at(0);
623 base::string16 text_0 = GetPromptText(); 473 ConfirmInfoBarDelegate* infobar_delegate_0 =
624 ASSERT_FALSE(text_0.empty()); 474 infobar_0->delegate()->AsConfirmInfoBarDelegate();
625 475 ASSERT_TRUE(infobar_delegate_0);
626 // Simulate the frame going away; the request should be removed. 476 base::string16 text_0 = infobar_delegate_0->GetMessageText();
627 if (BubbleEnabled()) { 477
628 PermissionBubbleManager* manager = 478 // Simulate the frame going away, ensure the infobar for this frame
629 PermissionBubbleManager::FromWebContents(web_contents()); 479 // is removed and the next pending infobar is created.
630 CloseBubble(manager); 480 geolocation_permission_context_->CancelPermissionRequest(web_contents(),
631 } else { 481 RequestID(0));
632 geolocation_permission_context_->CancelPermissionRequest(web_contents(), 482 EXPECT_EQ(1U, closed_infobar_tracker_.size());
633 RequestID(0)); 483 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_0));
634 } 484 closed_infobar_tracker_.Clear();
635 485 ASSERT_EQ(1U, infobar_service()->infobar_count());
636 // Check that the next pending request is created correctly. 486
637 base::string16 text_1 = GetPromptText(); 487 infobars::InfoBar* infobar_1 = infobar_service()->infobar_at(0);
488 ConfirmInfoBarDelegate* infobar_delegate_1 =
489 infobar_1->delegate()->AsConfirmInfoBarDelegate();
490 ASSERT_TRUE(infobar_delegate_1);
491 base::string16 text_1 = infobar_delegate_1->GetMessageText();
638 EXPECT_NE(text_0, text_1); 492 EXPECT_NE(text_0, text_1);
639 493
640 // Allow this frame and check that it worked. 494 // Allow this frame.
641 AcceptPrompt(); 495 infobar_delegate_1->Accept();
642 CheckTabContentsState(frame_1, CONTENT_SETTING_ALLOW); 496 CheckTabContentsState(requesting_frame_1, CONTENT_SETTING_ALLOW);
643 CheckPermissionMessageSent(1, true); 497 CheckPermissionMessageSent(1, true);
644 498 infobar_service()->RemoveInfoBar(infobar_1);
499 EXPECT_EQ(1U, closed_infobar_tracker_.size());
500 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_1));
501 EXPECT_EQ(0U, infobar_service()->infobar_count());
645 // Ensure the persisted permissions are ok. 502 // Ensure the persisted permissions are ok.
646 EXPECT_EQ( 503 EXPECT_EQ(CONTENT_SETTING_ASK,
647 CONTENT_SETTING_ASK, GetGeolocationContentSetting(frame_0, frame_0)); 504 profile()->GetHostContentSettingsMap()->GetContentSetting(
648 EXPECT_EQ( 505 requesting_frame_0, requesting_frame_0,
649 CONTENT_SETTING_ALLOW, GetGeolocationContentSetting(frame_1, frame_0)); 506 CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
650 } 507
651 508 EXPECT_EQ(CONTENT_SETTING_ALLOW,
652 TEST_P(GeolocationPermissionContextParamTests, InvalidURL) { 509 profile()->GetHostContentSettingsMap()->GetContentSetting(
653 // Navigate to the first url. 510 requesting_frame_1, requesting_frame_0,
511 CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
512 }
513
514 TEST_F(GeolocationPermissionContextTests, InvalidURL) {
654 GURL invalid_embedder("about:blank"); 515 GURL invalid_embedder("about:blank");
655 GURL requesting_frame; 516 GURL requesting_frame;
656 NavigateAndCommit(invalid_embedder); 517 NavigateAndCommit(invalid_embedder);
657 if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted(); 518 EXPECT_EQ(0U, infobar_service()->infobar_count());
658 519 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
659 // Nothing should be displayed. 520 EXPECT_EQ(0U, infobar_service()->infobar_count());
660 EXPECT_EQ(0U, GetNumberOfPrompts());
661 RequestGeolocationPermission(
662 web_contents(), RequestID(0), requesting_frame, true);
663 EXPECT_EQ(0U, GetNumberOfPrompts());
664 CheckPermissionMessageSent(0, false); 521 CheckPermissionMessageSent(0, false);
665 } 522 }
666 523
667 TEST_P(GeolocationPermissionContextParamTests, SameOriginMultipleTabs) { 524 TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) {
668 GURL url_a("http://www.example.com/geolocation"); 525 GURL url_a("http://www.example.com/geolocation");
669 GURL url_b("http://www.example-2.com/geolocation"); 526 GURL url_b("http://www.example-2.com/geolocation");
670 NavigateAndCommit(url_a); // Tab A0 527 NavigateAndCommit(url_a);
671 AddNewTab(url_b); // Tab B (extra_tabs_[0]) 528 AddNewTab(url_b);
672 AddNewTab(url_a); // Tab A1 (extra_tabs_[1]) 529 AddNewTab(url_a);
673 if (BubbleEnabled()) { 530
674 BubbleManagerDocumentLoadCompleted(); 531 EXPECT_EQ(0U, infobar_service()->infobar_count());
675 BubbleManagerDocumentLoadCompleted(extra_tabs_[0]); 532 RequestGeolocationPermission(web_contents(), RequestID(0), url_a);
676 BubbleManagerDocumentLoadCompleted(extra_tabs_[1]); 533 ASSERT_EQ(1U, infobar_service()->infobar_count());
677 } 534
678 PermissionBubbleManager* manager_a0 = 535 RequestGeolocationPermission(extra_tabs_[0], RequestIDForTab(0, 0), url_b);
679 PermissionBubbleManager::FromWebContents(web_contents()); 536 EXPECT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
680 PermissionBubbleManager* manager_b = 537
681 PermissionBubbleManager::FromWebContents(extra_tabs_[0]); 538 RequestGeolocationPermission(extra_tabs_[1], RequestIDForTab(1, 0), url_a);
682 PermissionBubbleManager* manager_a1 = 539 ASSERT_EQ(1U, infobar_service_for_tab(1)->infobar_count());
683 PermissionBubbleManager::FromWebContents(extra_tabs_[1]); 540
684 541 infobars::InfoBar* removed_infobar =
685 // Request permission in all three tabs. 542 infobar_service_for_tab(1)->infobar_at(0);
686 RequestGeolocationPermission( 543
687 web_contents(), RequestID(0), url_a, true); 544 // Accept the first tab.
688 RequestGeolocationPermission( 545 infobars::InfoBar* infobar_0 = infobar_service()->infobar_at(0);
689 extra_tabs_[0], RequestIDForTab(0, 0), url_b, true); 546 ConfirmInfoBarDelegate* infobar_delegate_0 =
690 RequestGeolocationPermission( 547 infobar_0->delegate()->AsConfirmInfoBarDelegate();
691 extra_tabs_[1], RequestIDForTab(1, 0), url_a, true); 548 ASSERT_TRUE(infobar_delegate_0);
692 ASSERT_EQ(1U, GetNumberOfPrompts()); // For A0. 549 infobar_delegate_0->Accept();
693 if (BubbleEnabled()) { 550 CheckPermissionMessageSent(0, true);
694 ASSERT_EQ(1U, GetBubblesQueueSize(manager_b)); 551 infobar_service()->RemoveInfoBar(infobar_0);
695 ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1)); 552 EXPECT_EQ(2U, closed_infobar_tracker_.size());
696 } else { 553 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_0));
697 ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count()); 554 // Now the infobar for the tab with the same origin should have gone.
698 ASSERT_EQ(1U, infobar_service_for_tab(1)->infobar_count()); 555 EXPECT_EQ(0U, infobar_service_for_tab(1)->infobar_count());
699 } 556 CheckPermissionMessageSentForTab(1, 0, true);
700 557 EXPECT_TRUE(closed_infobar_tracker_.Contains(removed_infobar));
701 // Accept the permission in tab A0. 558 closed_infobar_tracker_.Clear();
702 if (BubbleEnabled()) { 559
703 AcceptBubble(manager_a0); 560 // But the other tab should still have the info bar...
704 } else { 561 ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
705 infobars::InfoBar* infobar_a0 = infobar_service()->infobar_at(0); 562 infobars::InfoBar* infobar_1 = infobar_service_for_tab(0)->infobar_at(0);
706 ConfirmInfoBarDelegate* infobar_delegate_a0 = 563 ConfirmInfoBarDelegate* infobar_delegate_1 =
707 infobar_a0->delegate()->AsConfirmInfoBarDelegate(); 564 infobar_1->delegate()->AsConfirmInfoBarDelegate();
708 ASSERT_TRUE(infobar_delegate_a0); 565 ASSERT_TRUE(infobar_delegate_1);
709 infobar_delegate_a0->Accept(); 566 infobar_delegate_1->Cancel();
710 infobar_service()->RemoveInfoBar(infobar_a0); 567 infobar_service_for_tab(0)->RemoveInfoBar(infobar_1);
711 EXPECT_EQ(2U, closed_infobar_tracker_.size()); 568 EXPECT_EQ(1U, closed_infobar_tracker_.size());
712 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_a0)); 569 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_1));
713 } 570 }
714 CheckPermissionMessageSent(0, true); 571
715 // Because they're the same origin, this will cause tab A1's infobar to 572 TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
716 // disappear. It does not cause the bubble to disappear: crbug.com/443013.
717 // TODO(felt): Update this test when the bubble's behavior is changed.
718 if (BubbleEnabled())
719 ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
720 else
721 CheckPermissionMessageSentForTab(1, 0, true);
722
723 // Either way, tab B should still have a pending permission request.
724 if (BubbleEnabled())
725 ASSERT_EQ(1U, GetBubblesQueueSize(manager_b));
726 else
727 ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
728 }
729
730 TEST_P(GeolocationPermissionContextParamTests, QueuedOriginMultipleTabs) {
731 GURL url_a("http://www.example.com/geolocation"); 573 GURL url_a("http://www.example.com/geolocation");
732 GURL url_b("http://www.example-2.com/geolocation"); 574 GURL url_b("http://www.example-2.com/geolocation");
733 NavigateAndCommit(url_a); // Tab A0. 575 NavigateAndCommit(url_a);
734 AddNewTab(url_a); // Tab A1. 576 AddNewTab(url_a);
735 if (BubbleEnabled()) { 577
736 BubbleManagerDocumentLoadCompleted(); 578 EXPECT_EQ(0U, infobar_service()->infobar_count());
737 BubbleManagerDocumentLoadCompleted(extra_tabs_[0]); 579 RequestGeolocationPermission(web_contents(), RequestID(0), url_a);
738 } 580 ASSERT_EQ(1U, infobar_service()->infobar_count());
739 PermissionBubbleManager* manager_a0 = 581
740 PermissionBubbleManager::FromWebContents(web_contents()); 582 RequestGeolocationPermission(extra_tabs_[0], RequestIDForTab(0, 0), url_a);
741 PermissionBubbleManager* manager_a1 = 583 EXPECT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
742 PermissionBubbleManager::FromWebContents(extra_tabs_[0]); 584
743 585 RequestGeolocationPermission(extra_tabs_[0], RequestIDForTab(0, 1), url_b);
744 // Request permission in both tabs; the extra tab will have two permission 586 ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
745 // requests from two origins. 587
746 RequestGeolocationPermission( 588 infobars::InfoBar* removed_infobar = infobar_service()->infobar_at(0);
747 web_contents(), RequestID(0), url_a, true); 589
748 RequestGeolocationPermission( 590 // Accept the second tab.
749 extra_tabs_[0], RequestIDForTab(0, 0), url_a, true); 591 infobars::InfoBar* infobar_0 = infobar_service_for_tab(0)->infobar_at(0);
750 RequestGeolocationPermission( 592 ConfirmInfoBarDelegate* infobar_delegate_0 =
751 extra_tabs_[0], RequestIDForTab(0, 1), url_b, true); 593 infobar_0->delegate()->AsConfirmInfoBarDelegate();
752 if (BubbleEnabled()) { 594 ASSERT_TRUE(infobar_delegate_0);
753 ASSERT_EQ(1U, GetBubblesQueueSize(manager_a0)); 595 infobar_delegate_0->Accept();
754 ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
755 } else {
756 ASSERT_EQ(1U, infobar_service()->infobar_count());
757 ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
758 }
759
760 // Accept the first request in tab A1.
761 if (BubbleEnabled()) {
762 AcceptBubble(manager_a1);
763 } else {
764 infobars::InfoBar* infobar_a1 = infobar_service_for_tab(0)->infobar_at(0);
765 ConfirmInfoBarDelegate* infobar_delegate_a1 =
766 infobar_a1->delegate()->AsConfirmInfoBarDelegate();
767 ASSERT_TRUE(infobar_delegate_a1);
768 infobar_delegate_a1->Accept();
769 infobar_service_for_tab(0)->RemoveInfoBar(infobar_a1);
770 EXPECT_EQ(2U, closed_infobar_tracker_.size());
771 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_a1));
772 }
773 CheckPermissionMessageSentForTab(0, 0, true); 596 CheckPermissionMessageSentForTab(0, 0, true);
774 597 infobar_service_for_tab(0)->RemoveInfoBar(infobar_0);
775 // Because they're the same origin, this will cause tab A0's infobar to 598 EXPECT_EQ(2U, closed_infobar_tracker_.size());
776 // disappear. It does not cause the bubble to disappear: crbug.com/443013. 599 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_0));
777 // TODO(felt): Update this test when the bubble's behavior is changed. 600 // Now the infobar for the tab with the same origin should have gone.
778 if (BubbleEnabled()) { 601 EXPECT_EQ(0U, infobar_service()->infobar_count());
779 EXPECT_EQ(1U, GetBubblesQueueSize(manager_a0)); 602 CheckPermissionMessageSent(0, true);
780 } else { 603 EXPECT_TRUE(closed_infobar_tracker_.Contains(removed_infobar));
781 EXPECT_EQ(0U, infobar_service()->infobar_count()); 604 closed_infobar_tracker_.Clear();
782 CheckPermissionMessageSent(0, true); 605
783 } 606 // And we should have the queued infobar displayed now.
784 607 ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
785 // The second request should now be visible in tab A1. 608
786 if (BubbleEnabled()) 609 // Accept the second infobar.
787 ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1)); 610 infobars::InfoBar* infobar_1 = infobar_service_for_tab(0)->infobar_at(0);
788 else 611 ConfirmInfoBarDelegate* infobar_delegate_1 =
789 ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count()); 612 infobar_1->delegate()->AsConfirmInfoBarDelegate();
790 613 ASSERT_TRUE(infobar_delegate_1);
791 // Accept the second request and check that it's gone. 614 infobar_delegate_1->Accept();
792 if (BubbleEnabled()) { 615 CheckPermissionMessageSentForTab(0, 1, true);
793 AcceptBubble(manager_a1); 616 infobar_service_for_tab(0)->RemoveInfoBar(infobar_1);
794 EXPECT_EQ(0U, GetBubblesQueueSize(manager_a1)); 617 EXPECT_EQ(1U, closed_infobar_tracker_.size());
795 } else { 618 EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_1));
796 infobars::InfoBar* infobar_1 = infobar_service_for_tab(0)->infobar_at(0); 619 }
797 ConfirmInfoBarDelegate* infobar_delegate_1 = 620
798 infobar_1->delegate()->AsConfirmInfoBarDelegate(); 621 TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
799 ASSERT_TRUE(infobar_delegate_1);
800 infobar_delegate_1->Accept();
801 }
802 }
803
804 TEST_P(GeolocationPermissionContextParamTests, TabDestroyed) {
805 GURL requesting_frame_0("http://www.example.com/geolocation"); 622 GURL requesting_frame_0("http://www.example.com/geolocation");
806 GURL requesting_frame_1("http://www.example-2.com/geolocation"); 623 GURL requesting_frame_1("http://www.example-2.com/geolocation");
807 EXPECT_EQ( 624 EXPECT_EQ(CONTENT_SETTING_ASK,
808 CONTENT_SETTING_ASK, 625 profile()->GetHostContentSettingsMap()->GetContentSetting(
809 GetGeolocationContentSetting(requesting_frame_0, requesting_frame_0)); 626 requesting_frame_0, requesting_frame_0,
810 EXPECT_EQ( 627 CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
811 CONTENT_SETTING_ASK, 628
812 GetGeolocationContentSetting(requesting_frame_1, requesting_frame_0)); 629 EXPECT_EQ(CONTENT_SETTING_ASK,
630 profile()->GetHostContentSettingsMap()->GetContentSetting(
631 requesting_frame_1, requesting_frame_0,
632 CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
813 633
814 NavigateAndCommit(requesting_frame_0); 634 NavigateAndCommit(requesting_frame_0);
815 if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted(); 635 EXPECT_EQ(0U, infobar_service()->infobar_count());
816
817 // Request permission for two frames. 636 // Request permission for two frames.
818 RequestGeolocationPermission( 637 RequestGeolocationPermission(
819 web_contents(), RequestID(0), requesting_frame_0, false); 638 web_contents(), RequestID(0), requesting_frame_0);
820 RequestGeolocationPermission( 639 RequestGeolocationPermission(
821 web_contents(), RequestID(1), requesting_frame_1, false); 640 web_contents(), RequestID(1), requesting_frame_1);
822 641 // Ensure only one infobar is created.
823 // Ensure only one prompt is created. 642 ASSERT_EQ(1U, infobar_service()->infobar_count());
824 ASSERT_EQ(1U, GetNumberOfPrompts()); 643 infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
825 644
826 // Delete the tab contents. 645 // Delete the tab contents.
827 if (!BubbleEnabled()) { 646 DeleteContents();
828 infobars::InfoBar* infobar = infobar_service()->infobar_at(0); 647
829 DeleteContents(); 648 // During contents destruction, the infobar will have been closed, and the
830 ASSERT_EQ(1U, closed_infobar_tracker_.size()); 649 // pending request should have been cleared without an infobar being created.
831 ASSERT_TRUE(closed_infobar_tracker_.Contains(infobar)); 650 ASSERT_EQ(1U, closed_infobar_tracker_.size());
832 } 651 ASSERT_TRUE(closed_infobar_tracker_.Contains(infobar));
833 652 }
834 // The content settings should not have changed. 653
835 EXPECT_EQ( 654 TEST_F(GeolocationPermissionContextTests, LastUsageAudited) {
836 CONTENT_SETTING_ASK,
837 GetGeolocationContentSetting(requesting_frame_0, requesting_frame_0));
838 EXPECT_EQ(
839 CONTENT_SETTING_ASK,
840 GetGeolocationContentSetting(requesting_frame_1, requesting_frame_0));
841 }
842
843 TEST_P(GeolocationPermissionContextParamTests, LastUsageAudited) {
844 GURL requesting_frame("http://www.example.com/geolocation"); 655 GURL requesting_frame("http://www.example.com/geolocation");
845 NavigateAndCommit(requesting_frame); 656 NavigateAndCommit(requesting_frame);
846 if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted();
847 657
848 base::SimpleTestClock* test_clock = new base::SimpleTestClock; 658 base::SimpleTestClock* test_clock = new base::SimpleTestClock;
849 test_clock->SetNow(base::Time::UnixEpoch() + 659 test_clock->SetNow(base::Time::UnixEpoch() +
850 base::TimeDelta::FromSeconds(10)); 660 base::TimeDelta::FromSeconds(10));
851 661
852 HostContentSettingsMap* map = profile()->GetHostContentSettingsMap(); 662 HostContentSettingsMap* map = profile()->GetHostContentSettingsMap();
853 map->SetPrefClockForTesting(scoped_ptr<base::Clock>(test_clock)); 663 map->SetPrefClockForTesting(scoped_ptr<base::Clock>(test_clock));
854 664
855 // The permission shouldn't have been used yet. 665 // The permission shouldn't have been used yet.
856 EXPECT_EQ(map->GetLastUsage(requesting_frame.GetOrigin(), 666 EXPECT_EQ(map->GetLastUsage(requesting_frame.GetOrigin(),
857 requesting_frame.GetOrigin(), 667 requesting_frame.GetOrigin(),
858 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 668 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
859 0); 669 0);
860 ASSERT_EQ(0U, GetNumberOfPrompts());
861 RequestGeolocationPermission(
862 web_contents(), RequestID(0), requesting_frame, false);
863 ASSERT_EQ(1U, GetNumberOfPrompts());
864 670
865 AcceptPrompt(); 671 EXPECT_EQ(0U, infobar_service()->infobar_count());
672 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
673 ASSERT_EQ(1U, infobar_service()->infobar_count());
674 infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
675 ConfirmInfoBarDelegate* infobar_delegate =
676 infobar->delegate()->AsConfirmInfoBarDelegate();
677 ASSERT_TRUE(infobar_delegate);
678 infobar_delegate->Accept();
866 CheckTabContentsState(requesting_frame, CONTENT_SETTING_ALLOW); 679 CheckTabContentsState(requesting_frame, CONTENT_SETTING_ALLOW);
867 CheckPermissionMessageSent(0, true); 680 CheckPermissionMessageSent(0, true);
868 681
869 // Permission has been used at the starting time. 682 // Permission has been used at the starting time.
870 EXPECT_EQ(map->GetLastUsage(requesting_frame.GetOrigin(), 683 EXPECT_EQ(map->GetLastUsage(requesting_frame.GetOrigin(),
871 requesting_frame.GetOrigin(), 684 requesting_frame.GetOrigin(),
872 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 685 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
873 10); 686 10);
874 687
875 test_clock->Advance(base::TimeDelta::FromSeconds(3)); 688 test_clock->Advance(base::TimeDelta::FromSeconds(3));
876 RequestGeolocationPermission( 689 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
877 web_contents(), RequestID(0), requesting_frame, false);
878 690
879 // Permission has been used three seconds later. 691 // Permission has been used three seconds later.
880 EXPECT_EQ(map->GetLastUsage(requesting_frame.GetOrigin(), 692 EXPECT_EQ(map->GetLastUsage(requesting_frame.GetOrigin(),
881 requesting_frame.GetOrigin(), 693 requesting_frame.GetOrigin(),
882 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 694 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
883 13); 695 13);
884 } 696 }
885 697
886 TEST_P(GeolocationPermissionContextParamTests, LastUsageAuditedMultipleFrames) { 698 TEST_F(GeolocationPermissionContextTests, LastUsageAuditedMultipleFrames) {
887 base::SimpleTestClock* test_clock = new base::SimpleTestClock; 699 base::SimpleTestClock* test_clock = new base::SimpleTestClock;
888 test_clock->SetNow(base::Time::UnixEpoch() + 700 test_clock->SetNow(base::Time::UnixEpoch() +
889 base::TimeDelta::FromSeconds(10)); 701 base::TimeDelta::FromSeconds(10));
890 702
891 HostContentSettingsMap* map = profile()->GetHostContentSettingsMap(); 703 HostContentSettingsMap* map = profile()->GetHostContentSettingsMap();
892 map->SetPrefClockForTesting(scoped_ptr<base::Clock>(test_clock)); 704 map->SetPrefClockForTesting(scoped_ptr<base::Clock>(test_clock));
893 705
894 GURL requesting_frame_0("http://www.example.com/geolocation"); 706 GURL requesting_frame_0("http://www.example.com/geolocation");
895 GURL requesting_frame_1("http://www.example-2.com/geolocation"); 707 GURL requesting_frame_1("http://www.example-2.com/geolocation");
896 708
897 // The permission shouldn't have been used yet. 709 // The permission shouldn't have been used yet.
898 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), 710 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(),
899 requesting_frame_0.GetOrigin(), 711 requesting_frame_0.GetOrigin(),
900 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 712 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
901 0); 713 0);
902 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), 714 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(),
903 requesting_frame_0.GetOrigin(), 715 requesting_frame_0.GetOrigin(),
904 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 716 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
905 0); 717 0);
906 718
907 NavigateAndCommit(requesting_frame_0); 719 NavigateAndCommit(requesting_frame_0);
908 if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted(); 720 EXPECT_EQ(0U, infobar_service()->infobar_count());
909
910 EXPECT_EQ(0U, GetNumberOfPrompts());
911 721
912 // Request permission for two frames. 722 // Request permission for two frames.
913 RequestGeolocationPermission( 723 RequestGeolocationPermission(
914 web_contents(), RequestID(0), requesting_frame_0, false); 724 web_contents(), RequestID(0), requesting_frame_0);
915 RequestGeolocationPermission( 725 RequestGeolocationPermission(
916 web_contents(), RequestID(1), requesting_frame_1, false); 726 web_contents(), RequestID(1), requesting_frame_1);
917 727
918 // Ensure only one infobar is created. 728 // Ensure only one infobar is created.
919 ASSERT_EQ(1U, GetNumberOfPrompts()); 729 ASSERT_EQ(1U, infobar_service()->infobar_count());
730 infobars::InfoBar* infobar_0 = infobar_service()->infobar_at(0);
731 ConfirmInfoBarDelegate* infobar_delegate_0 =
732 infobar_0->delegate()->AsConfirmInfoBarDelegate();
920 733
921 // Accept the first frame. 734 // Accept the first frame.
922 AcceptPrompt(); 735 infobar_delegate_0->Accept();
923 if (!BubbleEnabled())
924 infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
925 CheckTabContentsState(requesting_frame_0, CONTENT_SETTING_ALLOW); 736 CheckTabContentsState(requesting_frame_0, CONTENT_SETTING_ALLOW);
926 CheckPermissionMessageSent(0, true); 737 CheckPermissionMessageSent(0, true);
738 infobar_service()->RemoveInfoBar(infobar_0);
927 739
928 // Verify that accepting the first didn't accept because it's embedded 740 // Verify that accepting the first didn't accept because it's embedder
929 // in the other. 741 // in the other.
930 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), 742 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(),
931 requesting_frame_0.GetOrigin(), 743 requesting_frame_0.GetOrigin(),
932 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 744 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
933 10); 745 10);
934 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), 746 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(),
935 requesting_frame_0.GetOrigin(), 747 requesting_frame_0.GetOrigin(),
936 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 748 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
937 0); 749 0);
938 750
939 ASSERT_EQ(1U, GetNumberOfPrompts()); 751 ASSERT_EQ(1U, infobar_service()->infobar_count());
752 infobars::InfoBar* infobar_1 = infobar_service()->infobar_at(0);
753 ConfirmInfoBarDelegate* infobar_delegate_1 =
754 infobar_1->delegate()->AsConfirmInfoBarDelegate();
940 755
941 test_clock->Advance(base::TimeDelta::FromSeconds(1)); 756 test_clock->Advance(base::TimeDelta::FromSeconds(1));
942 757
943 // Allow the second frame. 758 // Allow the second frame.
944 AcceptPrompt(); 759 infobar_delegate_1->Accept();
945 CheckTabContentsState(requesting_frame_1, CONTENT_SETTING_ALLOW); 760 CheckTabContentsState(requesting_frame_1, CONTENT_SETTING_ALLOW);
946 CheckPermissionMessageSent(1, true); 761 CheckPermissionMessageSent(1, true);
947 if (!BubbleEnabled()) 762 infobar_service()->RemoveInfoBar(infobar_1);
948 infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
949 763
950 // Verify that the times are different. 764 // Verify that the times are different.
951 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), 765 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(),
952 requesting_frame_0.GetOrigin(), 766 requesting_frame_0.GetOrigin(),
953 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 767 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
954 10); 768 10);
955 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), 769 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(),
956 requesting_frame_0.GetOrigin(), 770 requesting_frame_0.GetOrigin(),
957 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 771 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
958 11); 772 11);
959 773
960 test_clock->Advance(base::TimeDelta::FromSeconds(2)); 774 test_clock->Advance(base::TimeDelta::FromSeconds(2));
961 RequestGeolocationPermission( 775 RequestGeolocationPermission(
962 web_contents(), RequestID(0), requesting_frame_0, false); 776 web_contents(), RequestID(0), requesting_frame_0);
963 777
964 // Verify that requesting permission in one frame doesn't update other where 778 // Verify that requesting permission in one frame doesn't update other where
965 // it is the embedder. 779 // it is the embedder.
966 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), 780 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(),
967 requesting_frame_0.GetOrigin(), 781 requesting_frame_0.GetOrigin(),
968 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 782 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
969 13); 783 13);
970 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), 784 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(),
971 requesting_frame_0.GetOrigin(), 785 requesting_frame_0.GetOrigin(),
972 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 786 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
973 11); 787 11);
974 } 788 }
975
976 INSTANTIATE_TEST_CASE_P(GeolocationPermissionContextTestsWithAndWithoutBubbles,
977 GeolocationPermissionContextParamTests,
978 ::testing::Values(false, true));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698