Merge "Stop checking for QUIC success in CTS tests"
This commit is contained in:
@@ -222,29 +222,16 @@ public class HttpEngineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHttpEngine_EnableQuic() throws Exception {
|
public void testHttpEngine_EnableQuic() throws Exception {
|
||||||
|
String url = mTestServer.getSuccessUrl();
|
||||||
mEngine = mEngineBuilder.setEnableQuic(true).addQuicHint(HOST, 443, 443).build();
|
mEngine = mEngineBuilder.setEnableQuic(true).addQuicHint(HOST, 443, 443).build();
|
||||||
// The hint doesn't guarantee that QUIC will win the race, just that it will race TCP.
|
UrlRequest.Builder builder =
|
||||||
// We send multiple requests to reduce the flakiness of the test.
|
mEngine.newUrlRequestBuilder(url, mCallback.getExecutor(), mCallback);
|
||||||
boolean quicWasUsed = false;
|
mRequest = builder.build();
|
||||||
for (int i = 0; i < 5; i++) {
|
mRequest.start();
|
||||||
mCallback = new TestUrlRequestCallback();
|
|
||||||
UrlRequest.Builder builder =
|
|
||||||
mEngine.newUrlRequestBuilder(URL, mCallback.getExecutor(), mCallback);
|
|
||||||
mRequest = builder.build();
|
|
||||||
mRequest.start();
|
|
||||||
|
|
||||||
// This tests uses a non-hermetic server. Instead of asserting, assume the next
|
mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
|
||||||
// callback. This way, if the request were to fail, the test would just be skipped
|
UrlResponseInfo info = mCallback.mResponseInfo;
|
||||||
// instead of failing.
|
assertOKStatusCode(info);
|
||||||
mCallback.assumeCallback(ResponseStep.ON_SUCCEEDED);
|
|
||||||
UrlResponseInfo info = mCallback.mResponseInfo;
|
|
||||||
assumeOKStatusCode(info);
|
|
||||||
quicWasUsed = isQuic(info.getNegotiatedProtocol());
|
|
||||||
if (quicWasUsed) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assertTrue(quicWasUsed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -379,34 +366,22 @@ public class HttpEngineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHttpEngine_SetQuicOptions_RequestSucceedsWithQuic() throws Exception {
|
public void testHttpEngine_SetQuicOptions_RequestSucceedsWithQuic() throws Exception {
|
||||||
|
String url = mTestServer.getSuccessUrl();
|
||||||
QuicOptions options = new QuicOptions.Builder().build();
|
QuicOptions options = new QuicOptions.Builder().build();
|
||||||
mEngine = mEngineBuilder
|
mEngine = mEngineBuilder
|
||||||
.setEnableQuic(true)
|
.setEnableQuic(true)
|
||||||
.addQuicHint(HOST, 443, 443)
|
.addQuicHint(HOST, 443, 443)
|
||||||
.setQuicOptions(options)
|
.setQuicOptions(options)
|
||||||
.build();
|
.build();
|
||||||
|
UrlRequest.Builder builder =
|
||||||
|
mEngine.newUrlRequestBuilder(url, mCallback.getExecutor(), mCallback);
|
||||||
|
mRequest = builder.build();
|
||||||
|
mRequest.start();
|
||||||
|
|
||||||
// The hint doesn't guarantee that QUIC will win the race, just that it will race TCP.
|
mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
|
||||||
// We send multiple requests to reduce the flakiness of the test.
|
UrlResponseInfo info = mCallback.mResponseInfo;
|
||||||
boolean quicWasUsed = false;
|
assertOKStatusCode(info);
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
mCallback = new TestUrlRequestCallback();
|
|
||||||
UrlRequest.Builder builder =
|
|
||||||
mEngine.newUrlRequestBuilder(URL, mCallback.getExecutor(), mCallback);
|
|
||||||
mRequest = builder.build();
|
|
||||||
mRequest.start();
|
|
||||||
mCallback.blockForDone();
|
|
||||||
|
|
||||||
quicWasUsed = isQuic(mCallback.mResponseInfo.getNegotiatedProtocol());
|
|
||||||
if (quicWasUsed) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assertTrue(quicWasUsed);
|
|
||||||
// This tests uses a non-hermetic server. Instead of asserting, assume the next callback.
|
|
||||||
// This way, if the request were to fail, the test would just be skipped instead of failing.
|
|
||||||
assumeOKStatusCode(mCallback.mResponseInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user