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