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

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

Issue 1257603003: Revert of Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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/test_utils.h" 5 #include "content/public/test/test_utils.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 base::Closure GetQuitTaskForRunLoop(base::RunLoop* run_loop) { 169 base::Closure GetQuitTaskForRunLoop(base::RunLoop* run_loop) {
170 return base::Bind(&DeferredQuitRunLoop, run_loop->QuitClosure(), 170 return base::Bind(&DeferredQuitRunLoop, run_loop->QuitClosure(),
171 kNumQuitDeferrals); 171 kNumQuitDeferrals);
172 } 172 }
173 173
174 scoped_ptr<base::Value> ExecuteScriptAndGetValue( 174 scoped_ptr<base::Value> ExecuteScriptAndGetValue(
175 RenderFrameHost* render_frame_host, const std::string& script) { 175 RenderFrameHost* render_frame_host, const std::string& script) {
176 ScriptCallback observer; 176 ScriptCallback observer;
177 177
178 render_frame_host->ExecuteJavaScriptForTests( 178 render_frame_host->ExecuteJavaScript(
179 base::UTF8ToUTF16(script), 179 base::UTF8ToUTF16(script),
180 base::Bind(&ScriptCallback::ResultCallback, base::Unretained(&observer))); 180 base::Bind(&ScriptCallback::ResultCallback, base::Unretained(&observer)));
181 base::MessageLoop* loop = base::MessageLoop::current(); 181 base::MessageLoop* loop = base::MessageLoop::current();
182 loop->Run(); 182 loop->Run();
183 return observer.result().Pass(); 183 return observer.result().Pass();
184 } 184 }
185 185
186 MessageLoopRunner::MessageLoopRunner() 186 MessageLoopRunner::MessageLoopRunner()
187 : loop_running_(false), 187 : loop_running_(false),
188 quit_closure_called_(false) { 188 quit_closure_called_(false) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 void InProcessUtilityThreadHelper::BrowserChildProcessHostDisconnected( 305 void InProcessUtilityThreadHelper::BrowserChildProcessHostDisconnected(
306 const ChildProcessData& data) { 306 const ChildProcessData& data) {
307 if (--child_thread_count_) 307 if (--child_thread_count_)
308 return; 308 return;
309 309
310 if (runner_.get()) 310 if (runner_.get())
311 runner_->Quit(); 311 runner_->Quit();
312 } 312 }
313 313
314 } // namespace content 314 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/render_view_test.cc ('k') | content/renderer/accessibility/renderer_accessibility_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698