Delete unused downloads page asset.
[chromium-blink-merge.git] / net / test / run_all_unittests.cc
blob7da799183dc29779b58f6d287b86e6726bec4c57
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 "base/test/test_ui_thread_android.h"
19 #include "net/android/dummy_spnego_authenticator.h"
20 #include "net/android/net_jni_registrar.h"
21 #include "url/android/url_jni_registrar.h"
22 #endif
24 #if !defined(OS_ANDROID) && !defined(OS_IOS)
25 #include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h"
26 #endif
28 using net::internal::ClientSocketPoolBaseHelper;
29 using net::SpdySession;
31 int main(int argc, char** argv) {
32 // Record histograms, so we can get histograms data in tests.
33 base::StatisticsRecorder::Initialize();
35 #if defined(OS_ANDROID)
36 const base::android::RegistrationMethod kNetTestRegisteredMethods[] = {
37 {"DummySpnegoAuthenticator",
38 net::android::DummySpnegoAuthenticator::RegisterJni},
39 {"NetAndroid", net::android::RegisterJni},
40 {"TestFileUtil", base::RegisterContentUriTestUtils},
41 {"TestUiThreadAndroid", base::RegisterTestUiThreadAndroid},
42 {"UrlAndroid", url::android::RegisterJni},
45 // Register JNI bindings for android. Doing it early as the test suite setup
46 // may initiate a call to Java.
47 base::android::RegisterNativeMethods(
48 base::android::AttachCurrentThread(),
49 kNetTestRegisteredMethods,
50 arraysize(kNetTestRegisteredMethods));
51 #endif
53 NetTestSuite test_suite(argc, argv);
54 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false);
56 #if defined(OS_WIN) && !defined(USE_OPENSSL)
57 // We want to be sure to init NSPR on the main thread.
58 crypto::EnsureNSPRInit();
59 #endif
61 // Enable support for SSL server sockets, which must be done while
62 // single-threaded.
63 net::EnableSSLServerSockets();
65 #if !defined(OS_ANDROID) && !defined(OS_IOS)
66 mojo::embedder::test::InitWithSimplePlatformSupport();
67 #endif
69 return base::LaunchUnitTests(
70 argc, argv, base::Bind(&NetTestSuite::Run,
71 base::Unretained(&test_suite)));