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