Home | History | Annotate | Download | only in window_manager
      1 // Copyright 2014 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 "base/bind.h"
      6 #include "base/test/launcher/unit_test_launcher.h"
      7 #include "base/test/test_suite.h"
      8 #include "ui/gl/gl_surface.h"
      9 
     10 #if defined(USE_X11)
     11 #include "ui/gfx/x/x11_connection.h"
     12 #endif
     13 
     14 namespace mojo {
     15 
     16 class WindowManagerTestSuite : public base::TestSuite {
     17  public:
     18   WindowManagerTestSuite(int argc, char** argv) : TestSuite(argc, argv) {}
     19   virtual ~WindowManagerTestSuite() {}
     20 
     21  protected:
     22   virtual void Initialize() OVERRIDE {
     23 #if defined(USE_X11)
     24     // Each test ends up creating a new thread for the native viewport service.
     25     // In other words we'll use X on different threads, so tell it that.
     26     gfx::InitializeThreadedX11();
     27 #endif
     28     base::TestSuite::Initialize();
     29     gfx::GLSurface::InitializeOneOffForTests();
     30   }
     31 
     32  private:
     33   DISALLOW_COPY_AND_ASSIGN(WindowManagerTestSuite);
     34 };
     35 
     36 }  // namespace mojo
     37 
     38 int main(int argc, char** argv) {
     39   mojo::WindowManagerTestSuite test_suite(argc, argv);
     40 
     41   return base::LaunchUnitTests(
     42       argc, argv, base::Bind(&TestSuite::Run, base::Unretained(&test_suite)));
     43 }
     44