| 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/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/test/launcher/unit_test_launcher.h" | 8 #include "base/test/launcher/unit_test_launcher.h" |
| 9 #include "base/test/test_suite.h" | 9 #include "base/test/test_suite.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 12 #include "ui/base/ui_base_paths.h" | 12 #include "ui/base/ui_base_paths.h" |
| 13 #include "ui/gfx/gfx_paths.h" | 13 #include "ui/gfx/gfx_paths.h" |
| 14 | 14 |
| 15 #if defined(OS_ANDROID) | 15 #if defined(OS_ANDROID) |
| 16 #include "base/android/jni_android.h" | 16 #include "base/android/jni_android.h" |
| 17 #include "ui/base/android/ui_base_jni_registrar.h" | 17 #include "ui/base/android/ui_base_jni_registrar.h" |
| 18 #include "ui/gfx/android/gfx_jni_registrar.h" | 18 #include "ui/gfx/android/gfx_jni_registrar.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 #if defined(OS_MACOSX) && !defined(OS_IOS) | 21 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 22 #include "base/mac/bundle_locations.h" | 22 #include "base/mac/bundle_locations.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 #if defined(OS_WIN) |
| 26 #include "ui/gfx/win/dpi.h" |
| 27 #endif |
| 28 |
| 25 namespace { | 29 namespace { |
| 26 | 30 |
| 27 class UIBaseTestSuite : public base::TestSuite { | 31 class UIBaseTestSuite : public base::TestSuite { |
| 28 public: | 32 public: |
| 29 UIBaseTestSuite(int argc, char** argv); | 33 UIBaseTestSuite(int argc, char** argv); |
| 30 | 34 |
| 31 protected: | 35 protected: |
| 32 // base::TestSuite: | 36 // base::TestSuite: |
| 33 virtual void Initialize() OVERRIDE; | 37 virtual void Initialize() OVERRIDE; |
| 34 virtual void Shutdown() OVERRIDE; | 38 virtual void Shutdown() OVERRIDE; |
| 35 | 39 |
| 36 private: | 40 private: |
| 37 DISALLOW_COPY_AND_ASSIGN(UIBaseTestSuite); | 41 DISALLOW_COPY_AND_ASSIGN(UIBaseTestSuite); |
| 38 }; | 42 }; |
| 39 | 43 |
| 40 UIBaseTestSuite::UIBaseTestSuite(int argc, char** argv) | 44 UIBaseTestSuite::UIBaseTestSuite(int argc, char** argv) |
| 41 : base::TestSuite(argc, argv) {} | 45 : base::TestSuite(argc, argv) {} |
| 42 | 46 |
| 43 void UIBaseTestSuite::Initialize() { | 47 void UIBaseTestSuite::Initialize() { |
| 44 base::TestSuite::Initialize(); | 48 base::TestSuite::Initialize(); |
| 45 | 49 |
| 50 #if defined(OS_WIN) |
| 51 gfx::ForceHighDPISupportForTesting(1.0); |
| 52 #endif |
| 53 |
| 46 #if defined(OS_ANDROID) | 54 #if defined(OS_ANDROID) |
| 47 // Register JNI bindings for android. | 55 // Register JNI bindings for android. |
| 48 gfx::android::RegisterJni(base::android::AttachCurrentThread()); | 56 gfx::android::RegisterJni(base::android::AttachCurrentThread()); |
| 49 ui::android::RegisterJni(base::android::AttachCurrentThread()); | 57 ui::android::RegisterJni(base::android::AttachCurrentThread()); |
| 50 #endif | 58 #endif |
| 51 | 59 |
| 52 ui::RegisterPathProvider(); | 60 ui::RegisterPathProvider(); |
| 53 gfx::RegisterPathProvider(); | 61 gfx::RegisterPathProvider(); |
| 54 | 62 |
| 55 base::FilePath exe_path; | 63 base::FilePath exe_path; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } // namespace | 100 } // namespace |
| 93 | 101 |
| 94 int main(int argc, char** argv) { | 102 int main(int argc, char** argv) { |
| 95 UIBaseTestSuite test_suite(argc, argv); | 103 UIBaseTestSuite test_suite(argc, argv); |
| 96 | 104 |
| 97 return base::LaunchUnitTests(argc, | 105 return base::LaunchUnitTests(argc, |
| 98 argv, | 106 argv, |
| 99 base::Bind(&UIBaseTestSuite::Run, | 107 base::Bind(&UIBaseTestSuite::Run, |
| 100 base::Unretained(&test_suite))); | 108 base::Unretained(&test_suite))); |
| 101 } | 109 } |
| OLD | NEW |