Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: content/public/test/browser_test_base.cc

Issue 21052007: aura: Clean up compositor initialization/destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanupcompositor: UseRealGLBindings for CompositingRWHVBrowserTests on win_rel Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/public/test/browser_test_base.h ('k') | content/public/test/content_test_suite_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
13 #include "content/public/common/main_function_params.h" 13 #include "content/public/common/main_function_params.h"
14 #include "content/public/test/test_utils.h" 14 #include "content/public/test/test_utils.h"
15 #include "net/test/embedded_test_server/embedded_test_server.h" 15 #include "net/test/embedded_test_server/embedded_test_server.h"
16 #include "ui/compositor/compositor_switches.h"
17 #include "ui/gl/gl_implementation.h"
18 #include "ui/gl/gl_switches.h"
16 19
17 #if defined(OS_POSIX) 20 #if defined(OS_POSIX)
18 #include "base/process/process_handle.h" 21 #include "base/process/process_handle.h"
19 #endif 22 #endif
20 23
21 #if defined(OS_MACOSX) 24 #if defined(OS_MACOSX)
22 #include "base/mac/mac_util.h" 25 #include "base/mac/mac_util.h"
23 #include "base/power_monitor/power_monitor_device_source.h" 26 #include "base/power_monitor/power_monitor_device_source.h"
24 #endif 27 #endif
25 28
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, quit_task); 60 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, quit_task);
58 } 61 }
59 62
60 } // namespace 63 } // namespace
61 64
62 extern int BrowserMain(const MainFunctionParams&); 65 extern int BrowserMain(const MainFunctionParams&);
63 66
64 BrowserTestBase::BrowserTestBase() 67 BrowserTestBase::BrowserTestBase()
65 : embedded_test_server_( 68 : embedded_test_server_(
66 new net::test_server::EmbeddedTestServer( 69 new net::test_server::EmbeddedTestServer(
67 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))) { 70 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))),
71 allow_test_contexts_(true),
72 allow_osmesa_(true),
73 using_accelerated_video_decode_(false) {
68 #if defined(OS_MACOSX) 74 #if defined(OS_MACOSX)
69 base::mac::SetOverrideAmIBundled(true); 75 base::mac::SetOverrideAmIBundled(true);
70 base::PowerMonitorDeviceSource::AllocateSystemIOPorts(); 76 base::PowerMonitorDeviceSource::AllocateSystemIOPorts();
71 #endif 77 #endif
72 78
73 #if defined(OS_POSIX) 79 #if defined(OS_POSIX)
74 handle_sigterm_ = true; 80 handle_sigterm_ = true;
75 #endif 81 #endif
76 } 82 }
77 83
(...skipping 13 matching lines...) Expand all
91 97
92 command_line->AppendSwitch(switches::kDomAutomationController); 98 command_line->AppendSwitch(switches::kDomAutomationController);
93 99
94 command_line->AppendSwitch(switches::kSkipGpuDataLoading); 100 command_line->AppendSwitch(switches::kSkipGpuDataLoading);
95 101
96 MainFunctionParams params(*command_line); 102 MainFunctionParams params(*command_line);
97 params.ui_task = 103 params.ui_task =
98 new base::Closure( 104 new base::Closure(
99 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); 105 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this));
100 106
107 #if defined(USE_AURA)
108 // Use test contexts for browser tests unless they override and force us to
109 // use a real context.
110 if (allow_test_contexts_)
111 command_line->AppendSwitch(switches::kTestCompositor);
112 #endif
113
114 // When using real GL contexts, we usually use OSMesa as this works on all
115 // bots. The command line can override this behaviour to use a real GPU.
116 if (command_line->HasSwitch(switches::kUseGpuInTests))
117 allow_osmesa_ = false;
118
119 #if defined(OS_MACOSX)
120 // On Mac we always use a real GPU.
121 allow_osmesa_ = false;
122 #endif
123
124 if (command_line->HasSwitch(switches::kUseGL)) {
125 NOTREACHED() <<
126 "kUseGL should not be used with tests. Try kUseGpuInTests instead.";
127 }
128
129 if (allow_osmesa_) {
130 command_line->AppendSwitchASCII(
131 switches::kUseGL, gfx::kGLImplementationOSMesaName);
132 }
133
134 // NOTE: should be kept in sync with
135 // chrome/browser/resources/software_rendering_list.json
136 #if !defined(OS_WIN) && !defined(OS_CHROMEOS)
137 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
138 using_accelerated_video_decode_ = false;
139 #else
140 using_accelerated_video_decode_ = true;
141 #endif
142
101 SetUpInProcessBrowserTestFixture(); 143 SetUpInProcessBrowserTestFixture();
102 #if defined(OS_ANDROID) 144 #if defined(OS_ANDROID)
103 BrowserMainRunner::Create()->Initialize(params); 145 BrowserMainRunner::Create()->Initialize(params);
104 // We are done running the test by now. During teardown we 146 // We are done running the test by now. During teardown we
105 // need to be able to perform IO. 147 // need to be able to perform IO.
106 base::ThreadRestrictions::SetIOAllowed(true); 148 base::ThreadRestrictions::SetIOAllowed(true);
107 BrowserThread::PostTask( 149 BrowserThread::PostTask(
108 BrowserThread::IO, FROM_HERE, 150 BrowserThread::IO, FROM_HERE,
109 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), 151 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
110 true)); 152 true));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 RenderProcessHostImpl::GetInProcessRendererThreadForTesting(); 188 RenderProcessHostImpl::GetInProcessRendererThreadForTesting();
147 CHECK(renderer_loop); 189 CHECK(renderer_loop);
148 190
149 renderer_loop->PostTask( 191 renderer_loop->PostTask(
150 FROM_HERE, 192 FROM_HERE,
151 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure())); 193 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure()));
152 runner->Run(); 194 runner->Run();
153 } 195 }
154 196
155 } // namespace content 197 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/browser_test_base.h ('k') | content/public/test/content_test_suite_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698