Index: components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetChunkedOutputStreamTest.java |
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetChunkedOutputStreamTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetChunkedOutputStreamTest.java |
index a7df1c01f2a3dea60c23d53761d1f5080fb7438f..a364d8e497acad406fadcc26826fce8692593055 100644 |
--- a/components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetChunkedOutputStreamTest.java |
+++ b/components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetChunkedOutputStreamTest.java |
@@ -87,6 +87,29 @@ public class CronetChunkedOutputStreamTest extends CronetTestBase { |
@SmallTest |
@Feature({"Cronet"}) |
@CompareDefaultWithCronet |
+ public void testWriteAfterRequestFailed() throws Exception { |
+ URL url = new URL(NativeTestServer.getEchoBodyURL()); |
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection(); |
+ connection.setDoOutput(true); |
+ connection.setRequestMethod("POST"); |
+ connection.setChunkedStreamingMode(0); |
+ OutputStream out = connection.getOutputStream(); |
+ out.write(UPLOAD_DATA); |
+ NativeTestServer.shutdownNativeTestServer(); |
+ try { |
+ out.write(TestUtil.getLargeData()); |
+ connection.getResponseCode(); |
+ fail(); |
+ } catch (IOException e) { |
+ // Expected. |
+ } |
+ // Restarting server to run the test for a second time. |
+ assertTrue(NativeTestServer.startNativeTestServer(getContext())); |
+ } |
+ |
+ @SmallTest |
+ @Feature({"Cronet"}) |
+ @CompareDefaultWithCronet |
public void testPost() throws Exception { |
URL url = new URL(NativeTestServer.getEchoBodyURL()); |
HttpURLConnection connection = (HttpURLConnection) url.openConnection(); |