| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/metrics/statistics_recorder.h" | 8 #include "base/metrics/statistics_recorder.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 "components/content_settings/core/common/content_settings_pattern.h" | 12 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.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 "url/url_util.h" | 16 #include "url/url_util.h" |
| 17 | 17 |
| 18 #if !defined(OS_IOS) | 18 #if !defined(OS_IOS) |
| 19 #include "content/public/test/test_content_client_initializer.h" | 19 #include "content/public/test/test_content_client_initializer.h" |
| 20 #include "ui/gl/test/gl_surface_test_support.h" | 20 #include "ui/gl/test/gl_surface_test_support.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 #if defined(OS_ANDROID) | 23 #if defined(OS_ANDROID) |
| 24 #include "base/android/jni_android.h" | 24 #include "base/android/jni_android.h" |
| 25 #include "components/invalidation/impl/android/component_jni_registrar.h" | 25 #include "components/invalidation/impl/android/component_jni_registrar.h" |
| 26 #include "components/policy/core/browser/android/component_jni_registrar.h" | 26 #include "components/policy/core/browser/android/component_jni_registrar.h" |
| 27 #include "components/safe_json/android/component_jni_registrar.h" | 27 #include "components/safe_json/android/component_jni_registrar.h" |
| 28 #include "components/signin/core/browser/android/component_jni_registrar.h" | 28 #include "components/signin/core/browser/android/component_jni_registrar.h" |
| 29 #include "content/browser/android/browser_jni_registrar.h" | |
| 30 #include "net/android/net_jni_registrar.h" | |
| 31 #include "ui/base/android/ui_base_jni_registrar.h" | 29 #include "ui/base/android/ui_base_jni_registrar.h" |
| 32 #include "ui/gfx/android/gfx_jni_registrar.h" | 30 #include "ui/gfx/android/gfx_jni_registrar.h" |
| 33 #endif | 31 #endif |
| 34 | 32 |
| 35 namespace { | 33 namespace { |
| 36 | 34 |
| 37 class ComponentsTestSuite : public base::TestSuite { | 35 class ComponentsTestSuite : public base::TestSuite { |
| 38 public: | 36 public: |
| 39 ComponentsTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} | 37 ComponentsTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} |
| 40 | 38 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 52 #endif | 50 #endif |
| 53 #if defined(OS_ANDROID) | 51 #if defined(OS_ANDROID) |
| 54 // Register JNI bindings for android. | 52 // Register JNI bindings for android. |
| 55 JNIEnv* env = base::android::AttachCurrentThread(); | 53 JNIEnv* env = base::android::AttachCurrentThread(); |
| 56 ASSERT_TRUE(gfx::android::RegisterJni(env)); | 54 ASSERT_TRUE(gfx::android::RegisterJni(env)); |
| 57 ASSERT_TRUE(ui::android::RegisterJni(env)); | 55 ASSERT_TRUE(ui::android::RegisterJni(env)); |
| 58 ASSERT_TRUE(invalidation::android::RegisterInvalidationJni(env)); | 56 ASSERT_TRUE(invalidation::android::RegisterInvalidationJni(env)); |
| 59 ASSERT_TRUE(policy::android::RegisterPolicy(env)); | 57 ASSERT_TRUE(policy::android::RegisterPolicy(env)); |
| 60 ASSERT_TRUE(safe_json::android::RegisterSafeJsonJni(env)); | 58 ASSERT_TRUE(safe_json::android::RegisterSafeJsonJni(env)); |
| 61 ASSERT_TRUE(signin::android::RegisterSigninJni(env)); | 59 ASSERT_TRUE(signin::android::RegisterSigninJni(env)); |
| 62 ASSERT_TRUE(net::android::RegisterJni(env)); | |
| 63 ASSERT_TRUE(content::android::RegisterBrowserJni(env)); | |
| 64 #endif | 60 #endif |
| 65 | 61 |
| 66 ui::RegisterPathProvider(); | 62 ui::RegisterPathProvider(); |
| 67 | 63 |
| 68 base::FilePath pak_path; | 64 base::FilePath pak_path; |
| 69 #if defined(OS_ANDROID) | 65 #if defined(OS_ANDROID) |
| 70 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path); | 66 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path); |
| 71 #else | 67 #else |
| 72 PathService::Get(base::DIR_MODULE, &pak_path); | 68 PathService::Get(base::DIR_MODULE, &pak_path); |
| 73 #endif | 69 #endif |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // The listener will set up common test environment for all components unit | 130 // The listener will set up common test environment for all components unit |
| 135 // tests. | 131 // tests. |
| 136 testing::TestEventListeners& listeners = | 132 testing::TestEventListeners& listeners = |
| 137 testing::UnitTest::GetInstance()->listeners(); | 133 testing::UnitTest::GetInstance()->listeners(); |
| 138 listeners.Append(new ComponentsUnitTestEventListener()); | 134 listeners.Append(new ComponentsUnitTestEventListener()); |
| 139 | 135 |
| 140 return base::LaunchUnitTests( | 136 return base::LaunchUnitTests( |
| 141 argc, argv, base::Bind(&base::TestSuite::Run, | 137 argc, argv, base::Bind(&base::TestSuite::Run, |
| 142 base::Unretained(&test_suite))); | 138 base::Unretained(&test_suite))); |
| 143 } | 139 } |
| OLD | NEW |