| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 168 } |
| 169 | 169 |
| 170 void RenderViewTest::ExecuteJavaScriptForTests(const char* js) { | 170 void RenderViewTest::ExecuteJavaScriptForTests(const char* js) { |
| 171 GetMainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(js))); | 171 GetMainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(js))); |
| 172 } | 172 } |
| 173 | 173 |
| 174 bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue( | 174 bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue( |
| 175 const base::string16& script, | 175 const base::string16& script, |
| 176 int* int_result) { | 176 int* int_result) { |
| 177 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 177 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
| 178 v8::Local<v8::Value> result = | 178 v8::Local<v8::Value> result = GetMainFrame()->executeScriptAndReturnValue( |
| 179 GetMainFrame()->executeScriptAndReturnValue(WebScriptSource(script)); | 179 WebScriptSource(blink::WebString::fromUTF16(script))); |
| 180 if (result.IsEmpty() || !result->IsInt32()) | 180 if (result.IsEmpty() || !result->IsInt32()) |
| 181 return false; | 181 return false; |
| 182 | 182 |
| 183 if (int_result) | 183 if (int_result) |
| 184 *int_result = result->Int32Value(); | 184 *int_result = result->Int32Value(); |
| 185 | 185 |
| 186 return true; | 186 return true; |
| 187 } | 187 } |
| 188 | 188 |
| 189 void RenderViewTest::LoadHTML(const char* html) { | 189 void RenderViewTest::LoadHTML(const char* html) { |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 673 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
| 674 frame->Navigate(common_params, StartNavigationParams(), request_params); | 674 frame->Navigate(common_params, StartNavigationParams(), request_params); |
| 675 | 675 |
| 676 // The load actually happens asynchronously, so we pump messages to process | 676 // The load actually happens asynchronously, so we pump messages to process |
| 677 // the pending continuation. | 677 // the pending continuation. |
| 678 FrameLoadWaiter(frame).Wait(); | 678 FrameLoadWaiter(frame).Wait(); |
| 679 view_->GetWebView()->updateAllLifecyclePhases(); | 679 view_->GetWebView()->updateAllLifecyclePhases(); |
| 680 } | 680 } |
| 681 | 681 |
| 682 } // namespace content | 682 } // namespace content |
| OLD | NEW |