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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 | 183 |
184 std::unique_ptr<base::Value> ExecuteScriptAndGetValue( | 184 std::unique_ptr<base::Value> ExecuteScriptAndGetValue( |
185 RenderFrameHost* render_frame_host, | 185 RenderFrameHost* render_frame_host, |
186 const std::string& script) { | 186 const std::string& script) { |
187 ScriptCallback observer; | 187 ScriptCallback observer; |
188 | 188 |
189 render_frame_host->ExecuteJavaScriptForTests( | 189 render_frame_host->ExecuteJavaScriptForTests( |
190 base::UTF8ToUTF16(script), | 190 base::UTF8ToUTF16(script), |
191 base::Bind(&ScriptCallback::ResultCallback, base::Unretained(&observer))); | 191 base::Bind(&ScriptCallback::ResultCallback, base::Unretained(&observer))); |
192 base::MessageLoop* loop = base::MessageLoop::current(); | 192 base::RunLoop().Run(); |
193 loop->Run(); | |
194 return observer.result(); | 193 return observer.result(); |
195 } | 194 } |
196 | 195 |
197 bool AreAllSitesIsolatedForTesting() { | 196 bool AreAllSitesIsolatedForTesting() { |
198 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 197 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
199 switches::kSitePerProcess); | 198 switches::kSitePerProcess); |
200 } | 199 } |
201 | 200 |
202 void IsolateAllSitesForTesting(base::CommandLine* command_line) { | 201 void IsolateAllSitesForTesting(base::CommandLine* command_line) { |
203 command_line->AppendSwitch(switches::kSitePerProcess); | 202 command_line->AppendSwitch(switches::kSitePerProcess); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 | 380 |
382 void WebContentsDestroyedWatcher::Wait() { | 381 void WebContentsDestroyedWatcher::Wait() { |
383 message_loop_runner_->Run(); | 382 message_loop_runner_->Run(); |
384 } | 383 } |
385 | 384 |
386 void WebContentsDestroyedWatcher::WebContentsDestroyed() { | 385 void WebContentsDestroyedWatcher::WebContentsDestroyed() { |
387 message_loop_runner_->Quit(); | 386 message_loop_runner_->Quit(); |
388 } | 387 } |
389 | 388 |
390 } // namespace content | 389 } // namespace content |
OLD | NEW |