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

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

Issue 2489303003: [Cronet] Fix SdchTest.DictionaryAddedObserver (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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.json.JSONException; 10 import org.json.JSONException;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 callback1.mResponseInfo.getAllHeaders().get("Get-Dictionary")); 140 callback1.mResponseInfo.getAllHeaders().get("Get-Dictionary"));
141 141
142 // Make a request to fetch /sdch/test, and make sure Sdch encoding is no t used. 142 // Make a request to fetch /sdch/test, and make sure Sdch encoding is no t used.
143 TestUrlRequestCallback callback2 = startAndWaitForComplete( 143 TestUrlRequestCallback callback2 = startAndWaitForComplete(
144 mTestFramework.mCronetEngine, NativeTestServer.getSdchURL() + "/ sdch/test"); 144 mTestFramework.mCronetEngine, NativeTestServer.getSdchURL() + "/ sdch/test");
145 assertEquals(200, callback2.mResponseInfo.getHttpStatusCode()); 145 assertEquals(200, callback2.mResponseInfo.getHttpStatusCode());
146 assertEquals("Sdch is not used.\n", callback2.mResponseAsString); 146 assertEquals("Sdch is not used.\n", callback2.mResponseAsString);
147 } 147 }
148 148
149 private static class DictionaryAddedObserver extends SdchObserver { 149 private static class DictionaryAddedObserver extends SdchObserver {
150 ConditionVariable mBlock = new ConditionVariable(); 150 private final ConditionVariable mBlock;
151 151
152 public DictionaryAddedObserver(String targetUrl, long contextAdapter) { 152 public DictionaryAddedObserver(String targetUrl, long contextAdapter) {
153 super(targetUrl, contextAdapter); 153 super(targetUrl, contextAdapter);
154 mBlock = new ConditionVariable();
154 } 155 }
155 156
156 @Override 157 @Override
157 public void onDictionaryAdded() { 158 public void onDictionaryAdded() {
158 mBlock.open(); 159 mBlock.open();
159 } 160 }
160 161
161 public void waitForDictionaryAdded() { 162 public void waitForDictionaryAdded() {
162 if (!mDictionaryAlreadyPresent) { 163 if (!mDictionaryAlreadyPresent) {
163 mBlock.block(); 164 mBlock.block();
(...skipping 24 matching lines...) Expand all
188 while ((line = reader.readLine()) != null) { 189 while ((line = reader.readLine()) != null) {
189 if (line.contains(content)) { 190 if (line.contains(content)) {
190 reader.close(); 191 reader.close();
191 return true; 192 return true;
192 } 193 }
193 } 194 }
194 reader.close(); 195 reader.close();
195 return false; 196 return false;
196 } 197 }
197 } 198 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698