OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_test_base.h" | 5 #include "content/public/test/browser_test_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "content/browser/renderer_host/render_process_host_impl.h" | 11 #include "content/browser/renderer_host/render_process_host_impl.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
14 #include "content/public/common/main_function_params.h" | 14 #include "content/public/common/main_function_params.h" |
| 15 #include "content/public/common/startup_task_runner.h" |
15 #include "content/public/test/test_utils.h" | 16 #include "content/public/test/test_utils.h" |
16 #include "net/test/embedded_test_server/embedded_test_server.h" | 17 #include "net/test/embedded_test_server/embedded_test_server.h" |
17 | 18 |
18 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
19 #include "base/mac/mac_util.h" | 20 #include "base/mac/mac_util.h" |
20 #include "base/power_monitor/power_monitor.h" | 21 #include "base/power_monitor/power_monitor.h" |
21 #endif | 22 #endif |
22 | 23 |
23 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
24 #include "base/threading/thread_restrictions.h" | 25 #include "base/threading/thread_restrictions.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 91 |
91 command_line->AppendSwitch(switches::kSkipGpuDataLoading); | 92 command_line->AppendSwitch(switches::kSkipGpuDataLoading); |
92 | 93 |
93 MainFunctionParams params(*command_line); | 94 MainFunctionParams params(*command_line); |
94 params.ui_task = | 95 params.ui_task = |
95 new base::Closure( | 96 new base::Closure( |
96 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); | 97 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); |
97 | 98 |
98 SetUpInProcessBrowserTestFixture(); | 99 SetUpInProcessBrowserTestFixture(); |
99 #if defined(OS_ANDROID) | 100 #if defined(OS_ANDROID) |
100 BrowserMainRunner::Create()->Initialize(params); | 101 scoped_refptr<content::StartupTaskRunner> startup_task_runner = |
| 102 make_scoped_refptr(new content::StartupTaskRunner( |
| 103 content::StartupTaskRunner::IMMEDIATE, NULL)); |
| 104 |
| 105 BrowserMainRunner::Create()->Initialize(params, startup_task_runner); |
101 // We are done running the test by now. During teardown we | 106 // We are done running the test by now. During teardown we |
102 // need to be able to perform IO. | 107 // need to be able to perform IO. |
103 base::ThreadRestrictions::SetIOAllowed(true); | 108 base::ThreadRestrictions::SetIOAllowed(true); |
104 BrowserThread::PostTask( | 109 BrowserThread::PostTask( |
105 BrowserThread::IO, FROM_HERE, | 110 BrowserThread::IO, FROM_HERE, |
106 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), | 111 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), |
107 true)); | 112 true)); |
108 #else | 113 #else |
109 BrowserMain(params); | 114 BrowserMain(params); |
110 #endif | 115 #endif |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 RenderProcessHostImpl::GetInProcessRendererThreadForTesting(); | 148 RenderProcessHostImpl::GetInProcessRendererThreadForTesting(); |
144 CHECK(renderer_loop); | 149 CHECK(renderer_loop); |
145 | 150 |
146 renderer_loop->PostTask( | 151 renderer_loop->PostTask( |
147 FROM_HERE, | 152 FROM_HERE, |
148 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure())); | 153 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure())); |
149 runner->Run(); | 154 runner->Run(); |
150 } | 155 } |
151 | 156 |
152 } // namespace content | 157 } // namespace content |
OLD | NEW |