| 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 "content/public/test/browser_test_utils.h" | 5 #include "content/public/test/browser_test_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 : render_frame_host_(render_frame_host) { | 656 : render_frame_host_(render_frame_host) { |
| 657 } | 657 } |
| 658 | 658 |
| 659 bool ExecuteScript(const ToRenderFrameHost& adapter, | 659 bool ExecuteScript(const ToRenderFrameHost& adapter, |
| 660 const std::string& script) { | 660 const std::string& script) { |
| 661 std::string new_script = | 661 std::string new_script = |
| 662 script + ";window.domAutomationController.send(0);"; | 662 script + ";window.domAutomationController.send(0);"; |
| 663 return ExecuteScriptHelper(adapter.render_frame_host(), new_script, NULL); | 663 return ExecuteScriptHelper(adapter.render_frame_host(), new_script, NULL); |
| 664 } | 664 } |
| 665 | 665 |
| 666 bool ExecuteScriptAndExtractDouble(const ToRenderFrameHost& adapter, |
| 667 const std::string& script, double* result) { |
| 668 DCHECK(result); |
| 669 std::unique_ptr<base::Value> value; |
| 670 if (!ExecuteScriptHelper(adapter.render_frame_host(), script, &value) || |
| 671 !value.get()) { |
| 672 return false; |
| 673 } |
| 674 |
| 675 return value->GetAsDouble(result); |
| 676 } |
| 677 |
| 666 bool ExecuteScriptAndExtractInt(const ToRenderFrameHost& adapter, | 678 bool ExecuteScriptAndExtractInt(const ToRenderFrameHost& adapter, |
| 667 const std::string& script, int* result) { | 679 const std::string& script, int* result) { |
| 668 DCHECK(result); | 680 DCHECK(result); |
| 669 std::unique_ptr<base::Value> value; | 681 std::unique_ptr<base::Value> value; |
| 670 if (!ExecuteScriptHelper(adapter.render_frame_host(), script, &value) || | 682 if (!ExecuteScriptHelper(adapter.render_frame_host(), script, &value) || |
| 671 !value.get()) { | 683 !value.get()) { |
| 672 return false; | 684 return false; |
| 673 } | 685 } |
| 674 | 686 |
| 675 return value->GetAsInteger(result); | 687 return value->GetAsInteger(result); |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 // static | 1256 // static |
| 1245 TextInputStateTestExport TextInputStateTestExport::FromWebContents( | 1257 TextInputStateTestExport TextInputStateTestExport::FromWebContents( |
| 1246 WebContents* web_contents) { | 1258 WebContents* web_contents) { |
| 1247 const TextInputState* state = | 1259 const TextInputState* state = |
| 1248 static_cast<WebContentsImpl*>(web_contents)->GetTextInputState(); | 1260 static_cast<WebContentsImpl*>(web_contents)->GetTextInputState(); |
| 1249 | 1261 |
| 1250 return TextInputStateTestExport(state->type, state->value); | 1262 return TextInputStateTestExport(state->type, state->value); |
| 1251 } | 1263 } |
| 1252 | 1264 |
| 1253 } // namespace content | 1265 } // namespace content |
| OLD | NEW |