Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 assertEquals(UPLOAD_CHANNEL_DATA + "\0\0", listener.mResponseAsString); |
|
mmenke
2016/06/23 21:47:07
Is this second check still true?
xunjieli
2016/06/23 21:49:13
I am not sure. Still running test. Will update onc
xunjieli
2016/06/23 22:13:07
Done. It is null. We aren't able to assert on the
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |