Bug 896566 - Update testClearPrivateData for the new about:home (r=margaret)
authorAdrian Tamas <adrian.tamas@softvision.ro>
Fri, 02 Aug 2013 17:28:43 +0300
changeset 144088 617b9050b5ed0d4c9d814038cbb99dd6f17e0099
parent 144087 816c1730c8ece1fb15834370843bea2432d6de18
child 144089 ebf9d108717c54f83c8aa7ed006cc154a493a843
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersmargaret
bugs896566
milestone26.0a1
Bug 896566 - Update testClearPrivateData for the new about:home (r=margaret)
mobile/android/base/tests/robocop.ini
mobile/android/base/tests/testClearPrivateData.java.in
--- a/mobile/android/base/tests/robocop.ini
+++ b/mobile/android/base/tests/robocop.ini
@@ -23,17 +23,17 @@
 [testSharedPreferences]
 # [testThumbnails] # see bug 813107
 [testAddonManager]
 [testHistory]
 # [testVkbOverlap] # see bug 907274
 [testDoorHanger]
 [testTabHistory]
 [testShareLink]
-# [testClearPrivateData] # disabled on fig - bug 880060
+[testClearPrivateData]
 [testSettingsMenuItems]
 [testSystemPages]
 # [testPermissions] # see bug 757475
 [testJarReader]
 [testDistribution]
 [testFindInPage]
 [testInputUrlBar]
 # [testAddSearchEngine] # disabled on fig - bug 880060
--- a/mobile/android/base/tests/testClearPrivateData.java.in
+++ b/mobile/android/base/tests/testClearPrivateData.java.in
@@ -1,45 +1,44 @@
 #filter substitution
 package @ANDROID_PACKAGE_NAME@.tests;
 
 import @ANDROID_PACKAGE_NAME@.*;
-import android.widget.ListView;
+import java.util.ArrayList;
 
-public class testClearPrivateData extends AboutHomeTest  {
+public class testClearPrivateData extends AboutHomeTest {
+    private final String BLANK1_TITLE = "Browser Blank Page 01";
+    private final String BLANK2_TITLE = "Browser Blank Page 02";
 
     @Override
     protected int getTestType() {
         return TEST_MOCHITEST;
     }
 
     public void testClearPrivateData() {
         blockForGeckoReady();
         clearHistory();
     }
 
     private void clearHistory() {
-        // Loading a page so we are sure that there is at least one history entry
-        String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
-        inputAndLoadUrl(url);
+        // Loading a page and adding a second one as bookmark to have user made bookmarks and history
+        String blank1 = getAbsoluteUrl("/robocop/robocop_blank_01.html");
+        String blank2 = getAbsoluteUrl("/robocop/robocop_blank_02.html");
 
-        /*  Removed by Bug 896576 - [fig] Remove [getHistoryList] from BaseTest
-        // Checking that the history list is not empty
-        ListView hList = getHistoryList("Today|Yesterday");
-        mAsserter.ok(hList.getAdapter().getCount() > 0,"checking history exists","history exists");
+        inputAndLoadUrl(blank1);
+        waitForText(BLANK1_TITLE);
 
-        // Quit the awesomescreen
-        mActions.sendSpecialKey(Actions.SpecialKey.BACK);
-        waitForText("Browser Blank Page 01");
+        addOrUpdateMobileBookmark(BLANK2_TITLE, blank2);
 
-        // Clearing private data
-        selectSettingsItem("Privacy", "Clear private data");
-        mAsserter.ok(mSolo.searchButton("Clear data"),"checking clear button","clear button exists");
-        mSolo.clickOnButton("Clear data");
-        // TODO: extra long wait here for bug 837274
-        mAsserter.is(mSolo.waitForText("Private data cleared", 0, 60000),true,"private data cleared successfully");
+        // Checking that the history list is not empty
+        ArrayList<String> browserHistory = getBrowserDBUrls(BrowserDataType.HISTORY);
+        mAsserter.ok(browserHistory.size() > 0,"Checking history exists","History exists");
+
+        clearPrivateData();
 
         // Checking that history list is empty
-        hList = getHistoryList("History", 0);
-        mAsserter.ok(hList != null,"checking history is cleared ","history is cleared");
-        */
+        browserHistory = getBrowserDBUrls(BrowserDataType.HISTORY);
+        mAsserter.ok(browserHistory.size() == 0,"Checking history is cleared ","History is cleared");
+
+        // Checking that the user made bookmark is not removed
+        mAsserter.ok(isBookmark(blank2), "Checking that bookmarks have not been removed", "User made bookmarks were not removed with private data");
     }
 }