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