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