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"
23 #include "net/proxy/proxy_resolver_v8.h"
26 using net::internal::ClientSocketPoolBaseHelper
;
27 using net::SpdySession
;
29 int main(int argc
, char** argv
) {
30 // Record histograms, so we can get histograms data in tests.
31 base::StatisticsRecorder::Initialize();
33 #if defined(OS_ANDROID)
34 const base::android::RegistrationMethod kNetTestRegisteredMethods
[] = {
35 {"NetAndroid", net::android::RegisterJni
},
36 {"TestFileUtil", file_util::RegisterContentUriTestUtils
},
37 {"UrlAndroid", url::android::RegisterJni
},
40 // Register JNI bindings for android. Doing it early as the test suite setup
41 // may initiate a call to Java.
42 base::android::RegisterNativeMethods(
43 base::android::AttachCurrentThread(),
44 kNetTestRegisteredMethods
,
45 arraysize(kNetTestRegisteredMethods
));
48 NetTestSuite
test_suite(argc
, argv
);
49 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false);
52 // We want to be sure to init NSPR on the main thread.
53 crypto::EnsureNSPRInit();
56 // Enable support for SSL server sockets, which must be done while
58 net::EnableSSLServerSockets();
61 net::ProxyResolverV8::EnsureIsolateCreated();
64 return base::LaunchUnitTests(
65 argc
, argv
, base::Bind(&NetTestSuite::Run
,
66 base::Unretained(&test_suite
)));