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

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java

Issue 52723009: [android_webview] Fix findbugs warnings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | build/android/findbugs_filter/findbugs_known_bugs.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java
index 9aad743021d6d31158b823c197ca35988f972fcf..d90c59739b20b031eba5a94446000f4ea8f99f61 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java
@@ -33,11 +33,17 @@ public class ArchiveTest extends AwTestBase {
mTestContainerView = createAwTestContainerViewOnMainSync(mContentsClient);
}
+ private void deleteFile(String path) {
+ File file = new File(path);
+ if (file.exists())
+ assertTrue(file.delete());
+ assertFalse(file.exists());
+ }
+
private void doArchiveTest(final AwContents contents, final String path,
final boolean autoName, String expectedPath) throws InterruptedException {
if (expectedPath != null) {
- File file = new File(expectedPath);
- file.delete();
+ deleteFile(expectedPath);
}
// Set up a handler to handle the completion callback
@@ -78,9 +84,7 @@ public class ArchiveTest extends AwTestBase {
@Feature({"AndroidWebView"})
public void testExplicitGoodPath() throws Throwable {
final String path = new File(getActivity().getFilesDir(), "test.mht").getAbsolutePath();
- File file = new File(path);
- file.delete();
- assertFalse(file.exists());
+ deleteFile(path);
loadUrlSync(mTestContainerView.getAwContents(),
mContentsClient.getOnPageFinishedHelper(), TEST_PAGE);
@@ -113,9 +117,7 @@ public class ArchiveTest extends AwTestBase {
@Feature({"AndroidWebView"})
public void testExplicitBadPath() throws Throwable {
final String path = new File("/foo/bar/baz.mht").getAbsolutePath();
- File file = new File(path);
- file.delete();
- assertFalse(file.exists());
+ deleteFile(path);
loadUrlSync(mTestContainerView.getAwContents(),
mContentsClient.getOnPageFinishedHelper(), TEST_PAGE);
@@ -127,9 +129,7 @@ public class ArchiveTest extends AwTestBase {
@Feature({"AndroidWebView"})
public void testAutoBadPath() throws Throwable {
final String path = new File("/foo/bar/").getAbsolutePath();
- File file = new File(path);
- file.delete();
- assertFalse(file.exists());
+ deleteFile(path);
loadUrlSync(mTestContainerView.getAwContents(),
mContentsClient.getOnPageFinishedHelper(), TEST_PAGE);
« no previous file with comments | « no previous file | build/android/findbugs_filter/findbugs_known_bugs.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698