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