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

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

Issue 304763002: Trust the renderer's same-document navigation flag if it is a same-origin nav. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: isNavigationInPage->isFragmentNavigation, with caveat on the name Created 6 years, 6 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) 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/chrome_geolocation_permission_context.h" 5 #include "chrome/browser/geolocation/chrome_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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 MockGoogleLocationSettingsHelper::SetLocationStatus(true, true); 284 MockGoogleLocationSettingsHelper::SetLocationStatus(true, true);
285 EXPECT_EQ(0U, infobar_service()->infobar_count()); 285 EXPECT_EQ(0U, infobar_service()->infobar_count());
286 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame); 286 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
287 EXPECT_EQ(1U, infobar_service()->infobar_count()); 287 EXPECT_EQ(1U, infobar_service()->infobar_count());
288 ConfirmInfoBarDelegate* infobar_delegate_0 = 288 ConfirmInfoBarDelegate* infobar_delegate_0 =
289 infobar_service()->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate(); 289 infobar_service()->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate();
290 ASSERT_TRUE(infobar_delegate_0); 290 ASSERT_TRUE(infobar_delegate_0);
291 base::string16 text_0 = infobar_delegate_0->GetButtonLabel( 291 base::string16 text_0 = infobar_delegate_0->GetButtonLabel(
292 ConfirmInfoBarDelegate::BUTTON_OK); 292 ConfirmInfoBarDelegate::BUTTON_OK);
293 293
294 NavigateAndCommit(requesting_frame); 294 Reload();
295 MockGoogleLocationSettingsHelper::SetLocationStatus(true, false); 295 MockGoogleLocationSettingsHelper::SetLocationStatus(true, false);
296 EXPECT_EQ(0U, infobar_service()->infobar_count()); 296 EXPECT_EQ(0U, infobar_service()->infobar_count());
297 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame); 297 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
298 EXPECT_EQ(1U, infobar_service()->infobar_count()); 298 EXPECT_EQ(1U, infobar_service()->infobar_count());
299 ConfirmInfoBarDelegate* infobar_delegate_1 = 299 ConfirmInfoBarDelegate* infobar_delegate_1 =
300 infobar_service()->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate(); 300 infobar_service()->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate();
301 ASSERT_TRUE(infobar_delegate_1); 301 ASSERT_TRUE(infobar_delegate_1);
302 base::string16 text_1 = infobar_delegate_1->GetButtonLabel( 302 base::string16 text_1 = infobar_delegate_1->GetButtonLabel(
303 ConfirmInfoBarDelegate::BUTTON_OK); 303 ConfirmInfoBarDelegate::BUTTON_OK);
304 EXPECT_NE(text_0, text_1); 304 EXPECT_NE(text_0, text_1);
305 305
306 NavigateAndCommit(requesting_frame); 306 Reload();
307 MockGoogleLocationSettingsHelper::SetLocationStatus(false, false); 307 MockGoogleLocationSettingsHelper::SetLocationStatus(false, false);
308 EXPECT_EQ(0U, infobar_service()->infobar_count()); 308 EXPECT_EQ(0U, infobar_service()->infobar_count());
309 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame); 309 RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
310 EXPECT_EQ(0U, infobar_service()->infobar_count()); 310 EXPECT_EQ(0U, infobar_service()->infobar_count());
311 } 311 }
312 312
313 TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsEnabled) { 313 TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsEnabled) {
314 GURL requesting_frame("http://www.example.com/geolocation"); 314 GURL requesting_frame("http://www.example.com/geolocation");
315 NavigateAndCommit(requesting_frame); 315 NavigateAndCommit(requesting_frame);
316 MockGoogleLocationSettingsHelper::SetLocationStatus(true, true); 316 MockGoogleLocationSettingsHelper::SetLocationStatus(true, true);
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 EXPECT_FALSE(infobar_delegate->ShouldExpire( 688 EXPECT_FALSE(infobar_delegate->ShouldExpire(
689 InfoBarService::NavigationDetailsFromLoadCommittedDetails(details))); 689 InfoBarService::NavigationDetailsFromLoadCommittedDetails(details)));
690 // Ensure the infobar will expire when we commit the pending navigation. 690 // Ensure the infobar will expire when we commit the pending navigation.
691 details.entry = web_contents()->GetController().GetActiveEntry(); 691 details.entry = web_contents()->GetController().GetActiveEntry();
692 EXPECT_TRUE(infobar_delegate->ShouldExpire( 692 EXPECT_TRUE(infobar_delegate->ShouldExpire(
693 InfoBarService::NavigationDetailsFromLoadCommittedDetails(details))); 693 InfoBarService::NavigationDetailsFromLoadCommittedDetails(details)));
694 694
695 // Delete the tab contents. 695 // Delete the tab contents.
696 DeleteContents(); 696 DeleteContents();
697 } 697 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698