| 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" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "content/common/site_isolation_policy.h" | 19 #include "content/common/site_isolation_policy.h" |
| 20 #include "content/public/browser/browser_child_process_host_iterator.h" | 20 #include "content/public/browser/browser_child_process_host_iterator.h" |
| 21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 22 #include "content/public/browser/render_frame_host.h" | 22 #include "content/public/browser/render_frame_host.h" |
| 23 #include "content/public/browser/render_process_host.h" | 23 #include "content/public/browser/render_process_host.h" |
| 24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
| 25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 26 #include "content/public/common/process_type.h" | 26 #include "content/public/common/process_type.h" |
| 27 #include "content/public/test/test_launcher.h" | 27 #include "content/public/test/test_launcher.h" |
| 28 #include "content/public/test/test_mojo_shell_context.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 29 | 30 |
| 30 #if defined(OS_ANDROID) | 31 #if defined(OS_ANDROID) |
| 31 #include "content/browser/android/browser_jni_registrar.h" | 32 #include "content/browser/android/browser_jni_registrar.h" |
| 32 #endif | 33 #endif |
| 33 | 34 |
| 34 namespace content { | 35 namespace content { |
| 35 | 36 |
| 36 namespace { | 37 namespace { |
| 37 | 38 |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 304 |
| 304 seen_ = true; | 305 seen_ = true; |
| 305 if (!running_) | 306 if (!running_) |
| 306 return; | 307 return; |
| 307 | 308 |
| 308 message_loop_runner_->Quit(); | 309 message_loop_runner_->Quit(); |
| 309 running_ = false; | 310 running_ = false; |
| 310 } | 311 } |
| 311 | 312 |
| 312 InProcessUtilityThreadHelper::InProcessUtilityThreadHelper() | 313 InProcessUtilityThreadHelper::InProcessUtilityThreadHelper() |
| 313 : child_thread_count_(0) { | 314 : child_thread_count_(0), shell_context_(new TestMojoShellContext) { |
| 314 RenderProcessHost::SetRunRendererInProcess(true); | 315 RenderProcessHost::SetRunRendererInProcess(true); |
| 315 BrowserChildProcessObserver::Add(this); | 316 BrowserChildProcessObserver::Add(this); |
| 316 } | 317 } |
| 317 | 318 |
| 318 InProcessUtilityThreadHelper::~InProcessUtilityThreadHelper() { | 319 InProcessUtilityThreadHelper::~InProcessUtilityThreadHelper() { |
| 319 if (child_thread_count_) { | 320 if (child_thread_count_) { |
| 320 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::UI)); | 321 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::UI)); |
| 321 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::IO)); | 322 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::IO)); |
| 322 runner_ = new MessageLoopRunner; | 323 runner_ = new MessageLoopRunner; |
| 323 runner_->Run(); | 324 runner_->Run(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 384 |
| 384 void WebContentsDestroyedWatcher::Wait() { | 385 void WebContentsDestroyedWatcher::Wait() { |
| 385 message_loop_runner_->Run(); | 386 message_loop_runner_->Run(); |
| 386 } | 387 } |
| 387 | 388 |
| 388 void WebContentsDestroyedWatcher::WebContentsDestroyed() { | 389 void WebContentsDestroyedWatcher::WebContentsDestroyed() { |
| 389 message_loop_runner_->Quit(); | 390 message_loop_runner_->Quit(); |
| 390 } | 391 } |
| 391 | 392 |
| 392 } // namespace content | 393 } // namespace content |
| OLD | NEW |