diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-07 14:08:44 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-07 14:08:44 +0000 |
commit | d65d6fe3c667835a8a0ddc0b917519115321d605 (patch) | |
tree | b0090c9cbf784c825eb554fcb869dd0bc363a9dd /chrome/test/gpu | |
parent | 520d01a2c42f41e8003bc409f4bf0dba0b45f835 (diff) | |
download | chromium_src-d65d6fe3c667835a8a0ddc0b917519115321d605.zip chromium_src-d65d6fe3c667835a8a0ddc0b917519115321d605.tar.gz chromium_src-d65d6fe3c667835a8a0ddc0b917519115321d605.tar.bz2 |
Clean up compositor initialization/destruction.
Moved from https://codereview.chromium.org/21052007/
Currently the ContextFactory is outliving the compositor thread in
tests, which is bad since the contexts in there can be bound to the
compositor thread. Then we end up reusing those contexts and bad
things happen.
This enforces ordering for initializing and destroying the
compositor as follows:
Initialize ContextFactory
..Compositor::Initialize
....Create Compositor instances
....Delete Compositor instances
..Compositor::Terminate
The Compositor::Terminate call also destroys the ContextFactory.
The ContextFactory can be initialized in one of two ways:
1. ImageTransportFactory::Initialize will set up the
ContextFactory. This is used by things that invoke all of
content/browser/.
2. Compositor::InitializeContextFactoryForTests() must be
explicitly called by any unit tests that create a compositor.
Since some tests want a real GL context and some don't, this
does away with the misnomer of initializing the Compositor once
for the entire test suite, and then re-initializing somewhere
in the middle of the test suite. Instead, each test must
Initialize/Terminate the compositor with the ContextFactory
type of its choice.
Incidently, this test enables 20 tests on aura or win_aura that
were previously being skipped.
TBR=piman@chromium.org
BUG=258625, 266565
Review URL: https://codereview.chromium.org/22293003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216179 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/gpu')
-rw-r--r-- | chrome/test/gpu/gpu_feature_browsertest.cc | 35 | ||||
-rw-r--r-- | chrome/test/gpu/webgl_infobar_browsertest.cc | 7 |
2 files changed, 13 insertions, 29 deletions
diff --git a/chrome/test/gpu/gpu_feature_browsertest.cc b/chrome/test/gpu/gpu_feature_browsertest.cc index 7ace688..8a6af16 100644 --- a/chrome/test/gpu/gpu_feature_browsertest.cc +++ b/chrome/test/gpu/gpu_feature_browsertest.cc @@ -14,7 +14,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/test_launcher_utils.h" #include "chrome/test/base/tracing.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/gpu_data_manager.h" @@ -24,8 +23,7 @@ #include "gpu/config/gpu_info.h" #include "gpu/config/gpu_test_config.h" #include "net/base/net_util.h" -#include "ui/compositor/compositor_setup.h" -#include "ui/gl/gl_switches.h" +#include "ui/gl/gl_implementation.h" #if defined(OS_MACOSX) #include "ui/gl/io_surface_support_mac.h" @@ -49,7 +47,14 @@ const char kWebGLCreationEvent[] = "DrawingBufferCreation"; class GpuFeatureTest : public InProcessBrowserTest { public: - GpuFeatureTest() : category_patterns_("test_gpu"), gpu_enabled_(false) {} + GpuFeatureTest() : category_patterns_("test_gpu") {} + + virtual void SetUp() OVERRIDE { + // We expect to use real GL contexts for these tests. + UseRealGLContexts(); + + InProcessBrowserTest::SetUp(); + } virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { base::FilePath test_dir; @@ -58,18 +63,7 @@ class GpuFeatureTest : public InProcessBrowserTest { } virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { - // Do not use mesa if real GPU is required. - if (!command_line->HasSwitch(switches::kUseGpuInTests)) { -#if !defined(OS_MACOSX) - CHECK(test_launcher_utils::OverrideGLImplementation( - command_line, gfx::kGLImplementationOSMesaName)) << - "kUseGL must not be set by test framework code!"; -#endif - } else { - gpu_enabled_ = true; - } command_line->AppendSwitch(switches::kDisablePopupBlocking); - ui::DisableTestCompositor(); command_line->AppendSwitchASCII(switches::kWindowSize, "400,300"); } @@ -85,7 +79,7 @@ class GpuFeatureTest : public InProcessBrowserTest { bool new_tab) { #if defined(OS_LINUX) && !defined(NDEBUG) // Bypass tests on GPU Linux Debug bots. - if (gpu_enabled_) + if (gfx::GetGLImplementation() != gfx::kGLImplementationOSMesaGL) return; #endif @@ -117,7 +111,7 @@ class GpuFeatureTest : public InProcessBrowserTest { bool event_expected = false) { #if defined(OS_LINUX) && !defined(NDEBUG) // Bypass tests on GPU Linux Debug bots. - if (gpu_enabled_) + if (gfx::GetGLImplementation() != gfx::kGLImplementationOSMesaGL) return; #endif #if defined(OS_MACOSX) @@ -173,7 +167,6 @@ class GpuFeatureTest : public InProcessBrowserTest { scoped_ptr<TraceAnalyzer> analyzer_; std::string category_patterns_; std::string trace_events_json_; - bool gpu_enabled_; }; #if defined(OS_WIN) || defined(ADDRESS_SANITIZER) @@ -308,9 +301,7 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MultisamplingAllowed) { gpu::GPU_FEATURE_TYPE_MULTISAMPLING)); // Multisampling is not supported if running on top of osmesa. - std::string use_gl = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kUseGL); - if (use_gl == gfx::kGLImplementationOSMesaName) + if (gfx::GetGLImplementation() != gfx::kGLImplementationOSMesaGL) return; // Linux Intel uses mesa driver, where multisampling is not supported. @@ -558,4 +549,4 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, IOSurfaceReuse) { } #endif -} // namespace anonymous +} // namespace diff --git a/chrome/test/gpu/webgl_infobar_browsertest.cc b/chrome/test/gpu/webgl_infobar_browsertest.cc index 35071ae..e21df14 100644 --- a/chrome/test/gpu/webgl_infobar_browsertest.cc +++ b/chrome/test/gpu/webgl_infobar_browsertest.cc @@ -51,13 +51,6 @@ void SimulateGPUCrash(Browser* browser) { class WebGLInfobarTest : public InProcessBrowserTest { protected: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { - // GPU tests require gpu acceleration. -#if !defined(OS_MACOSX) - command_line->AppendSwitchASCII( - switches::kUseGL, gfx::kGLImplementationOSMesaName); -#endif - } virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { base::FilePath test_dir; ASSERT_TRUE(PathService::Get(content::DIR_TEST_DATA, &test_dir)); |