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

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

Issue 1839283002: [Cronet] Purge storage directory if version does not match (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self review Created 4 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 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 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.chromium.base.test.util.Feature; 10 import org.chromium.base.test.util.Feature;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 TestUrlRequestCallback callback = new TestUrlRequestCallback(); 271 TestUrlRequestCallback callback = new TestUrlRequestCallback();
272 UrlRequest.Builder builder = 272 UrlRequest.Builder builder =
273 new UrlRequest.Builder(url, callback, callback.getExecutor(), cr onetEngine); 273 new UrlRequest.Builder(url, callback, callback.getExecutor(), cr onetEngine);
274 builder.build().start(); 274 builder.build().start();
275 callback.blockForDone(); 275 callback.blockForDone();
276 return callback; 276 return callback;
277 } 277 }
278 278
279 // Returns whether a file contains a particular string. 279 // Returns whether a file contains a particular string.
280 private boolean fileContainsString(String filename, String content) throws I OException { 280 private boolean fileContainsString(String filename, String content) throws I OException {
281 BufferedReader reader = new BufferedReader( 281 BufferedReader reader = new BufferedReader(new FileReader(
282 new FileReader(CronetTestFramework.getTestStorage(getContext()) + "/" + filename)); 282 CronetTestFramework.getTestStorage(getContext()) + "/prefs/" + f ilename));
283 String line; 283 String line;
284 while ((line = reader.readLine()) != null) { 284 while ((line = reader.readLine()) != null) {
285 if (line.contains(content)) { 285 if (line.contains(content)) {
286 reader.close(); 286 reader.close();
287 return true; 287 return true;
288 } 288 }
289 } 289 }
290 reader.close(); 290 reader.close();
291 return false; 291 return false;
292 } 292 }
293 } 293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698