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 #include "url/url_features.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 "base/android/jni_registrar.h" | 17 #include "base/android/jni_registrar.h" |
18 #include "base/test/test_file_util.h" | |
19 #include "base/test/test_ui_thread_android.h" | |
20 #include "net/android/dummy_spnego_authenticator.h" | 18 #include "net/android/dummy_spnego_authenticator.h" |
21 #include "net/android/net_jni_registrar.h" | 19 #include "net/android/net_jni_registrar.h" |
22 #if BUILDFLAG(USE_PLATFORM_ICU_ALTERNATIVES) | 20 #if BUILDFLAG(USE_PLATFORM_ICU_ALTERNATIVES) |
23 #include "url/android/url_jni_registrar.h" // nogncheck | 21 #include "url/android/url_jni_registrar.h" // nogncheck |
24 #endif | 22 #endif |
25 | 23 |
26 #endif | 24 #endif |
27 | 25 |
28 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 26 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
29 #include "mojo/edk/embedder/embedder.h" // nogncheck | 27 #include "mojo/edk/embedder/embedder.h" // nogncheck |
30 #endif | 28 #endif |
31 | 29 |
32 using net::internal::ClientSocketPoolBaseHelper; | 30 using net::internal::ClientSocketPoolBaseHelper; |
33 using net::SpdySession; | 31 using net::SpdySession; |
34 | 32 |
35 int main(int argc, char** argv) { | 33 int main(int argc, char** argv) { |
36 // Record histograms, so we can get histograms data in tests. | 34 // Record histograms, so we can get histograms data in tests. |
37 base::StatisticsRecorder::Initialize(); | 35 base::StatisticsRecorder::Initialize(); |
38 | 36 |
39 #if defined(OS_ANDROID) | 37 #if defined(OS_ANDROID) |
40 const base::android::RegistrationMethod kNetTestRegisteredMethods[] = { | 38 const base::android::RegistrationMethod kNetTestRegisteredMethods[] = { |
41 {"DummySpnegoAuthenticator", | 39 {"DummySpnegoAuthenticator", |
42 net::android::DummySpnegoAuthenticator::RegisterJni}, | 40 net::android::DummySpnegoAuthenticator::RegisterJni}, |
43 {"NetAndroid", net::android::RegisterJni}, | 41 {"NetAndroid", net::android::RegisterJni}, |
44 {"TestFileUtil", base::RegisterContentUriTestUtils}, | |
45 {"TestUiThreadAndroid", base::RegisterTestUiThreadAndroid}, | |
46 #if BUILDFLAG(USE_PLATFORM_ICU_ALTERNATIVES) | 42 #if BUILDFLAG(USE_PLATFORM_ICU_ALTERNATIVES) |
47 {"UrlAndroid", url::android::RegisterJni}, | 43 {"UrlAndroid", url::android::RegisterJni}, |
48 #endif | 44 #endif |
49 }; | 45 }; |
50 | 46 |
51 // Register JNI bindings for android. Doing it early as the test suite setup | 47 // Register JNI bindings for android. Doing it early as the test suite setup |
52 // may initiate a call to Java. | 48 // may initiate a call to Java. |
53 base::android::RegisterNativeMethods( | 49 base::android::RegisterNativeMethods( |
54 base::android::AttachCurrentThread(), | 50 base::android::AttachCurrentThread(), |
55 kNetTestRegisteredMethods, | 51 kNetTestRegisteredMethods, |
56 arraysize(kNetTestRegisteredMethods)); | 52 arraysize(kNetTestRegisteredMethods)); |
57 #endif | 53 #endif |
58 | 54 |
59 NetTestSuite test_suite(argc, argv); | 55 NetTestSuite test_suite(argc, argv); |
60 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false); | 56 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false); |
61 | 57 |
62 // Enable support for SSL server sockets, which must be done while | 58 // Enable support for SSL server sockets, which must be done while |
63 // single-threaded. | 59 // single-threaded. |
64 net::EnableSSLServerSockets(); | 60 net::EnableSSLServerSockets(); |
65 | 61 |
66 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 62 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
67 mojo::edk::Init(); | 63 mojo::edk::Init(); |
68 #endif | 64 #endif |
69 | 65 |
70 return base::LaunchUnitTests( | 66 return base::LaunchUnitTests( |
71 argc, argv, base::Bind(&NetTestSuite::Run, | 67 argc, argv, base::Bind(&NetTestSuite::Run, |
72 base::Unretained(&test_suite))); | 68 base::Unretained(&test_suite))); |
73 } | 69 } |
OLD | NEW |