Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/metrics/statistics_recorder.h" | 5 #include "base/metrics/statistics_recorder.h" |
| 6 #include "base/test/launcher/unit_test_launcher.h" | 6 #include "base/test/launcher/unit_test_launcher.h" |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "crypto/nss_util.h" | 8 #include "crypto/nss_util.h" |
| 9 #include "net/socket/client_socket_pool_base.h" | 9 #include "net/socket/client_socket_pool_base.h" |
| 10 #include "net/socket/ssl_server_socket.h" | 10 #include "net/socket/ssl_server_socket.h" |
| 11 #include "net/spdy/spdy_session.h" | 11 #include "net/spdy/spdy_session.h" |
| 12 #include "net/test/net_test_suite.h" | 12 #include "net/test/net_test_suite.h" |
| 13 | 13 |
| 14 #if defined(OS_ANDROID) | 14 #if defined(OS_ANDROID) |
| 15 #include "base/android/jni_android.h" | 15 #include "base/android/jni_android.h" |
| 16 #include "base/android/jni_registrar.h" | |
| 16 #include "base/test/test_file_util.h" | 17 #include "base/test/test_file_util.h" |
| 17 #include "net/android/net_jni_registrar.h" | 18 #include "net/android/net_jni_registrar.h" |
| 19 #include "url/android/url_jni_registrar.h" | |
| 18 #endif | 20 #endif |
| 19 | 21 |
| 20 #if !defined(OS_IOS) | 22 #if !defined(OS_IOS) |
| 21 #include "net/proxy/proxy_resolver_v8.h" | 23 #include "net/proxy/proxy_resolver_v8.h" |
| 22 #endif | 24 #endif |
| 23 | 25 |
| 24 using net::internal::ClientSocketPoolBaseHelper; | 26 using net::internal::ClientSocketPoolBaseHelper; |
| 25 using net::SpdySession; | 27 using net::SpdySession; |
| 26 | 28 |
| 27 int main(int argc, char** argv) { | 29 int main(int argc, char** argv) { |
| 28 // Record histograms, so we can get histograms data in tests. | 30 // Record histograms, so we can get histograms data in tests. |
| 29 base::StatisticsRecorder::Initialize(); | 31 base::StatisticsRecorder::Initialize(); |
| 30 | 32 |
| 31 #if defined(OS_ANDROID) | 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}, | |
|
mef
2014/05/01 19:45:15
Hmm, does it mean that chrome would also use platf
mmenke
2014/05/01 21:01:33
If you look at url::android::RegisterJni, it only
mef
2014/05/02 15:10:48
Sounds good, I guess it is cleaner not to have an
| |
| 38 }; | |
| 39 | |
| 32 // Register JNI bindings for android. Doing it early as the test suite setup | 40 // Register JNI bindings for android. Doing it early as the test suite setup |
| 33 // may initiate a call to Java. | 41 // may initiate a call to Java. |
| 34 net::android::RegisterJni(base::android::AttachCurrentThread()); | 42 base::android::RegisterNativeMethods( |
| 35 file_util::RegisterContentUriTestUtils(base::android::AttachCurrentThread()); | 43 base::android::AttachCurrentThread(), |
| 44 kNetTestRegisteredMethods, | |
| 45 arraysize(kNetTestRegisteredMethods)); | |
| 36 #endif | 46 #endif |
| 37 | 47 |
| 38 NetTestSuite test_suite(argc, argv); | 48 NetTestSuite test_suite(argc, argv); |
| 39 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false); | 49 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false); |
| 40 | 50 |
| 41 #if defined(OS_WIN) | 51 #if defined(OS_WIN) |
| 42 // We want to be sure to init NSPR on the main thread. | 52 // We want to be sure to init NSPR on the main thread. |
| 43 crypto::EnsureNSPRInit(); | 53 crypto::EnsureNSPRInit(); |
| 44 #endif | 54 #endif |
| 45 | 55 |
| 46 // Enable support for SSL server sockets, which must be done while | 56 // Enable support for SSL server sockets, which must be done while |
| 47 // single-threaded. | 57 // single-threaded. |
| 48 net::EnableSSLServerSockets(); | 58 net::EnableSSLServerSockets(); |
| 49 | 59 |
| 50 #if !defined(OS_IOS) | 60 #if !defined(OS_IOS) |
| 51 net::ProxyResolverV8::EnsureIsolateCreated(); | 61 net::ProxyResolverV8::EnsureIsolateCreated(); |
| 52 #endif | 62 #endif |
| 53 | 63 |
| 54 return base::LaunchUnitTests( | 64 return base::LaunchUnitTests( |
| 55 argc, argv, base::Bind(&NetTestSuite::Run, | 65 argc, argv, base::Bind(&NetTestSuite::Run, |
| 56 base::Unretained(&test_suite))); | 66 base::Unretained(&test_suite))); |
| 57 } | 67 } |
| OLD | NEW |