Add include.
[chromium-blink-merge.git] / net / test / run_all_unittests.cc
blob12df717affb477a987dfff98e7c0a569921bb3a0
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.
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"
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
22 #if !defined(OS_IOS)
23 #include "net/proxy/proxy_resolver_v8.h"
24 #endif
26 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
27 #include "gin/public/isolate_holder.h"
28 #endif
30 using net::internal::ClientSocketPoolBaseHelper;
31 using net::SpdySession;
33 int main(int argc, char** argv) {
34 // Record histograms, so we can get histograms data in tests.
35 base::StatisticsRecorder::Initialize();
37 #if defined(OS_ANDROID)
38 const base::android::RegistrationMethod kNetTestRegisteredMethods[] = {
39 {"NetAndroid", net::android::RegisterJni},
40 {"TestFileUtil", base::RegisterContentUriTestUtils},
41 {"UrlAndroid", url::android::RegisterJni},
44 // Register JNI bindings for android. Doing it early as the test suite setup
45 // may initiate a call to Java.
46 base::android::RegisterNativeMethods(
47 base::android::AttachCurrentThread(),
48 kNetTestRegisteredMethods,
49 arraysize(kNetTestRegisteredMethods));
50 #endif
52 NetTestSuite test_suite(argc, argv);
53 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false);
55 #if defined(OS_WIN)
56 // We want to be sure to init NSPR on the main thread.
57 crypto::EnsureNSPRInit();
58 #endif
60 // Enable support for SSL server sockets, which must be done while
61 // single-threaded.
62 net::EnableSSLServerSockets();
64 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
65 gin::IsolateHolder::LoadV8Snapshot();
66 #endif
68 #if !defined(OS_IOS)
69 net::ProxyResolverV8::EnsureIsolateCreated();
70 #endif
72 return base::LaunchUnitTests(
73 argc, argv, base::Bind(&NetTestSuite::Run,
74 base::Unretained(&test_suite)));