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

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

Issue 2085353006: [Cronet] Fix UploadTest#testUploadChannelWithReadError (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust expected response string Created 4 years, 6 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
« no previous file with comments | « no previous file | no next file » | 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.suitebuilder.annotation.SmallTest; 7 import android.test.suitebuilder.annotation.SmallTest;
8 8
9 import org.chromium.base.test.util.Feature; 9 import org.chromium.base.test.util.Feature;
10 10
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 @Feature({"Cronet"}) 203 @Feature({"Cronet"})
204 public void testUploadChannelWithReadError() throws Exception { 204 public void testUploadChannelWithReadError() throws Exception {
205 TestHttpUrlRequestListener listener = new TestHttpUrlRequestListener(); 205 TestHttpUrlRequestListener listener = new TestHttpUrlRequestListener();
206 HttpUrlRequest request = createRequest( 206 HttpUrlRequest request = createRequest(
207 NativeTestServer.getEchoBodyURL(), listener); 207 NativeTestServer.getEchoBodyURL(), listener);
208 setUploadChannel(request, "text/plain", UPLOAD_CHANNEL_DATA, 208 setUploadChannel(request, "text/plain", UPLOAD_CHANNEL_DATA,
209 UPLOAD_CHANNEL_DATA.length() + 2); 209 UPLOAD_CHANNEL_DATA.length() + 2);
210 request.start(); 210 request.start();
211 listener.blockForComplete(); 211 listener.blockForComplete();
212 212
213 assertEquals(200, listener.mHttpStatusCode); 213 assertEquals(0, listener.mHttpStatusCode);
214 assertEquals(UPLOAD_CHANNEL_DATA + "\0\0", listener.mResponseAsString); 214 assertNull(listener.mResponseAsString);
215 } 215 }
216 216
217 /** 217 /**
218 * Tests Content-Type can be set when uploading from a channel. 218 * Tests Content-Type can be set when uploading from a channel.
219 */ 219 */
220 @SmallTest 220 @SmallTest
221 @Feature({"Cronet"}) 221 @Feature({"Cronet"})
222 public void testUploadChannelContentType() throws Exception { 222 public void testUploadChannelContentType() throws Exception {
223 String contentTypes[] = {"text/plain", "chicken/spicy"}; 223 String contentTypes[] = {"text/plain", "chicken/spicy"};
224 for (String contentType : contentTypes) { 224 for (String contentType : contentTypes) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // Upload a single empty chunk. 339 // Upload a single empty chunk.
340 ByteBuffer byteBuffer = ByteBuffer.allocateDirect(0); 340 ByteBuffer byteBuffer = ByteBuffer.allocateDirect(0);
341 request.appendChunk(byteBuffer, true); 341 request.appendChunk(byteBuffer, true);
342 342
343 listener.blockForComplete(); 343 listener.blockForComplete();
344 344
345 assertEquals(200, listener.mHttpStatusCode); 345 assertEquals(200, listener.mHttpStatusCode);
346 assertEquals("", listener.mResponseAsString); 346 assertEquals("", listener.mResponseAsString);
347 } 347 }
348 } 348 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698