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

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

Issue 2709003002: Fix of flaky SdchTest#testSdchEnabled test. (Closed)
Patch Set: Moved static field before non-static. Created 3 years, 10 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/src/org/chromium/net/SdchObserver.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/SdchTest.java
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/SdchTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/SdchTest.java
index 93500d17ba2358da0d9434d068216a0e1f6645bd..52078c5d5c77ffee4a36b7ff5aed9ae78dbfcaae 100644
--- a/components/cronet/android/test/javatests/src/org/chromium/net/SdchTest.java
+++ b/components/cronet/android/test/javatests/src/org/chromium/net/SdchTest.java
@@ -4,7 +4,6 @@
package org.chromium.net;
-import android.os.ConditionVariable;
import android.support.test.filters.SmallTest;
import org.json.JSONException;
@@ -71,7 +70,7 @@ public class SdchTest extends CronetTestBase {
String targetUrl = NativeTestServer.getSdchURL() + "/sdch/test";
long contextAdapter =
getContextAdapter((CronetUrlRequestContext) mTestFramework.mCronetEngine);
- DictionaryAddedObserver observer = new DictionaryAddedObserver(targetUrl, contextAdapter);
+ SdchObserver observer = new SdchObserver(targetUrl, contextAdapter);
// Make a request to /sdch which advertises the dictionary.
TestUrlRequestCallback callback1 = startAndWaitForComplete(mTestFramework.mCronetEngine,
@@ -101,8 +100,7 @@ public class SdchTest extends CronetTestBase {
null, mTestFramework.getCronetEngineBuilder());
CronetUrlRequestContext newContext = (CronetUrlRequestContext) mTestFramework.mCronetEngine;
long newContextAdapter = getContextAdapter(newContext);
- DictionaryAddedObserver newObserver =
- new DictionaryAddedObserver(targetUrl, newContextAdapter);
+ SdchObserver newObserver = new SdchObserver(targetUrl, newContextAdapter);
newObserver.waitForDictionaryAdded();
// Make a request to fetch encoded response at /sdch/test.
@@ -146,27 +144,6 @@ public class SdchTest extends CronetTestBase {
assertEquals("Sdch is not used.\n", callback2.mResponseAsString);
}
- private static class DictionaryAddedObserver extends SdchObserver {
- private final ConditionVariable mBlock;
-
- public DictionaryAddedObserver(String targetUrl, long contextAdapter) {
- super(targetUrl, contextAdapter);
- mBlock = new ConditionVariable();
- }
-
- @Override
- public void onDictionaryAdded() {
- mBlock.open();
- }
-
- public void waitForDictionaryAdded() {
- if (!mDictionaryAlreadyPresent) {
- mBlock.block();
- mBlock.close();
- }
- }
- }
-
private long getContextAdapter(CronetUrlRequestContext requestContext) {
return requestContext.getUrlRequestContextAdapter();
}
« no previous file with comments | « no previous file | components/cronet/android/test/src/org/chromium/net/SdchObserver.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698