diff options
author | Guang Zhu <guangzhu@google.com> | 2010-06-16 14:49:00 -0700 |
---|---|---|
committer | Guang Zhu <guangzhu@google.com> | 2010-06-16 14:52:08 -0700 |
commit | 91825062617f361fdf3687811194195678123391 (patch) | |
tree | b233d00b3fbc808110106c77a82620b70566ce77 | |
parent | 21a6703d6e00c6b267bce313d52a325ed9ff6e47 (diff) | |
download | packages_apps_Browser-91825062617f361fdf3687811194195678123391.zip packages_apps_Browser-91825062617f361fdf3687811194195678123391.tar.gz packages_apps_Browser-91825062617f361fdf3687811194195678123391.tar.bz2 |
add check for FileNotFoundException
make the test fail gracefully instead of throwing exception. because
otherwise it interrupts test run.
Change-Id: Ia2b92355db83cd13c55263f0699b29c10e00ea96
-rw-r--r-- | tests/src/com/android/browser/PopularUrlsTest.java | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/tests/src/com/android/browser/PopularUrlsTest.java b/tests/src/com/android/browser/PopularUrlsTest.java index d3806a0..5b8cb86 100644 --- a/tests/src/com/android/browser/PopularUrlsTest.java +++ b/tests/src/com/android/browser/PopularUrlsTest.java @@ -16,19 +16,6 @@ package com.android.browser; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - import android.app.Instrumentation; import android.content.Intent; import android.net.Uri; @@ -42,6 +29,19 @@ import android.webkit.JsResult; import android.webkit.SslErrorHandler; import android.webkit.WebView; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + /** * * Iterates over a list of URLs from a file and outputs the time to load each. @@ -423,6 +423,9 @@ public class PopularUrlsTest extends ActivityInstrumentationTestCase2<BrowserAct bufferedReader.close(); } } + } catch (FileNotFoundException fnfe) { + Log.e(TAG, fnfe.getMessage(), fnfe); + fail("Test environment not setup correctly"); } finally { if (writer != null) { writer.close(); @@ -436,6 +439,9 @@ public class PopularUrlsTest extends ActivityInstrumentationTestCase2<BrowserAct BufferedReader bufferedReader = getInputStream(); try { loopUrls(bufferedReader, null, true, STABILITY_LOOPCOUNT); + } catch (FileNotFoundException fnfe) { + Log.e(TAG, fnfe.getMessage(), fnfe); + fail("Test environment not setup correctly"); } finally { if (bufferedReader != null) { bufferedReader.close(); |