Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: content/public/test/render_view_test.cc

Issue 1123783002: Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/test/render_view_test.h ('k') | content/public/test/test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <cctype> 7 #include <cctype>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 void RenderViewTest::ProcessPendingMessages() { 138 void RenderViewTest::ProcessPendingMessages() {
139 msg_loop_.task_runner()->PostTask(FROM_HERE, 139 msg_loop_.task_runner()->PostTask(FROM_HERE,
140 base::MessageLoop::QuitClosure()); 140 base::MessageLoop::QuitClosure());
141 msg_loop_.Run(); 141 msg_loop_.Run();
142 } 142 }
143 143
144 WebLocalFrame* RenderViewTest::GetMainFrame() { 144 WebLocalFrame* RenderViewTest::GetMainFrame() {
145 return view_->GetWebView()->mainFrame()->toWebLocalFrame(); 145 return view_->GetWebView()->mainFrame()->toWebLocalFrame();
146 } 146 }
147 147
148 void RenderViewTest::ExecuteJavaScript(const char* js) { 148 void RenderViewTest::ExecuteJavaScriptForTests(const char* js) {
149 GetMainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(js))); 149 GetMainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(js)));
150 } 150 }
151 151
152 bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue( 152 bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue(
153 const base::string16& script, 153 const base::string16& script,
154 int* int_result) { 154 int* int_result) {
155 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); 155 v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
156 v8::Local<v8::Value> result = 156 v8::Local<v8::Value> result =
157 GetMainFrame()->executeScriptAndReturnValue(WebScriptSource(script)); 157 GetMainFrame()->executeScriptAndReturnValue(WebScriptSource(script));
158 if (result.IsEmpty() || !result->IsInt32()) 158 if (result.IsEmpty() || !result->IsInt32())
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 TestRenderFrame* frame = 577 TestRenderFrame* frame =
578 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); 578 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame());
579 frame->Navigate(common_params, StartNavigationParams(), request_params); 579 frame->Navigate(common_params, StartNavigationParams(), request_params);
580 580
581 // The load actually happens asynchronously, so we pump messages to process 581 // The load actually happens asynchronously, so we pump messages to process
582 // the pending continuation. 582 // the pending continuation.
583 FrameLoadWaiter(frame).Wait(); 583 FrameLoadWaiter(frame).Wait();
584 } 584 }
585 585
586 } // namespace content 586 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/render_view_test.h ('k') | content/public/test/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698