From bc6090d818de3405eecef556e05572eada5a00f8 Mon Sep 17 00:00:00 2001 From: Adrian Tamas Date: Fri, 2 Aug 2013 17:28:43 +0300 Subject: [PATCH] Bug 896566 - Update testClearPrivateData for the new about:home (r=margaret) --- mobile/android/base/tests/robocop.ini | 2 +- .../base/tests/testClearPrivateData.java.in | 41 +++++++++---------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/mobile/android/base/tests/robocop.ini b/mobile/android/base/tests/robocop.ini index 0a7258f8916..b57d455b0e4 100644 --- a/mobile/android/base/tests/robocop.ini +++ b/mobile/android/base/tests/robocop.ini @@ -28,7 +28,7 @@ [testDoorHanger] [testTabHistory] [testShareLink] -# [testClearPrivateData] # disabled on fig - bug 880060 +[testClearPrivateData] [testSettingsMenuItems] [testSystemPages] # [testPermissions] # see bug 757475 diff --git a/mobile/android/base/tests/testClearPrivateData.java.in b/mobile/android/base/tests/testClearPrivateData.java.in index 2c0af57abef..e9ae32bfc18 100644 --- a/mobile/android/base/tests/testClearPrivateData.java.in +++ b/mobile/android/base/tests/testClearPrivateData.java.in @@ -2,9 +2,11 @@ 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() { @@ -17,29 +19,26 @@ public class testClearPrivateData extends AboutHomeTest { } 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"); + + inputAndLoadUrl(blank1); + waitForText(BLANK1_TITLE); + + addOrUpdateMobileBookmark(BLANK2_TITLE, blank2); - /* 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"); + ArrayList browserHistory = getBrowserDBUrls(BrowserDataType.HISTORY); + mAsserter.ok(browserHistory.size() > 0,"Checking history exists","History exists"); - // Quit the awesomescreen - mActions.sendSpecialKey(Actions.SpecialKey.BACK); - waitForText("Browser Blank Page 01"); - - // 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"); + 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"); } }