| 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.os.ConditionVariable; | 7 import android.os.ConditionVariable; |
| 8 import android.test.MoreAsserts; | 8 import android.test.MoreAsserts; |
| 9 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
| 10 import android.util.Log; | 10 import android.util.Log; |
| (...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 final ConditionVariable uploadDataStreamAdapterDestroyed = new Condition
Variable(); | 1717 final ConditionVariable uploadDataStreamAdapterDestroyed = new Condition
Variable(); |
| 1718 request.setOnDestroyedUploadCallbackForTesting(new Runnable() { | 1718 request.setOnDestroyedUploadCallbackForTesting(new Runnable() { |
| 1719 @Override | 1719 @Override |
| 1720 public void run() { | 1720 public void run() { |
| 1721 uploadDataStreamAdapterDestroyed.open(); | 1721 uploadDataStreamAdapterDestroyed.open(); |
| 1722 } | 1722 } |
| 1723 }); | 1723 }); |
| 1724 | 1724 |
| 1725 request.start(); | 1725 request.start(); |
| 1726 uploadDataStreamAdapterDestroyed.block(); | 1726 uploadDataStreamAdapterDestroyed.block(); |
| 1727 callback.blockForDone(); |
| 1727 | 1728 |
| 1728 assertEquals(200, callback.mResponseInfo.getHttpStatusCode()); | 1729 assertEquals(200, callback.mResponseInfo.getHttpStatusCode()); |
| 1729 assertEquals("", callback.mResponseAsString); | 1730 assertEquals("", callback.mResponseAsString); |
| 1730 } | 1731 } |
| 1731 | 1732 |
| 1732 /* | 1733 /* |
| 1733 * Verifies error codes are passed through correctly. | 1734 * Verifies error codes are passed through correctly. |
| 1734 */ | 1735 */ |
| 1735 @SmallTest | 1736 @SmallTest |
| 1736 @Feature({"Cronet"}) | 1737 @Feature({"Cronet"}) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1813 private String bufferContentsToString(ByteBuffer byteBuffer, int start, int
end) { | 1814 private String bufferContentsToString(ByteBuffer byteBuffer, int start, int
end) { |
| 1814 // Use a duplicate to avoid modifying byteBuffer. | 1815 // Use a duplicate to avoid modifying byteBuffer. |
| 1815 ByteBuffer duplicate = byteBuffer.duplicate(); | 1816 ByteBuffer duplicate = byteBuffer.duplicate(); |
| 1816 duplicate.position(start); | 1817 duplicate.position(start); |
| 1817 duplicate.limit(end); | 1818 duplicate.limit(end); |
| 1818 byte[] contents = new byte[duplicate.remaining()]; | 1819 byte[] contents = new byte[duplicate.remaining()]; |
| 1819 duplicate.get(contents); | 1820 duplicate.get(contents); |
| 1820 return new String(contents); | 1821 return new String(contents); |
| 1821 } | 1822 } |
| 1822 } | 1823 } |
| OLD | NEW |