Commit 14b30e04 authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

AW: use FileUtils in HttpCacheTest

No change to production logic. No expected change to test behavior.

This swaps out our custom logic for deleting a directory with a
FileUtils method.

R=changwan@chromium.org

Test: run_webview_instrumentation_test_apk -f=HttpCacheTest#*
Change-Id: Ieaf269f4c0124e7d680ef0ba941f9c2ca730549f
Reviewed-on: https://chromium-review.googlesource.com/c/1391295Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619500}
parent 756aea5a
...@@ -13,6 +13,7 @@ import org.junit.Test; ...@@ -13,6 +13,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.android_webview.AwContents; import org.chromium.android_webview.AwContents;
import org.chromium.base.FileUtils;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.net.test.util.TestWebServer; import org.chromium.net.test.util.TestWebServer;
...@@ -40,7 +41,7 @@ public class HttpCacheTest { ...@@ -40,7 +41,7 @@ public class HttpCacheTest {
.getCacheDir() .getCacheDir()
.getPath(), .getPath(),
"org.chromium.android_webview"); "org.chromium.android_webview");
deleteDirectory(webViewCacheDir); FileUtils.recursivelyDeleteFile(webViewCacheDir);
mActivityTestRule.startBrowserProcess(); mActivityTestRule.startBrowserProcess();
final TestAwContentsClient contentClient = new TestAwContentsClient(); final TestAwContentsClient contentClient = new TestAwContentsClient();
...@@ -66,12 +67,4 @@ public class HttpCacheTest { ...@@ -66,12 +67,4 @@ public class HttpCacheTest {
Assert.assertTrue(webViewCacheDir.isDirectory()); Assert.assertTrue(webViewCacheDir.isDirectory());
Assert.assertTrue(webViewCacheDir.list().length > 0); Assert.assertTrue(webViewCacheDir.list().length > 0);
} }
private void deleteDirectory(File dir) throws Exception {
if (!dir.exists()) return;
Assert.assertTrue(dir.isDirectory());
Process rmrf = Runtime.getRuntime().exec("rm -rf " + dir.getAbsolutePath());
rmrf.waitFor();
Assert.assertFalse(dir.exists());
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment