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

Unified Diff: components/cronet/android/test/javatests/src/org/chromium/net/CronetTestBase.java

Issue 1412243012: Initial implementation of CronetBidirectionalStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Destroy the native adapter instead of cancel if can't post task to executor. Created 4 years, 11 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/javatests/src/org/chromium/net/CronetTestBase.java
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/CronetTestBase.java b/components/cronet/android/test/javatests/src/org/chromium/net/CronetTestBase.java
index 30c485638c37b013e999e50c1f19e4d44f55ac85..7d6b1348bdace592fdfb0e1bba7564b27d99eabe 100644
--- a/components/cronet/android/test/javatests/src/org/chromium/net/CronetTestBase.java
+++ b/components/cronet/android/test/javatests/src/org/chromium/net/CronetTestBase.java
@@ -134,7 +134,8 @@ public class CronetTestBase extends AndroidTestCase {
try {
Method method = getClass().getMethod(getName(), (Class[]) null);
super.runTest();
- if (!method.isAnnotationPresent(OnlyRunNativeCronet.class)) {
+ if (!getClass().isAnnotationPresent(OnlyRunNativeCronet.class)
pauljensen 2016/01/19 16:03:41 Charles wanted to avoid this as it makes it too ea
mef 2016/01/20 15:37:41 Done. We'll also need another annotation 'RunQuicA
+ && !method.isAnnotationPresent(OnlyRunNativeCronet.class)) {
if (mCronetTestFramework != null) {
mCronetTestFramework.mCronetEngine =
new JavaCronetEngine(UserAgent.from(getContext()));
@@ -175,6 +176,22 @@ public class CronetTestBase extends AndroidTestCase {
NativeTestServer.registerHostResolverProc(urlRequestContextAdapter, isLegacyAPI);
}
+ void assertResponseEquals(UrlResponseInfo expected, UrlResponseInfo actual) {
+ assertEquals(expected.getAllHeaders(), actual.getAllHeaders());
+ assertEquals(expected.getAllHeadersAsList(), actual.getAllHeadersAsList());
+ assertEquals(expected.getHttpStatusCode(), actual.getHttpStatusCode());
+ assertEquals(expected.getHttpStatusText(), actual.getHttpStatusText());
+ assertEquals(expected.getUrlChain(), actual.getUrlChain());
+ assertEquals(expected.getUrl(), actual.getUrl());
+ // Transferred bytes and proxy server are not supported in pure java
+ if (!(mCronetTestFramework.mCronetEngine instanceof JavaCronetEngine)) {
+ assertEquals(expected.getReceivedBytesCount(), actual.getReceivedBytesCount());
+ assertEquals(expected.getProxyServer(), actual.getProxyServer());
+ // This is a place where behavior intentionally differs between native and java
+ assertEquals(expected.getNegotiatedProtocol(), actual.getNegotiatedProtocol());
+ }
+ }
+
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface CompareDefaultWithCronet {
@@ -185,7 +202,7 @@ public class CronetTestBase extends AndroidTestCase {
public @interface OnlyRunCronetHttpURLConnection {
}
- @Target(ElementType.METHOD)
+ @Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface OnlyRunNativeCronet {}
}

Powered by Google App Engine
This is Rietveld 408576698