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

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

Issue 2506653003: Instrument CronetUrlRequestTest#testThrowOrCancelInOnCanceled flaky test (Closed)
Patch Set: Changed equals to contains when comparing error messages. Created 4 years, 1 month 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
OLDNEW
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 static org.chromium.base.CollectionUtil.newHashSet; 7 import static org.chromium.base.CollectionUtil.newHashSet;
8 8
9 import android.os.ConditionVariable; 9 import android.os.ConditionVariable;
10 import android.test.suitebuilder.annotation.SmallTest; 10 import android.test.suitebuilder.annotation.SmallTest;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 String url = "http://example.com"; 193 String url = "http://example.com";
194 TestBidirectionalStreamCallback callback = new TestBidirectionalStreamCa llback(); 194 TestBidirectionalStreamCallback callback = new TestBidirectionalStreamCa llback();
195 // Create stream. 195 // Create stream.
196 BidirectionalStream stream = 196 BidirectionalStream stream =
197 mTestFramework.mCronetEngine 197 mTestFramework.mCronetEngine
198 .newBidirectionalStreamBuilder(url, callback, callback.g etExecutor()) 198 .newBidirectionalStreamBuilder(url, callback, callback.g etExecutor())
199 .build(); 199 .build();
200 stream.start(); 200 stream.start();
201 callback.blockForDone(); 201 callback.blockForDone();
202 assertTrue(stream.isDone()); 202 assertTrue(stream.isDone());
203 assertEquals("Exception in BidirectionalStream: net::ERR_DISALLOWED_URL_ SCHEME", 203 assertContains("Exception in BidirectionalStream: net::ERR_DISALLOWED_UR L_SCHEME",
204 callback.mError.getMessage()); 204 callback.mError.getMessage());
205 assertEquals(-301, callback.mError.getCronetInternalErrorCode()); 205 assertEquals(-301, callback.mError.getCronetInternalErrorCode());
206 } 206 }
207 207
208 @SmallTest 208 @SmallTest
209 @Feature({"Cronet"}) 209 @Feature({"Cronet"})
210 @OnlyRunNativeCronet 210 @OnlyRunNativeCronet
211 public void testSimpleGet() throws Exception { 211 public void testSimpleGet() throws Exception {
212 // Since this is the first request on the connection, the expected recei ved bytes count 212 // Since this is the first request on the connection, the expected recei ved bytes count
213 // must account for an HPACK dynamic table size update. 213 // must account for an HPACK dynamic table size update.
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 private static String bufferContentsToString(ByteBuffer byteBuffer, int star t, int end) { 1449 private static String bufferContentsToString(ByteBuffer byteBuffer, int star t, int end) {
1450 // Use a duplicate to avoid modifying byteBuffer. 1450 // Use a duplicate to avoid modifying byteBuffer.
1451 ByteBuffer duplicate = byteBuffer.duplicate(); 1451 ByteBuffer duplicate = byteBuffer.duplicate();
1452 duplicate.position(start); 1452 duplicate.position(start);
1453 duplicate.limit(end); 1453 duplicate.limit(end);
1454 byte[] contents = new byte[duplicate.remaining()]; 1454 byte[] contents = new byte[duplicate.remaining()];
1455 duplicate.get(contents); 1455 duplicate.get(contents);
1456 return new String(contents); 1456 return new String(contents);
1457 } 1457 }
1458 } 1458 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698