| 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/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 Loading... |
| 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->ExecuteJavaScript( | 178 render_frame_host->ExecuteJavaScriptForTests( |
| 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 Loading... |
| 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 |
| OLD | NEW |