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 | 13 |
14 #if defined(OS_ANDROID) | 14 #if defined(OS_ANDROID) |
15 #include "base/android/jni_android.h" | 15 #include "base/android/jni_android.h" |
16 #include "base/test/test_file_util.h" | |
17 #include "net/android/net_jni_registrar.h" | 16 #include "net/android/net_jni_registrar.h" |
18 #endif | 17 #endif |
19 | 18 |
20 #if !defined(OS_IOS) | 19 #if !defined(OS_IOS) |
21 #include "net/proxy/proxy_resolver_v8.h" | 20 #include "net/proxy/proxy_resolver_v8.h" |
22 #endif | 21 #endif |
23 | 22 |
24 using net::internal::ClientSocketPoolBaseHelper; | 23 using net::internal::ClientSocketPoolBaseHelper; |
25 using net::SpdySession; | 24 using net::SpdySession; |
26 | 25 |
27 int main(int argc, char** argv) { | 26 int main(int argc, char** argv) { |
28 // Record histograms, so we can get histograms data in tests. | 27 // Record histograms, so we can get histograms data in tests. |
29 base::StatisticsRecorder::Initialize(); | 28 base::StatisticsRecorder::Initialize(); |
30 | 29 |
31 #if defined(OS_ANDROID) | 30 #if defined(OS_ANDROID) |
32 // Register JNI bindings for android. Doing it early as the test suite setup | 31 // Register JNI bindings for android. Doing it early as the test suite setup |
33 // may initiate a call to Java. | 32 // may initiate a call to Java. |
34 net::android::RegisterJni(base::android::AttachCurrentThread()); | 33 net::android::RegisterJni(base::android::AttachCurrentThread()); |
35 file_util::RegisterContentUriTestUtils(base::android::AttachCurrentThread()); | |
36 #endif | 34 #endif |
37 | 35 |
38 NetTestSuite test_suite(argc, argv); | 36 NetTestSuite test_suite(argc, argv); |
39 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false); | 37 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false); |
40 | 38 |
41 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
42 // We want to be sure to init NSPR on the main thread. | 40 // We want to be sure to init NSPR on the main thread. |
43 crypto::EnsureNSPRInit(); | 41 crypto::EnsureNSPRInit(); |
44 #endif | 42 #endif |
45 | 43 |
46 // Enable support for SSL server sockets, which must be done while | 44 // Enable support for SSL server sockets, which must be done while |
47 // single-threaded. | 45 // single-threaded. |
48 net::EnableSSLServerSockets(); | 46 net::EnableSSLServerSockets(); |
49 | 47 |
50 #if !defined(OS_IOS) | 48 #if !defined(OS_IOS) |
51 // This has to be done on the main thread. | 49 // This has to be done on the main thread. |
52 net::ProxyResolverV8::RememberDefaultIsolate(); | 50 net::ProxyResolverV8::RememberDefaultIsolate(); |
53 #endif | 51 #endif |
54 | 52 |
55 return base::LaunchUnitTests( | 53 return base::LaunchUnitTests( |
56 argc, argv, base::Bind(&NetTestSuite::Run, | 54 argc, argv, base::Bind(&NetTestSuite::Run, |
57 base::Unretained(&test_suite))); | 55 base::Unretained(&test_suite))); |
58 } | 56 } |
OLD | NEW |