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

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

Issue 2568213002: [Cronet] Make some test infrastructure public rather than package-private. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | components/cronet/android/test/javatests/src/org/chromium/net/TestUrlRequestCallback.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 package org.chromium.net; 5 package org.chromium.net;
6 6
7 import android.test.AndroidTestCase; 7 import android.test.AndroidTestCase;
8 8
9 import org.chromium.base.ContextUtils; 9 import org.chromium.base.ContextUtils;
10 import org.chromium.base.PathUtils; 10 import org.chromium.base.PathUtils;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 super.runTest(); 145 super.runTest();
146 } 146 }
147 } catch (Throwable e) { 147 } catch (Throwable e) {
148 throw new Throwable("CronetTestBase#runTest failed.", e); 148 throw new Throwable("CronetTestBase#runTest failed.", e);
149 } 149 }
150 } else { 150 } else {
151 super.runTest(); 151 super.runTest();
152 } 152 }
153 } 153 }
154 154
155 void assertResponseEquals(UrlResponseInfo expected, UrlResponseInfo actual) { 155 public void assertResponseEquals(UrlResponseInfo expected, UrlResponseInfo a ctual) {
156 assertEquals(expected.getAllHeaders(), actual.getAllHeaders()); 156 assertEquals(expected.getAllHeaders(), actual.getAllHeaders());
157 assertEquals(expected.getAllHeadersAsList(), actual.getAllHeadersAsList( )); 157 assertEquals(expected.getAllHeadersAsList(), actual.getAllHeadersAsList( ));
158 assertEquals(expected.getHttpStatusCode(), actual.getHttpStatusCode()); 158 assertEquals(expected.getHttpStatusCode(), actual.getHttpStatusCode());
159 assertEquals(expected.getHttpStatusText(), actual.getHttpStatusText()); 159 assertEquals(expected.getHttpStatusText(), actual.getHttpStatusText());
160 assertEquals(expected.getUrlChain(), actual.getUrlChain()); 160 assertEquals(expected.getUrlChain(), actual.getUrlChain());
161 assertEquals(expected.getUrl(), actual.getUrl()); 161 assertEquals(expected.getUrl(), actual.getUrl());
162 // Transferred bytes and proxy server are not supported in pure java 162 // Transferred bytes and proxy server are not supported in pure java
163 if (!(mCronetTestFramework.mCronetEngine instanceof JavaCronetEngine)) { 163 if (!(mCronetTestFramework.mCronetEngine instanceof JavaCronetEngine)) {
164 assertEquals(expected.getReceivedByteCount(), actual.getReceivedByte Count()); 164 assertEquals(expected.getReceivedByteCount(), actual.getReceivedByte Count());
165 assertEquals(expected.getProxyServer(), actual.getProxyServer()); 165 assertEquals(expected.getProxyServer(), actual.getProxyServer());
166 // This is a place where behavior intentionally differs between nati ve and java 166 // This is a place where behavior intentionally differs between nati ve and java
167 assertEquals(expected.getNegotiatedProtocol(), actual.getNegotiatedP rotocol()); 167 assertEquals(expected.getNegotiatedProtocol(), actual.getNegotiatedP rotocol());
168 } 168 }
169 } 169 }
170 170
171 static void assertContains(String expectedSubstring, String actualString) { 171 public static void assertContains(String expectedSubstring, String actualStr ing) {
172 assertNotNull(actualString); 172 assertNotNull(actualString);
173 if (!actualString.contains(expectedSubstring)) { 173 if (!actualString.contains(expectedSubstring)) {
174 fail("String [" + actualString + "] doesn't contain substring [" + e xpectedSubstring 174 fail("String [" + actualString + "] doesn't contain substring [" + e xpectedSubstring
175 + "]"); 175 + "]");
176 } 176 }
177 } 177 }
178 178
179 @Target(ElementType.METHOD) 179 @Target(ElementType.METHOD)
180 @Retention(RetentionPolicy.RUNTIME) 180 @Retention(RetentionPolicy.RUNTIME)
181 public @interface CompareDefaultWithCronet { 181 public @interface CompareDefaultWithCronet {
182 } 182 }
183 183
184 @Target(ElementType.METHOD) 184 @Target(ElementType.METHOD)
185 @Retention(RetentionPolicy.RUNTIME) 185 @Retention(RetentionPolicy.RUNTIME)
186 public @interface OnlyRunCronetHttpURLConnection { 186 public @interface OnlyRunCronetHttpURLConnection {
187 } 187 }
188 188
189 @Target(ElementType.METHOD) 189 @Target(ElementType.METHOD)
190 @Retention(RetentionPolicy.RUNTIME) 190 @Retention(RetentionPolicy.RUNTIME)
191 public @interface OnlyRunNativeCronet {} 191 public @interface OnlyRunNativeCronet {}
192 } 192 }
OLDNEW
« no previous file with comments | « no previous file | components/cronet/android/test/javatests/src/org/chromium/net/TestUrlRequestCallback.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698