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 "content/browser/renderer_host/render_process_host_impl.h" | 10 #include "content/browser/renderer_host/render_process_host_impl.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 } | 93 } |
94 | 94 |
95 void BrowserTestBase::SetUp() { | 95 void BrowserTestBase::SetUp() { |
96 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 96 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
97 | 97 |
98 // The tests assume that file:// URIs can freely access other file:// URIs. | 98 // The tests assume that file:// URIs can freely access other file:// URIs. |
99 command_line->AppendSwitch(switches::kAllowFileAccessFromFiles); | 99 command_line->AppendSwitch(switches::kAllowFileAccessFromFiles); |
100 | 100 |
101 command_line->AppendSwitch(switches::kDomAutomationController); | 101 command_line->AppendSwitch(switches::kDomAutomationController); |
102 | 102 |
103 command_line->AppendSwitch(switches::kSkipGpuDataLoading); | |
104 | |
105 MainFunctionParams params(*command_line); | 103 MainFunctionParams params(*command_line); |
106 params.ui_task = | 104 params.ui_task = |
107 new base::Closure( | 105 new base::Closure( |
108 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); | 106 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); |
109 | 107 |
110 #if defined(USE_AURA) | 108 #if defined(USE_AURA) |
111 // Use test contexts for browser tests unless they override and force us to | 109 // Use test contexts for browser tests unless they override and force us to |
112 // use a real context. | 110 // use a real context. |
113 if (allow_test_contexts_) | 111 if (allow_test_contexts_) |
114 command_line->AppendSwitch(switches::kTestCompositor); | 112 command_line->AppendSwitch(switches::kTestCompositor); |
(...skipping 24 matching lines...) Expand all Loading... | |
139 // we should use real GL bindings with it. | 137 // we should use real GL bindings with it. |
140 if (base::chromeos::IsRunningOnChromeOS()) | 138 if (base::chromeos::IsRunningOnChromeOS()) |
141 allow_osmesa_ = false; | 139 allow_osmesa_ = false; |
142 #endif | 140 #endif |
143 | 141 |
144 if (command_line->HasSwitch(switches::kUseGL)) { | 142 if (command_line->HasSwitch(switches::kUseGL)) { |
145 NOTREACHED() << | 143 NOTREACHED() << |
146 "kUseGL should not be used with tests. Try kUseGpuInTests instead."; | 144 "kUseGL should not be used with tests. Try kUseGpuInTests instead."; |
147 } | 145 } |
148 | 146 |
149 if (allow_osmesa_) { | 147 if (allow_osmesa_) { |
gab
2013/08/15 20:07:49
Even with all of this we will still use the OSMesa
| |
150 command_line->AppendSwitchASCII( | 148 command_line->AppendSwitchASCII( |
151 switches::kUseGL, gfx::kGLImplementationOSMesaName); | 149 switches::kUseGL, gfx::kGLImplementationOSMesaName); |
152 } | 150 } |
153 | 151 |
154 SetUpInProcessBrowserTestFixture(); | 152 SetUpInProcessBrowserTestFixture(); |
155 #if defined(OS_ANDROID) | 153 #if defined(OS_ANDROID) |
156 BrowserMainRunner::Create()->Initialize(params); | 154 BrowserMainRunner::Create()->Initialize(params); |
157 // We are done running the test by now. During teardown we | 155 // We are done running the test by now. During teardown we |
158 // need to be able to perform IO. | 156 // need to be able to perform IO. |
159 base::ThreadRestrictions::SetIOAllowed(true); | 157 base::ThreadRestrictions::SetIOAllowed(true); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 RenderProcessHostImpl::GetInProcessRendererThreadForTesting(); | 197 RenderProcessHostImpl::GetInProcessRendererThreadForTesting(); |
200 CHECK(renderer_loop); | 198 CHECK(renderer_loop); |
201 | 199 |
202 renderer_loop->PostTask( | 200 renderer_loop->PostTask( |
203 FROM_HERE, | 201 FROM_HERE, |
204 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure())); | 202 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure())); |
205 runner->Run(); | 203 runner->Run(); |
206 } | 204 } |
207 | 205 |
208 } // namespace content | 206 } // namespace content |
OLD | NEW |