| 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 <stddef.h> | 7 #include <stddef.h> |
| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 switches::kEnableTracing)) { | 334 switches::kEnableTracing)) { |
| 335 base::trace_event::TraceConfig trace_config( | 335 base::trace_event::TraceConfig trace_config( |
| 336 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 336 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 337 switches::kEnableTracing), | 337 switches::kEnableTracing), |
| 338 base::trace_event::RECORD_CONTINUOUSLY); | 338 base::trace_event::RECORD_CONTINUOUSLY); |
| 339 TracingController::GetInstance()->StartTracing( | 339 TracingController::GetInstance()->StartTracing( |
| 340 trace_config, | 340 trace_config, |
| 341 TracingController::StartTracingDoneCallback()); | 341 TracingController::StartTracingDoneCallback()); |
| 342 } | 342 } |
| 343 | 343 |
| 344 { | 344 RunTestOnMainThreadLoop(); |
| 345 // This can be called from a posted task. Allow nested tasks here, because | |
| 346 // otherwise the test body will have to do it in order to use RunLoop for | |
| 347 // waiting. | |
| 348 base::MessageLoop::ScopedNestableTaskAllower allow( | |
| 349 base::MessageLoop::current()); | |
| 350 RunTestOnMainThreadLoop(); | |
| 351 } | |
| 352 | 345 |
| 353 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 346 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 354 switches::kEnableTracing)) { | 347 switches::kEnableTracing)) { |
| 355 base::FilePath trace_file = | 348 base::FilePath trace_file = |
| 356 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 349 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 357 switches::kEnableTracingOutput); | 350 switches::kEnableTracingOutput); |
| 358 // If there was no file specified, put a hardcoded one in the current | 351 // If there was no file specified, put a hardcoded one in the current |
| 359 // working directory. | 352 // working directory. |
| 360 if (trace_file.empty()) | 353 if (trace_file.empty()) |
| 361 trace_file = base::FilePath().AppendASCII("trace.json"); | 354 trace_file = base::FilePath().AppendASCII("trace.json"); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 use_software_compositing_ = true; | 396 use_software_compositing_ = true; |
| 404 } | 397 } |
| 405 | 398 |
| 406 bool BrowserTestBase::UsingOSMesa() const { | 399 bool BrowserTestBase::UsingOSMesa() const { |
| 407 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 400 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 408 return cmd->GetSwitchValueASCII(switches::kUseGL) == | 401 return cmd->GetSwitchValueASCII(switches::kUseGL) == |
| 409 gl::kGLImplementationOSMesaName; | 402 gl::kGLImplementationOSMesaName; |
| 410 } | 403 } |
| 411 | 404 |
| 412 } // namespace content | 405 } // namespace content |
| OLD | NEW |