| 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/metrics/statistics_recorder.h" | 5 #include "base/metrics/statistics_recorder.h" |
| 6 #include "base/test/launcher/unit_test_launcher.h" | 6 #include "base/test/launcher/unit_test_launcher.h" |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "crypto/nss_util.h" | 8 #include "crypto/nss_util.h" |
| 9 #include "net/socket/client_socket_pool_base.h" | 9 #include "net/socket/client_socket_pool_base.h" |
| 10 #include "net/socket/ssl_server_socket.h" | 10 #include "net/socket/ssl_server_socket.h" |
| 11 #include "net/spdy/spdy_session.h" | 11 #include "net/spdy/spdy_session.h" |
| 12 #include "net/test/net_test_suite.h" | 12 #include "net/test/net_test_suite.h" |
| 13 #include "url/url_features.h" |
| 13 | 14 |
| 14 #if defined(OS_ANDROID) | 15 #if defined(OS_ANDROID) |
| 15 #include "base/android/jni_android.h" | 16 #include "base/android/jni_android.h" |
| 16 #include "base/android/jni_registrar.h" | 17 #include "base/android/jni_registrar.h" |
| 17 #include "base/test/test_file_util.h" | 18 #include "base/test/test_file_util.h" |
| 18 #include "base/test/test_ui_thread_android.h" | 19 #include "base/test/test_ui_thread_android.h" |
| 19 #include "net/android/dummy_spnego_authenticator.h" | 20 #include "net/android/dummy_spnego_authenticator.h" |
| 20 #include "net/android/net_jni_registrar.h" | 21 #include "net/android/net_jni_registrar.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 #if defined(USE_ICU_ALTERNATIVES_ON_ANDROID) | 24 #if BUILDFLAG(USE_PLATFORM_ICU_ALTERNATIVES) |
| 24 #include "url/android/url_jni_registrar.h" // nogncheck | 25 #include "url/android/url_jni_registrar.h" // nogncheck |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 28 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 28 #include "mojo/edk/embedder/embedder.h" // nogncheck | 29 #include "mojo/edk/embedder/embedder.h" // nogncheck |
| 29 #endif | 30 #endif |
| 30 | 31 |
| 31 using net::internal::ClientSocketPoolBaseHelper; | 32 using net::internal::ClientSocketPoolBaseHelper; |
| 32 using net::SpdySession; | 33 using net::SpdySession; |
| 33 | 34 |
| 34 int main(int argc, char** argv) { | 35 int main(int argc, char** argv) { |
| 35 // Record histograms, so we can get histograms data in tests. | 36 // Record histograms, so we can get histograms data in tests. |
| 36 base::StatisticsRecorder::Initialize(); | 37 base::StatisticsRecorder::Initialize(); |
| 37 | 38 |
| 38 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
| 39 const base::android::RegistrationMethod kNetTestRegisteredMethods[] = { | 40 const base::android::RegistrationMethod kNetTestRegisteredMethods[] = { |
| 40 {"DummySpnegoAuthenticator", | 41 {"DummySpnegoAuthenticator", |
| 41 net::android::DummySpnegoAuthenticator::RegisterJni}, | 42 net::android::DummySpnegoAuthenticator::RegisterJni}, |
| 42 {"NetAndroid", net::android::RegisterJni}, | 43 {"NetAndroid", net::android::RegisterJni}, |
| 43 {"TestFileUtil", base::RegisterContentUriTestUtils}, | 44 {"TestFileUtil", base::RegisterContentUriTestUtils}, |
| 44 {"TestUiThreadAndroid", base::RegisterTestUiThreadAndroid}, | 45 {"TestUiThreadAndroid", base::RegisterTestUiThreadAndroid}, |
| 45 #if defined(USE_ICU_ALTERNATIVES_ON_ANDROID) | 46 #if BUILDFLAG(USE_PLATFORM_ICU_ALTERNATIVES) |
| 46 {"UrlAndroid", url::android::RegisterJni}, | 47 {"UrlAndroid", url::android::RegisterJni}, |
| 47 #endif | 48 #endif |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 // Register JNI bindings for android. Doing it early as the test suite setup | 51 // Register JNI bindings for android. Doing it early as the test suite setup |
| 51 // may initiate a call to Java. | 52 // may initiate a call to Java. |
| 52 base::android::RegisterNativeMethods( | 53 base::android::RegisterNativeMethods( |
| 53 base::android::AttachCurrentThread(), | 54 base::android::AttachCurrentThread(), |
| 54 kNetTestRegisteredMethods, | 55 kNetTestRegisteredMethods, |
| 55 arraysize(kNetTestRegisteredMethods)); | 56 arraysize(kNetTestRegisteredMethods)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 68 net::EnableSSLServerSockets(); | 69 net::EnableSSLServerSockets(); |
| 69 | 70 |
| 70 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 71 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 71 mojo::edk::Init(); | 72 mojo::edk::Init(); |
| 72 #endif | 73 #endif |
| 73 | 74 |
| 74 return base::LaunchUnitTests( | 75 return base::LaunchUnitTests( |
| 75 argc, argv, base::Bind(&NetTestSuite::Run, | 76 argc, argv, base::Bind(&NetTestSuite::Run, |
| 76 base::Unretained(&test_suite))); | 77 base::Unretained(&test_suite))); |
| 77 } | 78 } |
| OLD | NEW |