blob: 2cfb258e0db856b98540c2173df5f91bab56273f [file] [log] [blame]
[email protected]dca629c2012-03-22 03:40:381// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]d82abb92010-05-04 17:21:322// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
[email protected]4d9bdfaf2008-08-26 05:53:574
[email protected]567d30e2012-07-13 21:48:295#include "base/metrics/statistics_recorder.h"
[email protected]ee881f402013-10-04 21:51:506#include "base/test/launcher/unit_test_launcher.h"
[email protected]331c2512010-05-04 18:15:567#include "build/build_config.h"
[email protected]4b559b4d2011-04-14 17:37:148#include "crypto/nss_util.h"
[email protected]636b8252011-04-08 19:56:549#include "net/socket/client_socket_pool_base.h"
[email protected]a4965c882012-06-13 20:19:4410#include "net/socket/ssl_server_socket.h"
[email protected]8753a122011-10-16 08:05:0811#include "net/spdy/spdy_session.h"
[email protected]8efa4ba42013-03-18 21:14:1412#include "net/test/net_test_suite.h"
[email protected]636b8252011-04-08 19:56:5413
[email protected]6e4cc8f2012-06-27 02:21:0214#if defined(OS_ANDROID)
15#include "base/android/jni_android.h"
[email protected]847aaab82014-05-07 14:05:4616#include "base/android/jni_registrar.h"
[email protected]f12d1e12013-11-20 07:04:5517#include "base/test/test_file_util.h"
aberentec894a52015-07-09 14:45:5318#include "base/test/test_ui_thread_android.h"
19#include "net/android/dummy_spnego_authenticator.h"
[email protected]6e4cc8f2012-06-27 02:21:0220#include "net/android/net_jni_registrar.h"
asankaca611862015-09-29 20:26:3221#endif
22
23#if defined(USE_ICU_ALTERNATIVES_ON_ANDROID)
[email protected]847aaab82014-05-07 14:05:4624#include "url/android/url_jni_registrar.h"
[email protected]6e4cc8f2012-06-27 02:21:0225#endif
26
amistry7e6ebfdc82015-02-13 04:19:1127#if !defined(OS_ANDROID) && !defined(OS_IOS)
rockotc637caf9b2016-02-10 09:57:0828#include "mojo/edk/embedder/embedder.h"
amistry7e6ebfdc82015-02-13 04:19:1129#endif
30
[email protected]636b8252011-04-08 19:56:5431using net::internal::ClientSocketPoolBaseHelper;
[email protected]8753a122011-10-16 08:05:0832using net::SpdySession;
[email protected]4d9bdfaf2008-08-26 05:53:5733
34int main(int argc, char** argv) {
[email protected]26a64592009-12-15 08:04:4035 // Record histograms, so we can get histograms data in tests.
[email protected]fce44c12012-07-19 19:17:3236 base::StatisticsRecorder::Initialize();
[email protected]6e4cc8f2012-06-27 02:21:0237
38#if defined(OS_ANDROID)
[email protected]847aaab82014-05-07 14:05:4639 const base::android::RegistrationMethod kNetTestRegisteredMethods[] = {
asankaca611862015-09-29 20:26:3240 {"DummySpnegoAuthenticator",
41 net::android::DummySpnegoAuthenticator::RegisterJni},
42 {"NetAndroid", net::android::RegisterJni},
43 {"TestFileUtil", base::RegisterContentUriTestUtils},
44 {"TestUiThreadAndroid", base::RegisterTestUiThreadAndroid},
45#if defined(USE_ICU_ALTERNATIVES_ON_ANDROID)
46 {"UrlAndroid", url::android::RegisterJni},
47#endif
[email protected]847aaab82014-05-07 14:05:4648 };
49
[email protected]6e4cc8f2012-06-27 02:21:0250 // Register JNI bindings for android. Doing it early as the test suite setup
51 // may initiate a call to Java.
[email protected]847aaab82014-05-07 14:05:4652 base::android::RegisterNativeMethods(
53 base::android::AttachCurrentThread(),
54 kNetTestRegisteredMethods,
55 arraysize(kNetTestRegisteredMethods));
[email protected]6e4cc8f2012-06-27 02:21:0256#endif
57
[email protected]47c196b2009-12-02 20:04:2758 NetTestSuite test_suite(argc, argv);
[email protected]636b8252011-04-08 19:56:5459 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false);
[email protected]d82abb92010-05-04 17:21:3260
davidbend5587412014-10-30 21:44:1661#if defined(OS_WIN) && !defined(USE_OPENSSL)
[email protected]d82abb92010-05-04 17:21:3262 // We want to be sure to init NSPR on the main thread.
[email protected]4b559b4d2011-04-14 17:37:1463 crypto::EnsureNSPRInit();
[email protected]d82abb92010-05-04 17:21:3264#endif
65
[email protected]a4965c882012-06-13 20:19:4466 // Enable support for SSL server sockets, which must be done while
67 // single-threaded.
68 net::EnableSSLServerSockets();
69
amistry7e6ebfdc82015-02-13 04:19:1170#if !defined(OS_ANDROID) && !defined(OS_IOS)
rockotc637caf9b2016-02-10 09:57:0871 mojo::edk::Init();
amistry7e6ebfdc82015-02-13 04:19:1172#endif
73
[email protected]d85fe1e2013-09-05 18:20:3674 return base::LaunchUnitTests(
75 argc, argv, base::Bind(&NetTestSuite::Run,
76 base::Unretained(&test_suite)));
[email protected]4d9bdfaf2008-08-26 05:53:5777}