| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } else { | 126 } else { |
| 127 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 127 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 128 content::NotificationService::AllSources()); | 128 content::NotificationService::AllSources()); |
| 129 registrar_.Add(this, content::NOTIFICATION_LOAD_START, | 129 registrar_.Add(this, content::NOTIFICATION_LOAD_START, |
| 130 content::NotificationService::AllSources()); | 130 content::NotificationService::AllSources()); |
| 131 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, | 131 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, |
| 132 content::NotificationService::AllSources()); | 132 content::NotificationService::AllSources()); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 void AddWatchAndWaitForNotification(RenderViewHost* render_view_host, | 136 void AddWatchAndWaitForNotification(content::RenderViewHost* render_view_host, |
| 137 const std::wstring& iframe_xpath) { | 137 const std::wstring& iframe_xpath) { |
| 138 LOG(WARNING) << "will add geolocation watch"; | 138 LOG(WARNING) << "will add geolocation watch"; |
| 139 std::string script = | 139 std::string script = |
| 140 "window.domAutomationController.setAutomationId(0);" | 140 "window.domAutomationController.setAutomationId(0);" |
| 141 "window.domAutomationController.send(geoStart());"; | 141 "window.domAutomationController.send(geoStart());"; |
| 142 render_view_host->ExecuteJavascriptInWebFrame(WideToUTF16Hack(iframe_xpath), | 142 render_view_host->ExecuteJavascriptInWebFrame(WideToUTF16Hack(iframe_xpath), |
| 143 UTF8ToUTF16(script)); | 143 UTF8ToUTF16(script)); |
| 144 ui_test_utils::RunMessageLoop(); | 144 ui_test_utils::RunMessageLoop(); |
| 145 registrar_.RemoveAll(); | 145 registrar_.RemoveAll(); |
| 146 LOG(WARNING) << "got geolocation watch" << javascript_response_; | 146 LOG(WARNING) << "got geolocation watch" << javascript_response_; |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 "window.domAutomationController.setAutomationId(0);" | 667 "window.domAutomationController.setAutomationId(0);" |
| 668 "window.domAutomationController.send(window.close());"; | 668 "window.domAutomationController.send(window.close());"; |
| 669 bool result = | 669 bool result = |
| 670 ui_test_utils::ExecuteJavaScript( | 670 ui_test_utils::ExecuteJavaScript( |
| 671 current_browser_->GetSelectedWebContents()->GetRenderViewHost(), | 671 current_browser_->GetSelectedWebContents()->GetRenderViewHost(), |
| 672 L"", UTF8ToWide(script)); | 672 L"", UTF8ToWide(script)); |
| 673 EXPECT_EQ(result, true); | 673 EXPECT_EQ(result, true); |
| 674 } | 674 } |
| 675 | 675 |
| 676 } // namespace | 676 } // namespace |
| OLD | NEW |