| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/test/launcher/unit_test_launcher.h" | 9 #include "base/test/launcher/unit_test_launcher.h" |
| 10 #include "base/test/test_suite.h" | 10 #include "base/test/test_suite.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "ui/aura/env.h" | |
| 13 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
| 14 #include "ui/base/ui_base_paths.h" | 13 #include "ui/base/ui_base_paths.h" |
| 15 #include "ui/gl/test/gl_surface_test_support.h" | 14 #include "ui/gl/test/gl_surface_test_support.h" |
| 16 | 15 |
| 17 class WMTestSuite : public base::TestSuite { | 16 class WMTestSuite : public base::TestSuite { |
| 18 public: | 17 public: |
| 19 WMTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} | 18 WMTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} |
| 20 | 19 |
| 21 protected: | 20 protected: |
| 22 void Initialize() override { | 21 void Initialize() override { |
| 23 base::TestSuite::Initialize(); | 22 base::TestSuite::Initialize(); |
| 24 gfx::GLSurfaceTestSupport::InitializeOneOff(); | 23 gfx::GLSurfaceTestSupport::InitializeOneOff(); |
| 25 ui::RegisterPathProvider(); | 24 ui::RegisterPathProvider(); |
| 26 | 25 |
| 27 base::FilePath ui_test_pak_path; | 26 base::FilePath ui_test_pak_path; |
| 28 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); | 27 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); |
| 29 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); | 28 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); |
| 30 | |
| 31 env_ = aura::Env::CreateInstance(); | |
| 32 } | 29 } |
| 33 | 30 |
| 34 void Shutdown() override { | 31 void Shutdown() override { |
| 35 env_.reset(); | |
| 36 ui::ResourceBundle::CleanupSharedInstance(); | 32 ui::ResourceBundle::CleanupSharedInstance(); |
| 37 base::TestSuite::Shutdown(); | 33 base::TestSuite::Shutdown(); |
| 38 } | 34 } |
| 39 | 35 |
| 40 private: | 36 private: |
| 41 scoped_ptr<aura::Env> env_; | |
| 42 DISALLOW_COPY_AND_ASSIGN(WMTestSuite); | 37 DISALLOW_COPY_AND_ASSIGN(WMTestSuite); |
| 43 }; | 38 }; |
| 44 | 39 |
| 45 int main(int argc, char** argv) { | 40 int main(int argc, char** argv) { |
| 46 WMTestSuite test_suite(argc, argv); | 41 WMTestSuite test_suite(argc, argv); |
| 47 | 42 |
| 48 return base::LaunchUnitTests( | 43 return base::LaunchUnitTests( |
| 49 argc, argv, base::Bind(&WMTestSuite::Run, base::Unretained(&test_suite))); | 44 argc, argv, base::Bind(&WMTestSuite::Run, base::Unretained(&test_suite))); |
| 50 } | 45 } |
| OLD | NEW |