| 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" |
| 11 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 11 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" |
| 12 #include "chrome/browser/geolocation/geolocation_settings_state.h" | 12 #include "chrome/browser/geolocation/geolocation_settings_state.h" |
| 13 #include "chrome/browser/geolocation/location_arbitrator.h" | 13 #include "chrome/browser/geolocation/location_arbitrator.h" |
| 14 #include "chrome/browser/geolocation/mock_location_provider.h" | 14 #include "chrome/browser/geolocation/mock_location_provider.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/renderer_host/render_view_host.h" | 16 #include "chrome/browser/renderer_host/render_view_host.h" |
| 17 #include "chrome/browser/tab_contents/infobar_delegate.h" | 17 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 18 #include "chrome/browser/tab_contents/tab_contents.h" | 18 #include "chrome/browser/tab_contents/tab_contents.h" |
| 19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/common/geoposition.h" | 21 #include "chrome/common/geoposition.h" |
| 22 #include "chrome/common/notification_details.h" | 22 #include "chrome/common/notification_details.h" |
| 23 #include "chrome/common/notification_service.h" | 23 #include "chrome/common/notification_service.h" |
| 24 #include "chrome/common/notification_type.h" | 24 #include "chrome/common/notification_type.h" |
| 25 #include "chrome/test/in_process_browser_test.h" | 25 #include "chrome/test/in_process_browser_test.h" |
| 26 #include "chrome/test/ui_test_utils.h" | 26 #include "chrome/test/ui_test_utils.h" |
| 27 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
| 28 #include "net/test/test_server.h" | 28 #include "net/test/test_server.h" |
| 29 | 29 |
| 30 namespace { |
| 31 |
| 30 // Used to block until an iframe is loaded via a javascript call. | 32 // Used to block until an iframe is loaded via a javascript call. |
| 31 // Note: NavigateToURLBlockUntilNavigationsComplete doesn't seem to work for | 33 // Note: NavigateToURLBlockUntilNavigationsComplete doesn't seem to work for |
| 32 // multiple embedded iframes, as notifications seem to be 'batched'. Instead, we | 34 // multiple embedded iframes, as notifications seem to be 'batched'. Instead, we |
| 33 // load and wait one single frame here by calling a javascript function. | 35 // load and wait one single frame here by calling a javascript function. |
| 34 class IFrameLoader : public NotificationObserver { | 36 class IFrameLoader : public NotificationObserver { |
| 35 public: | 37 public: |
| 36 IFrameLoader(Browser* browser, int iframe_id, const GURL& url) | 38 IFrameLoader(Browser* browser, int iframe_id, const GURL& url) |
| 37 : navigation_completed_(false), | 39 : navigation_completed_(false), |
| 38 javascript_completed_(false) { | 40 javascript_completed_(false) { |
| 39 NavigationController* controller = | 41 NavigationController* controller = |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 | 630 |
| 629 std::string script = | 631 std::string script = |
| 630 "window.domAutomationController.setAutomationId(0);" | 632 "window.domAutomationController.setAutomationId(0);" |
| 631 "window.domAutomationController.send(window.close());"; | 633 "window.domAutomationController.send(window.close());"; |
| 632 bool result = | 634 bool result = |
| 633 ui_test_utils::ExecuteJavaScript( | 635 ui_test_utils::ExecuteJavaScript( |
| 634 current_browser_->GetSelectedTabContents()->render_view_host(), | 636 current_browser_->GetSelectedTabContents()->render_view_host(), |
| 635 L"", UTF8ToWide(script)); | 637 L"", UTF8ToWide(script)); |
| 636 EXPECT_EQ(result, true); | 638 EXPECT_EQ(result, true); |
| 637 } | 639 } |
| 640 |
| 641 } // namespace |
| OLD | NEW |