| Index: content/public/test/browser_test_base.cc
|
| diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc
|
| index 5587180de8aa72201a5da4bcea535723e93d57fc..a8733e4435b68f7d03b6fa915e795b7b647510df 100644
|
| --- a/content/public/test/browser_test_base.cc
|
| +++ b/content/public/test/browser_test_base.cc
|
| @@ -120,7 +120,8 @@ extern int BrowserMain(const MainFunctionParams&);
|
|
|
| BrowserTestBase::BrowserTestBase()
|
| : allow_test_contexts_(true),
|
| - allow_osmesa_(true) {
|
| + allow_osmesa_(true),
|
| + use_software_compositing_(false) {
|
| #if defined(OS_MACOSX)
|
| base::mac::SetOverrideAmIBundled(true);
|
| base::PowerMonitorDeviceSource::AllocateSystemIOPorts();
|
| @@ -153,6 +154,15 @@ void BrowserTestBase::SetUp() {
|
| // GPU blacklisting decisions were made.
|
| command_line->AppendSwitch(switches::kLogGpuControlListDecisions);
|
|
|
| + if (use_software_compositing_) {
|
| + command_line->AppendSwitch(switches::kDisableGpu);
|
| + command_line->AppendSwitch(switches::kEnableSoftwareCompositing);
|
| +#if defined(USE_AURA)
|
| + command_line->AppendSwitch(switches::kUIEnableSoftwareCompositing);
|
| + command_line->AppendSwitch(switches::kUIDisableThreadedCompositing);
|
| +#endif
|
| + }
|
| +
|
| #if defined(OS_CHROMEOS)
|
| // If the test is running on the chromeos envrionment (such as
|
| // device or vm bots), always use real contexts.
|
| @@ -166,7 +176,7 @@ void BrowserTestBase::SetUp() {
|
|
|
| // Use test contexts for browser tests unless they override and force us to
|
| // use a real context.
|
| - if (allow_test_contexts_) {
|
| + if (allow_test_contexts_ && !use_software_compositing_) {
|
| content::ImageTransportFactory::InitializeForUnitTests(
|
| scoped_ptr<ui::ContextFactory>(new ui::TestContextFactory));
|
| }
|
| @@ -204,7 +214,7 @@ void BrowserTestBase::SetUp() {
|
| "kUseGL should not be used with tests. Try kUseGpuInTests instead.";
|
| }
|
|
|
| - if (allow_osmesa_) {
|
| + if (allow_osmesa_ && !use_software_compositing_) {
|
| command_line->AppendSwitchASCII(
|
| switches::kUseGL, gfx::kGLImplementationOSMesaName);
|
| }
|
| @@ -274,4 +284,22 @@ void BrowserTestBase::PostTaskToInProcessRendererAndWait(
|
| runner->Run();
|
| }
|
|
|
| +void BrowserTestBase::UseRealGLContexts() { allow_test_contexts_ = false; }
|
| +
|
| +void BrowserTestBase::UseRealGLBindings() {
|
| + DCHECK(!use_software_compositing_)
|
| + << "Can't use GL with software compositing";
|
| + allow_osmesa_ = false;
|
| +}
|
| +
|
| +void BrowserTestBase::UseSoftwareCompositing() {
|
| +#if !defined(USE_AURA) && !defined(OS_MACOSX)
|
| + // TODO(danakj): Remove when GTK linux is no more.
|
| + NOTREACHED();
|
| +#endif
|
| +
|
| + DCHECK(allow_osmesa_) << "Can't use GL with software compositing";
|
| + use_software_compositing_ = true;
|
| +}
|
| +
|
| } // namespace content
|
|
|