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/i18n/icu_util.h" | 10 #include "base/i18n/icu_util.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
14 #include "base/test/test_timeouts.h" | 14 #include "base/test/test_timeouts.h" |
15 #include "content/public/app/content_main.h" | 15 #include "content/public/app/content_main.h" |
16 #include "content/browser/renderer_host/render_process_host_impl.h" | 16 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 17 #include "content/browser/tracing/tracing_controller_impl.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/tracing_controller.h" | |
19 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
20 #include "content/public/common/main_function_params.h" | 20 #include "content/public/common/main_function_params.h" |
21 #include "content/public/test/test_launcher.h" | 21 #include "content/public/test/test_launcher.h" |
22 #include "content/public/test/test_utils.h" | 22 #include "content/public/test/test_utils.h" |
23 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
24 #include "net/dns/mock_host_resolver.h" | 24 #include "net/dns/mock_host_resolver.h" |
25 #include "net/test/embedded_test_server/embedded_test_server.h" | 25 #include "net/test/embedded_test_server/embedded_test_server.h" |
26 #include "ui/compositor/compositor_switches.h" | 26 #include "ui/compositor/compositor_switches.h" |
27 #include "ui/gl/gl_implementation.h" | 27 #include "ui/gl/gl_implementation.h" |
28 #include "ui/gl/gl_switches.h" | 28 #include "ui/gl/gl_switches.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 294 CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
295 switches::kEnableTracingOutput); | 295 switches::kEnableTracingOutput); |
296 // If there was no file specified, put a hardcoded one in the current | 296 // If there was no file specified, put a hardcoded one in the current |
297 // working directory. | 297 // working directory. |
298 if (trace_file.empty()) | 298 if (trace_file.empty()) |
299 trace_file = base::FilePath().AppendASCII("trace.json"); | 299 trace_file = base::FilePath().AppendASCII("trace.json"); |
300 | 300 |
301 // Wait for tracing to collect results from the renderers. | 301 // Wait for tracing to collect results from the renderers. |
302 base::RunLoop run_loop; | 302 base::RunLoop run_loop; |
303 TracingController::GetInstance()->DisableRecording( | 303 TracingController::GetInstance()->DisableRecording( |
304 trace_file, | 304 TracingControllerImpl::CreateFileSink( |
305 base::Bind(&TraceDisableRecordingComplete, run_loop.QuitClosure())); | 305 trace_file, |
| 306 base::Bind(&TraceDisableRecordingComplete, |
| 307 run_loop.QuitClosure(), |
| 308 trace_file))); |
306 run_loop.Run(); | 309 run_loop.Run(); |
307 } | 310 } |
308 } | 311 } |
309 | 312 |
310 void BrowserTestBase::CreateTestServer(const base::FilePath& test_server_base) { | 313 void BrowserTestBase::CreateTestServer(const base::FilePath& test_server_base) { |
311 CHECK(!test_server_.get()); | 314 CHECK(!test_server_.get()); |
312 test_server_.reset(new net::SpawnedTestServer( | 315 test_server_.reset(new net::SpawnedTestServer( |
313 net::SpawnedTestServer::TYPE_HTTP, | 316 net::SpawnedTestServer::TYPE_HTTP, |
314 net::SpawnedTestServer::kLocalhost, | 317 net::SpawnedTestServer::kLocalhost, |
315 test_server_base)); | 318 test_server_base)); |
(...skipping 21 matching lines...) Expand all Loading... |
337 use_software_compositing_ = true; | 340 use_software_compositing_ = true; |
338 } | 341 } |
339 | 342 |
340 bool BrowserTestBase::UsingOSMesa() const { | 343 bool BrowserTestBase::UsingOSMesa() const { |
341 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 344 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
342 return cmd->GetSwitchValueASCII(switches::kUseGL) == | 345 return cmd->GetSwitchValueASCII(switches::kUseGL) == |
343 gfx::kGLImplementationOSMesaName; | 346 gfx::kGLImplementationOSMesaName; |
344 } | 347 } |
345 | 348 |
346 } // namespace content | 349 } // namespace content |
OLD | NEW |