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/android/jni_android.h" | 5 #include "base/android/jni_android.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/macros.h" | 8 #include "base/macros.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/test/launcher/unit_test_launcher.h" | 10 #include "base/test/launcher/unit_test_launcher.h" |
11 #include "base/test/test_suite.h" | 11 #include "base/test/test_suite.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/android/ui_android_jni_registrar.h" | 13 #include "ui/android/ui_android_jni_registrar.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/base/ui_base_paths.h" | 15 #include "ui/base/ui_base_paths.h" |
| 16 #include "ui/display/android/jni_registrar.h" |
16 #include "ui/gfx/android/gfx_jni_registrar.h" | 17 #include "ui/gfx/android/gfx_jni_registrar.h" |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 class UIAndroidTestSuite : public base::TestSuite { | 21 class UIAndroidTestSuite : public base::TestSuite { |
21 public: | 22 public: |
22 UIAndroidTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} | 23 UIAndroidTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} |
23 | 24 |
24 protected: | 25 protected: |
25 void Initialize() override { | 26 void Initialize() override { |
26 base::TestSuite::Initialize(); | 27 base::TestSuite::Initialize(); |
27 | 28 |
28 gfx::android::RegisterJni(base::android::AttachCurrentThread()); | 29 gfx::android::RegisterJni(base::android::AttachCurrentThread()); |
| 30 display::RegisterJni(base::android::AttachCurrentThread()); |
29 ui::RegisterUIAndroidJni(base::android::AttachCurrentThread()); | 31 ui::RegisterUIAndroidJni(base::android::AttachCurrentThread()); |
30 | 32 |
31 ui::RegisterPathProvider(); | 33 ui::RegisterPathProvider(); |
32 | 34 |
33 base::FilePath ui_test_pak_path; | 35 base::FilePath ui_test_pak_path; |
34 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); | 36 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); |
35 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); | 37 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); |
36 } | 38 } |
37 | 39 |
38 void Shutdown() override { | 40 void Shutdown() override { |
39 ui::ResourceBundle::CleanupSharedInstance(); | 41 ui::ResourceBundle::CleanupSharedInstance(); |
40 base::TestSuite::Shutdown(); | 42 base::TestSuite::Shutdown(); |
41 } | 43 } |
42 | 44 |
43 private: | 45 private: |
44 DISALLOW_COPY_AND_ASSIGN(UIAndroidTestSuite); | 46 DISALLOW_COPY_AND_ASSIGN(UIAndroidTestSuite); |
45 }; | 47 }; |
46 | 48 |
47 } // namespace | 49 } // namespace |
48 | 50 |
49 int main(int argc, char** argv) { | 51 int main(int argc, char** argv) { |
50 UIAndroidTestSuite test_suite(argc, argv); | 52 UIAndroidTestSuite test_suite(argc, argv); |
51 | 53 |
52 return base::LaunchUnitTests( | 54 return base::LaunchUnitTests( |
53 argc, argv, | 55 argc, argv, |
54 base::Bind(&UIAndroidTestSuite::Run, base::Unretained(&test_suite))); | 56 base::Bind(&UIAndroidTestSuite::Run, base::Unretained(&test_suite))); |
55 } | 57 } |
OLD | NEW |