From c7a193cf28e5da72afabfa1b9c6633f87c7d53de Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Tue, 14 Aug 2012 08:49:59 -0600 Subject: [PATCH] Bug 774833 - Robocop: use finishOpenedActivities instead of finalize; r=jmaher --- mobile/android/base/tests/BaseTest.java.in | 5 ++--- mobile/android/base/tests/testAllPagesTab.java.in | 4 ++-- mobile/android/base/tests/testBookmarksTab.java.in | 4 ++-- mobile/android/base/tests/testBrowserProvider.java.in | 4 ---- .../android/base/tests/testBrowserProviderPerf.java.in | 3 --- mobile/android/base/tests/testFormHistory.java.in | 10 +++++++--- mobile/android/base/tests/testJarReader.java.in | 3 --- mobile/android/base/tests/testMigration.java.in | 6 +++++- mobile/android/base/tests/testPasswordEncrypt.java.in | 10 +++++++--- mobile/android/base/tests/testPasswordProvider.java.in | 10 +++++++--- 10 files changed, 32 insertions(+), 27 deletions(-) diff --git a/mobile/android/base/tests/BaseTest.java.in b/mobile/android/base/tests/BaseTest.java.in index 623005eaab3a..5ffdd5c40b3f 100644 --- a/mobile/android/base/tests/BaseTest.java.in +++ b/mobile/android/base/tests/BaseTest.java.in @@ -83,7 +83,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2 { mAsserter.setTestName(this.getClass().getName()); // Set up Robotium.solo and Driver objects - mSolo = new Solo(getInstrumentation()); + mSolo = new Solo(getInstrumentation(), mActivity); mDriver = new FennecNativeDriver(mActivity, mSolo); mActions = new FennecNativeActions(mActivity, mSolo, getInstrumentation(), mAsserter); } @@ -106,11 +106,10 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2 { public void tearDown() throws Exception { try { mAsserter.endTest(); - mSolo.finalize(); + mSolo.finishOpenedActivities(); } catch (Throwable e) { e.printStackTrace(); } - getActivity().finish(); super.tearDown(); } diff --git a/mobile/android/base/tests/testAllPagesTab.java.in b/mobile/android/base/tests/testAllPagesTab.java.in index 9420c40b4518..f48b7c022e82 100644 --- a/mobile/android/base/tests/testAllPagesTab.java.in +++ b/mobile/android/base/tests/testAllPagesTab.java.in @@ -137,8 +137,6 @@ public class testAllPagesTab extends BaseTest { } public void tearDown() throws Exception { - super.tearDown(); - ContentResolver resolver = getActivity().getContentResolver(); Uri uri = Uri.parse("content://@ANDROID_PACKAGE_NAME@.db.browser/history"); uri = uri.buildUpon().appendQueryParameter("profile", "default") @@ -146,5 +144,7 @@ public class testAllPagesTab extends BaseTest { resolver.delete(uri, "url = ?", new String[] { "http://mochi.test:8888/tests/robocop/robocop_big_link.html" }); + + super.tearDown(); } } diff --git a/mobile/android/base/tests/testBookmarksTab.java.in b/mobile/android/base/tests/testBookmarksTab.java.in index 9a641a83fe69..d9d551421517 100644 --- a/mobile/android/base/tests/testBookmarksTab.java.in +++ b/mobile/android/base/tests/testBookmarksTab.java.in @@ -212,8 +212,6 @@ public class testBookmarksTab extends BaseTest { } public void tearDown() throws Exception { - super.tearDown(); - ContentResolver resolver = getActivity().getContentResolver(); Uri uri = Uri.parse("content://@ANDROID_PACKAGE_NAME@.db.browser/bookmarks"); uri = uri.buildUpon().appendQueryParameter("profile", "default") @@ -221,5 +219,7 @@ public class testBookmarksTab extends BaseTest { resolver.delete(uri, "title = ?", new String[] { "BOOKMARK_TITLE" }); + + super.tearDown(); } } diff --git a/mobile/android/base/tests/testBrowserProvider.java.in b/mobile/android/base/tests/testBrowserProvider.java.in index e3c55293d4ae..27e12346fa0a 100644 --- a/mobile/android/base/tests/testBrowserProvider.java.in +++ b/mobile/android/base/tests/testBrowserProvider.java.in @@ -336,10 +336,6 @@ public class testBrowserProvider extends ContentProviderTest { } } - public void tearDown() throws Exception { - super.tearDown(); - } - abstract class Test implements Runnable { public void run() { try { diff --git a/mobile/android/base/tests/testBrowserProviderPerf.java.in b/mobile/android/base/tests/testBrowserProviderPerf.java.in index 0abcdab08ae2..f0de0a6051c6 100644 --- a/mobile/android/base/tests/testBrowserProviderPerf.java.in +++ b/mobile/android/base/tests/testBrowserProviderPerf.java.in @@ -255,7 +255,4 @@ public class testBrowserProviderPerf extends ContentProviderTest { c.close(); } - public void tearDown() throws Exception { - super.tearDown(); - } } diff --git a/mobile/android/base/tests/testFormHistory.java.in b/mobile/android/base/tests/testFormHistory.java.in index 46c53d787886..b7c1d2dab3b6 100644 --- a/mobile/android/base/tests/testFormHistory.java.in +++ b/mobile/android/base/tests/testFormHistory.java.in @@ -108,11 +108,15 @@ public class testFormHistory extends BaseTest { } public void tearDown() throws Exception { - super.tearDown(); - // remove the entire signons.sqlite file File profile = new File(mProfile); File db = new File(profile, "formhistory.sqlite"); - db.delete(); + if (db.delete()) { + mAsserter.dumpLog("tearDown deleted "+db.toString()); + } else { + mAsserter.dumpLog("tearDown did not delete "+db.toString()); + } + + super.tearDown(); } } diff --git a/mobile/android/base/tests/testJarReader.java.in b/mobile/android/base/tests/testJarReader.java.in index c1157ca8d6b5..4987563c25bc 100644 --- a/mobile/android/base/tests/testJarReader.java.in +++ b/mobile/android/base/tests/testJarReader.java.in @@ -69,7 +69,4 @@ public class testJarReader extends BaseTest { return new java.util.Scanner(stream).useDelimiter("\\A").next(); } - public void tearDown() throws Exception { - super.tearDown(); - } } diff --git a/mobile/android/base/tests/testMigration.java.in b/mobile/android/base/tests/testMigration.java.in index 5066ea391a00..e821da1bdb04 100644 --- a/mobile/android/base/tests/testMigration.java.in +++ b/mobile/android/base/tests/testMigration.java.in @@ -346,7 +346,11 @@ public class testMigration extends ContentProviderTest { // remove the database file File profile = new File(mProfile); File db = new File(profile, DB_NAME); - db.delete(); + if (db.delete()) { + mAsserter.dumpLog("tearDown deleted "+db.toString()); + } else { + mAsserter.dumpLog("tearDown did not delete "+db.toString()); + } super.tearDown(); } diff --git a/mobile/android/base/tests/testPasswordEncrypt.java.in b/mobile/android/base/tests/testPasswordEncrypt.java.in index 117eafab9161..317bd5b911b3 100644 --- a/mobile/android/base/tests/testPasswordEncrypt.java.in +++ b/mobile/android/base/tests/testPasswordEncrypt.java.in @@ -147,11 +147,15 @@ public class testPasswordEncrypt extends BaseTest { } public void tearDown() throws Exception { - super.tearDown(); - // remove the entire signons.sqlite file File profile = new File(mProfile); File db = new File(profile, "signons.sqlite"); - db.delete(); + if (db.delete()) { + mAsserter.dumpLog("tearDown deleted "+db.toString()); + } else { + mAsserter.dumpLog("tearDown did not delete "+db.toString()); + } + + super.tearDown(); } } diff --git a/mobile/android/base/tests/testPasswordProvider.java.in b/mobile/android/base/tests/testPasswordProvider.java.in index 1fcd846d5f32..9ace65b6a29b 100644 --- a/mobile/android/base/tests/testPasswordProvider.java.in +++ b/mobile/android/base/tests/testPasswordProvider.java.in @@ -85,11 +85,15 @@ public class testPasswordProvider extends BaseTest { } public void tearDown() throws Exception { - super.tearDown(); - // remove the entire signons.sqlite file File profile = new File(mProfile); File db = new File(profile, "signons.sqlite"); - db.delete(); + if (db.delete()) { + mAsserter.dumpLog("tearDown deleted "+db.toString()); + } else { + mAsserter.dumpLog("tearDown did not delete "+db.toString()); + } + + super.tearDown(); } }