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

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

Issue 1817553002: Add host resolver rules experimental flag for Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete unused definitions, rebase, and fix test Created 4 years, 4 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 unified diff | Download patch
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.PathUtils; 9 import org.chromium.base.PathUtils;
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 super.runTest(); 144 super.runTest();
145 } 145 }
146 } catch (Throwable e) { 146 } catch (Throwable e) {
147 throw new Throwable("CronetTestBase#runTest failed.", e); 147 throw new Throwable("CronetTestBase#runTest failed.", e);
148 } 148 }
149 } else { 149 } else {
150 super.runTest(); 150 super.runTest();
151 } 151 }
152 } 152 }
153 153
154 /**
155 * Registers test host resolver for testing with the new API.
156 */
157 protected void registerHostResolver(CronetTestFramework framework) {
158 registerHostResolver(framework, false);
159 }
160
161 /**
162 * Registers test host resolver.
163 *
164 * @param isLegacyAPI true if the test should use the legacy API.
165 */
166 protected void registerHostResolver(CronetTestFramework framework, boolean i sLegacyAPI) {
167 if (isLegacyAPI) {
168 CronetTestUtil.registerHostResolverProc(framework.mRequestFactory, L OOPBACK_ADDRESS);
169 } else {
170 CronetTestUtil.registerHostResolverProc(framework.mCronetEngine, LOO PBACK_ADDRESS);
171 }
172 }
173
174 void assertResponseEquals(UrlResponseInfo expected, UrlResponseInfo actual) { 154 void assertResponseEquals(UrlResponseInfo expected, UrlResponseInfo actual) {
175 assertEquals(expected.getAllHeaders(), actual.getAllHeaders()); 155 assertEquals(expected.getAllHeaders(), actual.getAllHeaders());
176 assertEquals(expected.getAllHeadersAsList(), actual.getAllHeadersAsList( )); 156 assertEquals(expected.getAllHeadersAsList(), actual.getAllHeadersAsList( ));
177 assertEquals(expected.getHttpStatusCode(), actual.getHttpStatusCode()); 157 assertEquals(expected.getHttpStatusCode(), actual.getHttpStatusCode());
178 assertEquals(expected.getHttpStatusText(), actual.getHttpStatusText()); 158 assertEquals(expected.getHttpStatusText(), actual.getHttpStatusText());
179 assertEquals(expected.getUrlChain(), actual.getUrlChain()); 159 assertEquals(expected.getUrlChain(), actual.getUrlChain());
180 assertEquals(expected.getUrl(), actual.getUrl()); 160 assertEquals(expected.getUrl(), actual.getUrl());
181 // Transferred bytes and proxy server are not supported in pure java 161 // Transferred bytes and proxy server are not supported in pure java
182 if (!(mCronetTestFramework.mCronetEngine instanceof JavaCronetEngine)) { 162 if (!(mCronetTestFramework.mCronetEngine instanceof JavaCronetEngine)) {
183 assertEquals(expected.getReceivedBytesCount(), actual.getReceivedByt esCount()); 163 assertEquals(expected.getReceivedBytesCount(), actual.getReceivedByt esCount());
(...skipping 10 matching lines...) Expand all
194 174
195 @Target(ElementType.METHOD) 175 @Target(ElementType.METHOD)
196 @Retention(RetentionPolicy.RUNTIME) 176 @Retention(RetentionPolicy.RUNTIME)
197 public @interface OnlyRunCronetHttpURLConnection { 177 public @interface OnlyRunCronetHttpURLConnection {
198 } 178 }
199 179
200 @Target(ElementType.METHOD) 180 @Target(ElementType.METHOD)
201 @Retention(RetentionPolicy.RUNTIME) 181 @Retention(RetentionPolicy.RUNTIME)
202 public @interface OnlyRunNativeCronet {} 182 public @interface OnlyRunNativeCronet {}
203 } 183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698