1116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// Copyright 2014 The Chromium Authors. All rights reserved.
2116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// Use of this source code is governed by a BSD-style license that can be
3116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// found in the LICENSE file.
4116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
5116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "base/bind.h"
6116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "base/test/launcher/unit_test_launcher.h"
7116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "base/test/test_suite.h"
8116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "ui/gl/gl_surface.h"
9116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
10116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#if defined(USE_X11)
11116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "ui/gfx/x/x11_connection.h"
12116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#endif
13116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
14116680a4aac90f2aa7413d9095a592090648e557Ben Murdochnamespace mojo {
15116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
16116680a4aac90f2aa7413d9095a592090648e557Ben Murdochclass WindowManagerTestSuite : public base::TestSuite {
17116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch public:
18116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  WindowManagerTestSuite(int argc, char** argv) : TestSuite(argc, argv) {}
19116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual ~WindowManagerTestSuite() {}
20116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
21116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch protected:
22116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual void Initialize() OVERRIDE {
23116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#if defined(USE_X11)
24116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    // Each test ends up creating a new thread for the native viewport service.
25116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    // In other words we'll use X on different threads, so tell it that.
26116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    gfx::InitializeThreadedX11();
27116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#endif
28116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    base::TestSuite::Initialize();
29116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    gfx::GLSurface::InitializeOneOffForTests();
30116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  }
31116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
32116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch private:
33116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  DISALLOW_COPY_AND_ASSIGN(WindowManagerTestSuite);
34116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch};
35116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
36116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch}  // namespace mojo
37116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
38116680a4aac90f2aa7413d9095a592090648e557Ben Murdochint main(int argc, char** argv) {
39116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  mojo::WindowManagerTestSuite test_suite(argc, argv);
40116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
41116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  return base::LaunchUnitTests(
42116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      argc, argv, base::Bind(&TestSuite::Run, base::Unretained(&test_suite)));
43116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch}
44