 Chromium Code Reviews
 Chromium Code Reviews Issue 5984001:
  Client-based geolocation refactoring.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 5984001:
  Client-based geolocation refactoring.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/scoped_vector.h" | 7 #include "base/scoped_vector.h" | 
| 8 #include "chrome/browser/browser_thread.h" | 8 #include "chrome/browser/browser_thread.h" | 
| 9 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 9 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 
| 10 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 10 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 EXPECT_EQ( | 283 EXPECT_EQ( | 
| 284 CONTENT_SETTING_ASK, | 284 CONTENT_SETTING_ASK, | 
| 285 profile()->GetGeolocationContentSettingsMap()->GetContentSetting( | 285 profile()->GetGeolocationContentSettingsMap()->GetContentSetting( | 
| 286 requesting_frame_0, requesting_frame_0)); | 286 requesting_frame_0, requesting_frame_0)); | 
| 287 EXPECT_EQ( | 287 EXPECT_EQ( | 
| 288 CONTENT_SETTING_ALLOW, | 288 CONTENT_SETTING_ALLOW, | 
| 289 profile()->GetGeolocationContentSettingsMap()->GetContentSetting( | 289 profile()->GetGeolocationContentSettingsMap()->GetContentSetting( | 
| 290 requesting_frame_1, requesting_frame_0)); | 290 requesting_frame_1, requesting_frame_0)); | 
| 291 } | 291 } | 
| 292 | 292 | 
| 293 #if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) | |
| 293 TEST_F(GeolocationPermissionContextTests, StopUpdating) { | 294 TEST_F(GeolocationPermissionContextTests, StopUpdating) { | 
| 
bulach
2010/12/17 11:19:47
the way we normally disable tests is:
// TODO(jkn
 | |
| 294 GURL requesting_frame("http://www.example.com/geolocation"); | 295 GURL requesting_frame("http://www.example.com/geolocation"); | 
| 295 NavigateAndCommit(requesting_frame); | 296 NavigateAndCommit(requesting_frame); | 
| 296 EXPECT_EQ(0, contents()->infobar_delegate_count()); | 297 EXPECT_EQ(0, contents()->infobar_delegate_count()); | 
| 297 geolocation_permission_context_->RequestGeolocationPermission( | 298 geolocation_permission_context_->RequestGeolocationPermission( | 
| 298 process_id(), render_id(), bridge_id(), requesting_frame); | 299 process_id(), render_id(), bridge_id(), requesting_frame); | 
| 299 EXPECT_EQ(1, contents()->infobar_delegate_count()); | 300 EXPECT_EQ(1, contents()->infobar_delegate_count()); | 
| 300 ConfirmInfoBarDelegate* infobar_0 = | 301 ConfirmInfoBarDelegate* infobar_0 = | 
| 301 contents()->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); | 302 contents()->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); | 
| 302 ASSERT_TRUE(infobar_0); | 303 ASSERT_TRUE(infobar_0); | 
| 303 | 304 | 
| 304 geolocation_permission_context_->StopUpdatingRequested( | 305 geolocation_permission_context_->StopUpdatingRequested( | 
| 305 process_id(), render_id(), bridge_id()); | 306 process_id(), render_id(), bridge_id()); | 
| 306 EXPECT_EQ(infobar_0, | 307 EXPECT_EQ(infobar_0, | 
| 307 tab_contents_with_pending_infobar_->removed_infobar_delegate_); | 308 tab_contents_with_pending_infobar_->removed_infobar_delegate_); | 
| 308 infobar_0->InfoBarClosed(); | 309 infobar_0->InfoBarClosed(); | 
| 309 EXPECT_EQ(0, contents()->infobar_delegate_count()); | 310 EXPECT_EQ(0, contents()->infobar_delegate_count()); | 
| 310 EXPECT_EQ( | 311 EXPECT_EQ( | 
| 311 CONTENT_SETTING_ASK, | 312 CONTENT_SETTING_ASK, | 
| 312 profile()->GetGeolocationContentSettingsMap()->GetContentSetting( | 313 profile()->GetGeolocationContentSettingsMap()->GetContentSetting( | 
| 313 requesting_frame, requesting_frame)); | 314 requesting_frame, requesting_frame)); | 
| 314 } | 315 } | 
| 316 #endif | |
| 315 | 317 | 
| 316 TEST_F(GeolocationPermissionContextTests, InvalidURL) { | 318 TEST_F(GeolocationPermissionContextTests, InvalidURL) { | 
| 317 GURL invalid_embedder; | 319 GURL invalid_embedder; | 
| 318 GURL requesting_frame("about:blank"); | 320 GURL requesting_frame("about:blank"); | 
| 319 NavigateAndCommit(invalid_embedder); | 321 NavigateAndCommit(invalid_embedder); | 
| 320 EXPECT_EQ(0, contents()->infobar_delegate_count()); | 322 EXPECT_EQ(0, contents()->infobar_delegate_count()); | 
| 321 geolocation_permission_context_->RequestGeolocationPermission( | 323 geolocation_permission_context_->RequestGeolocationPermission( | 
| 322 process_id(), render_id(), bridge_id(), requesting_frame); | 324 process_id(), render_id(), bridge_id(), requesting_frame); | 
| 323 EXPECT_EQ(0, contents()->infobar_delegate_count()); | 325 EXPECT_EQ(0, contents()->infobar_delegate_count()); | 
| 324 CheckPermissionMessageSent(bridge_id(), false); | 326 CheckPermissionMessageSent(bridge_id(), false); | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 ASSERT_TRUE(infobar_1); | 417 ASSERT_TRUE(infobar_1); | 
| 416 infobar_1->Accept(); | 418 infobar_1->Accept(); | 
| 417 CheckPermissionMessageSentForTab(0, bridge_id() + 1, true); | 419 CheckPermissionMessageSentForTab(0, bridge_id() + 1, true); | 
| 418 extra_tabs_[0]->RemoveInfoBar(infobar_1); | 420 extra_tabs_[0]->RemoveInfoBar(infobar_1); | 
| 419 EXPECT_EQ(infobar_1, | 421 EXPECT_EQ(infobar_1, | 
| 420 extra_tabs_[0]->removed_infobar_delegate_); | 422 extra_tabs_[0]->removed_infobar_delegate_); | 
| 421 infobar_1->InfoBarClosed(); | 423 infobar_1->InfoBarClosed(); | 
| 422 | 424 | 
| 423 extra_tabs_.reset(); | 425 extra_tabs_.reset(); | 
| 424 } | 426 } | 
| OLD | NEW |