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

Side by Side Diff: components/cronet/android/test/cronet_test_util.h

Issue 2406273002: [Cronet] Test the libcronet that's shipped, not libcronet_test (Closed)
Patch Set: address two remaining comments Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef COMPONENTS_CRONET_ANDROID_TEST_CRONET_TEST_UTIL_H_ 5 #ifndef COMPONENTS_CRONET_ANDROID_TEST_CRONET_TEST_UTIL_H_
6 #define COMPONENTS_CRONET_ANDROID_TEST_CRONET_TEST_UTIL_H_ 6 #define COMPONENTS_CRONET_ANDROID_TEST_CRONET_TEST_UTIL_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include "base/android/jni_android.h"
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/single_thread_task_runner.h"
13
14 namespace net {
15 class URLRequest;
16 class URLRequestContext;
17 } // namespace net
9 18
10 namespace cronet { 19 namespace cronet {
11 20
12 bool RegisterCronetTestUtil(JNIEnv* env); 21 // Various test utility functions for testing Cronet.
22 // NOTE(pauljensen): This class is friended by Cronet internal implementation
23 // classes to provide access to internals.
24 class TestUtil {
25 public:
26 // CronetURLRequestContextAdapter manipulation:
27
28 // Returns SingleThreadTaskRunner for the network thread of the context
29 // adapter.
30 static scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(
31 jlong jcontext_adapter);
32 // Returns underlying URLRequestContext.
33 static net::URLRequestContext* GetURLRequestContext(jlong jcontext_adapter);
34 // Run |task| after URLRequestContext is initialized.
35 static void RunAfterContextInit(jlong jcontext_adapter,
36 const base::Closure& task);
37
38 // CronetURLRequestAdapter manipulation:
39
40 // Returns underlying URLRequest.
41 static net::URLRequest* GetURLRequest(jlong jrequest_adapter);
42
43 // Register JNI.
44 static bool Register(JNIEnv* env);
45
46 private:
47 static void RunAfterContextInitOnNetworkThread(jlong jcontext_adapter,
48 const base::Closure& task);
49
50 DISALLOW_IMPLICIT_CONSTRUCTORS(TestUtil);
51 };
13 52
14 } // namespace cronet 53 } // namespace cronet
15 54
16 #endif // COMPONENTS_CRONET_ANDROID_TEST_CRONET_TEST_UTIL_H_ 55 #endif // COMPONENTS_CRONET_ANDROID_TEST_CRONET_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698