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