| 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/browser_thread.h" | |
| 11 #include "chrome/browser/dom_operation_notification_details.h" | 10 #include "chrome/browser/dom_operation_notification_details.h" |
| 12 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 11 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" |
| 13 #include "chrome/browser/geolocation/geolocation_settings_state.h" | 12 #include "chrome/browser/geolocation/geolocation_settings_state.h" |
| 14 #include "chrome/browser/geolocation/location_arbitrator.h" | 13 #include "chrome/browser/geolocation/location_arbitrator.h" |
| 15 #include "chrome/browser/geolocation/mock_location_provider.h" | 14 #include "chrome/browser/geolocation/mock_location_provider.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/renderer_host/render_view_host.h" | 16 #include "chrome/browser/renderer_host/render_view_host.h" |
| 18 #include "chrome/browser/tab_contents/infobar_delegate.h" | 17 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 19 #include "chrome/browser/tab_contents/tab_contents.h" | 18 #include "chrome/browser/tab_contents/tab_contents.h" |
| 20 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 22 #include "chrome/common/geoposition.h" | 21 #include "chrome/common/geoposition.h" |
| 23 #include "chrome/common/notification_details.h" | 22 #include "chrome/common/notification_details.h" |
| 24 #include "chrome/common/notification_service.h" | 23 #include "chrome/common/notification_service.h" |
| 25 #include "chrome/common/notification_type.h" | 24 #include "chrome/common/notification_type.h" |
| 26 #include "chrome/test/in_process_browser_test.h" | 25 #include "chrome/test/in_process_browser_test.h" |
| 27 #include "chrome/test/ui_test_utils.h" | 26 #include "chrome/test/ui_test_utils.h" |
| 28 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
| 29 #include "net/test/test_server.h" | 28 #include "net/test/test_server.h" |
| 30 | 29 |
| 31 // Used to block until an iframe is loaded via a javascript call. | 30 // Used to block until an iframe is loaded via a javascript call. |
| 32 // Note: NavigateToURLBlockUntilNavigationsComplete doesn't seem to work for | 31 // Note: NavigateToURLBlockUntilNavigationsComplete doesn't seem to work for |
| 33 // multiple embedded iframes, as notifications seem to be 'batched'. Instead, we | 32 // multiple embedded iframes, as notifications seem to be 'batched'. Instead, we |
| 34 // load and wait one single frame here by calling a javascript function. | 33 // load and wait one single frame here by calling a javascript function. |
| 35 class IFrameLoader : public NotificationObserver { | 34 class IFrameLoader : public NotificationObserver { |
| 36 public: | 35 public: |
| 37 IFrameLoader(Browser* browser, int iframe_id, const GURL& url) | 36 IFrameLoader(Browser* browser, int iframe_id, const GURL& url) |
| 38 : navigation_completed_(false), | 37 : navigation_completed_(false), |
| 39 javascript_completed_(false) { | 38 javascript_completed_(false) { |
| 40 NavigationController* controller = | 39 NavigationController* controller = |
| 41 &browser->GetSelectedTabContents()->controller(); | 40 &browser->GetSelectedTabContents()->controller(); |
| 42 registrar_.Add(this, NotificationType::LOAD_STOP, | 41 registrar_.Add(this, NotificationType::LOAD_STOP, |
| 43 Source<NavigationController>(controller)); | 42 Source<NavigationController>(controller)); |
| 44 registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE, | 43 registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE, |
| 45 NotificationService::AllSources()); | 44 NotificationService::AllSources()); |
| 46 std::string script = StringPrintf( | 45 std::string script = StringPrintf( |
| 47 "window.domAutomationController.setAutomationId(0);" | 46 "window.domAutomationController.setAutomationId(0);" |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 AddGeolocationWatch(true); | 593 AddGeolocationWatch(true); |
| 595 SetInfobarResponse(current_url_, true); | 594 SetInfobarResponse(current_url_, true); |
| 596 CheckGeoposition(MockLocationProvider::instance_->position_); | 595 CheckGeoposition(MockLocationProvider::instance_->position_); |
| 597 | 596 |
| 598 // The second watch will now have cancelled. Ensure an update still makes | 597 // The second watch will now have cancelled. Ensure an update still makes |
| 599 // its way through to the first watcher. | 598 // its way through to the first watcher. |
| 600 NotifyGeoposition(final_position); | 599 NotifyGeoposition(final_position); |
| 601 WaitForNavigation(); | 600 WaitForNavigation(); |
| 602 CheckGeoposition(final_position); | 601 CheckGeoposition(final_position); |
| 603 } | 602 } |
| OLD | NEW |