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