Merge "Add a multiple redirects test for Cronet."
This commit is contained in:
@@ -287,6 +287,24 @@ public class UrlRequestTest {
|
|||||||
assertTrue(e.getCause().getMessage().contains("full"));
|
assertTrue(e.getCause().getMessage().contains("full"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUrlRequest_redirects() throws Exception {
|
||||||
|
int expectedNumRedirects = 5;
|
||||||
|
String url =
|
||||||
|
mTestServer.getRedirectingAssetUrl("html/hello_world.html", expectedNumRedirects);
|
||||||
|
|
||||||
|
UrlRequest request = createUrlRequestBuilder(url).build();
|
||||||
|
request.start();
|
||||||
|
|
||||||
|
mCallback.expectCallback(ResponseStep.ON_SUCCEEDED);
|
||||||
|
UrlResponseInfo info = mCallback.mResponseInfo;
|
||||||
|
assertOKStatusCode(info);
|
||||||
|
assertThat(mCallback.mResponseAsString).contains("hello world");
|
||||||
|
assertThat(info.getUrlChain()).hasSize(expectedNumRedirects + 1);
|
||||||
|
assertThat(info.getUrlChain().get(0)).isEqualTo(url);
|
||||||
|
assertThat(info.getUrlChain().get(expectedNumRedirects)).isEqualTo(info.getUrl());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUrlRequestPost_withRedirect() throws Exception {
|
public void testUrlRequestPost_withRedirect() throws Exception {
|
||||||
String body = Strings.repeat(
|
String body = Strings.repeat(
|
||||||
|
|||||||
Reference in New Issue
Block a user