Home | History | Annotate | Download | only in test
      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/basictypes.h"
      6 #include "base/bind.h"
      7 #include "base/compiler_specific.h"
      8 #include "base/path_service.h"
      9 #include "base/test/launcher/unit_test_launcher.h"
     10 #include "base/test/test_suite.h"
     11 #include "testing/gtest/include/gtest/gtest.h"
     12 #include "ui/base/resource/resource_bundle.h"
     13 #include "ui/base/ui_base_paths.h"
     14 
     15 #if !defined(OS_MACOSX)
     16 #include "ui/gl/gl_surface.h"
     17 #endif
     18 
     19 namespace {
     20 
     21 class MessageCenterTestSuite : public base::TestSuite {
     22  public:
     23   MessageCenterTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {}
     24 
     25  protected:
     26   virtual void Initialize() OVERRIDE {
     27 #if !defined(OS_MACOSX)
     28     gfx::GLSurface::InitializeOneOffForTests();
     29 #endif
     30     base::TestSuite::Initialize();
     31     ui::RegisterPathProvider();
     32 
     33     base::FilePath ui_test_pak_path;
     34     ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
     35     ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
     36   }
     37 
     38   virtual void Shutdown() OVERRIDE {
     39     ui::ResourceBundle::CleanupSharedInstance();
     40     base::TestSuite::Shutdown();
     41   }
     42 
     43  private:
     44   DISALLOW_COPY_AND_ASSIGN(MessageCenterTestSuite);
     45 };
     46 
     47 }  // namespace
     48 
     49 int main(int argc, char** argv) {
     50   MessageCenterTestSuite test_suite(argc, argv);
     51 
     52   return base::LaunchUnitTests(
     53       argc,
     54       argv,
     55       base::Bind(&MessageCenterTestSuite::Run, base::Unretained(&test_suite)));
     56 }
     57