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

Unified 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 Helen's comments Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/test/cronet_test_util.h
diff --git a/components/cronet/android/test/cronet_test_util.h b/components/cronet/android/test/cronet_test_util.h
index 5952edba2f703e69ea7d727e1221ecaeb6e47844..d21bcccf59aa0e00c6cc5cedb109c2b2599edbd4 100644
--- a/components/cronet/android/test/cronet_test_util.h
+++ b/components/cronet/android/test/cronet_test_util.h
@@ -6,10 +6,44 @@
#define COMPONENTS_CRONET_ANDROID_TEST_CRONET_TEST_UTIL_H_
#include <jni.h>
+#include "base/android/jni_android.h"
+#include "base/memory/ref_counted.h"
+#include "base/single_thread_task_runner.h"
+
+namespace net {
+class URLRequest;
+class URLRequestContext;
+} // namespace net
namespace cronet {
-bool RegisterCronetTestUtil(JNIEnv* env);
+// Various test utility functions for testing Cronet.
+class TestUtil {
xunjieli 2016/10/27 14:49:42 I guess it doesn't make sense for this to have a c
pauljensen 2016/10/28 15:24:42 I've gone one step further and used DISALLOW_IMPLI
+ public:
+ // CronetURLRequestContextAdapter manipulation:
+
+ // Returns SingleThreadTaskRunner for the network thread of the context
+ // adapter.
+ static scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(
+ jlong jcontext_adapter);
+ // Returns underlying URLRequestContext.
+ static net::URLRequestContext* GetURLRequestContext(jlong jcontext_adapter);
+ // Run |task| after URLRequestContext is initialized.
+ static void RunAfterContextInit(jlong jcontext_adapter,
+ const base::Closure& task);
+
+ // CronetURLRequestAdapter manipulation:
+
+ // Returns underlying URLRequest.
+ static net::URLRequest* GetURLRequest(jlong jrequest_adapter);
+
+ // Register JNI.
+ static bool Register(JNIEnv* env);
+
+ private:
+ static void RunAfterContextInitOnNetworkThread(jlong jcontext_adapter,
xunjieli 2016/10/27 14:49:42 The style guide encourages making this file local,
pauljensen 2016/10/28 15:24:42 This function needs to be a member of TestUtil bec
+ const base::Closure& task);
+};
} // namespace cronet

Powered by Google App Engine
This is Rietveld 408576698