| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/metrics/statistics_recorder.h" | |
| 6 #include "base/test/launcher/unit_test_launcher.h" | |
| 7 #include "build/build_config.h" | |
| 8 #include "crypto/nss_util.h" | |
| 9 #include "net/socket/client_socket_pool_base.h" | |
| 10 #include "net/socket/ssl_server_socket.h" | |
| 11 #include "net/spdy/spdy_session.h" | |
| 12 #include "net/test/net_test_suite.h" | |
| 13 | |
| 14 #if defined(OS_ANDROID) | |
| 15 #include "base/android/jni_android.h" | |
| 16 #include "base/android/jni_registrar.h" | |
| 17 #include "base/test/test_file_util.h" | |
| 18 #include "net/android/net_jni_registrar.h" | |
| 19 #include "url/android/url_jni_registrar.h" | |
| 20 #endif | |
| 21 | |
| 22 #if !defined(OS_IOS) | |
| 23 #include "net/proxy/proxy_resolver_v8.h" | |
| 24 #endif | |
| 25 | |
| 26 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | |
| 27 #include "gin/public/isolate_holder.h" | |
| 28 #endif | |
| 29 | |
| 30 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
| 31 #include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h" | |
| 32 #endif | |
| 33 | |
| 34 using net::internal::ClientSocketPoolBaseHelper; | |
| 35 using net::SpdySession; | |
| 36 | |
| 37 int main(int argc, char** argv) { | |
| 38 // Record histograms, so we can get histograms data in tests. | |
| 39 base::StatisticsRecorder::Initialize(); | |
| 40 | |
| 41 #if defined(OS_ANDROID) | |
| 42 const base::android::RegistrationMethod kNetTestRegisteredMethods[] = { | |
| 43 {"NetAndroid", net::android::RegisterJni}, | |
| 44 {"TestFileUtil", base::RegisterContentUriTestUtils}, | |
| 45 {"UrlAndroid", url::android::RegisterJni}, | |
| 46 }; | |
| 47 | |
| 48 // Register JNI bindings for android. Doing it early as the test suite setup | |
| 49 // may initiate a call to Java. | |
| 50 base::android::RegisterNativeMethods( | |
| 51 base::android::AttachCurrentThread(), | |
| 52 kNetTestRegisteredMethods, | |
| 53 arraysize(kNetTestRegisteredMethods)); | |
| 54 #endif | |
| 55 | |
| 56 NetTestSuite test_suite(argc, argv); | |
| 57 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false); | |
| 58 | |
| 59 #if defined(OS_WIN) && !defined(USE_OPENSSL) | |
| 60 // We want to be sure to init NSPR on the main thread. | |
| 61 crypto::EnsureNSPRInit(); | |
| 62 #endif | |
| 63 | |
| 64 // Enable support for SSL server sockets, which must be done while | |
| 65 // single-threaded. | |
| 66 net::EnableSSLServerSockets(); | |
| 67 | |
| 68 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | |
| 69 gin::IsolateHolder::LoadV8Snapshot(); | |
| 70 #endif | |
| 71 | |
| 72 #if !defined(OS_IOS) | |
| 73 net::ProxyResolverV8::EnsureIsolateCreated(); | |
| 74 #endif | |
| 75 | |
| 76 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
| 77 mojo::embedder::test::InitWithSimplePlatformSupport(); | |
| 78 #endif | |
| 79 | |
| 80 return base::LaunchUnitTests( | |
| 81 argc, argv, base::Bind(&NetTestSuite::Run, | |
| 82 base::Unretained(&test_suite))); | |
| 83 } | |
| OLD | NEW |