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/render_view_test.h" | 5 #include "content/public/test/render_view_test.h" |
6 | 6 |
7 #include "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
8 #include "content/public/browser/native_web_keyboard_event.h" | 8 #include "content/public/browser/native_web_keyboard_event.h" |
9 #include "content/public/common/renderer_preferences.h" | 9 #include "content/public/common/renderer_preferences.h" |
10 #include "content/renderer/render_thread_impl.h" | 10 #include "content/renderer/render_thread_impl.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return view_->GetWebView()->mainFrame(); | 83 return view_->GetWebView()->mainFrame(); |
84 } | 84 } |
85 | 85 |
86 void RenderViewTest::ExecuteJavaScript(const char* js) { | 86 void RenderViewTest::ExecuteJavaScript(const char* js) { |
87 GetMainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(js))); | 87 GetMainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(js))); |
88 } | 88 } |
89 | 89 |
90 bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue( | 90 bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue( |
91 const string16& script, | 91 const string16& script, |
92 int* int_result) { | 92 int* int_result) { |
| 93 v8::HandleScope handle_scope; |
93 v8::Handle<v8::Value> result = | 94 v8::Handle<v8::Value> result = |
94 GetMainFrame()->executeScriptAndReturnValue(WebScriptSource(script)); | 95 GetMainFrame()->executeScriptAndReturnValue(WebScriptSource(script)); |
95 if (result.IsEmpty() || !result->IsInt32()) | 96 if (result.IsEmpty() || !result->IsInt32()) |
96 return false; | 97 return false; |
97 | 98 |
98 if (int_result) | 99 if (int_result) |
99 *int_result = result->Int32Value(); | 100 *int_result = result->Int32Value(); |
100 | 101 |
101 return true; | 102 return true; |
102 } | 103 } |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 356 |
356 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); | 357 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); |
357 OnMessageReceived(navigate_message); | 358 OnMessageReceived(navigate_message); |
358 | 359 |
359 // The load actually happens asynchronously, so we pump messages to process | 360 // The load actually happens asynchronously, so we pump messages to process |
360 // the pending continuation. | 361 // the pending continuation. |
361 ProcessPendingMessages(); | 362 ProcessPendingMessages(); |
362 } | 363 } |
363 | 364 |
364 } // namespace content | 365 } // namespace content |
OLD | NEW |