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

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

Issue 1503943003: [Cronet] Unit test refactoring and fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
Index: components/cronet/android/test/src/org/chromium/net/CronetTestFramework.java
diff --git a/components/cronet/android/test/src/org/chromium/net/CronetTestFramework.java b/components/cronet/android/test/src/org/chromium/net/CronetTestFramework.java
index a1a759a19fa8583a1dec1521148c395706f0a1c2..3c625a746a279728a8a3e3be82a228a3087e16c4 100644
--- a/components/cronet/android/test/src/org/chromium/net/CronetTestFramework.java
+++ b/components/cronet/android/test/src/org/chromium/net/CronetTestFramework.java
@@ -105,7 +105,6 @@ public class CronetTestFramework {
String appUrl, String[] commandLine, Context context, CronetEngine.Builder builder) {
mCommandLine = commandLine;
mContext = context;
- prepareTestStorage();
// Print out extra arguments passed in starting this activity.
if (commandLine != null) {
@@ -149,12 +148,12 @@ public class CronetTestFramework {
/**
* Prepares the path for the test storage (http cache, QUIC server info).
*/
- private void prepareTestStorage() {
- File storage = new File(getTestStorageDirectory(mContext));
+ public static void prepareTestStorage(Context context) {
xunjieli 2015/12/07 23:09:10 I think moving CronetTestFramework into CronetTest
kapishnikov 2015/12/08 01:09:37 Yes, I agree that we could move some of the Cronet
+ File storage = new File(getTestStorageDirectory(context));
if (storage.exists()) {
assertTrue(recursiveDelete(storage));
}
- ensureTestStorageExists(mContext);
+ ensureTestStorageExists(context);
}
/**
@@ -185,7 +184,7 @@ public class CronetTestFramework {
}
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
- private boolean recursiveDelete(File path) {
+ private static boolean recursiveDelete(File path) {
if (path.isDirectory()) {
for (File c : path.listFiles()) {
if (!recursiveDelete(c)) {

Powered by Google App Engine
This is Rietveld 408576698