gecko/mobile/android/base/tests/testClearPrivateData.java.in

45 lines
1.6 KiB
Java

#filter substitution
package @ANDROID_PACKAGE_NAME@.tests;
import @ANDROID_PACKAGE_NAME@.*;
import java.util.ArrayList;
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 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);
// 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
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");
}
}