Chromium Code Reviews| 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 {} |
| } |