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

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

Issue 2401933002: Rename RequestFinishedInfo.Metrics.getResponseEnd() to getRequestEnd() (Closed)
Patch Set: Created 4 years, 2 months 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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 assertTrue(metrics.getReceivedBytesCount() > 0); 1198 assertTrue(metrics.getReceivedBytesCount() > 0);
1199 } else if (failureStep == ResponseStep.ON_STREAM_READY) { 1199 } else if (failureStep == ResponseStep.ON_STREAM_READY) {
1200 // onStreamReady() happens before response headers are received, so 1200 // onStreamReady() happens before response headers are received, so
1201 // there is no connect timing metrics. 1201 // there is no connect timing metrics.
1202 assertNotNull(metrics.getRequestStart()); 1202 assertNotNull(metrics.getRequestStart());
1203 MetricsTestUtil.assertAfter(metrics.getRequestStart(), startTime); 1203 MetricsTestUtil.assertAfter(metrics.getRequestStart(), startTime);
1204 MetricsTestUtil.checkNoConnectTiming(metrics); 1204 MetricsTestUtil.checkNoConnectTiming(metrics);
1205 // metrics.getResponseStart() can be null or non null 1205 // metrics.getResponseStart() can be null or non null
1206 // TODO(xunjieli): It's weird to have a null response start but a 1206 // TODO(xunjieli): It's weird to have a null response start but a
1207 // non-null response end. 1207 // non-null response end.
1208 assertNotNull(metrics.getResponseEnd()); 1208 assertNotNull(metrics.getRequestEnd());
1209 MetricsTestUtil.assertAfter(endTime, metrics.getResponseEnd()); 1209 MetricsTestUtil.assertAfter(endTime, metrics.getRequestEnd());
1210 // Entire request should take more than 0 ms 1210 // Entire request should take more than 0 ms
1211 assertTrue( 1211 assertTrue(metrics.getRequestEnd().getTime() - metrics.getRequestSta rt().getTime() > 0);
1212 metrics.getResponseEnd().getTime() - metrics.getRequestStart ().getTime() > 0);
1213 } 1212 }
1214 assertEquals(expectError, callback.mError != null); 1213 assertEquals(expectError, callback.mError != null);
1215 assertEquals(expectError, callback.mOnErrorCalled); 1214 assertEquals(expectError, callback.mOnErrorCalled);
1216 assertEquals(failureType == FailureType.CANCEL_SYNC 1215 assertEquals(failureType == FailureType.CANCEL_SYNC
1217 || failureType == FailureType.CANCEL_ASYNC 1216 || failureType == FailureType.CANCEL_ASYNC
1218 || failureType == FailureType.CANCEL_ASYNC_WITHOUT_PAUSE , 1217 || failureType == FailureType.CANCEL_ASYNC_WITHOUT_PAUSE ,
1219 callback.mOnCanceledCalled); 1218 callback.mOnCanceledCalled);
1220 mTestFramework.mCronetEngine.removeRequestFinishedListener(requestFinish edListener); 1219 mTestFramework.mCronetEngine.removeRequestFinishedListener(requestFinish edListener);
1221 } 1220 }
1222 1221
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 private static String bufferContentsToString(ByteBuffer byteBuffer, int star t, int end) { 1435 private static String bufferContentsToString(ByteBuffer byteBuffer, int star t, int end) {
1437 // Use a duplicate to avoid modifying byteBuffer. 1436 // Use a duplicate to avoid modifying byteBuffer.
1438 ByteBuffer duplicate = byteBuffer.duplicate(); 1437 ByteBuffer duplicate = byteBuffer.duplicate();
1439 duplicate.position(start); 1438 duplicate.position(start);
1440 duplicate.limit(end); 1439 duplicate.limit(end);
1441 byte[] contents = new byte[duplicate.remaining()]; 1440 byte[] contents = new byte[duplicate.remaining()];
1442 duplicate.get(contents); 1441 duplicate.get(contents);
1443 return new String(contents); 1442 return new String(contents);
1444 } 1443 }
1445 } 1444 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698