OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 ExpectPosition(fake_latitude(), fake_longitude()); | 519 ExpectPosition(fake_latitude(), fake_longitude()); |
520 | 520 |
521 // The permission is persisted for the regular profile, and inherited by its | 521 // The permission is persisted for the regular profile, and inherited by its |
522 // incognito profile. Go incognito, and check that the user is not prompted | 522 // incognito profile. Go incognito, and check that the user is not prompted |
523 // again and the position gets to the script. | 523 // again and the position gets to the script. |
524 ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_OFFTHERECORD)); | 524 ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_OFFTHERECORD)); |
525 WatchPositionAndObservePermissionRequest(false); | 525 WatchPositionAndObservePermissionRequest(false); |
526 ExpectPosition(fake_latitude(), fake_longitude()); | 526 ExpectPosition(fake_latitude(), fake_longitude()); |
527 } | 527 } |
528 | 528 |
529 // http://crbug.com/523387 | 529 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, NoLeakFromOffTheRecord) { |
530 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, | |
531 DISABLED_NoLeakFromOffTheRecord) { | |
532 // The user is prompted in a fresh incognito profile, and when granted the | 530 // The user is prompted in a fresh incognito profile, and when granted the |
533 // position gets to the script. | 531 // position gets to the script. |
534 ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_OFFTHERECORD)); | 532 ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_OFFTHERECORD)); |
535 ASSERT_TRUE(WatchPositionAndGrantPermission()); | 533 ASSERT_TRUE(WatchPositionAndGrantPermission()); |
536 ExpectPosition(fake_latitude(), fake_longitude()); | 534 ExpectPosition(fake_latitude(), fake_longitude()); |
537 | 535 |
538 // The regular profile knows nothing of what happened in incognito. It is | 536 // The regular profile knows nothing of what happened in incognito. It is |
539 // prompted and when granted the position gets to the script. | 537 // prompted and when granted the position gets to the script. |
540 ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_DEFAULT)); | 538 ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_DEFAULT)); |
541 ASSERT_TRUE(WatchPositionAndGrantPermission()); | 539 ASSERT_TRUE(WatchPositionAndGrantPermission()); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 ASSERT_TRUE(SetPositionAndWaitUntilUpdated(cached_position_latitude, | 627 ASSERT_TRUE(SetPositionAndWaitUntilUpdated(cached_position_latitude, |
630 cached_position_lognitude)); | 628 cached_position_lognitude)); |
631 ExpectPosition(cached_position_latitude, cached_position_lognitude); | 629 ExpectPosition(cached_position_latitude, cached_position_lognitude); |
632 | 630 |
633 // Now check the second frame gets cached values as well. | 631 // Now check the second frame gets cached values as well. |
634 SetFrameForScriptExecution("iframe_1"); | 632 SetFrameForScriptExecution("iframe_1"); |
635 ASSERT_TRUE(WatchPositionAndGrantPermission()); | 633 ASSERT_TRUE(WatchPositionAndGrantPermission()); |
636 ExpectPosition(cached_position_latitude, cached_position_lognitude); | 634 ExpectPosition(cached_position_latitude, cached_position_lognitude); |
637 } | 635 } |
638 | 636 |
639 // http://crbug.com/523387 | 637 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, CancelPermissionForFrame) { |
640 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, | |
641 DISABLED_CancelPermissionForFrame) { | |
642 set_html_for_tests("/geolocation/two_iframes.html"); | 638 set_html_for_tests("/geolocation/two_iframes.html"); |
643 ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_DEFAULT)); | 639 ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_DEFAULT)); |
644 LoadIFrames(); | 640 LoadIFrames(); |
645 | 641 |
646 SetFrameForScriptExecution("iframe_0"); | 642 SetFrameForScriptExecution("iframe_0"); |
647 ASSERT_TRUE(WatchPositionAndGrantPermission()); | 643 ASSERT_TRUE(WatchPositionAndGrantPermission()); |
648 ExpectPosition(fake_latitude(), fake_longitude()); | 644 ExpectPosition(fake_latitude(), fake_longitude()); |
649 | 645 |
650 // Test second iframe from a different origin with a cached position will | 646 // Test second iframe from a different origin with a cached position will |
651 // create the prompt. | 647 // create the prompt. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 // Calling watchPosition should trigger the last usage update. | 765 // Calling watchPosition should trigger the last usage update. |
770 WatchPositionAndObservePermissionRequest(false); | 766 WatchPositionAndObservePermissionRequest(false); |
771 ExpectPosition(fake_latitude(), fake_longitude()); | 767 ExpectPosition(fake_latitude(), fake_longitude()); |
772 | 768 |
773 // Last usage has been updated. | 769 // Last usage has been updated. |
774 EXPECT_EQ(GetHostContentSettingsMap()->GetLastUsage( | 770 EXPECT_EQ(GetHostContentSettingsMap()->GetLastUsage( |
775 current_url().GetOrigin(), | 771 current_url().GetOrigin(), |
776 current_url().GetOrigin(), | 772 current_url().GetOrigin(), |
777 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 13); | 773 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 13); |
778 } | 774 } |
OLD | NEW |