| 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 "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "content/common/dom_storage/dom_storage_types.h" | 8 #include "content/common/dom_storage/dom_storage_types.h" |
| 9 #include "content/common/input_messages.h" | 9 #include "content/common/input_messages.h" |
| 10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 WebFrame* RenderViewTest::GetMainFrame() { | 85 WebFrame* RenderViewTest::GetMainFrame() { |
| 86 return view_->GetWebView()->mainFrame(); | 86 return view_->GetWebView()->mainFrame(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void RenderViewTest::ExecuteJavaScript(const char* js) { | 89 void RenderViewTest::ExecuteJavaScript(const char* js) { |
| 90 GetMainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(js))); | 90 GetMainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(js))); |
| 91 } | 91 } |
| 92 | 92 |
| 93 bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue( | 93 bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue( |
| 94 const string16& script, | 94 const base::string16& script, |
| 95 int* int_result) { | 95 int* int_result) { |
| 96 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 96 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
| 97 v8::Handle<v8::Value> result = | 97 v8::Handle<v8::Value> result = |
| 98 GetMainFrame()->executeScriptAndReturnValue(WebScriptSource(script)); | 98 GetMainFrame()->executeScriptAndReturnValue(WebScriptSource(script)); |
| 99 if (result.IsEmpty() || !result->IsInt32()) | 99 if (result.IsEmpty() || !result->IsInt32()) |
| 100 return false; | 100 return false; |
| 101 | 101 |
| 102 if (int_result) | 102 if (int_result) |
| 103 *int_result = result->Int32Value(); | 103 *int_result = result->Int32Value(); |
| 104 | 104 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 // This needs to pass the mock render thread to the view. | 167 // This needs to pass the mock render thread to the view. |
| 168 RenderViewImpl* view = RenderViewImpl::Create( | 168 RenderViewImpl* view = RenderViewImpl::Create( |
| 169 kOpenerId, | 169 kOpenerId, |
| 170 RendererPreferences(), | 170 RendererPreferences(), |
| 171 WebPreferences(), | 171 WebPreferences(), |
| 172 kRouteId, | 172 kRouteId, |
| 173 kMainFrameRouteId, | 173 kMainFrameRouteId, |
| 174 kSurfaceId, | 174 kSurfaceId, |
| 175 kInvalidSessionStorageNamespaceId, | 175 kInvalidSessionStorageNamespaceId, |
| 176 string16(), | 176 base::string16(), |
| 177 false, // is_renderer_created | 177 false, // is_renderer_created |
| 178 false, // swapped_out | 178 false, // swapped_out |
| 179 false, // hidden | 179 false, // hidden |
| 180 1, // next_page_id | 180 1, // next_page_id |
| 181 blink::WebScreenInfo(), | 181 blink::WebScreenInfo(), |
| 182 AccessibilityModeOff, | 182 AccessibilityModeOff, |
| 183 true); | 183 true); |
| 184 view->AddRef(); | 184 view->AddRef(); |
| 185 view_ = view; | 185 view_ = view; |
| 186 } | 186 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 376 |
| 377 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); | 377 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); |
| 378 OnMessageReceived(navigate_message); | 378 OnMessageReceived(navigate_message); |
| 379 | 379 |
| 380 // The load actually happens asynchronously, so we pump messages to process | 380 // The load actually happens asynchronously, so we pump messages to process |
| 381 // the pending continuation. | 381 // the pending continuation. |
| 382 ProcessPendingMessages(); | 382 ProcessPendingMessages(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace content | 385 } // namespace content |
| OLD | NEW |