| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.suitebuilder.annotation.SmallTest; | 8 import android.test.suitebuilder.annotation.SmallTest; |
| 9 | 9 |
| 10 import org.chromium.base.test.util.Feature; | 10 import org.chromium.base.test.util.Feature; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Create stream. | 147 // Create stream. |
| 148 BidirectionalStream stream = new BidirectionalStream | 148 BidirectionalStream stream = new BidirectionalStream |
| 149 .Builder(url, callback, callback.ge
tExecutor(), | 149 .Builder(url, callback, callback.ge
tExecutor(), |
| 150 mTestFramework.mCronetEngin
e) | 150 mTestFramework.mCronetEngin
e) |
| 151 .build(); | 151 .build(); |
| 152 stream.start(); | 152 stream.start(); |
| 153 callback.blockForDone(); | 153 callback.blockForDone(); |
| 154 assertTrue(stream.isDone()); | 154 assertTrue(stream.isDone()); |
| 155 assertEquals("Exception in BidirectionalStream: net::ERR_DISALLOWED_URL_
SCHEME", | 155 assertEquals("Exception in BidirectionalStream: net::ERR_DISALLOWED_URL_
SCHEME", |
| 156 callback.mError.getMessage()); | 156 callback.mError.getMessage()); |
| 157 assertEquals(-301, callback.mError.netError()); | 157 assertEquals(-301, callback.mError.getCronetInternalErrorCode()); |
| 158 } | 158 } |
| 159 | 159 |
| 160 @SmallTest | 160 @SmallTest |
| 161 @Feature({"Cronet"}) | 161 @Feature({"Cronet"}) |
| 162 @OnlyRunNativeCronet | 162 @OnlyRunNativeCronet |
| 163 public void testSimpleGet() throws Exception { | 163 public void testSimpleGet() throws Exception { |
| 164 String url = Http2TestServer.getEchoMethodUrl(); | 164 String url = Http2TestServer.getEchoMethodUrl(); |
| 165 TestBidirectionalStreamCallback callback = new TestBidirectionalStreamCa
llback(); | 165 TestBidirectionalStreamCallback callback = new TestBidirectionalStreamCa
llback(); |
| 166 // Create stream. | 166 // Create stream. |
| 167 BidirectionalStream stream = new BidirectionalStream | 167 BidirectionalStream stream = new BidirectionalStream |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 private static String bufferContentsToString(ByteBuffer byteBuffer, int star
t, int end) { | 1002 private static String bufferContentsToString(ByteBuffer byteBuffer, int star
t, int end) { |
| 1003 // Use a duplicate to avoid modifying byteBuffer. | 1003 // Use a duplicate to avoid modifying byteBuffer. |
| 1004 ByteBuffer duplicate = byteBuffer.duplicate(); | 1004 ByteBuffer duplicate = byteBuffer.duplicate(); |
| 1005 duplicate.position(start); | 1005 duplicate.position(start); |
| 1006 duplicate.limit(end); | 1006 duplicate.limit(end); |
| 1007 byte[] contents = new byte[duplicate.remaining()]; | 1007 byte[] contents = new byte[duplicate.remaining()]; |
| 1008 duplicate.get(contents); | 1008 duplicate.get(contents); |
| 1009 return new String(contents); | 1009 return new String(contents); |
| 1010 } | 1010 } |
| 1011 } | 1011 } |
| OLD | NEW |