| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cctype> | 9 #include <cctype> |
| 10 | 10 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 165 } |
| 166 | 166 |
| 167 void RenderViewTest::ExecuteJavaScriptForTests(const char* js) { | 167 void RenderViewTest::ExecuteJavaScriptForTests(const char* js) { |
| 168 GetMainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(js))); | 168 GetMainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(js))); |
| 169 } | 169 } |
| 170 | 170 |
| 171 bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue( | 171 bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue( |
| 172 const base::string16& script, | 172 const base::string16& script, |
| 173 int* int_result) { | 173 int* int_result) { |
| 174 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 174 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
| 175 v8::Local<v8::Value> result = | 175 v8::Local<v8::Value> result = GetMainFrame()->executeScriptAndReturnValue( |
| 176 GetMainFrame()->executeScriptAndReturnValue(WebScriptSource(script)); | 176 WebScriptSource(blink::WebString::fromUTF16(script))); |
| 177 if (result.IsEmpty() || !result->IsInt32()) | 177 if (result.IsEmpty() || !result->IsInt32()) |
| 178 return false; | 178 return false; |
| 179 | 179 |
| 180 if (int_result) | 180 if (int_result) |
| 181 *int_result = result->Int32Value(); | 181 *int_result = result->Int32Value(); |
| 182 | 182 |
| 183 return true; | 183 return true; |
| 184 } | 184 } |
| 185 | 185 |
| 186 void RenderViewTest::LoadHTML(const char* html) { | 186 void RenderViewTest::LoadHTML(const char* html) { |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 664 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
| 665 frame->Navigate(common_params, StartNavigationParams(), request_params); | 665 frame->Navigate(common_params, StartNavigationParams(), request_params); |
| 666 | 666 |
| 667 // The load actually happens asynchronously, so we pump messages to process | 667 // The load actually happens asynchronously, so we pump messages to process |
| 668 // the pending continuation. | 668 // the pending continuation. |
| 669 FrameLoadWaiter(frame).Wait(); | 669 FrameLoadWaiter(frame).Wait(); |
| 670 view_->GetWebView()->updateAllLifecyclePhases(); | 670 view_->GetWebView()->updateAllLifecyclePhases(); |
| 671 } | 671 } |
| 672 | 672 |
| 673 } // namespace content | 673 } // namespace content |
| OLD | NEW |