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

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

Issue 13548003: Prevent leaking geolocation permission from Incognito (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a check to the test Created 7 years, 8 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 <string> 5 #include <string>
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 SetInfobarResponse(current_url_, true); 454 SetInfobarResponse(current_url_, true);
455 CheckGeoposition(fake_latitude_, fake_longitude_); 455 CheckGeoposition(fake_latitude_, fake_longitude_);
456 // Disables further prompts from this tab. 456 // Disables further prompts from this tab.
457 CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)"); 457 CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)");
458 // Go incognito, and checks no infobar will be created. 458 // Go incognito, and checks no infobar will be created.
459 ASSERT_TRUE(Initialize(INITIALIZATION_OFFTHERECORD)); 459 ASSERT_TRUE(Initialize(INITIALIZATION_OFFTHERECORD));
460 AddGeolocationWatch(false); 460 AddGeolocationWatch(false);
461 CheckGeoposition(fake_latitude_, fake_longitude_); 461 CheckGeoposition(fake_latitude_, fake_longitude_);
462 } 462 }
463 463
464 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, NoLeakFromOffTheRecord) {
465 // First, check infobar will be created for incognito profile.
466 ASSERT_TRUE(Initialize(INITIALIZATION_OFFTHERECORD));
467 AddGeolocationWatch(true);
468 // Response won't be persisted.
469 SetInfobarResponse(current_url_, true);
470 CheckGeoposition(fake_latitude_, fake_longitude_);
471 // Disables further prompts from this tab.
472 CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)");
473 // Go to the regular profile, infobar will be created.
474 ASSERT_TRUE(Initialize(INITIALIZATION_NONE));
475 AddGeolocationWatch(true);
476 SetInfobarResponse(current_url_, false);
477 CheckStringValueFromJavascript("1", "geoGetLastError()");
478 }
479
464 // crbug.com/176291 480 // crbug.com/176291
465 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, 481 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest,
466 DISABLED_IFramesWithFreshPosition) { 482 DISABLED_IFramesWithFreshPosition) {
467 html_for_tests_ = "files/geolocation/iframes_different_origin.html"; 483 html_for_tests_ = "files/geolocation/iframes_different_origin.html";
468 ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES)); 484 ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES));
469 LoadIFrames(2); 485 LoadIFrames(2);
470 LOG(WARNING) << "frames loaded"; 486 LOG(WARNING) << "frames loaded";
471 487
472 iframe_xpath_ = "//iframe[@id='iframe_0']"; 488 iframe_xpath_ = "//iframe[@id='iframe_0']";
473 AddGeolocationWatch(true); 489 AddGeolocationWatch(true);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 std::string script = 676 std::string script =
661 "window.domAutomationController.send(window.close());"; 677 "window.domAutomationController.send(window.close());";
662 bool result = 678 bool result =
663 content::ExecuteScript( 679 content::ExecuteScript(
664 current_browser_->tab_strip_model()->GetActiveWebContents(), 680 current_browser_->tab_strip_model()->GetActiveWebContents(),
665 script); 681 script);
666 EXPECT_EQ(result, true); 682 EXPECT_EQ(result, true);
667 } 683 }
668 684
669 } // namespace 685 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698