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