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

Side by Side Diff: components/cronet/android/test/javatests/src/org/chromium/net/QuicTest.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.test.suitebuilder.annotation.LargeTest; 7 import android.test.suitebuilder.annotation.LargeTest;
8 import android.test.suitebuilder.annotation.SmallTest; 8 import android.test.suitebuilder.annotation.SmallTest;
9 9
10 import org.chromium.base.Log; 10 import org.chromium.base.Log;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 assertEquals(expectedContent, callback2.mResponseAsString); 155 assertEquals(expectedContent, callback2.mResponseAsString);
156 assertEquals("quic/1+spdy/3", callback2.mResponseInfo.getNegotiatedProto col()); 156 assertEquals("quic/1+spdy/3", callback2.mResponseInfo.getNegotiatedProto col());
157 // The total received bytes should be larger than the content length, to account for 157 // The total received bytes should be larger than the content length, to account for
158 // headers. 158 // headers.
159 assertTrue(callback2.mResponseInfo.getReceivedBytesCount() > expectedCon tent.length()); 159 assertTrue(callback2.mResponseInfo.getReceivedBytesCount() > expectedCon tent.length());
160 } 160 }
161 161
162 // Returns whether a file contains a particular string. 162 // Returns whether a file contains a particular string.
163 @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") 163 @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE")
164 private boolean fileContainsString(String filename, String content) throws I OException { 164 private boolean fileContainsString(String filename, String content) throws I OException {
165 File file = new File(CronetTestFramework.getTestStorage(getContext()) + "/" + filename); 165 File file =
166 new File(CronetTestFramework.getTestStorage(getContext()) + "/pr efs/" + filename);
166 FileInputStream fileInputStream = new FileInputStream(file); 167 FileInputStream fileInputStream = new FileInputStream(file);
167 byte[] data = new byte[(int) file.length()]; 168 byte[] data = new byte[(int) file.length()];
168 fileInputStream.read(data); 169 fileInputStream.read(data);
169 fileInputStream.close(); 170 fileInputStream.close();
170 return new String(data, "UTF-8").contains(content); 171 return new String(data, "UTF-8").contains(content);
171 } 172 }
172 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698