OLD | NEW |
---|---|
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/memory/ref_counted.h" | |
11 #include "base/single_thread_task_runner.h" | |
12 | |
13 namespace net { | |
14 class URLRequest; | |
15 class URLRequestContext; | |
16 } // namespace net | |
9 | 17 |
10 namespace cronet { | 18 namespace cronet { |
11 | 19 |
12 bool RegisterCronetTestUtil(JNIEnv* env); | 20 // Various test utility functions for testing Cronet. |
21 class TestUtil { | |
22 public: | |
23 // CronetURLRequestContextAdapter manipulation: | |
24 | |
25 // Returns SingleThreadTaskRunner for the network thread of the context | |
26 // adapter. | |
27 static scoped_refptr<base::SingleThreadTaskRunner> getTaskRunner( | |
xunjieli
2016/10/25 17:51:38
nit: CamelCase here and below.
pauljensen
2016/10/26 17:55:18
Done.
| |
28 jlong jcontext_adapter); | |
29 // Returns underlying URLRequestContext. | |
30 static net::URLRequestContext* getURLRequestContext(jlong jcontext_adapter); | |
31 // Run |task| after URLRequestContext is initialized. | |
32 static void runAfterContextInit(jlong jcontext_adapter, | |
33 const base::Closure& task); | |
34 | |
35 // CronetURLRequestAdapter manipulation: | |
36 | |
37 // Returns underlying URLRequest. | |
38 static net::URLRequest* getURLRequest(jlong jrequest_adapter); | |
39 | |
40 // Register JNI. | |
41 static bool Register(JNIEnv* env); | |
42 }; | |
13 | 43 |
14 } // namespace cronet | 44 } // namespace cronet |
15 | 45 |
16 #endif // COMPONENTS_CRONET_ANDROID_TEST_CRONET_TEST_UTIL_H_ | 46 #endif // COMPONENTS_CRONET_ANDROID_TEST_CRONET_TEST_UTIL_H_ |
OLD | NEW |