Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: net/base/run_all_unittests.cc

Issue 10668047: Register JNI methods before running unittests on android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "build/build_config.h" 5 #include "build/build_config.h"
6 #include "base/metrics/histogram.h" 6 #include "base/metrics/histogram.h"
7 #include "crypto/nss_util.h" 7 #include "crypto/nss_util.h"
8 #include "net/base/net_test_suite.h" 8 #include "net/base/net_test_suite.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 12
13 #if defined(OS_ANDROID)
14 #include "base/android/jni_android.h"
15 #include "net/android/net_jni_registrar.h"
16 #endif
17
13 using net::internal::ClientSocketPoolBaseHelper; 18 using net::internal::ClientSocketPoolBaseHelper;
14 using net::SpdySession; 19 using net::SpdySession;
15 20
16 int main(int argc, char** argv) { 21 int main(int argc, char** argv) {
17 // Record histograms, so we can get histograms data in tests. 22 // Record histograms, so we can get histograms data in tests.
18 base::StatisticsRecorder recorder; 23 base::StatisticsRecorder recorder;
24
25 #if defined(OS_ANDROID)
26 // Register JNI bindings for android. Doing it early as the test suite setup
27 // may initiate a call to Java.
28 JNIEnv* env = base::android::AttachCurrentThread();
Jay Civelli 2012/06/26 20:17:11 Nit: do you need a local var?
nilesh 2012/06/26 20:33:54 Removed
29 net::android::RegisterJni(env);
30 #endif
31
19 NetTestSuite test_suite(argc, argv); 32 NetTestSuite test_suite(argc, argv);
20 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false); 33 ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false);
21 34
22 #if defined(OS_WIN) 35 #if defined(OS_WIN)
23 // We want to be sure to init NSPR on the main thread. 36 // We want to be sure to init NSPR on the main thread.
24 crypto::EnsureNSPRInit(); 37 crypto::EnsureNSPRInit();
25 #endif 38 #endif
26 39
27 // Enable support for SSL server sockets, which must be done while 40 // Enable support for SSL server sockets, which must be done while
28 // single-threaded. 41 // single-threaded.
29 net::EnableSSLServerSockets(); 42 net::EnableSSLServerSockets();
30 43
31 return test_suite.Run(); 44 return test_suite.Run();
32 } 45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698