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

Unified Diff: components/cronet/android/test/javatests/src/org/chromium/net/NQETest.java

Issue 2852153002: Fix flaky NQE QUIC test (Closed)
Patch Set: pauljensen comments Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/cronet/android/test/javatests/src/org/chromium/net/QuicTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/android/test/javatests/src/org/chromium/net/NQETest.java
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/NQETest.java b/components/cronet/android/test/javatests/src/org/chromium/net/NQETest.java
index 4bf2631d5e9c845980ca4b7d0be57cc8aeba9dc5..905a83a524e0fa1c4d9751f83c8997db778963af 100644
--- a/components/cronet/android/test/javatests/src/org/chromium/net/NQETest.java
+++ b/components/cronet/android/test/javatests/src/org/chromium/net/NQETest.java
@@ -4,7 +4,6 @@
package org.chromium.net;
-import android.os.ConditionVariable;
import android.os.StrictMode;
import android.support.test.filters.SmallTest;
@@ -78,7 +77,7 @@ public class NQETest extends CronetTestBase {
TestNetworkQualityRttListener rttListener =
new TestNetworkQualityRttListener(networkQualityExecutor);
TestNetworkQualityThroughputListener throughputListener =
- new TestNetworkQualityThroughputListener(networkQualityExecutor, null);
+ new TestNetworkQualityThroughputListener(networkQualityExecutor);
try {
testFramework.mCronetEngine.addRttListener(rttListener);
fail("Should throw an exception.");
@@ -147,11 +146,10 @@ public class NQETest extends CronetTestBase {
new ExperimentalCronetEngine.Builder(getContext());
assert RttThroughputValues.INVALID_RTT_THROUGHPUT < 0;
Executor listenersExecutor = Executors.newSingleThreadExecutor(new ExecutorThreadFactory());
- ConditionVariable waitForThroughput = new ConditionVariable();
TestNetworkQualityRttListener rttListener =
new TestNetworkQualityRttListener(listenersExecutor);
TestNetworkQualityThroughputListener throughputListener =
- new TestNetworkQualityThroughputListener(listenersExecutor, waitForThroughput);
+ new TestNetworkQualityThroughputListener(listenersExecutor);
mCronetEngineBuilder.enableNetworkQualityEstimator(true).enableHttp2(true).enableQuic(
false);
mCronetEngineBuilder.setStoragePath(CronetTestFramework.getTestStorage(getContext()));
@@ -178,7 +176,11 @@ public class NQETest extends CronetTestBase {
// Throughput observation is posted to the network quality estimator on the network thread
// after the UrlRequest is completed. The observations are then eventually posted to
// throughput listeners on the executor provided to network quality.
- waitForThroughput.block();
+ throughputListener.waitUntilFirstThroughputObservationReceived();
+
+ // Wait for RTT observation (at the URL request layer) to be posted.
+ rttListener.waitUntilFirstUrlRequestRTTReceived();
+
assertTrue(throughputListener.throughputObservationCount() > 0);
// Prefs must be read at startup.
« no previous file with comments | « no previous file | components/cronet/android/test/javatests/src/org/chromium/net/QuicTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698