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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return base::Bind(&DeferredQuitRunLoop, run_loop->QuitClosure(), | 130 return base::Bind(&DeferredQuitRunLoop, run_loop->QuitClosure(), |
131 kNumQuitDeferrals); | 131 kNumQuitDeferrals); |
132 } | 132 } |
133 | 133 |
134 scoped_ptr<base::Value> ExecuteScriptAndGetValue( | 134 scoped_ptr<base::Value> ExecuteScriptAndGetValue( |
135 RenderViewHost* render_view_host, | 135 RenderViewHost* render_view_host, |
136 const std::string& script) { | 136 const std::string& script) { |
137 ScriptCallback observer; | 137 ScriptCallback observer; |
138 | 138 |
139 render_view_host->ExecuteJavascriptInWebFrameCallbackResult( | 139 render_view_host->ExecuteJavascriptInWebFrameCallbackResult( |
140 string16(), // frame_xpath, | 140 base::string16(), // frame_xpath, |
141 UTF8ToUTF16(script), | 141 UTF8ToUTF16(script), |
142 base::Bind(&ScriptCallback::ResultCallback, base::Unretained(&observer))); | 142 base::Bind(&ScriptCallback::ResultCallback, base::Unretained(&observer))); |
143 base::MessageLoop* loop = base::MessageLoop::current(); | 143 base::MessageLoop* loop = base::MessageLoop::current(); |
144 loop->Run(); | 144 loop->Run(); |
145 return observer.result().Pass(); | 145 return observer.result().Pass(); |
146 } | 146 } |
147 | 147 |
148 MessageLoopRunner::MessageLoopRunner() | 148 MessageLoopRunner::MessageLoopRunner() |
149 : loop_running_(false), | 149 : loop_running_(false), |
150 quit_closure_called_(false) { | 150 quit_closure_called_(false) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 seen_ = true; | 237 seen_ = true; |
238 if (!running_) | 238 if (!running_) |
239 return; | 239 return; |
240 | 240 |
241 message_loop_runner_->Quit(); | 241 message_loop_runner_->Quit(); |
242 running_ = false; | 242 running_ = false; |
243 } | 243 } |
244 | 244 |
245 } // namespace content | 245 } // namespace content |
OLD | NEW |