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 12 matching lines...) Expand all Loading... | |
23 @SuppressWarnings("deprecation") | 23 @SuppressWarnings("deprecation") |
24 public class UploadTest extends CronetTestBase { | 24 public class UploadTest extends CronetTestBase { |
25 private static final String UPLOAD_DATA = "Nifty upload data!"; | 25 private static final String UPLOAD_DATA = "Nifty upload data!"; |
26 private static final String UPLOAD_CHANNEL_DATA = "Upload channel data"; | 26 private static final String UPLOAD_CHANNEL_DATA = "Upload channel data"; |
27 | 27 |
28 private CronetTestFramework mTestFramework; | 28 private CronetTestFramework mTestFramework; |
29 | 29 |
30 // @Override | 30 // @Override |
31 protected void setUp() throws Exception { | 31 protected void setUp() throws Exception { |
32 super.setUp(); | 32 super.setUp(); |
33 mTestFramework = startCronetTestFramework(); | 33 String[] commandLineArgs = new String[] { |
mef
2015/11/24 20:38:33
not used?
xunjieli
2015/11/24 21:28:06
Done.
| |
34 CronetTestFramework.LIBRARY_INIT_KEY, CronetTestFramework.Librar yInitType.LEGACY}; | |
35 mTestFramework = new CronetTestFramework(null, mTestFramework, getContex t(), null); | |
mef
2015/11/24 20:38:33
wrong copy-paste?
xunjieli
2015/11/24 21:28:06
Done. Thanks! I wonder how the tests managed to pa
| |
34 assertNotNull(mTestFramework); | 36 assertNotNull(mTestFramework); |
35 assertTrue(NativeTestServer.startNativeTestServer(getContext())); | 37 assertTrue(NativeTestServer.startNativeTestServer(getContext())); |
36 } | 38 } |
37 | 39 |
38 private HttpUrlRequest createRequest( | 40 private HttpUrlRequest createRequest( |
39 String url, HttpUrlRequestListener listener) { | 41 String url, HttpUrlRequestListener listener) { |
40 HashMap<String, String> headers = new HashMap<String, String>(); | 42 HashMap<String, String> headers = new HashMap<String, String>(); |
41 return mTestFramework.mRequestFactory.createRequest( | 43 return mTestFramework.mRequestFactory.createRequest( |
42 url, HttpUrlRequest.REQUEST_PRIORITY_MEDIUM, headers, listener); | 44 url, HttpUrlRequest.REQUEST_PRIORITY_MEDIUM, headers, listener); |
43 } | 45 } |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 // Upload a single empty chunk. | 341 // Upload a single empty chunk. |
340 ByteBuffer byteBuffer = ByteBuffer.allocateDirect(0); | 342 ByteBuffer byteBuffer = ByteBuffer.allocateDirect(0); |
341 request.appendChunk(byteBuffer, true); | 343 request.appendChunk(byteBuffer, true); |
342 | 344 |
343 listener.blockForComplete(); | 345 listener.blockForComplete(); |
344 | 346 |
345 assertEquals(200, listener.mHttpStatusCode); | 347 assertEquals(200, listener.mHttpStatusCode); |
346 assertEquals("", listener.mResponseAsString); | 348 assertEquals("", listener.mResponseAsString); |
347 } | 349 } |
348 } | 350 } |
OLD | NEW |