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