test_suite.cc revision ca12bfac764ba476d6cd062bf1dde12cc64c3f40
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
3// found in the LICENSE file.
4
5#include "ui/compositor/test/test_suite.h"
6
7#include "base/command_line.h"
8#include "base/message_loop/message_loop.h"
9#include "ui/base/ui_base_paths.h"
10#include "ui/compositor/compositor.h"
11#include "ui/compositor/compositor_switches.h"
12#include "ui/gfx/gfx_paths.h"
13#include "ui/gl/gl_implementation.h"
14
15#if defined(USE_X11)
16#include <X11/Xlib.h>
17#endif
18
19namespace ui {
20namespace test {
21
22CompositorTestSuite::CompositorTestSuite(int argc, char** argv)
23    : TestSuite(argc, argv) {}
24
25CompositorTestSuite::~CompositorTestSuite() {}
26
27void CompositorTestSuite::Initialize() {
28#if defined(USE_X11)
29  XInitThreads();
30#endif
31#if defined(OS_LINUX)
32  gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL);
33#endif
34  base::TestSuite::Initialize();
35
36  gfx::RegisterPathProvider();
37
38  message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
39  Compositor::Initialize();
40}
41
42void CompositorTestSuite::Shutdown() {
43  Compositor::Terminate();
44  message_loop_.reset();
45
46  base::TestSuite::Shutdown();
47}
48
49}  // namespace test
50}  // namespace ui
51