diff options
author | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-02 00:17:17 +0000 |
---|---|---|
committer | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-02 00:17:17 +0000 |
commit | 89cdcbc6e294fc1799702cc70fa129c246092897 (patch) | |
tree | 451a2d50104dad622e37d7984c3112a150a8b802 /android_webview | |
parent | 7b61d12a34da9b210df4717656db950259a35d42 (diff) | |
download | chromium_src-89cdcbc6e294fc1799702cc70fa129c246092897.zip chromium_src-89cdcbc6e294fc1799702cc70fa129c246092897.tar.gz chromium_src-89cdcbc6e294fc1799702cc70fa129c246092897.tar.bz2 |
[android_webview] Fix findbugs warnings.
Refactor the code a bit and don't ignore return value of delete().
BUG=230209
TEST=AndroidWebViewTest
Review URL: https://codereview.chromium.org/52723009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232522 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r-- | android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java | 22 |
1 files changed, 11 insertions, 11 deletions
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 9aad743..d90c597 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); |