| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.content.Context; | 7 import android.content.Context; |
| 8 import android.os.ConditionVariable; | 8 import android.os.ConditionVariable; |
| 9 import android.os.Environment; | 9 import android.os.Environment; |
| 10 | 10 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 assertTrue(recursiveDelete(storage)); | 155 assertTrue(recursiveDelete(storage)); |
| 156 } | 156 } |
| 157 ensureTestStorageExists(context); | 157 ensureTestStorageExists(context); |
| 158 } | 158 } |
| 159 | 159 |
| 160 /** | 160 /** |
| 161 * Returns the path for the test storage (http cache, QUIC server info). | 161 * Returns the path for the test storage (http cache, QUIC server info). |
| 162 * NOTE: Does not ensure it exists; tests should use {@link #getTestStorage}
. | 162 * NOTE: Does not ensure it exists; tests should use {@link #getTestStorage}
. |
| 163 */ | 163 */ |
| 164 private static String getTestStorageDirectory(Context context) { | 164 private static String getTestStorageDirectory(Context context) { |
| 165 return PathUtils.getDataDirectory(context) + "/test_storage"; | 165 return PathUtils.getDataDirectory() + "/test_storage"; |
| 166 } | 166 } |
| 167 | 167 |
| 168 /** | 168 /** |
| 169 * Ensures test storage directory exists, i.e. creates one if it does not ex
ist. | 169 * Ensures test storage directory exists, i.e. creates one if it does not ex
ist. |
| 170 */ | 170 */ |
| 171 private static void ensureTestStorageExists(Context context) { | 171 private static void ensureTestStorageExists(Context context) { |
| 172 File storage = new File(getTestStorageDirectory(context)); | 172 File storage = new File(getTestStorageDirectory(context)); |
| 173 if (!storage.exists()) { | 173 if (!storage.exists()) { |
| 174 assertTrue(storage.mkdir()); | 174 assertTrue(storage.mkdir()); |
| 175 } | 175 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 309 |
| 310 public void stopNetLog() { | 310 public void stopNetLog() { |
| 311 if (mRequestFactory != null) { | 311 if (mRequestFactory != null) { |
| 312 mRequestFactory.stopNetLog(); | 312 mRequestFactory.stopNetLog(); |
| 313 } | 313 } |
| 314 if (mCronetEngine != null) { | 314 if (mCronetEngine != null) { |
| 315 mCronetEngine.stopNetLog(); | 315 mCronetEngine.stopNetLog(); |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 } | 318 } |
| OLD | NEW |