| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/compositor/test/test_suite.h" | 5 #include "ui/compositor/test/test_suite.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "ui/base/ui_base_paths.h" | 9 #include "ui/base/ui_base_paths.h" |
| 10 #include "ui/compositor/compositor.h" | 10 #include "ui/compositor/compositor.h" |
| 11 #include "ui/compositor/compositor_switches.h" | 11 #include "ui/compositor/compositor_switches.h" |
| 12 #include "ui/compositor/test/compositor_test_support.h" | 12 #include "ui/compositor/test/compositor_test_support.h" |
| 13 #include "ui/gfx/gfx_paths.h" | 13 #include "ui/gfx/gfx_paths.h" |
| 14 #include "ui/gl/gl_implementation.h" | 14 #include "ui/gl/gl_implementation.h" |
| 15 | 15 |
| 16 #if defined(USE_X11) | 16 #if defined(USE_X11) |
| 17 #include <X11/Xlib.h> | 17 #include <X11/Xlib.h> |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 namespace ui { | 20 namespace ui { |
| 21 namespace test { | 21 namespace test { |
| 22 | 22 |
| 23 CompositorTestSuite::CompositorTestSuite(int argc, char** argv) | 23 CompositorTestSuite::CompositorTestSuite(int argc, char** argv) |
| 24 : TestSuite(argc, argv) {} | 24 : TestSuite(argc, argv) {} |
| 25 | 25 |
| 26 CompositorTestSuite::~CompositorTestSuite() {} | 26 CompositorTestSuite::~CompositorTestSuite() {} |
| 27 | 27 |
| 28 void CompositorTestSuite::Initialize() { | 28 void CompositorTestSuite::Initialize() { |
| 29 bool use_threaded_compositing = CommandLine::ForCurrentProcess()-> | |
| 30 HasSwitch(switches::kUIEnableThreadedCompositing); | |
| 31 #if defined(USE_X11) | 29 #if defined(USE_X11) |
| 32 if (use_threaded_compositing) | 30 XInitThreads(); |
| 33 XInitThreads(); | |
| 34 #endif | 31 #endif |
| 35 #if defined(OS_LINUX) | 32 #if defined(OS_LINUX) |
| 36 gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL); | 33 gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL); |
| 37 #endif | 34 #endif |
| 38 base::TestSuite::Initialize(); | 35 base::TestSuite::Initialize(); |
| 39 | 36 |
| 40 gfx::RegisterPathProvider(); | 37 gfx::RegisterPathProvider(); |
| 41 | 38 |
| 42 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); | 39 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); |
| 43 CompositorTestSupport::Initialize(); | 40 CompositorTestSupport::Initialize(); |
| 44 Compositor::Initialize(use_threaded_compositing); | 41 Compositor::Initialize(); |
| 45 } | 42 } |
| 46 | 43 |
| 47 void CompositorTestSuite::Shutdown() { | 44 void CompositorTestSuite::Shutdown() { |
| 48 Compositor::Terminate(); | 45 Compositor::Terminate(); |
| 49 CompositorTestSupport::Terminate(); | 46 CompositorTestSupport::Terminate(); |
| 50 message_loop_.reset(); | 47 message_loop_.reset(); |
| 51 | 48 |
| 52 base::TestSuite::Shutdown(); | 49 base::TestSuite::Shutdown(); |
| 53 } | 50 } |
| 54 | 51 |
| 55 } // namespace test | 52 } // namespace test |
| 56 } // namespace ui | 53 } // namespace ui |
| OLD | NEW |