| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/string_number_conversions.h" | 6 #include "base/string_number_conversions.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_list.h" | 9 #include "chrome/browser/browser_list.h" |
| 10 #include "chrome/browser/dom_operation_notification_details.h" | 10 #include "chrome/browser/dom_operation_notification_details.h" |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 AddGeolocationWatch(true); | 368 AddGeolocationWatch(true); |
| 369 } | 369 } |
| 370 | 370 |
| 371 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, Geoposition) { | 371 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, Geoposition) { |
| 372 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); | 372 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); |
| 373 AddGeolocationWatch(true); | 373 AddGeolocationWatch(true); |
| 374 SetInfobarResponse(current_url_, true); | 374 SetInfobarResponse(current_url_, true); |
| 375 CheckGeoposition(MockLocationProvider::instance_->position_); | 375 CheckGeoposition(MockLocationProvider::instance_->position_); |
| 376 } | 376 } |
| 377 | 377 |
| 378 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, ErrorOnPermissionDenied) { | 378 // Crashy, http://crbug.com/70585. |
| 379 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, |
| 380 DISABLED_ErrorOnPermissionDenied) { |
| 379 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); | 381 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); |
| 380 AddGeolocationWatch(true); | 382 AddGeolocationWatch(true); |
| 381 // Infobar was displayed, deny access and check for error code. | 383 // Infobar was displayed, deny access and check for error code. |
| 382 SetInfobarResponse(current_url_, false); | 384 SetInfobarResponse(current_url_, false); |
| 383 CheckStringValueFromJavascript("1", "geoGetLastError()"); | 385 CheckStringValueFromJavascript("1", "geoGetLastError()"); |
| 384 } | 386 } |
| 385 | 387 |
| 386 // http://crbug.com/44589. Hangs on Mac, crashes on Windows | 388 // http://crbug.com/44589. Hangs on Mac, crashes on Windows |
| 387 #if defined(OS_MACOSX) || defined(OS_WINDOWS) | 389 #if defined(OS_MACOSX) || defined(OS_WINDOWS) |
| 388 #define MAYBE_NoInfobarForSecondTab DISABLED_NoInfobarForSecondTab | 390 #define MAYBE_NoInfobarForSecondTab DISABLED_NoInfobarForSecondTab |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 SetInfobarResponse(current_url_, true); | 604 SetInfobarResponse(current_url_, true); |
| 603 CheckGeoposition(MockLocationProvider::instance_->position_); | 605 CheckGeoposition(MockLocationProvider::instance_->position_); |
| 604 | 606 |
| 605 // The second watch will now have cancelled. Ensure an update still makes | 607 // The second watch will now have cancelled. Ensure an update still makes |
| 606 // its way through to the first watcher. | 608 // its way through to the first watcher. |
| 607 NotifyGeoposition(final_position); | 609 NotifyGeoposition(final_position); |
| 608 WaitForNavigation(); | 610 WaitForNavigation(); |
| 609 CheckGeoposition(final_position); | 611 CheckGeoposition(final_position); |
| 610 } | 612 } |
| 611 | 613 |
| 612 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, TabDestroyed) { | 614 // Hangs flakily, http://crbug.com/70588. |
| 615 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_TabDestroyed) { |
| 613 html_for_tests_ = "files/geolocation/tab_destroyed.html"; | 616 html_for_tests_ = "files/geolocation/tab_destroyed.html"; |
| 614 ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES)); | 617 ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES)); |
| 615 LoadIFrames(3); | 618 LoadIFrames(3); |
| 616 | 619 |
| 617 iframe_xpath_ = L"//iframe[@id='iframe_0']"; | 620 iframe_xpath_ = L"//iframe[@id='iframe_0']"; |
| 618 AddGeolocationWatch(true); | 621 AddGeolocationWatch(true); |
| 619 | 622 |
| 620 iframe_xpath_ = L"//iframe[@id='iframe_1']"; | 623 iframe_xpath_ = L"//iframe[@id='iframe_1']"; |
| 621 AddGeolocationWatch(false); | 624 AddGeolocationWatch(false); |
| 622 | 625 |
| 623 iframe_xpath_ = L"//iframe[@id='iframe_2']"; | 626 iframe_xpath_ = L"//iframe[@id='iframe_2']"; |
| 624 AddGeolocationWatch(false); | 627 AddGeolocationWatch(false); |
| 625 | 628 |
| 626 std::string script = | 629 std::string script = |
| 627 "window.domAutomationController.setAutomationId(0);" | 630 "window.domAutomationController.setAutomationId(0);" |
| 628 "window.domAutomationController.send(window.close());"; | 631 "window.domAutomationController.send(window.close());"; |
| 629 bool result = | 632 bool result = |
| 630 ui_test_utils::ExecuteJavaScript( | 633 ui_test_utils::ExecuteJavaScript( |
| 631 current_browser_->GetSelectedTabContents()->render_view_host(), | 634 current_browser_->GetSelectedTabContents()->render_view_host(), |
| 632 L"", UTF8ToWide(script)); | 635 L"", UTF8ToWide(script)); |
| 633 EXPECT_EQ(result, true); | 636 EXPECT_EQ(result, true); |
| 634 } | 637 } |
| OLD | NEW |