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

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

Issue 5938002: Remove legacy non-client-based geolocation code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove non-client-based geolocation code. Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
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
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 // TODO(jknotten): Remove this test once we have completely
294 // switched over to client-based geolocation.
295 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION)
296 #define MAYBE_StopUpdating DISABLED_StopUpdating
297 #else
298 #define MAYBE_StopUpdating StopUpdating
299 #endif
300 TEST_F(GeolocationPermissionContextTests, MAYBE_StopUpdating) {
301 GURL requesting_frame("http://www.example.com/geolocation");
302 NavigateAndCommit(requesting_frame);
303 EXPECT_EQ(0, contents()->infobar_delegate_count());
304 geolocation_permission_context_->RequestGeolocationPermission(
305 process_id(), render_id(), bridge_id(), requesting_frame);
306 EXPECT_EQ(1, contents()->infobar_delegate_count());
307 ConfirmInfoBarDelegate* infobar_0 =
308 contents()->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate();
309 ASSERT_TRUE(infobar_0);
310
311 geolocation_permission_context_->StopUpdatingRequested(
312 process_id(), render_id(), bridge_id());
313 EXPECT_EQ(infobar_0,
314 tab_contents_with_pending_infobar_->removed_infobar_delegate_);
315 infobar_0->InfoBarClosed();
316 EXPECT_EQ(0, contents()->infobar_delegate_count());
317 EXPECT_EQ(
318 CONTENT_SETTING_ASK,
319 profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
320 requesting_frame, requesting_frame));
321 }
322
323 TEST_F(GeolocationPermissionContextTests, InvalidURL) { 293 TEST_F(GeolocationPermissionContextTests, InvalidURL) {
324 GURL invalid_embedder; 294 GURL invalid_embedder;
325 GURL requesting_frame("about:blank"); 295 GURL requesting_frame("about:blank");
326 NavigateAndCommit(invalid_embedder); 296 NavigateAndCommit(invalid_embedder);
327 EXPECT_EQ(0, contents()->infobar_delegate_count()); 297 EXPECT_EQ(0, contents()->infobar_delegate_count());
328 geolocation_permission_context_->RequestGeolocationPermission( 298 geolocation_permission_context_->RequestGeolocationPermission(
329 process_id(), render_id(), bridge_id(), requesting_frame); 299 process_id(), render_id(), bridge_id(), requesting_frame);
330 EXPECT_EQ(0, contents()->infobar_delegate_count()); 300 EXPECT_EQ(0, contents()->infobar_delegate_count());
331 CheckPermissionMessageSent(bridge_id(), false); 301 CheckPermissionMessageSent(bridge_id(), false);
332 } 302 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 ASSERT_TRUE(infobar_1); 392 ASSERT_TRUE(infobar_1);
423 infobar_1->Accept(); 393 infobar_1->Accept();
424 CheckPermissionMessageSentForTab(0, bridge_id() + 1, true); 394 CheckPermissionMessageSentForTab(0, bridge_id() + 1, true);
425 extra_tabs_[0]->RemoveInfoBar(infobar_1); 395 extra_tabs_[0]->RemoveInfoBar(infobar_1);
426 EXPECT_EQ(infobar_1, 396 EXPECT_EQ(infobar_1,
427 extra_tabs_[0]->removed_infobar_delegate_); 397 extra_tabs_[0]->removed_infobar_delegate_);
428 infobar_1->InfoBarClosed(); 398 infobar_1->InfoBarClosed();
429 399
430 extra_tabs_.reset(); 400 extra_tabs_.reset();
431 } 401 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698