Bug 938845 - Merge StringHelper and org.mozilla.gecko.* Strings. r=mcomella

This commit is contained in:
Jalpreet Singh Nanda 2015-02-12 22:39:02 +05:30
parent 4df1d605f2
commit 461725a3d1
54 changed files with 790 additions and 555 deletions

View File

@ -24,6 +24,7 @@ import org.mozilla.gecko.updater.UpdateServiceHelper;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.PowerManager;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;
@ -73,6 +74,8 @@ public abstract class BaseRobocopTest extends ActivityInstrumentationTestCase2<A
protected String mProfile;
protected StringHelper mStringHelper;
protected abstract Intent createActivityIntent();
/**
@ -145,6 +148,10 @@ public abstract class BaseRobocopTest extends ActivityInstrumentationTestCase2<A
mSolo = new Solo(getInstrumentation(), tempActivity);
mDriver = new FennecNativeDriver(tempActivity, mSolo, mRootPath);
mActions = new FennecNativeActions(tempActivity, mSolo, getInstrumentation(), mAsserter);
final Resources res = getActivity().getResources();
StringHelper.initialize(res);
mStringHelper = StringHelper.get();
}
/**

View File

@ -33,6 +33,7 @@ import android.content.ContentValues;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.database.Cursor;
import android.os.Build;
import android.os.SystemClock;
@ -524,8 +525,8 @@ abstract class BaseTest extends BaseRobocopTest {
mAsserter.isnot(url, null, "The url argument is not null");
final String expected;
if (StringHelper.ABOUT_HOME_URL.equals(url)) {
expected = StringHelper.ABOUT_HOME_TITLE;
if (mStringHelper.ABOUT_HOME_URL.equals(url)) {
expected = mStringHelper.ABOUT_HOME_TITLE;
} else if (url.startsWith(URL_HTTP_PREFIX)) {
expected = url.substring(URL_HTTP_PREFIX.length());
} else {
@ -570,9 +571,9 @@ abstract class BaseTest extends BaseRobocopTest {
mSolo.clickLongOnText(gridItemTitle);
boolean dialogOpened = mSolo.waitForDialogToOpen();
mAsserter.ok(dialogOpened, "Pin site dialog opened: " + gridItemTitle, null);
boolean pinSiteFound = waitForText(StringHelper.CONTEXT_MENU_PIN_SITE);
boolean pinSiteFound = waitForText(mStringHelper.CONTEXT_MENU_PIN_SITE);
mAsserter.ok(pinSiteFound, "Found pin site menu item", null);
mSolo.clickOnText(StringHelper.CONTEXT_MENU_PIN_SITE);
mSolo.clickOnText(mStringHelper.CONTEXT_MENU_PIN_SITE);
verifyPinned(true, gridItemTitle);
}
@ -581,9 +582,9 @@ abstract class BaseTest extends BaseRobocopTest {
mSolo.clickLongOnText(gridItemTitle);
boolean dialogOpened = mSolo.waitForDialogToOpen();
mAsserter.ok(dialogOpened, "Pin site dialog opened: " + gridItemTitle, null);
boolean unpinSiteFound = waitForText(StringHelper.CONTEXT_MENU_UNPIN_SITE);
boolean unpinSiteFound = waitForText(mStringHelper.CONTEXT_MENU_UNPIN_SITE);
mAsserter.ok(unpinSiteFound, "Found unpin site menu item", null);
mSolo.clickOnText(StringHelper.CONTEXT_MENU_UNPIN_SITE);
mSolo.clickOnText(mStringHelper.CONTEXT_MENU_UNPIN_SITE);
verifyPinned(false, gridItemTitle);
}
@ -770,7 +771,7 @@ abstract class BaseTest extends BaseRobocopTest {
}
public void clearPrivateData() {
selectSettingsItem(StringHelper.PRIVACY_SECTION_LABEL, StringHelper.CLEAR_PRIVATE_DATA_LABEL);
selectSettingsItem(mStringHelper.PRIVACY_SECTION_LABEL, mStringHelper.CLEAR_PRIVATE_DATA_LABEL);
Actions.EventExpecter clearData = mActions.expectGeckoEvent("Sanitize:Finished");
mSolo.clickOnText("Clear data");
clearData.blockForEvent();

View File

@ -40,7 +40,7 @@ public class JavascriptTest extends BaseTest {
final Actions.EventExpecter expecter = mActions.expectGeckoEvent(EVENT_TYPE);
mAsserter.dumpLog("Registered listener for " + EVENT_TYPE);
final String url = getAbsoluteUrl(StringHelper.getHarnessUrlForJavascript(javascriptUrl));
final String url = getAbsoluteUrl(mStringHelper.getHarnessUrlForJavascript(javascriptUrl));
mAsserter.dumpLog("Loading JavaScript test from " + url);
loadUrl(url);

View File

@ -33,8 +33,8 @@ abstract class PixelTest extends BaseTest {
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
mActions.sendSpecialKey(Actions.SpecialKey.MENU);
waitForText(StringHelper.RELOAD_LABEL);
mSolo.clickOnText(StringHelper.RELOAD_LABEL);
waitForText(mStringHelper.RELOAD_LABEL);
mSolo.clickOnText(mStringHelper.RELOAD_LABEL);
paintExpecter.blockUntilClear(PAINT_CLEAR_DELAY);
paintExpecter.unregisterListener();
@ -55,13 +55,13 @@ abstract class PixelTest extends BaseTest {
Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
if (isPrivate) {
selectMenuItem(StringHelper.NEW_PRIVATE_TAB_LABEL);
selectMenuItem(mStringHelper.NEW_PRIVATE_TAB_LABEL);
} else {
selectMenuItem(StringHelper.NEW_TAB_LABEL);
selectMenuItem(mStringHelper.NEW_TAB_LABEL);
}
tabEventExpecter.blockForEvent();
contentEventExpecter.blockForEvent();
waitForText(StringHelper.TITLE_PLACE_HOLDER);
waitForText(mStringHelper.TITLE_PLACE_HOLDER);
loadAndPaint(url);
tabEventExpecter.unregisterListener();
contentEventExpecter.unregisterListener();

View File

@ -136,7 +136,7 @@ public abstract class SessionTest extends BaseTest {
protected void loadSessionTabs(Session session) {
// Verify initial about:home tab
verifyTabCount(1);
verifyUrl(StringHelper.ABOUT_HOME_URL);
verifyUrl(mStringHelper.ABOUT_HOME_URL);
SessionTab[] tabs = session.getItems();
for (int i = 0; i < tabs.length; i++) {
@ -145,8 +145,8 @@ public abstract class SessionTest extends BaseTest {
// New tabs always start with about:home, so make sure about:home
// is always the first entry.
mAsserter.is(pages[0].url, StringHelper.ABOUT_HOME_URL, "first page in tab is " +
StringHelper.ABOUT_HOME_URL);
mAsserter.is(pages[0].url, mStringHelper.ABOUT_HOME_URL, "first page in tab is " +
mStringHelper.ABOUT_HOME_URL);
// If this is the first tab, the tab already exists, so no need to
// create a new one. Otherwise, create a new tab if we're loading
@ -197,8 +197,8 @@ public abstract class SessionTest extends BaseTest {
@Override
public void onItem(PageInfo page, int currentIndex) {
final String text;
if (StringHelper.ABOUT_HOME_URL.equals(page.url)) {
text = StringHelper.TITLE_PLACE_HOLDER;
if (mStringHelper.ABOUT_HOME_URL.equals(page.url)) {
text = mStringHelper.TITLE_PLACE_HOLDER;
} else if (page.url.startsWith(URL_HTTP_PREFIX)) {
text = page.url.substring(URL_HTTP_PREFIX.length());
} else {

View File

@ -6,114 +6,477 @@
package org.mozilla.gecko.tests;
public class StringHelper {
private StringHelper() {}
import android.content.res.Resources;
public static final String OK = "OK";
import org.mozilla.gecko.R;
public class StringHelper {
private static StringHelper instance = null;
public final String OK;
// Note: DEFAULT_BOOKMARKS_TITLES.length == DEFAULT_BOOKMARKS_URLS.length
public static final String[] DEFAULT_BOOKMARKS_TITLES = new String[] {
"Firefox: About your browser",
"Firefox: Support",
"Firefox: Customize with add-ons"
};
public static final String[] DEFAULT_BOOKMARKS_URLS = new String[] {
"about:firefox",
"https://support.mozilla.org/products/mobile",
"https://addons.mozilla.org/android/"
};
public static final int DEFAULT_BOOKMARKS_COUNT = DEFAULT_BOOKMARKS_TITLES.length;
public final String[] DEFAULT_BOOKMARKS_TITLES;
public final String[] DEFAULT_BOOKMARKS_URLS;
public final int DEFAULT_BOOKMARKS_COUNT;
// About pages
public static final String ABOUT_BLANK_URL = "about:blank";
public static final String ABOUT_FIREFOX_URL = "about:firefox";
public static final String ABOUT_RIGHTS_URL = "about:rights";
public static final String ABOUT_BUILDCONFIG_URL = "about:buildconfig";
public static final String ABOUT_FEEDBACK_URL = "about:feedback";
public static final String ABOUT_HEALTHREPORT_URL = "about:healthreport";
public static final String ABOUT_DOWNLOADS_URL = "about:downloads";
public static final String ABOUT_HOME_URL = "about:home";
public static final String ABOUT_ADDONS_URL = "about:addons";
public static final String ABOUT_APPS_URL = "about:apps";
public static final String ABOUT_ABOUT_URL = "about:about";
public static final String ABOUT_SCHEME = "about:";
public final String ABOUT_BLANK_URL;
public final String ABOUT_FIREFOX_URL;
public final String ABOUT_RIGHTS_URL;
public final String ABOUT_BUILDCONFIG_URL;
public final String ABOUT_FEEDBACK_URL;
public final String ABOUT_HEALTHREPORT_URL;
public final String ABOUT_DOWNLOADS_URL;
public final String ABOUT_HOME_URL;
public final String ABOUT_ADDONS_URL;
public final String ABOUT_APPS_URL;
public final String ABOUT_ABOUT_URL;
public final String ABOUT_SCHEME;
// About pages' titles
public static final String ABOUT_HOME_TITLE = "";
public final String ABOUT_HOME_TITLE;
// Context Menu item strings
public static final String CONTEXT_MENU_BOOKMARK_LINK = "Bookmark Link";
public static final String CONTEXT_MENU_OPEN_LINK_IN_NEW_TAB = "Open Link in New Tab";
public static final String CONTEXT_MENU_OPEN_IN_NEW_TAB = "Open in New Tab";
public static final String CONTEXT_MENU_OPEN_LINK_IN_PRIVATE_TAB = "Open Link in Private Tab";
public static final String CONTEXT_MENU_OPEN_IN_PRIVATE_TAB = "Open in Private Tab";
public static final String CONTEXT_MENU_COPY_LINK = "Copy Link";
public static final String CONTEXT_MENU_SHARE_LINK = "Share Link";
public static final String CONTEXT_MENU_EDIT = "Edit";
public static final String CONTEXT_MENU_SHARE = "Share";
public static final String CONTEXT_MENU_REMOVE = "Remove";
public static final String CONTEXT_MENU_COPY_ADDRESS = "Copy Address";
public static final String CONTEXT_MENU_EDIT_SITE_SETTINGS = "Edit Site Settings";
public static final String CONTEXT_MENU_ADD_TO_HOME_SCREEN = "Add to Home Screen";
public static final String CONTEXT_MENU_PIN_SITE = "Pin Site";
public static final String CONTEXT_MENU_UNPIN_SITE = "Unpin Site";
public final String CONTEXT_MENU_BOOKMARK_LINK;
public final String CONTEXT_MENU_OPEN_LINK_IN_NEW_TAB;
public final String CONTEXT_MENU_OPEN_IN_NEW_TAB;
public final String CONTEXT_MENU_OPEN_LINK_IN_PRIVATE_TAB;
public final String CONTEXT_MENU_OPEN_IN_PRIVATE_TAB;
public final String CONTEXT_MENU_COPY_LINK;
public final String CONTEXT_MENU_SHARE_LINK;
public final String CONTEXT_MENU_EDIT;
public final String CONTEXT_MENU_SHARE;
public final String CONTEXT_MENU_REMOVE;
public final String CONTEXT_MENU_COPY_ADDRESS;
public final String CONTEXT_MENU_EDIT_SITE_SETTINGS;
public final String CONTEXT_MENU_ADD_TO_HOME_SCREEN;
public final String CONTEXT_MENU_PIN_SITE;
public final String CONTEXT_MENU_UNPIN_SITE;
// Context Menu menu items
public static final String[] CONTEXT_MENU_ITEMS_IN_PRIVATE_TAB = new String[] {
CONTEXT_MENU_OPEN_LINK_IN_PRIVATE_TAB,
CONTEXT_MENU_COPY_LINK,
CONTEXT_MENU_SHARE_LINK,
CONTEXT_MENU_BOOKMARK_LINK
};
public final String[] CONTEXT_MENU_ITEMS_IN_PRIVATE_TAB;
public static final String[] CONTEXT_MENU_ITEMS_IN_NORMAL_TAB = new String[] {
CONTEXT_MENU_OPEN_LINK_IN_NEW_TAB,
CONTEXT_MENU_OPEN_LINK_IN_PRIVATE_TAB,
CONTEXT_MENU_COPY_LINK,
CONTEXT_MENU_SHARE_LINK,
CONTEXT_MENU_BOOKMARK_LINK
};
public final String[] CONTEXT_MENU_ITEMS_IN_NORMAL_TAB;
public static final String[] BOOKMARK_CONTEXT_MENU_ITEMS = new String[] {
CONTEXT_MENU_OPEN_IN_NEW_TAB,
CONTEXT_MENU_OPEN_IN_PRIVATE_TAB,
CONTEXT_MENU_COPY_ADDRESS,
CONTEXT_MENU_SHARE,
CONTEXT_MENU_EDIT,
CONTEXT_MENU_REMOVE,
CONTEXT_MENU_ADD_TO_HOME_SCREEN
};
public final String[] BOOKMARK_CONTEXT_MENU_ITEMS;
public static final String[] CONTEXT_MENU_ITEMS_IN_URL_BAR = new String[] {
CONTEXT_MENU_SHARE,
CONTEXT_MENU_COPY_ADDRESS,
CONTEXT_MENU_EDIT_SITE_SETTINGS,
CONTEXT_MENU_ADD_TO_HOME_SCREEN
};
public final String[] CONTEXT_MENU_ITEMS_IN_URL_BAR;
public static final String TITLE_PLACE_HOLDER = "Search or enter address";
public final String TITLE_PLACE_HOLDER;
// Robocop page urls
// Note: please use getAbsoluteUrl(String url) on each robocop url to get the correct url
public static final String ROBOCOP_BIG_LINK_URL = "/robocop/robocop_big_link.html";
public static final String ROBOCOP_BIG_MAILTO_URL = "/robocop/robocop_big_mailto.html";
public static final String ROBOCOP_BLANK_PAGE_01_URL = "/robocop/robocop_blank_01.html";
public static final String ROBOCOP_BLANK_PAGE_02_URL = "/robocop/robocop_blank_02.html";
public static final String ROBOCOP_BLANK_PAGE_03_URL = "/robocop/robocop_blank_03.html";
public static final String ROBOCOP_BLANK_PAGE_04_URL = "/robocop/robocop_blank_04.html";
public static final String ROBOCOP_BLANK_PAGE_05_URL = "/robocop/robocop_blank_05.html";
public static final String ROBOCOP_BOXES_URL = "/robocop/robocop_boxes.html";
public static final String ROBOCOP_GEOLOCATION_URL = "/robocop/robocop_geolocation.html";
public static final String ROBOCOP_LOGIN_URL = "/robocop/robocop_login.html";
public static final String ROBOCOP_POPUP_URL = "/robocop/robocop_popup.html";
public static final String ROBOCOP_OFFLINE_STORAGE_URL = "/robocop/robocop_offline_storage.html";
public static final String ROBOCOP_PICTURE_LINK_URL = "/robocop/robocop_picture_link.html";
public static final String ROBOCOP_SEARCH_URL = "/robocop/robocop_search.html";
public static final String ROBOCOP_TEXT_PAGE_URL = "/robocop/robocop_text_page.html";
public static final String ROBOCOP_ADOBE_FLASH_URL = "/robocop/robocop_adobe_flash.html";
public static final String ROBOCOP_INPUT_URL = "/robocop/robocop_input.html";
public final String ROBOCOP_BIG_LINK_URL;
public final String ROBOCOP_BIG_MAILTO_URL;
public final String ROBOCOP_BLANK_PAGE_01_URL;
public final String ROBOCOP_BLANK_PAGE_02_URL;
public final String ROBOCOP_BLANK_PAGE_03_URL;
public final String ROBOCOP_BLANK_PAGE_04_URL;
public final String ROBOCOP_BLANK_PAGE_05_URL;
public final String ROBOCOP_BOXES_URL;
public final String ROBOCOP_GEOLOCATION_URL;
public final String ROBOCOP_LOGIN_URL;
public final String ROBOCOP_POPUP_URL;
public final String ROBOCOP_OFFLINE_STORAGE_URL;
public final String ROBOCOP_PICTURE_LINK_URL;
public final String ROBOCOP_SEARCH_URL;
public final String ROBOCOP_TEXT_PAGE_URL;
public final String ROBOCOP_ADOBE_FLASH_URL;
public final String ROBOCOP_INPUT_URL;
private static final String ROBOCOP_JS_HARNESS_URL = "/robocop/robocop_javascript.html";
private final String ROBOCOP_JS_HARNESS_URL;
// Robocop page titles
public final String ROBOCOP_BIG_LINK_TITLE;
public final String ROBOCOP_BIG_MAILTO_TITLE;
public final String ROBOCOP_BLANK_PAGE_01_TITLE;
public final String ROBOCOP_BLANK_PAGE_02_TITLE;
public final String ROBOCOP_BLANK_PAGE_03_TITLE;
public final String ROBOCOP_BLANK_PAGE_04_TITLE;
public final String ROBOCOP_BLANK_PAGE_05_TITLE;
public final String ROBOCOP_BOXES_TITLE;
public final String ROBOCOP_GEOLOCATION_TITLE;
public final String ROBOCOP_LOGIN_TITLE;
public final String ROBOCOP_OFFLINE_STORAGE_TITLE;
public final String ROBOCOP_PICTURE_LINK_TITLE;
public final String ROBOCOP_SEARCH_TITLE;
public final String ROBOCOP_TEXT_PAGE_TITLE;
public final String ROBOCOP_INPUT_TITLE;
// Distribution tile labels
public final String DISTRIBUTION1_LABEL;
public final String DISTRIBUTION2_LABEL;
// Settings menu strings
// Section labels - ordered as found in the settings menu
public final String CUSTOMIZE_SECTION_LABEL;
public final String DISPLAY_SECTION_LABEL;
public final String PRIVACY_SECTION_LABEL;
public final String MOZILLA_SECTION_LABEL;
public final String DEVELOPER_TOOLS_SECTION_LABEL;
// Option labels
// Customize
public final String SYNC_LABEL;
public final String IMPORT_FROM_ANDROID_LABEL;
public final String TABS_LABEL;
// Display
public final String TEXT_SIZE_LABEL;
public final String TITLE_BAR_LABEL;
public final String SCROLL_TITLE_BAR_LABEL;
public final String TEXT_REFLOW_LABEL;
public final String CHARACTER_ENCODING_LABEL;
public final String PLUGINS_LABEL;
// Title bar
public final String SHOW_PAGE_TITLE_LABEL;
public final String SHOW_PAGE_ADDRESS_LABEL;
// Privacy
public final String TRACKING_PROTECTION_LABEL;
public final String DNT_LABEL;
public final String COOKIES_LABEL;
public final String REMEMBER_PASSWORDS_LABEL;
public final String MASTER_PASSWORD_LABEL;
public final String CLEAR_PRIVATE_DATA_LABEL;
// Mozilla
public final String BRAND_NAME;
public final String ABOUT_LABEL;
public final String FAQS_LABEL;
public final String FEEDBACK_LABEL;
public final String LOCATION_SERVICES_LABEL;
public final String HEALTH_REPORT_LABEL;
public final String MY_HEALTH_REPORT_LABEL;
// Developer tools
public final String PAINT_FLASHING_LABEL;
public final String REMOTE_DEBUGGING_LABEL;
public final String LEARN_MORE_LABEL;
// Labels for the about:home tabs
public final String HISTORY_LABEL;
public final String TOP_SITES_LABEL;
public final String BOOKMARKS_LABEL;
public final String READING_LIST_LABEL;
public final String TODAY_LABEL;
public final String TABS_FROM_LAST_TIME_LABEL;
// Desktop default bookmarks folders
public final String BOOKMARKS_UP_TO;
public final String BOOKMARKS_ROOT_LABEL;
public final String DESKTOP_FOLDER_LABEL;
public final String TOOLBAR_FOLDER_LABEL;
public final String BOOKMARKS_MENU_FOLDER_LABEL;
public final String UNSORTED_FOLDER_LABEL;
// Menu items - some of the items are found only on android 2.3 and lower and some only on android 3.0+
public final String NEW_TAB_LABEL;
public final String NEW_PRIVATE_TAB_LABEL;
public final String SHARE_LABEL;
public final String FIND_IN_PAGE_LABEL;
public final String DESKTOP_SITE_LABEL;
public final String PDF_LABEL;
public final String DOWNLOADS_LABEL;
public final String ADDONS_LABEL;
public final String APPS_LABEL;
public final String SETTINGS_LABEL;
public final String GUEST_MODE_LABEL;
// Android 3.0+
public final String TOOLS_LABEL;
public final String PAGE_LABEL;
// Android 2.3 and lower only
public final String MORE_LABEL;
public final String RELOAD_LABEL;
public final String FORWARD_LABEL;
public final String BOOKMARK_LABEL;
// Bookmark Toast Notification
public final String BOOKMARK_ADDED_LABEL;
public final String BOOKMARK_REMOVED_LABEL;
public final String BOOKMARK_UPDATED_LABEL;
public final String BOOKMARK_OPTIONS_LABEL;
// Edit Bookmark screen
public final String EDIT_BOOKMARK;
// Strings used in doorhanger messages and buttons
public final String GEO_MESSAGE;
public final String GEO_ALLOW;
public final String GEO_DENY;
public final String OFFLINE_MESSAGE;
public final String OFFLINE_ALLOW;
public final String OFFLINE_DENY;
public final String LOGIN_MESSAGE;
public final String LOGIN_ALLOW;
public final String LOGIN_DENY;
public final String POPUP_MESSAGE;
public final String POPUP_ALLOW;
public final String POPUP_DENY;
private StringHelper (final Resources res) {
OK = res.getString(R.string.button_ok);
// Note: DEFAULT_BOOKMARKS_TITLES.length == DEFAULT_BOOKMARKS_URLS.length
DEFAULT_BOOKMARKS_TITLES = new String[] {
res.getString(R.string.bookmarkdefaults_title_aboutfirefox),
res.getString(R.string.bookmarkdefaults_title_support),
res.getString(R.string.bookmarkdefaults_title_addons)
};
DEFAULT_BOOKMARKS_URLS = new String[] {
res.getString(R.string.bookmarkdefaults_url_aboutfirefox),
res.getString(R.string.bookmarkdefaults_url_support),
res.getString(R.string.bookmarkdefaults_url_addons)
};
DEFAULT_BOOKMARKS_COUNT = DEFAULT_BOOKMARKS_TITLES.length;
// About pages
ABOUT_BLANK_URL = "about:blank";
ABOUT_FIREFOX_URL = res.getString(R.string.bookmarkdefaults_url_aboutfirefox);
ABOUT_RIGHTS_URL = "about:rights";
ABOUT_BUILDCONFIG_URL = "about:buildconfig";
ABOUT_FEEDBACK_URL = "about:feedback";
ABOUT_HEALTHREPORT_URL = "about:healthreport";
ABOUT_DOWNLOADS_URL = "about:downloads";
ABOUT_HOME_URL = "about:home";
ABOUT_ADDONS_URL = "about:addons";
ABOUT_APPS_URL = "about:apps";
ABOUT_ABOUT_URL = "about:about";
ABOUT_SCHEME = "about:";
// About pages' titles
ABOUT_HOME_TITLE = "";
// Context Menu item strings
CONTEXT_MENU_BOOKMARK_LINK = "Bookmark Link";
CONTEXT_MENU_OPEN_LINK_IN_NEW_TAB = "Open Link in New Tab";
CONTEXT_MENU_OPEN_IN_NEW_TAB = res.getString(R.string.contextmenu_open_new_tab);
CONTEXT_MENU_OPEN_LINK_IN_PRIVATE_TAB = "Open Link in Private Tab";
CONTEXT_MENU_OPEN_IN_PRIVATE_TAB = res.getString(R.string.contextmenu_open_private_tab);
CONTEXT_MENU_COPY_LINK = "Copy Link";
CONTEXT_MENU_SHARE_LINK = "Share Link";
CONTEXT_MENU_EDIT = res.getString(R.string.contextmenu_top_sites_edit);
CONTEXT_MENU_SHARE = res.getString(R.string.contextmenu_share);
CONTEXT_MENU_REMOVE = res.getString(R.string.contextmenu_remove);
CONTEXT_MENU_COPY_ADDRESS = res.getString(R.string.contextmenu_copyurl);
CONTEXT_MENU_EDIT_SITE_SETTINGS = res.getString(R.string.contextmenu_site_settings);
CONTEXT_MENU_ADD_TO_HOME_SCREEN = res.getString(R.string.contextmenu_add_to_launcher);
CONTEXT_MENU_PIN_SITE = res.getString(R.string.contextmenu_top_sites_pin);
CONTEXT_MENU_UNPIN_SITE = res.getString(R.string.contextmenu_top_sites_unpin);
// Context Menu menu items
CONTEXT_MENU_ITEMS_IN_PRIVATE_TAB = new String[] {
CONTEXT_MENU_OPEN_LINK_IN_PRIVATE_TAB,
CONTEXT_MENU_COPY_LINK,
CONTEXT_MENU_SHARE_LINK,
CONTEXT_MENU_BOOKMARK_LINK
};
CONTEXT_MENU_ITEMS_IN_NORMAL_TAB = new String[] {
CONTEXT_MENU_OPEN_LINK_IN_NEW_TAB,
CONTEXT_MENU_OPEN_LINK_IN_PRIVATE_TAB,
CONTEXT_MENU_COPY_LINK,
CONTEXT_MENU_SHARE_LINK,
CONTEXT_MENU_BOOKMARK_LINK
};
BOOKMARK_CONTEXT_MENU_ITEMS = new String[] {
CONTEXT_MENU_OPEN_IN_NEW_TAB,
CONTEXT_MENU_OPEN_IN_PRIVATE_TAB,
CONTEXT_MENU_COPY_ADDRESS,
CONTEXT_MENU_SHARE,
CONTEXT_MENU_EDIT,
CONTEXT_MENU_REMOVE,
CONTEXT_MENU_ADD_TO_HOME_SCREEN
};
CONTEXT_MENU_ITEMS_IN_URL_BAR = new String[] {
CONTEXT_MENU_SHARE,
CONTEXT_MENU_COPY_ADDRESS,
CONTEXT_MENU_EDIT_SITE_SETTINGS,
CONTEXT_MENU_ADD_TO_HOME_SCREEN
};
TITLE_PLACE_HOLDER = res.getString(R.string.url_bar_default_text);
// Robocop page urls
// Note: please use getAbsoluteUrl(String url) on each robocop url to get the correct url
ROBOCOP_BIG_LINK_URL = "/robocop/robocop_big_link.html";
ROBOCOP_BIG_MAILTO_URL = "/robocop/robocop_big_mailto.html";
ROBOCOP_BLANK_PAGE_01_URL = "/robocop/robocop_blank_01.html";
ROBOCOP_BLANK_PAGE_02_URL = "/robocop/robocop_blank_02.html";
ROBOCOP_BLANK_PAGE_03_URL = "/robocop/robocop_blank_03.html";
ROBOCOP_BLANK_PAGE_04_URL = "/robocop/robocop_blank_04.html";
ROBOCOP_BLANK_PAGE_05_URL = "/robocop/robocop_blank_05.html";
ROBOCOP_BOXES_URL = "/robocop/robocop_boxes.html";
ROBOCOP_GEOLOCATION_URL = "/robocop/robocop_geolocation.html";
ROBOCOP_LOGIN_URL = "/robocop/robocop_login.html";
ROBOCOP_POPUP_URL = "/robocop/robocop_popup.html";
ROBOCOP_OFFLINE_STORAGE_URL = "/robocop/robocop_offline_storage.html";
ROBOCOP_PICTURE_LINK_URL = "/robocop/robocop_picture_link.html";
ROBOCOP_SEARCH_URL = "/robocop/robocop_search.html";
ROBOCOP_TEXT_PAGE_URL = "/robocop/robocop_text_page.html";
ROBOCOP_ADOBE_FLASH_URL = "/robocop/robocop_adobe_flash.html";
ROBOCOP_INPUT_URL = "/robocop/robocop_input.html";
ROBOCOP_JS_HARNESS_URL = "/robocop/robocop_javascript.html";
// Robocop page titles
ROBOCOP_BIG_LINK_TITLE = "Big Link";
ROBOCOP_BIG_MAILTO_TITLE = "Big Mailto";
ROBOCOP_BLANK_PAGE_01_TITLE = "Browser Blank Page 01";
ROBOCOP_BLANK_PAGE_02_TITLE = "Browser Blank Page 02";
ROBOCOP_BLANK_PAGE_03_TITLE = "Browser Blank Page 03";
ROBOCOP_BLANK_PAGE_04_TITLE = "Browser Blank Page 04";
ROBOCOP_BLANK_PAGE_05_TITLE = "Browser Blank Page 05";
ROBOCOP_BOXES_TITLE = "Browser Box test";
ROBOCOP_GEOLOCATION_TITLE = "Geolocation Test Page";
ROBOCOP_LOGIN_TITLE = "Robocop Login";
ROBOCOP_OFFLINE_STORAGE_TITLE = "Robocop offline storage";
ROBOCOP_PICTURE_LINK_TITLE = "Picture Link";
ROBOCOP_SEARCH_TITLE = "Robocop Search Engine";
ROBOCOP_TEXT_PAGE_TITLE = "Robocop Text Page";
ROBOCOP_INPUT_TITLE = "Robocop Input";
// Distribution tile labels
DISTRIBUTION1_LABEL = "Distribution 1";
DISTRIBUTION2_LABEL = "Distribution 2";
// Settings menu strings
// Section labels - ordered as found in the settings menu
CUSTOMIZE_SECTION_LABEL = res.getString(R.string.pref_category_customize);
DISPLAY_SECTION_LABEL = res.getString(R.string.pref_category_display);
PRIVACY_SECTION_LABEL = res.getString(R.string.pref_category_privacy_short);
MOZILLA_SECTION_LABEL = res.getString(R.string.pref_category_vendor);
DEVELOPER_TOOLS_SECTION_LABEL = res.getString(R.string.pref_category_devtools);
// Option labels
// Customize
SYNC_LABEL = res.getString(R.string.pref_sync);
IMPORT_FROM_ANDROID_LABEL = res.getString(R.string.pref_import_android);
TABS_LABEL = res.getString(R.string.pref_restore);
// Display
TEXT_SIZE_LABEL = res.getString(R.string.pref_text_size);
TITLE_BAR_LABEL = "Title bar";
SCROLL_TITLE_BAR_LABEL = res.getString(R.string.pref_scroll_title_bar2);
TEXT_REFLOW_LABEL = res.getString(R.string.pref_reflow_on_zoom);
CHARACTER_ENCODING_LABEL = res.getString(R.string.pref_char_encoding);
PLUGINS_LABEL = res.getString(R.string.pref_plugins);
// Title bar
SHOW_PAGE_TITLE_LABEL = "Show page title";
SHOW_PAGE_ADDRESS_LABEL = "Show page address";
// Privacy
TRACKING_PROTECTION_LABEL = res.getString(R.string.pref_tracking_protection_title);
DNT_LABEL = res.getString(R.string.pref_donottrack_title);
COOKIES_LABEL = res.getString(R.string.pref_cookies_menu);
REMEMBER_PASSWORDS_LABEL = res.getString(R.string.pref_remember_signons);
MASTER_PASSWORD_LABEL = res.getString(R.string.pref_use_master_password);
CLEAR_PRIVATE_DATA_LABEL = res.getString(R.string.pref_clear_private_data);
// Mozilla
BRAND_NAME = "(Fennec|Nightly|Aurora|Firefox Beta|Firefox)";
ABOUT_LABEL = "About " + BRAND_NAME;
FAQS_LABEL = res.getString(R.string.pref_vendor_faqs);
FEEDBACK_LABEL = res.getString(R.string.pref_vendor_feedback);
LOCATION_SERVICES_LABEL = "Mozilla Location Service";
HEALTH_REPORT_LABEL = BRAND_NAME + " Health Report";
MY_HEALTH_REPORT_LABEL = res.getString(R.string.datareporting_abouthr_title);
// Developer tools
PAINT_FLASHING_LABEL = res.getString(R.string.pref_developer_paint_flashing);
REMOTE_DEBUGGING_LABEL = res.getString(R.string.pref_developer_remotedebugging);
LEARN_MORE_LABEL = res.getString(R.string.pref_learn_more);
// Labels for the about:home tabs
HISTORY_LABEL = res.getString(R.string.home_history_title);
TOP_SITES_LABEL = res.getString(R.string.home_top_sites_title);
BOOKMARKS_LABEL = res.getString(R.string.bookmarks_title);
READING_LIST_LABEL = res.getString(R.string.reading_list_title);
TODAY_LABEL = res.getString(R.string.history_today_section);
TABS_FROM_LAST_TIME_LABEL = "Open all tabs from last time";
// Desktop default bookmarks folders
BOOKMARKS_UP_TO = res.getString(R.string.home_move_up_to_filter);
BOOKMARKS_ROOT_LABEL = res.getString(R.string.bookmarks_title);
DESKTOP_FOLDER_LABEL = res.getString(R.string.bookmarks_folder_desktop);
TOOLBAR_FOLDER_LABEL = res.getString(R.string.bookmarks_folder_toolbar);
BOOKMARKS_MENU_FOLDER_LABEL = res.getString(R.string.bookmarks_folder_menu);
UNSORTED_FOLDER_LABEL = res.getString(R.string.bookmarks_folder_unfiled);
// Menu items - some of the items are found only on android 2.3 and lower and some only on android 3.0+
NEW_TAB_LABEL = res.getString(R.string.new_tab);
NEW_PRIVATE_TAB_LABEL = res.getString(R.string.new_private_tab);
SHARE_LABEL = res.getString(R.string.share);
FIND_IN_PAGE_LABEL = res.getString(R.string.find_in_page);
DESKTOP_SITE_LABEL = res.getString(R.string.desktop_mode);
PDF_LABEL = res.getString(R.string.save_as_pdf);
DOWNLOADS_LABEL = res.getString(R.string.downloads);
ADDONS_LABEL = res.getString(R.string.addons);
APPS_LABEL = res.getString(R.string.apps);
SETTINGS_LABEL = res.getString(R.string.settings);
GUEST_MODE_LABEL = res.getString(R.string.new_guest_session);
// Android 3.0+
TOOLS_LABEL = res.getString(R.string.tools);
PAGE_LABEL = res.getString(R.string.page);
// Android 2.3 and lower only
MORE_LABEL = "More";
RELOAD_LABEL = res.getString(R.string.reload);
FORWARD_LABEL = res.getString(R.string.forward);
BOOKMARK_LABEL = res.getString(R.string.bookmark);
// Bookmark Toast Notification
BOOKMARK_ADDED_LABEL = res.getString(R.string.bookmark_added);
BOOKMARK_REMOVED_LABEL = res.getString(R.string.bookmark_removed);
BOOKMARK_UPDATED_LABEL = res.getString(R.string.bookmark_updated);
BOOKMARK_OPTIONS_LABEL = res.getString(R.string.bookmark_options);
// Edit Bookmark screen
EDIT_BOOKMARK = res.getString(R.string.bookmark_edit_title);
// Strings used in doorhanger messages and buttons
GEO_MESSAGE = "Share your location with";
GEO_ALLOW = res.getString(R.string.share);
GEO_DENY = "Don't share";
OFFLINE_MESSAGE = "to store data on your device for offline use";
OFFLINE_ALLOW = "Allow";
OFFLINE_DENY = "Don't allow";
LOGIN_MESSAGE = "Save password";
LOGIN_ALLOW = "Save";
LOGIN_DENY = "Don't save";
POPUP_MESSAGE = "prevented this site from opening";
POPUP_ALLOW = res.getString(R.string.pref_panels_show);
POPUP_DENY = "Don't show";
}
public static void initialize(Resources res) {
if (instance != null) {
throw new IllegalStateException(StringHelper.class.getSimpleName() + " already Initialized");
}
instance = new StringHelper(res);
}
public static StringHelper get() {
if (instance == null) {
throw new IllegalStateException(StringHelper.class.getSimpleName() + " instance is not yet initialized. Use StringHelper.initialize(Resources) first.");
}
return instance;
}
/**
* Build a URL for loading a Javascript file in the Robocop Javascript
@ -125,144 +488,10 @@ public class StringHelper {
* @param javascriptUrl to load.
* @return URL with harness wrapper.
*/
public static String getHarnessUrlForJavascript(String javascriptUrl) {
public String getHarnessUrlForJavascript(String javascriptUrl) {
// We include a slug to make sure we never cache the harness.
return ROBOCOP_JS_HARNESS_URL +
"?slug=" + System.currentTimeMillis() +
"&path=" + javascriptUrl;
}
// Robocop page titles
public static final String ROBOCOP_BIG_LINK_TITLE = "Big Link";
public static final String ROBOCOP_BIG_MAILTO_TITLE = "Big Mailto";
public static final String ROBOCOP_BLANK_PAGE_01_TITLE = "Browser Blank Page 01";
public static final String ROBOCOP_BLANK_PAGE_02_TITLE = "Browser Blank Page 02";
public static final String ROBOCOP_BLANK_PAGE_03_TITLE = "Browser Blank Page 03";
public static final String ROBOCOP_BLANK_PAGE_04_TITLE = "Browser Blank Page 04";
public static final String ROBOCOP_BLANK_PAGE_05_TITLE = "Browser Blank Page 05";
public static final String ROBOCOP_BOXES_TITLE = "Browser Box test";
public static final String ROBOCOP_GEOLOCATION_TITLE = "Geolocation Test Page";
public static final String ROBOCOP_LOGIN_TITLE = "Robocop Login";
public static final String ROBOCOP_OFFLINE_STORAGE_TITLE = "Robocop offline storage";
public static final String ROBOCOP_PICTURE_LINK_TITLE = "Picture Link";
public static final String ROBOCOP_SEARCH_TITLE = "Robocop Search Engine";
public static final String ROBOCOP_TEXT_PAGE_TITLE = "Robocop Text Page";
public static final String ROBOCOP_INPUT_TITLE = "Robocop Input";
// Distribution tile labels
public static final String DISTRIBUTION1_LABEL = "Distribution 1";
public static final String DISTRIBUTION2_LABEL = "Distribution 2";
// Settings menu strings
// Section labels - ordered as found in the settings menu
public static final String CUSTOMIZE_SECTION_LABEL = "Customize";
public static final String DISPLAY_SECTION_LABEL = "Display";
public static final String PRIVACY_SECTION_LABEL = "Privacy";
public static final String MOZILLA_SECTION_LABEL = "Mozilla";
public static final String DEVELOPER_TOOLS_SECTION_LABEL = "Developer tools";
// Option labels
// Customize
public static final String SYNC_LABEL = "Sync";
public static final String IMPORT_FROM_ANDROID_LABEL = "Import from Android";
public static final String TABS_LABEL = "Tabs";
// Display
public static final String TEXT_SIZE_LABEL = "Text size";
public static final String TITLE_BAR_LABEL = "Title bar";
public static final String SCROLL_TITLE_BAR_LABEL = "Full-screen browsing";
public static final String TEXT_REFLOW_LABEL = "Text reflow";
public static final String CHARACTER_ENCODING_LABEL = "Character encoding";
public static final String PLUGINS_LABEL = "Plugins";
// Title bar
public static final String SHOW_PAGE_TITLE_LABEL = "Show page title";
public static final String SHOW_PAGE_ADDRESS_LABEL = "Show page address";
// Privacy
public static final String TRACKING_PROTECTION_LABEL = "Tracking protection";
public static final String DNT_LABEL = "Do not track";
public static final String COOKIES_LABEL = "Cookies";
public static final String REMEMBER_PASSWORDS_LABEL = "Remember passwords";
public static final String MASTER_PASSWORD_LABEL = "Use master password";
public static final String CLEAR_PRIVATE_DATA_LABEL = "Clear now";
// Mozilla
public static final String BRAND_NAME = "(Fennec|Nightly|Aurora|Firefox Beta|Firefox)";
public static final String ABOUT_LABEL = "About " + BRAND_NAME;
public static final String FAQS_LABEL = "FAQs";
public static final String FEEDBACK_LABEL = "Give feedback";
public static final String LOCATION_SERVICES_LABEL = "Mozilla Location Service";
public static final String HEALTH_REPORT_LABEL = BRAND_NAME + " Health Report";
public static final String MY_HEALTH_REPORT_LABEL = "View my Health Report";
// Developer tools
public static final String PAINT_FLASHING_LABEL = "Paint flashing";
public static final String REMOTE_DEBUGGING_LABEL = "Remote debugging";
public static final String LEARN_MORE_LABEL = "Learn more";
// Labels for the about:home tabs
public static final String HISTORY_LABEL = "HISTORY";
public static final String TOP_SITES_LABEL = "TOP SITES";
public static final String BOOKMARKS_LABEL = "BOOKMARKS";
public static final String READING_LIST_LABEL = "READING LIST";
public static final String TODAY_LABEL = "Today";
public static final String TABS_FROM_LAST_TIME_LABEL = "Open all tabs from last time";
// Desktop default bookmarks folders
public static final String BOOKMARKS_UP_TO = "Up to %s";
public static final String BOOKMARKS_ROOT_LABEL = "Bookmarks";
public static final String DESKTOP_FOLDER_LABEL = "Desktop Bookmarks";
public static final String TOOLBAR_FOLDER_LABEL = "Bookmarks Toolbar";
public static final String BOOKMARKS_MENU_FOLDER_LABEL = "Bookmarks Menu";
public static final String UNSORTED_FOLDER_LABEL = "Unsorted Bookmarks";
// Menu items - some of the items are found only on android 2.3 and lower and some only on android 3.0+
public static final String NEW_TAB_LABEL = "New Tab";
public static final String NEW_PRIVATE_TAB_LABEL = "New Private Tab";
public static final String SHARE_LABEL = "Share";
public static final String FIND_IN_PAGE_LABEL = "Find in Page";
public static final String DESKTOP_SITE_LABEL = "Request Desktop Site";
public static final String PDF_LABEL = "Save as PDF";
public static final String DOWNLOADS_LABEL = "Downloads";
public static final String ADDONS_LABEL = "Add-ons";
public static final String APPS_LABEL = "Apps";
public static final String SETTINGS_LABEL = "Settings";
public static final String GUEST_MODE_LABEL = "New Guest Session";
// Android 3.0+
public static final String TOOLS_LABEL = "Tools";
public static final String PAGE_LABEL = "Page";
// Android 2.3 and lower only
public static final String MORE_LABEL = "More";
public static final String RELOAD_LABEL = "Reload";
public static final String FORWARD_LABEL = "Forward";
public static final String BOOKMARK_LABEL = "Bookmark";
// Bookmark Toast Notification
public static final String BOOKMARK_ADDED_LABEL = "Bookmark added";
public static final String BOOKMARK_REMOVED_LABEL = "Bookmark removed";
public static final String BOOKMARK_UPDATED_LABEL = "Bookmark updated";
public static final String BOOKMARK_OPTIONS_LABEL = "Options";
// Edit Bookmark screen
public static final String EDIT_BOOKMARK = "Edit Bookmark";
// Strings used in doorhanger messages and buttons
public static final String GEO_MESSAGE = "Share your location with";
public static final String GEO_ALLOW = "Share";
public static final String GEO_DENY = "Don't share";
public static final String OFFLINE_MESSAGE = "to store data on your device for offline use";
public static final String OFFLINE_ALLOW = "Allow";
public static final String OFFLINE_DENY = "Don't allow";
public static final String LOGIN_MESSAGE = "Save password";
public static final String LOGIN_ALLOW = "Save";
public static final String LOGIN_DENY = "Don't save";
public static final String POPUP_MESSAGE = "prevented this site from opening";
public static final String POPUP_ALLOW = "Show";
public static final String POPUP_DENY = "Don't show";
}

View File

@ -18,6 +18,7 @@ import org.mozilla.gecko.tests.components.ToolbarComponent;
import org.mozilla.gecko.tests.helpers.HelperInitializer;
import android.content.Intent;
import android.content.res.Resources;
import android.text.TextUtils;
import com.jayway.android.robotium.solo.Solo;

View File

@ -51,8 +51,9 @@ public class ToolbarComponent extends BaseComponent {
final String expected;
final String absoluteURL = NavigationHelper.adjustUrl(url);
if (StringHelper.ABOUT_HOME_URL.equals(absoluteURL)) {
expected = StringHelper.ABOUT_HOME_TITLE;
if (StringHelper.get().ABOUT_HOME_URL.equals(absoluteURL)) {
expected = StringHelper.get().ABOUT_HOME_TITLE;
} else if (absoluteURL.startsWith(URL_HTTP_PREFIX)) {
expected = absoluteURL.substring(URL_HTTP_PREFIX.length());
} else {

View File

@ -17,18 +17,18 @@ public class testAboutHomeVisibility extends UITest {
GeckoHelper.blockForReady();
// Check initial state on about:home.
mToolbar.assertTitle(StringHelper.ABOUT_HOME_URL);
mToolbar.assertTitle(mStringHelper.ABOUT_HOME_URL);
mAboutHome.assertVisible()
.assertCurrentPanel(PanelType.TOP_SITES);
// Go to blank 01.
NavigationHelper.enterAndLoadUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
NavigationHelper.enterAndLoadUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
mToolbar.assertTitle(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
mAboutHome.assertNotVisible();
// Go to blank 02.
NavigationHelper.enterAndLoadUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
NavigationHelper.enterAndLoadUrl(mStringHelper.ROBOCOP_BLANK_PAGE_02_URL);
mToolbar.assertTitle(mStringHelper.ROBOCOP_BLANK_PAGE_02_URL);
mAboutHome.assertNotVisible();
// Enter editing mode, where the about:home UI should be visible.
@ -41,8 +41,8 @@ public class testAboutHomeVisibility extends UITest {
mAboutHome.assertNotVisible();
// Loading about:home should show about:home again.
NavigationHelper.enterAndLoadUrl(StringHelper.ABOUT_HOME_URL);
mToolbar.assertTitle(StringHelper.ABOUT_HOME_URL);
NavigationHelper.enterAndLoadUrl(mStringHelper.ABOUT_HOME_URL);
mToolbar.assertTitle(mStringHelper.ABOUT_HOME_URL);
mAboutHome.assertVisible()
.assertCurrentPanel(PanelType.TOP_SITES);

View File

@ -21,13 +21,13 @@ public class testAboutPage extends PixelTest {
blockForGeckoReady();
// Load the about: page and verify its title.
String url = StringHelper.ABOUT_SCHEME;
String url = mStringHelper.ABOUT_SCHEME;
loadAndPaint(url);
verifyUrlBarTitle(url);
// Open a new page to remove the about: page from the current tab.
url = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
url = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
inputAndLoadUrl(url);
// At this point the page title should have been set.
@ -37,7 +37,7 @@ public class testAboutPage extends PixelTest {
Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
selectSettingsItem(StringHelper.MOZILLA_SECTION_LABEL, StringHelper.ABOUT_LABEL);
selectSettingsItem(mStringHelper.MOZILLA_SECTION_LABEL, mStringHelper.ABOUT_LABEL);
// Wait for the new tab and page to load
tabEventExpecter.blockForEvent();
@ -47,6 +47,6 @@ public class testAboutPage extends PixelTest {
contentEventExpecter.unregisterListener();
// Make sure the about: page was loaded.
verifyUrlBarTitle(StringHelper.ABOUT_SCHEME);
verifyUrlBarTitle(mStringHelper.ABOUT_SCHEME);
}
}

View File

@ -30,15 +30,15 @@ public class testAddSearchEngine extends AboutHomeTest {
private final String ADD_SEARCHENGINE_OPTION_TEXT = "Add as Search Engine";
public void testAddSearchEngine() {
String blankPageURL = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String searchEngineURL = getAbsoluteUrl(StringHelper.ROBOCOP_SEARCH_URL);
String blankPageURL = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String searchEngineURL = getAbsoluteUrl(mStringHelper.ROBOCOP_SEARCH_URL);
blockForGeckoReady();
int height = mDriver.getGeckoTop() + 150;
int width = mDriver.getGeckoLeft() + 150;
inputAndLoadUrl(blankPageURL);
waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
// Get the searchengine data by clicking the awesomebar - this causes Gecko to send Java the list
// of search engines.
@ -79,12 +79,12 @@ public class testAddSearchEngine extends AboutHomeTest {
waitForText("Cancel");
clickOnButton("OK");
mAsserter.ok(!mSolo.searchText(ADD_SEARCHENGINE_OPTION_TEXT), "Adding the Search Engine", "The add Search Engine pop-up has been closed");
waitForText(StringHelper.ROBOCOP_SEARCH_TITLE); // Make sure the pop-up is closed and we are back at the searchengine page
waitForText(mStringHelper.ROBOCOP_SEARCH_TITLE); // Make sure the pop-up is closed and we are back at the searchengine page
// Load Robocop Blank 1 again to give the time for the searchengine to be added
// TODO: This is a potential source of intermittent oranges - it's a race condition!
loadUrl(blankPageURL);
waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
// Load search engines again and check that the quantity of engines has increased by 1.
searchEngineDataEventExpector = mActions.expectGeckoEvent("SearchEngines:Data");
@ -157,7 +157,7 @@ public class testAddSearchEngine extends AboutHomeTest {
// Exit about:home
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
mAsserter.ok(correctNumSearchEnginesDisplayed, expectedCount + " Search Engines should be displayed" , "The correct number of Search Engines has been displayed");
}
}

View File

@ -21,12 +21,12 @@ public class testAddonManager extends PixelTest {
public void testAddonManager() {
Actions.EventExpecter tabEventExpecter;
Actions.EventExpecter contentEventExpecter;
final String aboutAddonsURL = StringHelper.ABOUT_ADDONS_URL;
final String aboutAddonsURL = mStringHelper.ABOUT_ADDONS_URL;
blockForGeckoReady();
// Use the menu to open the Addon Manger
selectMenuItem(StringHelper.ADDONS_LABEL);
selectMenuItem(mStringHelper.ADDONS_LABEL);
// Set up listeners to catch the page load we're about to do
tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
@ -54,7 +54,7 @@ public class testAddonManager extends PixelTest {
contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
// Open a new tab
final String blankURL = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
final String blankURL = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
addTab(blankURL);
// Wait for the new tab and page to load
@ -71,7 +71,7 @@ public class testAddonManager extends PixelTest {
verifyUrlBarTitle(blankURL);
// Addons Manager is not opened 2 separate times when opened from the menu
selectMenuItem(StringHelper.ADDONS_LABEL);
selectMenuItem(mStringHelper.ADDONS_LABEL);
// Verify tab count not increased
verifyTabCount(2);

View File

@ -35,7 +35,7 @@ public class testAdobeFlash extends PixelTest {
blockForGeckoReady();
String url = getAbsoluteUrl(StringHelper.ROBOCOP_ADOBE_FLASH_URL);
String url = getAbsoluteUrl(mStringHelper.ROBOCOP_ADOBE_FLASH_URL);
PaintedSurface painted = loadAndGetPainted(url);
mAsserter.ispixel(painted.getPixelAt(0, 0), 0, 0xff, 0, "Pixel at 0, 0");

View File

@ -51,8 +51,8 @@ public class testAppMenuPathways extends UITest {
// The above mock video playback test changes Java state, but not the associated JS state.
// Navigate to a new page so that the Java state is cleared.
NavigationHelper.enterAndLoadUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
NavigationHelper.enterAndLoadUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
mToolbar.assertTitle(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
// Test save as pdf functionality.
// The following call doesn't wait for the resulting pdf but checks that no exception are thrown.

View File

@ -8,7 +8,7 @@ public class testAwesomebar extends BaseTest {
public void testAwesomebar() {
blockForGeckoReady();
String url = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String url = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
inputAndLoadUrl(url);
mDriver.setupScrollHandling();

View File

@ -17,7 +17,7 @@ import org.mozilla.gecko.PaintedSurface;
*/
public class testAxisLocking extends PixelTest {
public void testAxisLocking() {
String url = getAbsoluteUrl(StringHelper.ROBOCOP_BOXES_URL);
String url = getAbsoluteUrl(mStringHelper.ROBOCOP_BOXES_URL);
MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());

View File

@ -10,7 +10,7 @@ public class testBookmark extends AboutHomeTest {
private static final int WAIT_FOR_BOOKMARKED_TIMEOUT = 10000;
public void testBookmark() {
BOOKMARK_URL = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
BOOKMARK_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
runAboutHomeTest();
runMenuTest();
}
@ -26,16 +26,16 @@ public class testBookmark extends AboutHomeTest {
public void runAboutHomeTest() {
blockForGeckoReady();
for (String url:StringHelper.DEFAULT_BOOKMARKS_URLS) {
for (String url : mStringHelper.DEFAULT_BOOKMARKS_URLS) {
mAsserter.ok(mDatabaseHelper.isBookmark(url), "Checking that " + url + " is bookmarked by default", url + " is bookmarked");
}
mDatabaseHelper.addOrUpdateMobileBookmark(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE, BOOKMARK_URL);
mDatabaseHelper.addOrUpdateMobileBookmark(mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE, BOOKMARK_URL);
waitForBookmarked(true);
isBookmarkDisplayed(BOOKMARK_URL);
loadBookmark(BOOKMARK_URL);
verifyUrlBarTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
verifyUrlBarTitle(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
mDatabaseHelper.deleteBookmark(BOOKMARK_URL);
waitForBookmarked(false);
@ -56,16 +56,16 @@ public class testBookmark extends AboutHomeTest {
private void setUpBookmark() {
// Bookmark a page for the test
loadUrl(BOOKMARK_URL);
waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
toggleBookmark();
mAsserter.is(waitForText(StringHelper.BOOKMARK_ADDED_LABEL), true, "bookmark added successfully");
mAsserter.is(waitForText(mStringHelper.BOOKMARK_ADDED_LABEL), true, "bookmark added successfully");
}
private void cleanUpBookmark() {
// Go back to the page we bookmarked
loadUrl(BOOKMARK_URL);
waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
toggleBookmark();
mAsserter.is(waitForText(StringHelper.BOOKMARK_REMOVED_LABEL), true, "bookmark removed successfully");
mAsserter.is(waitForText(mStringHelper.BOOKMARK_REMOVED_LABEL), true, "bookmark removed successfully");
}
}

View File

@ -21,7 +21,7 @@ public class testBookmarkFolders extends AboutHomeTest {
private static String DESKTOP_BOOKMARK_URL;
public void testBookmarkFolders() {
DESKTOP_BOOKMARK_URL = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
DESKTOP_BOOKMARK_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_02_URL);
setUpDesktopBookmarks();
checkBookmarkList();
@ -29,9 +29,9 @@ public class testBookmarkFolders extends AboutHomeTest {
private void checkBookmarkList() {
openAboutHomeTab(AboutHomeTabs.BOOKMARKS);
waitForText(StringHelper.DESKTOP_FOLDER_LABEL);
clickOnBookmarkFolder(StringHelper.DESKTOP_FOLDER_LABEL);
waitForText(StringHelper.TOOLBAR_FOLDER_LABEL);
waitForText(mStringHelper.DESKTOP_FOLDER_LABEL);
clickOnBookmarkFolder(mStringHelper.DESKTOP_FOLDER_LABEL);
waitForText(mStringHelper.TOOLBAR_FOLDER_LABEL);
// Verify the number of folders displayed in the Desktop Bookmarks folder is correct
ListView desktopFolderContent = findListViewWithTag(HomePager.LIST_TAG_BOOKMARKS);
@ -40,17 +40,17 @@ public class testBookmarkFolders extends AboutHomeTest {
// Three folders and "Up to Bookmarks".
mAsserter.is(adapter.getCount(), 4, "Checking that the correct number of folders is displayed in the Desktop Bookmarks folder");
clickOnBookmarkFolder(StringHelper.TOOLBAR_FOLDER_LABEL);
clickOnBookmarkFolder(mStringHelper.TOOLBAR_FOLDER_LABEL);
// Go up in the bookmark folder hierarchy
clickOnBookmarkFolder(String.format(StringHelper.BOOKMARKS_UP_TO, StringHelper.DESKTOP_FOLDER_LABEL));
mAsserter.ok(waitForText(StringHelper.BOOKMARKS_MENU_FOLDER_LABEL), "Going up in the folder hierarchy", "We are back in the Desktop Bookmarks folder");
clickOnBookmarkFolder(String.format(mStringHelper.BOOKMARKS_UP_TO, mStringHelper.DESKTOP_FOLDER_LABEL));
mAsserter.ok(waitForText(mStringHelper.BOOKMARKS_MENU_FOLDER_LABEL), "Going up in the folder hierarchy", "We are back in the Desktop Bookmarks folder");
clickOnBookmarkFolder(String.format(StringHelper.BOOKMARKS_UP_TO, StringHelper.BOOKMARKS_ROOT_LABEL));
mAsserter.ok(waitForText(StringHelper.DESKTOP_FOLDER_LABEL), "Going up in the folder hierarchy", "We are back in the main Bookmarks List View");
clickOnBookmarkFolder(String.format(mStringHelper.BOOKMARKS_UP_TO, mStringHelper.BOOKMARKS_ROOT_LABEL));
mAsserter.ok(waitForText(mStringHelper.DESKTOP_FOLDER_LABEL), "Going up in the folder hierarchy", "We are back in the main Bookmarks List View");
clickOnBookmarkFolder(StringHelper.DESKTOP_FOLDER_LABEL);
clickOnBookmarkFolder(StringHelper.TOOLBAR_FOLDER_LABEL);
clickOnBookmarkFolder(mStringHelper.DESKTOP_FOLDER_LABEL);
clickOnBookmarkFolder(mStringHelper.TOOLBAR_FOLDER_LABEL);
isBookmarkDisplayed(DESKTOP_BOOKMARK_URL);
// Open the bookmark from a bookmark folder hierarchy
@ -62,7 +62,7 @@ public class testBookmarkFolders extends AboutHomeTest {
boolean success = waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
View desktopFolder = getBookmarkFolderView(StringHelper.DESKTOP_FOLDER_LABEL);
View desktopFolder = getBookmarkFolderView(mStringHelper.DESKTOP_FOLDER_LABEL);
if (desktopFolder == null) {
return false;
}
@ -72,11 +72,11 @@ public class testBookmarkFolders extends AboutHomeTest {
mAsserter.ok(success, "Trying to long click on the Desktop Bookmarks","Desktop Bookmarks folder could not be long clicked");
final String contextMenuString = StringHelper.BOOKMARK_CONTEXT_MENU_ITEMS[0];
final String contextMenuString = mStringHelper.BOOKMARK_CONTEXT_MENU_ITEMS[0];
mAsserter.ok(!waitForText(contextMenuString), "Folders do not have context menus", "The context menu was not opened");
// Even if no context menu is opened long clicking a folder still opens it. We need to close it.
clickOnBookmarkFolder(String.format(StringHelper.BOOKMARKS_UP_TO, StringHelper.BOOKMARKS_ROOT_LABEL));
clickOnBookmarkFolder(String.format(mStringHelper.BOOKMARKS_UP_TO, mStringHelper.BOOKMARKS_ROOT_LABEL));
}
private void clickOnBookmarkFolder(final String folderName) {
@ -127,7 +127,7 @@ public class testBookmarkFolders extends AboutHomeTest {
private void setUpDesktopBookmarks() {
blockForGeckoReady();
// Get the folder id of the StringHelper.DESKTOP_FOLDER_LABEL folder
// Get the folder id of the mStringHelper.DESKTOP_FOLDER_LABEL folder
Long desktopFolderId = mDatabaseHelper.getFolderIdFromGuid("toolbar");
// Generate a Guid for the bookmark
@ -140,7 +140,7 @@ public class testBookmarkFolders extends AboutHomeTest {
long now = System.currentTimeMillis();
ContentValues values = new ContentValues();
values.put("title", StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
values.put("title", mStringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
values.put("url", DESKTOP_BOOKMARK_URL);
values.put("parent", desktopFolderId);
values.put("modified", now);

View File

@ -9,18 +9,18 @@ public class testBookmarkKeyword extends AboutHomeTest {
public void testBookmarkKeyword() {
blockForGeckoReady();
final String url = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
final String url = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
final String keyword = "testkeyword";
// Add a bookmark, and update it to have a keyword.
mDatabaseHelper.addOrUpdateMobileBookmark(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE, url);
mDatabaseHelper.updateBookmark(url, StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE, keyword);
mDatabaseHelper.addOrUpdateMobileBookmark(mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE, url);
mDatabaseHelper.updateBookmark(url, mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE, keyword);
// Enter the keyword in the urlbar.
inputAndLoadUrl(keyword);
// Make sure the title of the page appeared.
verifyUrlBarTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
verifyUrlBarTitle(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
// Delete the bookmark to clean up.
mDatabaseHelper.deleteBookmark(url);

View File

@ -13,7 +13,7 @@ import android.widget.ListView;
public class testBookmarklets extends AboutHomeTest {
public void testBookmarklets() {
final String url = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
final String url = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
final String title = "alertBookmarklet";
final String js = "javascript:alert(12 + .34)";
boolean alerted;
@ -23,7 +23,7 @@ public class testBookmarklets extends AboutHomeTest {
// load a standard page so bookmarklets work
inputAndLoadUrl(url);
// Waiting for page title to ensure the page is loaded
verifyUrlBarTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
verifyUrlBarTitle(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
// verify that user-entered bookmarklets do *not* work
enterUrl(js);

View File

@ -13,7 +13,7 @@ import org.mozilla.gecko.util.StringUtils;
public class testBookmarksPanel extends AboutHomeTest {
public void testBookmarksPanel() {
final String BOOKMARK_URL = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
final String BOOKMARK_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
JSONObject data = null;
// Make sure our default bookmarks are loaded.
@ -21,38 +21,38 @@ public class testBookmarksPanel extends AboutHomeTest {
initializeProfile();
// Add a mobile bookmark.
mDatabaseHelper.addOrUpdateMobileBookmark(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE, BOOKMARK_URL);
mDatabaseHelper.addOrUpdateMobileBookmark(mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE, BOOKMARK_URL);
openAboutHomeTab(AboutHomeTabs.BOOKMARKS);
// Check that the default bookmarks are displayed.
// We need to wait for the distribution to have been processed
// before this will succeed.
for (String url : StringHelper.DEFAULT_BOOKMARKS_URLS) {
for (String url : mStringHelper.DEFAULT_BOOKMARKS_URLS) {
isBookmarkDisplayed(url);
}
assertAllContextMenuOptionsArePresent(StringHelper.DEFAULT_BOOKMARKS_URLS[1],
StringHelper.DEFAULT_BOOKMARKS_URLS[0]);
assertAllContextMenuOptionsArePresent(mStringHelper.DEFAULT_BOOKMARKS_URLS[1],
mStringHelper.DEFAULT_BOOKMARKS_URLS[0]);
openBookmarkContextMenu(StringHelper.DEFAULT_BOOKMARKS_URLS[0]);
openBookmarkContextMenu(mStringHelper.DEFAULT_BOOKMARKS_URLS[0]);
// Test that "Open in New Tab" works
final Element tabCount = mDriver.findElement(getActivity(), R.id.tabs_counter);
final int tabCountInt = Integer.parseInt(tabCount.getText());
Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
mSolo.clickOnText(StringHelper.BOOKMARK_CONTEXT_MENU_ITEMS[0]);
mSolo.clickOnText(mStringHelper.BOOKMARK_CONTEXT_MENU_ITEMS[0]);
try {
data = new JSONObject(tabEventExpecter.blockForEventData());
} catch (JSONException e) {
mAsserter.ok(false, "exception getting event data", e.toString());
}
tabEventExpecter.unregisterListener();
mAsserter.ok(mSolo.searchText(StringHelper.TITLE_PLACE_HOLDER), "Checking that the tab is not changed", "The tab was not changed");
mAsserter.ok(mSolo.searchText(mStringHelper.TITLE_PLACE_HOLDER), "Checking that the tab is not changed", "The tab was not changed");
// extra check here on the Tab:Added message to be sure the right tab opened
int tabID = 0;
try {
mAsserter.is(StringHelper.ABOUT_FIREFOX_URL, data.getString("uri"), "Checking tab uri");
mAsserter.is(mStringHelper.ABOUT_FIREFOX_URL, data.getString("uri"), "Checking tab uri");
tabID = data.getInt("tabID");
} catch (JSONException e) {
mAsserter.ok(false, "exception accessing event data", e.toString());
@ -61,19 +61,19 @@ public class testBookmarksPanel extends AboutHomeTest {
closeTab(tabID);
// Test that "Open in Private Tab" works
openBookmarkContextMenu(StringHelper.DEFAULT_BOOKMARKS_URLS[0]);
openBookmarkContextMenu(mStringHelper.DEFAULT_BOOKMARKS_URLS[0]);
tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
mSolo.clickOnText(StringHelper.BOOKMARK_CONTEXT_MENU_ITEMS[1]);
mSolo.clickOnText(mStringHelper.BOOKMARK_CONTEXT_MENU_ITEMS[1]);
try {
data = new JSONObject(tabEventExpecter.blockForEventData());
} catch (JSONException e) {
mAsserter.ok(false, "exception getting event data", e.toString());
}
tabEventExpecter.unregisterListener();
mAsserter.ok(mSolo.searchText(StringHelper.TITLE_PLACE_HOLDER), "Checking that the tab is not changed", "The tab was not changed");
mAsserter.ok(mSolo.searchText(mStringHelper.TITLE_PLACE_HOLDER), "Checking that the tab is not changed", "The tab was not changed");
// extra check here on the Tab:Added message to be sure the right tab opened, again
try {
mAsserter.is(StringHelper.ABOUT_FIREFOX_URL, data.getString("uri"), "Checking tab uri");
mAsserter.is(mStringHelper.ABOUT_FIREFOX_URL, data.getString("uri"), "Checking tab uri");
} catch (JSONException e) {
mAsserter.ok(false, "exception accessing event data", e.toString());
}
@ -85,8 +85,8 @@ public class testBookmarksPanel extends AboutHomeTest {
// Test that "Remove" works
openBookmarkContextMenu(editedBookmarkValues[1]);
mSolo.clickOnText(StringHelper.BOOKMARK_CONTEXT_MENU_ITEMS[5]);
waitForText(StringHelper.BOOKMARK_REMOVED_LABEL);
mSolo.clickOnText(mStringHelper.BOOKMARK_CONTEXT_MENU_ITEMS[5]);
waitForText(mStringHelper.BOOKMARK_REMOVED_LABEL);
mAsserter.ok(!mDatabaseHelper.isBookmark(editedBookmarkValues[1]), "Checking that the bookmark was removed", "The bookmark was removed");
}
@ -103,7 +103,7 @@ public class testBookmarksPanel extends AboutHomeTest {
mAsserter.ok(!StringUtils.isShareableUrl(nonShareableURL), "Ensuring url is not shareable", "");
openBookmarkContextMenu(shareableURL);
for (String contextMenuOption : StringHelper.BOOKMARK_CONTEXT_MENU_ITEMS) {
for (String contextMenuOption : mStringHelper.BOOKMARK_CONTEXT_MENU_ITEMS) {
mAsserter.ok(mSolo.searchText(contextMenuOption),
"Checking that the context menu option is present",
contextMenuOption + " is present");
@ -113,7 +113,7 @@ public class testBookmarksPanel extends AboutHomeTest {
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
openBookmarkContextMenu(nonShareableURL);
for (String contextMenuOption : StringHelper.BOOKMARK_CONTEXT_MENU_ITEMS) {
for (String contextMenuOption : mStringHelper.BOOKMARK_CONTEXT_MENU_ITEMS) {
// This link is not shareable: skip the "Share" option.
if ("Share".equals(contextMenuOption)) {
continue;
@ -140,8 +140,8 @@ public class testBookmarksPanel extends AboutHomeTest {
*/
private void editBookmark(String bookmarkUrl, String[] values) {
openBookmarkContextMenu(bookmarkUrl);
mSolo.clickOnText(StringHelper.CONTEXT_MENU_EDIT);
waitForText(StringHelper.EDIT_BOOKMARK);
mSolo.clickOnText(mStringHelper.CONTEXT_MENU_EDIT);
waitForText(mStringHelper.EDIT_BOOKMARK);
// Update the fields with the new values
for (int i = 0; i < values.length; i++) {
@ -150,8 +150,8 @@ public class testBookmarksPanel extends AboutHomeTest {
mActions.sendKeys(values[i]);
}
mSolo.clickOnButton(StringHelper.OK);
waitForText(StringHelper.BOOKMARK_UPDATED_LABEL);
mSolo.clickOnButton(mStringHelper.OK);
waitForText(mStringHelper.BOOKMARK_UPDATED_LABEL);
}
/**
@ -160,8 +160,8 @@ public class testBookmarksPanel extends AboutHomeTest {
*/
private void checkBookmarkEdit(String bookmarkUrl, String[] values) {
openBookmarkContextMenu(bookmarkUrl);
mSolo.clickOnText(StringHelper.CONTEXT_MENU_EDIT);
waitForText(StringHelper.EDIT_BOOKMARK);
mSolo.clickOnText(mStringHelper.CONTEXT_MENU_EDIT);
waitForText(mStringHelper.EDIT_BOOKMARK);
// Check the values of the fields
for (String value : values) {
@ -169,6 +169,6 @@ public class testBookmarksPanel extends AboutHomeTest {
}
mSolo.clickOnButton("Cancel");
waitForText(StringHelper.BOOKMARKS_LABEL);
waitForText(mStringHelper.BOOKMARKS_LABEL);
}
}

View File

@ -8,7 +8,6 @@ import org.mozilla.gecko.Actions;
import org.mozilla.gecko.R;
import com.jayway.android.robotium.solo.Condition;
import android.view.View;
/**
@ -33,13 +32,12 @@ public class testClearPrivateData extends PixelTest {
private void clearHistory() {
// Loading a page and adding a second one as bookmark to have user made bookmarks and history
String blank1 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String blank2 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
String title = StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE;
String blank1 = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String blank2 = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_02_URL);
String title = mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE;
inputAndLoadUrl(blank1);
verifyUrlBarTitle(blank1);
mDatabaseHelper.addOrUpdateMobileBookmark(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE, blank2);
mDatabaseHelper.addOrUpdateMobileBookmark(mStringHelper.ROBOCOP_BLANK_PAGE_02_TITLE, blank2);
// Checking that the history list is not empty
verifyHistoryCount(1);
@ -66,9 +64,8 @@ public class testClearPrivateData extends PixelTest {
public void clearSiteSettings() {
String shareStrings[] = {"Share your location with", "Share", "Don't share", "There are no settings to clear"};
String titleGeolocation = StringHelper.ROBOCOP_GEOLOCATION_TITLE;
String url = getAbsoluteUrl(StringHelper.ROBOCOP_GEOLOCATION_URL);
String titleGeolocation = mStringHelper.ROBOCOP_GEOLOCATION_TITLE;
String url = getAbsoluteUrl(mStringHelper.ROBOCOP_GEOLOCATION_URL);
loadCheckDismiss(shareStrings[1], url, shareStrings[0]);
checkOption(shareStrings[1], "Clear");
checkOption(shareStrings[3], "Cancel");
@ -79,13 +76,12 @@ public class testClearPrivateData extends PixelTest {
public void clearPassword(){
String passwordStrings[] = {"Save password", "Save", "Don't save"};
String title = StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE;
String loginUrl = getAbsoluteUrl(StringHelper.ROBOCOP_LOGIN_URL);
String title = mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE;
String loginUrl = getAbsoluteUrl(mStringHelper.ROBOCOP_LOGIN_URL);
loadCheckDismiss(passwordStrings[1], loginUrl, passwordStrings[0]);
checkOption(passwordStrings[1], "Clear");
loadCheckDismiss(passwordStrings[2], loginUrl, passwordStrings[0]);
checkDevice(title, getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL));
checkDevice(title, getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL));
}
// clear private data and verify the device type because for phone there is an extra back action to exit the settings menu
@ -93,7 +89,7 @@ public class testClearPrivateData extends PixelTest {
clearPrivateData();
if (mDevice.type.equals("phone")) {
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
mAsserter.ok(waitForText(StringHelper.PRIVACY_SECTION_LABEL), "waiting to perform one back", "one back");
mAsserter.ok(waitForText(mStringHelper.PRIVACY_SECTION_LABEL), "waiting to perform one back", "one back");
}
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
verifyUrlBarTitle(url);
@ -114,14 +110,14 @@ public class testClearPrivateData extends PixelTest {
// Use the context menu in pre-11
final View toolbarView = mSolo.getView(R.id.browser_toolbar);
mSolo.clickLongOnView(toolbarView);
mAsserter.ok(waitForText(StringHelper.CONTEXT_MENU_ITEMS_IN_URL_BAR[2]), "Waiting for the pop-up to open", "Pop up was opened");
mAsserter.ok(waitForText(mStringHelper.CONTEXT_MENU_ITEMS_IN_URL_BAR[2]), "Waiting for the pop-up to open", "Pop up was opened");
} else {
// Use the Page menu in 11+
selectMenuItem(StringHelper.PAGE_LABEL);
mAsserter.ok(waitForText(StringHelper.CONTEXT_MENU_ITEMS_IN_URL_BAR[2]), "Waiting for the submenu to open", "Submenu was opened");
selectMenuItem(mStringHelper.PAGE_LABEL);
mAsserter.ok(waitForText(mStringHelper.CONTEXT_MENU_ITEMS_IN_URL_BAR[2]), "Waiting for the submenu to open", "Submenu was opened");
}
mSolo.clickOnText(StringHelper.CONTEXT_MENU_ITEMS_IN_URL_BAR[2]);
mSolo.clickOnText(mStringHelper.CONTEXT_MENU_ITEMS_IN_URL_BAR[2]);
mAsserter.ok(waitForText(option), "Verify that the option: " + option + " is in the list", "The option is in the list. There are settings to clear");
mSolo.clickOnButton(button);
}

View File

@ -462,29 +462,29 @@ public class testDistribution extends ContentProviderTest {
public void checkTilesReporting(String localeCode) throws JSONException {
// Slight hack: Force top sites grid to reload.
inputAndLoadUrl(StringHelper.ABOUT_BLANK_URL);
inputAndLoadUrl(StringHelper.ABOUT_HOME_URL);
inputAndLoadUrl(mStringHelper.ABOUT_BLANK_URL);
inputAndLoadUrl(mStringHelper.ABOUT_HOME_URL);
// Click the first tracking tile and verify the posted data.
JSONObject response = clickTrackingTile(StringHelper.DISTRIBUTION1_LABEL);
JSONObject response = clickTrackingTile(mStringHelper.DISTRIBUTION1_LABEL);
mAsserter.is(response.getInt("click"), 0, "JSON click index matched");
mAsserter.is(response.getString("locale"), localeCode, "JSON locale code matched");
mAsserter.is(response.getString("tiles"), "[{\"id\":123},{\"id\":456},{\"id\":632},{\"id\":629},{\"id\":630},{\"id\":631}]", "JSON tiles data matched");
inputAndLoadUrl(StringHelper.ABOUT_HOME_URL);
inputAndLoadUrl(mStringHelper.ABOUT_HOME_URL);
// Pin the second tracking tile.
pinTopSite(StringHelper.DISTRIBUTION2_LABEL);
pinTopSite(mStringHelper.DISTRIBUTION2_LABEL);
// Click the second tracking tile and verify the posted data.
response = clickTrackingTile(StringHelper.DISTRIBUTION2_LABEL);
response = clickTrackingTile(mStringHelper.DISTRIBUTION2_LABEL);
mAsserter.is(response.getInt("click"), 1, "JSON click index matched");
mAsserter.is(response.getString("tiles"), "[{\"id\":123},{\"id\":456,\"pin\":true},{\"id\":632},{\"id\":629},{\"id\":630},{\"id\":631}]", "JSON tiles data matched");
inputAndLoadUrl(StringHelper.ABOUT_HOME_URL);
inputAndLoadUrl(mStringHelper.ABOUT_HOME_URL);
// Unpin the second tracking tile.
unpinTopSite(StringHelper.DISTRIBUTION2_LABEL);
unpinTopSite(mStringHelper.DISTRIBUTION2_LABEL);
}
private JSONObject clickTrackingTile(String text) throws JSONException {

View File

@ -21,35 +21,35 @@ import org.mozilla.gecko.Actions;
*/
public class testDoorHanger extends BaseTest {
public void testDoorHanger() {
String GEO_URL = getAbsoluteUrl(StringHelper.ROBOCOP_GEOLOCATION_URL);
String BLANK_URL = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String OFFLINE_STORAGE_URL = getAbsoluteUrl(StringHelper.ROBOCOP_OFFLINE_STORAGE_URL);
String LOGIN_URL = getAbsoluteUrl(StringHelper.ROBOCOP_LOGIN_URL);
String GEO_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_GEOLOCATION_URL);
String BLANK_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String OFFLINE_STORAGE_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_OFFLINE_STORAGE_URL);
String LOGIN_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_LOGIN_URL);
blockForGeckoReady();
// Test geolocation notification
inputAndLoadUrl(GEO_URL);
waitForText(StringHelper.GEO_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.GEO_MESSAGE), true, "Geolocation doorhanger has been displayed");
waitForText(mStringHelper.GEO_MESSAGE);
mAsserter.is(mSolo.searchText(mStringHelper.GEO_MESSAGE), true, "Geolocation doorhanger has been displayed");
// Test "Share" button hides the notification
waitForCheckBox();
mSolo.clickOnCheckBox(0);
mSolo.clickOnButton(StringHelper.GEO_ALLOW);
waitForTextDismissed(StringHelper.GEO_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.GEO_MESSAGE), false, "Geolocation doorhanger has been hidden when allowing share");
mSolo.clickOnButton(mStringHelper.GEO_ALLOW);
waitForTextDismissed(mStringHelper.GEO_MESSAGE);
mAsserter.is(mSolo.searchText(mStringHelper.GEO_MESSAGE), false, "Geolocation doorhanger has been hidden when allowing share");
// Re-trigger geolocation notification
inputAndLoadUrl(GEO_URL);
waitForText(StringHelper.GEO_MESSAGE);
waitForText(mStringHelper.GEO_MESSAGE);
// Test "Don't share" button hides the notification
waitForCheckBox();
mSolo.clickOnCheckBox(0);
mSolo.clickOnButton(StringHelper.GEO_DENY);
waitForTextDismissed(StringHelper.GEO_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.GEO_MESSAGE), false, "Geolocation doorhanger has been hidden when denying share");
mSolo.clickOnButton(mStringHelper.GEO_DENY);
waitForTextDismissed(mStringHelper.GEO_MESSAGE);
mAsserter.is(mSolo.searchText(mStringHelper.GEO_MESSAGE), false, "Geolocation doorhanger has been hidden when denying share");
/* FIXME: disabled on fig - bug 880060 (for some reason this fails because of some raciness)
// Re-trigger geolocation notification
@ -99,25 +99,25 @@ public class testDoorHanger extends BaseTest {
// Load offline storage page
inputAndLoadUrl(OFFLINE_STORAGE_URL);
waitForText(StringHelper.OFFLINE_MESSAGE);
waitForText(mStringHelper.OFFLINE_MESSAGE);
// Test doorhanger dismissed when tapping "Don't share"
waitForCheckBox();
mSolo.clickOnCheckBox(0);
mSolo.clickOnButton(StringHelper.OFFLINE_DENY);
waitForTextDismissed(StringHelper.OFFLINE_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.OFFLINE_MESSAGE), false, "Offline storage doorhanger notification is hidden when denying storage");
mSolo.clickOnButton(mStringHelper.OFFLINE_DENY);
waitForTextDismissed(mStringHelper.OFFLINE_MESSAGE);
mAsserter.is(mSolo.searchText(mStringHelper.OFFLINE_MESSAGE), false, "Offline storage doorhanger notification is hidden when denying storage");
// Load offline storage page
inputAndLoadUrl(OFFLINE_STORAGE_URL);
waitForText(StringHelper.OFFLINE_MESSAGE);
waitForText(mStringHelper.OFFLINE_MESSAGE);
// Test doorhanger dismissed when tapping "Allow" and is not displayed again
mSolo.clickOnButton(StringHelper.OFFLINE_ALLOW);
waitForTextDismissed(StringHelper.OFFLINE_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.OFFLINE_MESSAGE), false, "Offline storage doorhanger notification is hidden when allowing storage");
mSolo.clickOnButton(mStringHelper.OFFLINE_ALLOW);
waitForTextDismissed(mStringHelper.OFFLINE_MESSAGE);
mAsserter.is(mSolo.searchText(mStringHelper.OFFLINE_MESSAGE), false, "Offline storage doorhanger notification is hidden when allowing storage");
inputAndLoadUrl(OFFLINE_STORAGE_URL);
mAsserter.is(mSolo.searchText(StringHelper.OFFLINE_MESSAGE), false, "Offline storage doorhanger is no longer triggered");
mAsserter.is(mSolo.searchText(mStringHelper.OFFLINE_MESSAGE), false, "Offline storage doorhanger is no longer triggered");
try {
// Revert offline setting
@ -133,27 +133,27 @@ public class testDoorHanger extends BaseTest {
// Load login page
inputAndLoadUrl(LOGIN_URL);
waitForText(StringHelper.LOGIN_MESSAGE);
waitForText(mStringHelper.LOGIN_MESSAGE);
// Test doorhanger is dismissed when tapping "Don't save"
mSolo.clickOnButton(StringHelper.LOGIN_DENY);
waitForTextDismissed(StringHelper.LOGIN_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.LOGIN_MESSAGE), false, "Login doorhanger notification is hidden when denying saving password");
mSolo.clickOnButton(mStringHelper.LOGIN_DENY);
waitForTextDismissed(mStringHelper.LOGIN_MESSAGE);
mAsserter.is(mSolo.searchText(mStringHelper.LOGIN_MESSAGE), false, "Login doorhanger notification is hidden when denying saving password");
// Load login page
inputAndLoadUrl(LOGIN_URL);
waitForText(StringHelper.LOGIN_MESSAGE);
waitForText(mStringHelper.LOGIN_MESSAGE);
// Test doorhanger is dismissed when tapping "Save" and is no longer triggered
mSolo.clickOnButton(StringHelper.LOGIN_ALLOW);
waitForTextDismissed(StringHelper.LOGIN_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.LOGIN_MESSAGE), false, "Login doorhanger notification is hidden when allowing saving password");
mSolo.clickOnButton(mStringHelper.LOGIN_ALLOW);
waitForTextDismissed(mStringHelper.LOGIN_MESSAGE);
mAsserter.is(mSolo.searchText(mStringHelper.LOGIN_MESSAGE), false, "Login doorhanger notification is hidden when allowing saving password");
testPopupBlocking();
}
private void testPopupBlocking() {
String POPUP_URL = getAbsoluteUrl(StringHelper.ROBOCOP_POPUP_URL);
String POPUP_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_POPUP_URL);
try {
JSONObject jsonPref = new JSONObject();
@ -167,17 +167,17 @@ public class testDoorHanger extends BaseTest {
// Load page with popup
inputAndLoadUrl(POPUP_URL);
waitForText(StringHelper.POPUP_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.POPUP_MESSAGE), true, "Popup blocker is displayed");
waitForText(mStringHelper.POPUP_MESSAGE);
mAsserter.is(mSolo.searchText(mStringHelper.POPUP_MESSAGE), true, "Popup blocker is displayed");
// Wait for the popup to be shown.
Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
waitForCheckBox();
mSolo.clickOnCheckBox(0);
mSolo.clickOnButton(StringHelper.POPUP_ALLOW);
waitForTextDismissed(StringHelper.POPUP_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.POPUP_MESSAGE), false, "Popup blocker is hidden when popup allowed");
mSolo.clickOnButton(mStringHelper.POPUP_ALLOW);
waitForTextDismissed(mStringHelper.POPUP_MESSAGE);
mAsserter.is(mSolo.searchText(mStringHelper.POPUP_MESSAGE), false, "Popup blocker is hidden when popup allowed");
try {
final JSONObject data = new JSONObject(tabEventExpecter.blockForEventData());
@ -195,14 +195,14 @@ public class testDoorHanger extends BaseTest {
// Load page with popup
inputAndLoadUrl(POPUP_URL);
waitForText(StringHelper.POPUP_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.POPUP_MESSAGE), true, "Popup blocker is displayed");
waitForText(mStringHelper.POPUP_MESSAGE);
mAsserter.is(mSolo.searchText(mStringHelper.POPUP_MESSAGE), true, "Popup blocker is displayed");
waitForCheckBox();
mSolo.clickOnCheckBox(0);
mSolo.clickOnButton(StringHelper.POPUP_DENY);
waitForTextDismissed(StringHelper.POPUP_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.POPUP_MESSAGE), false, "Popup blocker is hidden when popup denied");
mSolo.clickOnButton(mStringHelper.POPUP_DENY);
waitForTextDismissed(mStringHelper.POPUP_MESSAGE);
mAsserter.is(mSolo.searchText(mStringHelper.POPUP_MESSAGE), false, "Popup blocker is hidden when popup denied");
// Check that we're on the same page to verify that the popup was not shown.
verifyUrl(POPUP_URL);

View File

@ -63,7 +63,7 @@ public class testEventDispatcher extends UITest
public void testEventDispatcher() {
GeckoHelper.blockForReady();
NavigationHelper.enterAndLoadUrl(StringHelper.getHarnessUrlForJavascript(TEST_JS));
NavigationHelper.enterAndLoadUrl(mStringHelper.getHarnessUrlForJavascript(TEST_JS));
js.syncCall("send_test_message", GECKO_EVENT);
js.syncCall("send_message_for_response", GECKO_RESPONSE_EVENT, "success");

View File

@ -53,8 +53,8 @@ public class testFindInPage extends JavascriptTest implements NativeEventListene
super.setUp();
EventDispatcher.getInstance().registerGeckoThreadListener(this,
"Test:FindInPage",
"Test:CloseFindInPage");
"Test:FindInPage",
"Test:CloseFindInPage");
}
@Override
@ -62,12 +62,12 @@ public class testFindInPage extends JavascriptTest implements NativeEventListene
super.tearDown();
EventDispatcher.getInstance().unregisterGeckoThreadListener(this,
"Test:FindInPage",
"Test:CloseFindInPage");
"Test:FindInPage",
"Test:CloseFindInPage");
}
public void findText(String text, int nrOfMatches){
selectMenuItem(StringHelper.FIND_IN_PAGE_LABEL);
selectMenuItem(mStringHelper.FIND_IN_PAGE_LABEL);
close = mDriver.findElement(getActivity(), R.id.find_close);
boolean success = waitForTest ( new BooleanTest() {
@Override
@ -105,4 +105,4 @@ public class testFindInPage extends JavascriptTest implements NativeEventListene
mAsserter.ok(success, "Checking if the next button was clicked", "button was clicked");
}
}
}
}

View File

@ -15,7 +15,7 @@ import org.mozilla.gecko.PaintedSurface;
*/
public class testFlingCorrectness extends PixelTest {
public void testFlingCorrectness() {
String url = getAbsoluteUrl(StringHelper.ROBOCOP_BOXES_URL);
String url = getAbsoluteUrl(mStringHelper.ROBOCOP_BOXES_URL);
MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());

View File

@ -42,7 +42,7 @@ public class testGeckoRequest extends UITest {
public void testGeckoRequest() {
GeckoHelper.blockForReady();
NavigationHelper.enterAndLoadUrl(StringHelper.getHarnessUrlForJavascript(TEST_JS));
NavigationHelper.enterAndLoadUrl(mStringHelper.getHarnessUrlForJavascript(TEST_JS));
// Register a listener for this request.
js.syncCall("add_request_listener", REQUEST_EVENT);

View File

@ -16,9 +16,9 @@ public class testHistory extends AboutHomeTest {
public void testHistory() {
blockForGeckoReady();
String url = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String url2 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
String url3 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_03_URL);
String url = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String url2 = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_02_URL);
String url3 = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_03_URL);
inputAndLoadUrl(url);
verifyUrlBarTitle(url);
@ -66,7 +66,7 @@ public class testHistory extends AboutHomeTest {
// The first item here (since it was just visited) should be a "Switch to tab" item
// i.e. don't expect a DOMContentLoaded event
verifyUrlBarTitle(StringHelper.ROBOCOP_BLANK_PAGE_03_URL);
verifyUrlBarTitle(mStringHelper.ROBOCOP_BLANK_PAGE_03_URL);
verifyUrl(url3);
}
}

View File

@ -41,20 +41,20 @@ public class testHomeBanner extends UITest {
// Load about:home and make sure the onshown handler is called.
Actions.EventExpecter eventExpecter = getActions().expectGeckoEvent("TestHomeBanner:MessageShown");
addBannerMessage();
NavigationHelper.enterAndLoadUrl(StringHelper.ABOUT_HOME_URL);
NavigationHelper.enterAndLoadUrl(mStringHelper.ABOUT_HOME_URL);
eventExpecter.blockForEvent();
// Verify that the banner is visible with the correct text.
mAboutHome.assertBannerText(TEXT);
// Verify that the banner isn't visible after navigating away from about:home.
NavigationHelper.enterAndLoadUrl(StringHelper.ABOUT_FIREFOX_URL);
NavigationHelper.enterAndLoadUrl(mStringHelper.ABOUT_FIREFOX_URL);
mAboutHome.assertBannerNotVisible();
}
private void hideOnToolbarFocusTest() {
NavigationHelper.enterAndLoadUrl(StringHelper.ABOUT_HOME_URL);
NavigationHelper.enterAndLoadUrl(mStringHelper.ABOUT_HOME_URL);
mAboutHome.assertVisible()
.assertBannerVisible();
@ -72,7 +72,7 @@ public class testHomeBanner extends UITest {
* Note: This test does not remove the message after it is done.
*/
private void dismissBannerTest() {
NavigationHelper.enterAndLoadUrl(StringHelper.ABOUT_HOME_URL);
NavigationHelper.enterAndLoadUrl(mStringHelper.ABOUT_HOME_URL);
mAboutHome.assertVisible();
// Test to make sure the ondismiss handler is called when the close button is clicked.

View File

@ -134,8 +134,8 @@ public class testImportFromAndroid extends AboutHomeTest {
}
private void importDataFromAndroid() {
waitForText(StringHelper.TITLE_PLACE_HOLDER);
selectSettingsItem(StringHelper.CUSTOMIZE_SECTION_LABEL, StringHelper.IMPORT_FROM_ANDROID_LABEL);
waitForText(mStringHelper.TITLE_PLACE_HOLDER);
selectSettingsItem(mStringHelper.CUSTOMIZE_SECTION_LABEL, mStringHelper.IMPORT_FROM_ANDROID_LABEL);
// Wait for the Import form Android pop-up to be opened. It has the same title as the option so waiting for the "Cancel" button
waitForText("Cancel");
@ -154,13 +154,13 @@ public class testImportFromAndroid extends AboutHomeTest {
// Import has finished. Waiting to get back to the Settings Menu and looking for the Import&Export subsection
if ("phone".equals(mDevice.type)) {
// Phones don't have headers like tablets, so we need to pop up one more level.
waitForText(StringHelper.IMPORT_FROM_ANDROID_LABEL);
waitForText(mStringHelper.IMPORT_FROM_ANDROID_LABEL);
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
}
waitForText(StringHelper.PRIVACY_SECTION_LABEL); // Settings is a header for the settings menu page. Waiting for Privacy ensures we are back in the top Settings view
waitForText(mStringHelper.PRIVACY_SECTION_LABEL); // Settings is a header for the settings menu page. Waiting for Privacy ensures we are back in the top Settings view
mActions.sendSpecialKey(Actions.SpecialKey.BACK); // Exit Settings
// Make sure the settings menu has been closed.
mAsserter.ok(mSolo.waitForText(StringHelper.TITLE_PLACE_HOLDER), "Waiting for search bar", "Search bar found");
mAsserter.ok(mSolo.waitForText(mStringHelper.TITLE_PLACE_HOLDER), "Waiting for search bar", "Search bar found");
}

View File

@ -28,7 +28,7 @@ public class testInputConnection extends UITest {
public void testInputConnection() throws InterruptedException {
GeckoHelper.blockForReady();
final String url = StringHelper.ROBOCOP_INPUT_URL + "#" + INITIAL_TEXT;
final String url = mStringHelper.ROBOCOP_INPUT_URL + "#" + INITIAL_TEXT;
NavigationHelper.enterAndLoadUrl(url);
mToolbar.assertTitle(url);

View File

@ -23,7 +23,7 @@ public final class testInputUrlBar extends BaseTest {
blockForGeckoReady();
startEditingMode();
assertUrlBarText(StringHelper.ABOUT_HOME_URL);
assertUrlBarText(mStringHelper.ABOUT_HOME_URL);
// Avoid any auto domain completion by using a prefix that matches
// nothing, including about: pages
@ -93,11 +93,11 @@ public final class testInputUrlBar extends BaseTest {
// Dismiss editing mode
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
waitForText(StringHelper.TITLE_PLACE_HOLDER);
waitForText(mStringHelper.TITLE_PLACE_HOLDER);
// URL bar should have forgotten about "uv" text.
startEditingMode();
assertUrlBarText(StringHelper.ABOUT_HOME_URL);
assertUrlBarText(mStringHelper.ABOUT_HOME_URL);
int width = mDriver.getGeckoWidth() / 2;
int y = mDriver.getGeckoHeight() / 2;

View File

@ -36,7 +36,7 @@ public class testJavascriptBridge extends UITest {
public void testJavascriptBridge() {
GeckoHelper.blockForReady();
NavigationHelper.enterAndLoadUrl(StringHelper.getHarnessUrlForJavascript(TEST_JS));
NavigationHelper.enterAndLoadUrl(mStringHelper.getHarnessUrlForJavascript(TEST_JS));
js.syncCall("check_js_int_arg", 1);
}

View File

@ -4,20 +4,20 @@
package org.mozilla.gecko.tests;
public class testLinkContextMenu extends ContentContextMenuTest {
// Test website strings
private static String LINK_PAGE_URL;
private static String BLANK_PAGE_URL;
private static final String LINK_PAGE_TITLE = "Big Link";
private static final String linkMenuItems [] = StringHelper.CONTEXT_MENU_ITEMS_IN_NORMAL_TAB;
public void testLinkContextMenu() {
final String linkMenuItems [] = mStringHelper.CONTEXT_MENU_ITEMS_IN_NORMAL_TAB;
blockForGeckoReady();
LINK_PAGE_URL=getAbsoluteUrl(StringHelper.ROBOCOP_BIG_LINK_URL);
BLANK_PAGE_URL=getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
LINK_PAGE_URL=getAbsoluteUrl(mStringHelper.ROBOCOP_BIG_LINK_URL);
BLANK_PAGE_URL=getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
inputAndLoadUrl(LINK_PAGE_URL);
waitForText(LINK_PAGE_TITLE);

View File

@ -12,7 +12,7 @@ package org.mozilla.gecko.tests;
*/
public class testLoad extends PixelTest {
public void testLoad() {
String url = getAbsoluteUrl(StringHelper.ROBOCOP_BOXES_URL);
String url = getAbsoluteUrl(mStringHelper.ROBOCOP_BOXES_URL);
blockForGeckoReady();

View File

@ -4,18 +4,18 @@
package org.mozilla.gecko.tests;
public class testMailToContextMenu extends ContentContextMenuTest {
// Test website strings
private static String MAILTO_PAGE_URL;
private static final String MAILTO_PAGE_TITLE = StringHelper.ROBOCOP_BIG_MAILTO_TITLE;
private static final String mailtoMenuItems [] = {"Copy Email Address", "Share Email Address"};
public void testMailToContextMenu() {
final String MAILTO_PAGE_TITLE = mStringHelper.ROBOCOP_BIG_MAILTO_TITLE;
blockForGeckoReady();
MAILTO_PAGE_URL=getAbsoluteUrl(StringHelper.ROBOCOP_BIG_MAILTO_URL);
MAILTO_PAGE_URL=getAbsoluteUrl(mStringHelper.ROBOCOP_BIG_MAILTO_URL);
inputAndLoadUrl(MAILTO_PAGE_URL);
waitForText(MAILTO_PAGE_TITLE);

View File

@ -26,7 +26,7 @@ public class testMasterPassword extends PixelTest {
public void enableMasterPassword(String password, String badPassword) {
// Look for the 'Settings' menu if this device/OS uses it
selectSettingsItem(StringHelper.PRIVACY_SECTION_LABEL, StringHelper.MASTER_PASSWORD_LABEL);
selectSettingsItem(mStringHelper.PRIVACY_SECTION_LABEL, mStringHelper.MASTER_PASSWORD_LABEL);
waitForText("^Create Master Password$");
// Verify that the OK button is not activated until both fields are filled
@ -53,8 +53,8 @@ public class testMasterPassword extends PixelTest {
mActions.sendKeys(password);
waitForText("^Cancel$");
mSolo.clickOnText("^Cancel$");
waitForText("^" + StringHelper.MASTER_PASSWORD_LABEL + "$");
mSolo.clickOnText("^" + StringHelper.MASTER_PASSWORD_LABEL + "$");
waitForText("^" + mStringHelper.MASTER_PASSWORD_LABEL + "$");
mSolo.clickOnText("^" + mStringHelper.MASTER_PASSWORD_LABEL + "$");
mAsserter.ok(mSolo.waitForText("^Create Master Password$"), "Checking if no password was set if the action was canceled", "No password was set");
// Enable Master Password
@ -79,14 +79,14 @@ public class testMasterPassword extends PixelTest {
waitForText("Use master password");
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
}
waitForText(StringHelper.SETTINGS_LABEL);
waitForText(mStringHelper.SETTINGS_LABEL);
mActions.sendSpecialKey(Actions.SpecialKey.BACK);// Close the Settings Menu
}
public void disableMasterPassword(String password, String badPassword) {
// Look for the 'Settings' menu if this device/OS uses it
selectSettingsItem(StringHelper.PRIVACY_SECTION_LABEL, StringHelper.MASTER_PASSWORD_LABEL);
selectSettingsItem(mStringHelper.PRIVACY_SECTION_LABEL, mStringHelper.MASTER_PASSWORD_LABEL);
waitForText("^Remove Master Password$");
// Verify that the OK button is not activated if the password field is empty
@ -144,7 +144,7 @@ public class testMasterPassword extends PixelTest {
public void clearPrivateData() {
// Look for the 'Settings' menu if this device/OS uses it
selectSettingsItem(StringHelper.PRIVACY_SECTION_LABEL, StringHelper.CLEAR_PRIVATE_DATA_LABEL);
selectSettingsItem(mStringHelper.PRIVACY_SECTION_LABEL, mStringHelper.CLEAR_PRIVATE_DATA_LABEL);
waitForText("Browsing history"); // Make sure the Clear private data pop-up is displayed
Actions.EventExpecter clearPrivateDataEventExpecter = mActions.expectGeckoEvent("Sanitize:Finished");
@ -173,7 +173,7 @@ public class testMasterPassword extends PixelTest {
waitForText("Use master password");
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
}
waitForText(StringHelper.SETTINGS_LABEL);
waitForText(mStringHelper.SETTINGS_LABEL);
mActions.sendSpecialKey(Actions.SpecialKey.BACK);// Close the Settings Menu
// Make sure the settings menu has been closed.
mAsserter.ok(mSolo.waitForText("Browser Blank Page 01"), "Waiting for blank browser page after exiting settings", "Blank browser page present");

View File

@ -20,8 +20,8 @@ public class testNewTab extends BaseTest {
private int tabCountInt = 0;
public void testNewTab() {
String url = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String url2 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
String url = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String url2 = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_02_URL);
blockForGeckoReady();

View File

@ -15,7 +15,7 @@ import org.mozilla.gecko.PaintedSurface;
*/
public class testPanCorrectness extends PixelTest {
public void testPanCorrectness() {
String url = getAbsoluteUrl(StringHelper.ROBOCOP_BOXES_URL);
String url = getAbsoluteUrl(mStringHelper.ROBOCOP_BOXES_URL);
MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());

View File

@ -22,7 +22,7 @@ public class testPermissions extends PixelTest {
Actions.RepeatedEventExpecter paintExpecter;
// Test geolocation notification
loadAndPaint(getAbsoluteUrl(StringHelper.ROBOCOP_GEOLOCATION_URL));
loadAndPaint(getAbsoluteUrl(mStringHelper.ROBOCOP_GEOLOCATION_URL));
waitForText("wants your location");
// Uncheck the "Don't ask again for this site" checkbox

View File

@ -4,23 +4,23 @@
package org.mozilla.gecko.tests;
public class testPictureLinkContextMenu extends ContentContextMenuTest {
// Test website strings
private static String PICTURE_PAGE_URL;
private static String BLANK_PAGE_URL;
private static final String PICTURE_PAGE_TITLE = StringHelper.ROBOCOP_PICTURE_LINK_TITLE;
private static final String tabs [] = { "Image", "Link" };
private static final String photoMenuItems [] = { "Copy Image Location", "Share Image", "Set Image As", "Save Image" };
private static final String linkMenuItems [] = StringHelper.CONTEXT_MENU_ITEMS_IN_NORMAL_TAB;
private static final String imageTitle = "^Image$";
public void testPictureLinkContextMenu() {
final String PICTURE_PAGE_TITLE = mStringHelper.ROBOCOP_PICTURE_LINK_TITLE;
final String linkMenuItems [] = mStringHelper.CONTEXT_MENU_ITEMS_IN_NORMAL_TAB;
blockForGeckoReady();
PICTURE_PAGE_URL=getAbsoluteUrl(StringHelper.ROBOCOP_PICTURE_LINK_URL);
BLANK_PAGE_URL=getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
PICTURE_PAGE_URL=getAbsoluteUrl(mStringHelper.ROBOCOP_PICTURE_LINK_URL);
BLANK_PAGE_URL=getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_02_URL);
loadAndPaint(PICTURE_PAGE_URL);
verifyUrlBarTitle(PICTURE_PAGE_URL);

View File

@ -19,27 +19,27 @@ import org.mozilla.gecko.Actions;
public class testPrivateBrowsing extends ContentContextMenuTest {
public void testPrivateBrowsing() {
String bigLinkUrl = getAbsoluteUrl(StringHelper.ROBOCOP_BIG_LINK_URL);
String blank1Url = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String blank2Url = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
String bigLinkUrl = getAbsoluteUrl(mStringHelper.ROBOCOP_BIG_LINK_URL);
String blank1Url = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String blank2Url = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_02_URL);
blockForGeckoReady();
inputAndLoadUrl(StringHelper.ABOUT_BLANK_URL);
inputAndLoadUrl(mStringHelper.ABOUT_BLANK_URL);
addTab(bigLinkUrl, StringHelper.ROBOCOP_BIG_LINK_TITLE, true);
addTab(bigLinkUrl, mStringHelper.ROBOCOP_BIG_LINK_TITLE, true);
verifyTabCount(1);
// Open the link context menu and verify the options
verifyContextMenuItems(StringHelper.CONTEXT_MENU_ITEMS_IN_PRIVATE_TAB);
verifyContextMenuItems(mStringHelper.CONTEXT_MENU_ITEMS_IN_PRIVATE_TAB);
// Check that "Open Link in New Tab" is not in the menu
mAsserter.ok(!mSolo.searchText(StringHelper.CONTEXT_MENU_ITEMS_IN_NORMAL_TAB[0]), "Checking that 'Open Link in New Tab' is not displayed in the context menu", "'Open Link in New Tab' is not displayed in the context menu");
mAsserter.ok(!mSolo.searchText(mStringHelper.CONTEXT_MENU_ITEMS_IN_NORMAL_TAB[0]), "Checking that 'Open Link in New Tab' is not displayed in the context menu", "'Open Link in New Tab' is not displayed in the context menu");
// Open the link in a new private tab and check that it is private
Actions.EventExpecter privateTabEventExpector = mActions.expectGeckoEvent("Tab:Added");
mSolo.clickOnText(StringHelper.CONTEXT_MENU_ITEMS_IN_PRIVATE_TAB[0]);
mSolo.clickOnText(mStringHelper.CONTEXT_MENU_ITEMS_IN_PRIVATE_TAB[0]);
String eventData = privateTabEventExpector.blockForEventData();
privateTabEventExpector.unregisterListener();
@ -47,7 +47,7 @@ public class testPrivateBrowsing extends ContentContextMenuTest {
verifyTabCount(2);
// Open a normal tab to check later that it was registered in the Firefox Browser History
addTab(blank2Url, StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE, false);
addTab(blank2Url, mStringHelper.ROBOCOP_BLANK_PAGE_02_TITLE, false);
verifyTabCount(2);
// Get the history list and check that the links open in private browsing are not saved

View File

@ -40,9 +40,9 @@ public class testPromptGridInput extends BaseTest {
public void test(final int num) {
// Load about:blank between each test to ensure we reset state
loadUrl(StringHelper.ABOUT_BLANK_URL);
mAsserter.ok(waitForText(StringHelper.ABOUT_BLANK_URL), "Loaded blank page",
StringHelper.ABOUT_BLANK_URL);
loadUrl(mStringHelper.ABOUT_BLANK_URL);
mAsserter.ok(waitForText(mStringHelper.ABOUT_BLANK_URL), "Loaded blank page",
mStringHelper.ABOUT_BLANK_URL);
loadUrl("chrome://roboextender/content/robocop_prompt_gridinput.html#test" + num);
}

View File

@ -38,7 +38,7 @@ public class testReaderMode extends AboutHomeTest {
ListView list;
View child;
View readerIcon;
String textUrl = getAbsoluteUrl(StringHelper.ROBOCOP_TEXT_PAGE_URL);
String textUrl = getAbsoluteUrl(mStringHelper.ROBOCOP_TEXT_PAGE_URL);
String devType = mDevice.type;
int childNo;
int height;
@ -77,7 +77,7 @@ public class testReaderMode extends AboutHomeTest {
contentPageShowExpecter.unregisterListener();
paintExpecter.blockUntilClear(EVENT_CLEAR_DELAY_MS);
paintExpecter.unregisterListener();
verifyUrlBarTitle(StringHelper.ROBOCOP_TEXT_PAGE_URL);
verifyUrlBarTitle(mStringHelper.ROBOCOP_TEXT_PAGE_URL);
// Open the share menu for the reader toolbar
height = mDriver.getGeckoTop() + mDriver.getGeckoHeight() - 10;
@ -108,9 +108,9 @@ public class testReaderMode extends AboutHomeTest {
contentEventExpecter.unregisterListener();
// Check if the page is present in the Reading List
mAsserter.ok(mSolo.waitForText(StringHelper.ROBOCOP_TEXT_PAGE_TITLE),
mAsserter.ok(mSolo.waitForText(mStringHelper.ROBOCOP_TEXT_PAGE_TITLE),
"Verify if the page is added to your Reading List",
StringHelper.ROBOCOP_TEXT_PAGE_TITLE);
mStringHelper.ROBOCOP_TEXT_PAGE_TITLE);
// Check if the page is added in History tab like a Reading List item
openAboutHomeTab(AboutHomeTabs.HISTORY);
@ -120,7 +120,7 @@ public class testReaderMode extends AboutHomeTest {
mSolo.clickLongOnView(child);
mAsserter.ok(mSolo.waitForText("Open in Reader"), "Verify if the page is present in history as a Reading List item", "The page is present in history as a Reading List item");
mActions.sendSpecialKey(Actions.SpecialKey.BACK); // Dismiss the context menu
mSolo.waitForText(StringHelper.ROBOCOP_TEXT_PAGE_TITLE);
mSolo.waitForText(mStringHelper.ROBOCOP_TEXT_PAGE_TITLE);
// Verify separately the Reading List entries for tablets and phone because for tablets there is an extra child in UI design
if (devType.equals("phone")) {
@ -138,7 +138,7 @@ public class testReaderMode extends AboutHomeTest {
mSolo.clickOnView(child);
contentEventExpecter.blockForEvent();
contentEventExpecter.unregisterListener();
verifyUrlBarTitle(StringHelper.ROBOCOP_TEXT_PAGE_URL);
verifyUrlBarTitle(mStringHelper.ROBOCOP_TEXT_PAGE_URL);
// Verify that we are in reader mode and remove the page from Reading List
height = mDriver.getGeckoTop() + mDriver.getGeckoHeight() - 10;
@ -146,7 +146,7 @@ public class testReaderMode extends AboutHomeTest {
mAsserter.dumpLog("Long Clicking at width = " + String.valueOf(width) + " and height = " + String.valueOf(height));
mSolo.clickOnScreen(width,height);
mAsserter.ok(mSolo.waitForText("Page removed from your Reading List"), "Waiting for the page to removed from your Reading List", "The page is removed from your Reading List");
verifyUrlBarTitle(StringHelper.ROBOCOP_TEXT_PAGE_URL);
verifyUrlBarTitle(mStringHelper.ROBOCOP_TEXT_PAGE_URL);
//Check if the Reading List is empty
openAboutHomeTab(AboutHomeTabs.READING_LIST);

View File

@ -10,28 +10,28 @@ public class testSessionHistory extends UITest {
public void testSessionHistory() {
GeckoHelper.blockForReady();
String url = StringHelper.ROBOCOP_BLANK_PAGE_01_URL;
String url = mStringHelper.ROBOCOP_BLANK_PAGE_01_URL;
NavigationHelper.enterAndLoadUrl(url);
mToolbar.assertTitle(url);
url = StringHelper.ROBOCOP_BLANK_PAGE_02_URL;
url = mStringHelper.ROBOCOP_BLANK_PAGE_02_URL;
NavigationHelper.enterAndLoadUrl(url);
mToolbar.assertTitle(url);
url = StringHelper.ROBOCOP_BLANK_PAGE_03_URL;
url = mStringHelper.ROBOCOP_BLANK_PAGE_03_URL;
NavigationHelper.enterAndLoadUrl(url);
mToolbar.assertTitle(url);
NavigationHelper.goBack();
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
mToolbar.assertTitle(mStringHelper.ROBOCOP_BLANK_PAGE_02_URL);
NavigationHelper.goBack();
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
mToolbar.assertTitle(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
NavigationHelper.goForward();
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
mToolbar.assertTitle(mStringHelper.ROBOCOP_BLANK_PAGE_02_URL);
NavigationHelper.reload();
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
mToolbar.assertTitle(mStringHelper.ROBOCOP_BLANK_PAGE_02_URL);
}
}

View File

@ -17,7 +17,7 @@ public class testSessionOOMRestore extends SessionTest {
@Override
public void setActivityIntent(Intent intent) {
PageInfo home = new PageInfo(StringHelper.ABOUT_HOME_URL);
PageInfo home = new PageInfo(mStringHelper.ABOUT_HOME_URL);
PageInfo page1 = new PageInfo("page1");
PageInfo page2 = new PageInfo("page2");
PageInfo page3 = new PageInfo("page3");

View File

@ -17,7 +17,7 @@ public class testSessionOOMSave extends SessionTest {
pageShowExpecter.blockForEvent();
pageShowExpecter.unregisterListener();
PageInfo home = new PageInfo(StringHelper.ABOUT_HOME_URL);
PageInfo home = new PageInfo(mStringHelper.ABOUT_HOME_URL);
PageInfo page1 = new PageInfo("page1");
PageInfo page2 = new PageInfo("page2");
PageInfo page3 = new PageInfo("page3");

View File

@ -28,63 +28,63 @@ public class testSettingsMenuItems extends PixelTest {
*/
// Customize menu items.
String[] PATH_CUSTOMIZE = { StringHelper.CUSTOMIZE_SECTION_LABEL };
String[] PATH_CUSTOMIZE = { mStringHelper.CUSTOMIZE_SECTION_LABEL };
String[][] OPTIONS_CUSTOMIZE = {
{ "Home" },
{ "Search", "", "Show search suggestions", "Installed search engines"},
{ StringHelper.TABS_LABEL, "Don't restore after quitting " + StringHelper.BRAND_NAME, "Always restore", "Don't restore after quitting " + StringHelper.BRAND_NAME },
{ StringHelper.IMPORT_FROM_ANDROID_LABEL, "", "Bookmarks", "History", "Import" },
{ mStringHelper.TABS_LABEL, "Don't restore after quitting " + mStringHelper.BRAND_NAME, "Always restore", "Don't restore after quitting " + mStringHelper.BRAND_NAME },
{ mStringHelper.IMPORT_FROM_ANDROID_LABEL, "", "Bookmarks", "History", "Import" },
};
// Home panel menu items.
String[] PATH_HOME = { StringHelper.CUSTOMIZE_SECTION_LABEL, "Home" };
String[] PATH_HOME = { mStringHelper.CUSTOMIZE_SECTION_LABEL, "Home" };
String[][] OPTIONS_HOME = {
{ "Panels" },
{ "Automatic updates", "Enabled", "Enabled", "Only over Wi-Fi" },
};
// Display menu items.
String[] PATH_DISPLAY = { StringHelper.DISPLAY_SECTION_LABEL };
final String[] TITLE_BAR_LABEL_ARR = { StringHelper.TITLE_BAR_LABEL, StringHelper.SHOW_PAGE_TITLE_LABEL,
StringHelper.SHOW_PAGE_TITLE_LABEL, StringHelper.SHOW_PAGE_ADDRESS_LABEL };
String[] PATH_DISPLAY = { mStringHelper.DISPLAY_SECTION_LABEL };
final String[] TITLE_BAR_LABEL_ARR = { mStringHelper.TITLE_BAR_LABEL, mStringHelper.SHOW_PAGE_TITLE_LABEL,
mStringHelper.SHOW_PAGE_TITLE_LABEL, mStringHelper.SHOW_PAGE_ADDRESS_LABEL };
String[][] OPTIONS_DISPLAY = {
{ StringHelper.TEXT_SIZE_LABEL },
{ mStringHelper.TEXT_SIZE_LABEL },
TITLE_BAR_LABEL_ARR,
{ StringHelper.SCROLL_TITLE_BAR_LABEL, "Hide the " + StringHelper.BRAND_NAME + " title bar when scrolling down a page" },
{ mStringHelper.SCROLL_TITLE_BAR_LABEL, "Hide the " + mStringHelper.BRAND_NAME + " title bar when scrolling down a page" },
{ "Advanced" },
{ StringHelper.CHARACTER_ENCODING_LABEL, "Don't show menu", "Show menu", "Don't show menu" },
{ StringHelper.PLUGINS_LABEL, "Tap to play", "Enabled", "Tap to play", "Disabled" },
{ mStringHelper.CHARACTER_ENCODING_LABEL, "Don't show menu", "Show menu", "Don't show menu" },
{ mStringHelper.PLUGINS_LABEL, "Tap to play", "Enabled", "Tap to play", "Disabled" },
};
// Privacy menu items.
String[] PATH_PRIVACY = { StringHelper.PRIVACY_SECTION_LABEL };
final String[] TRACKING_PROTECTION_LABEL_ARR = { StringHelper.TRACKING_PROTECTION_LABEL };
String[] PATH_PRIVACY = { mStringHelper.PRIVACY_SECTION_LABEL };
final String[] TRACKING_PROTECTION_LABEL_ARR = { mStringHelper.TRACKING_PROTECTION_LABEL };
String[][] OPTIONS_PRIVACY = {
TRACKING_PROTECTION_LABEL_ARR,
{ StringHelper.DNT_LABEL },
{ StringHelper.COOKIES_LABEL, "Enabled", "Enabled, excluding 3rd party", "Disabled" },
{ StringHelper.REMEMBER_PASSWORDS_LABEL },
{ StringHelper.MASTER_PASSWORD_LABEL },
{ StringHelper.CLEAR_PRIVATE_DATA_LABEL, "", "Browsing history", "Downloads", "Form & search history", "Cookies & active logins", "Saved passwords", "Cache", "Offline website data", "Site settings", "Clear data" },
{ mStringHelper.DNT_LABEL },
{ mStringHelper.COOKIES_LABEL, "Enabled", "Enabled, excluding 3rd party", "Disabled" },
{ mStringHelper.REMEMBER_PASSWORDS_LABEL },
{ mStringHelper.MASTER_PASSWORD_LABEL },
{ mStringHelper.CLEAR_PRIVATE_DATA_LABEL, "", "Browsing history", "Downloads", "Form & search history", "Cookies & active logins", "Saved passwords", "Cache", "Offline website data", "Site settings", "Clear data" },
};
// Mozilla/vendor menu items.
String[] PATH_MOZILLA = { StringHelper.MOZILLA_SECTION_LABEL };
String[] PATH_MOZILLA = { mStringHelper.MOZILLA_SECTION_LABEL };
String[][] OPTIONS_MOZILLA = {
{ StringHelper.ABOUT_LABEL },
{ StringHelper.FAQS_LABEL },
{ StringHelper.FEEDBACK_LABEL },
{ mStringHelper.ABOUT_LABEL },
{ mStringHelper.FAQS_LABEL },
{ mStringHelper.FEEDBACK_LABEL },
{ "Data choices" },
{ StringHelper.HEALTH_REPORT_LABEL, "Shares data with Mozilla about your browser health and helps you understand your browser performance" },
{ StringHelper.MY_HEALTH_REPORT_LABEL },
{ mStringHelper.HEALTH_REPORT_LABEL, "Shares data with Mozilla about your browser health and helps you understand your browser performance" },
{ mStringHelper.MY_HEALTH_REPORT_LABEL },
};
// Developer menu items.
String[] PATH_DEVELOPER = { StringHelper.DEVELOPER_TOOLS_SECTION_LABEL };
String[] PATH_DEVELOPER = { mStringHelper.DEVELOPER_TOOLS_SECTION_LABEL };
String[][] OPTIONS_DEVELOPER = {
{ StringHelper.PAINT_FLASHING_LABEL },
{ StringHelper.REMOTE_DEBUGGING_LABEL },
{ StringHelper.LEARN_MORE_LABEL },
{ mStringHelper.PAINT_FLASHING_LABEL },
{ mStringHelper.REMOTE_DEBUGGING_LABEL },
{ mStringHelper.LEARN_MORE_LABEL },
};
/*
@ -117,21 +117,21 @@ public class testSettingsMenuItems extends PixelTest {
// Set special handling for Settings items that are conditionally built.
updateConditionalSettings(settingsMenuItems);
selectMenuItem(StringHelper.SETTINGS_LABEL);
mAsserter.ok(mSolo.waitForText(StringHelper.SETTINGS_LABEL),
"The Settings menu did not load", StringHelper.SETTINGS_LABEL);
selectMenuItem(mStringHelper.SETTINGS_LABEL);
mAsserter.ok(mSolo.waitForText(mStringHelper.SETTINGS_LABEL),
"The Settings menu did not load", mStringHelper.SETTINGS_LABEL);
// Dismiss the Settings screen and verify that the view is returned to about:home page
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
// Waiting for page title to appear to be sure that is fully loaded before opening the menu
mAsserter.ok(mSolo.waitForText(StringHelper.TITLE_PLACE_HOLDER), "about:home did not load",
StringHelper.TITLE_PLACE_HOLDER);
verifyUrl(StringHelper.ABOUT_HOME_URL);
mAsserter.ok(mSolo.waitForText(mStringHelper.TITLE_PLACE_HOLDER), "about:home did not load",
mStringHelper.TITLE_PLACE_HOLDER);
verifyUrl(mStringHelper.ABOUT_HOME_URL);
selectMenuItem(StringHelper.SETTINGS_LABEL);
mAsserter.ok(mSolo.waitForText(StringHelper.SETTINGS_LABEL),
"The Settings menu did not load", StringHelper.SETTINGS_LABEL);
selectMenuItem(mStringHelper.SETTINGS_LABEL);
mAsserter.ok(mSolo.waitForText(mStringHelper.SETTINGS_LABEL),
"The Settings menu did not load", mStringHelper.SETTINGS_LABEL);
checkForSync(mDevice);
@ -145,8 +145,8 @@ public class testSettingsMenuItems extends PixelTest {
* but is under "Customize" on large tablets.
*/
public void checkForSync(Device device) {
mAsserter.ok(mSolo.waitForText(StringHelper.SYNC_LABEL), "Waiting for Sync option",
StringHelper.SYNC_LABEL);
mAsserter.ok(mSolo.waitForText(mStringHelper.SYNC_LABEL), "Waiting for Sync option",
mStringHelper.SYNC_LABEL);
}
/**
@ -157,7 +157,7 @@ public class testSettingsMenuItems extends PixelTest {
// Preferences dependent on RELEASE_BUILD
if (!AppConstants.RELEASE_BUILD) {
// Text reflow - only built if *not* release build
String[] textReflowUi = { StringHelper.TEXT_REFLOW_LABEL };
String[] textReflowUi = { mStringHelper.TEXT_REFLOW_LABEL };
settingsMap.get(PATH_DISPLAY).add(textReflowUi);
if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED) {
@ -182,13 +182,13 @@ public class testSettingsMenuItems extends PixelTest {
// Crash reporter
if (AppConstants.MOZ_CRASHREPORTER) {
String[] crashReporterUi = { "Crash Reporter", StringHelper.BRAND_NAME + " submits crash reports to help Mozilla make your browser more stable and secure" };
String[] crashReporterUi = { "Crash Reporter", mStringHelper.BRAND_NAME + " submits crash reports to help Mozilla make your browser more stable and secure" };
settingsMap.get(PATH_MOZILLA).add(crashReporterUi);
}
// Telemetry
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
String[] telemetryUi = { "Telemetry", "Shares performance, usage, hardware and customization data about your browser with Mozilla to help us make " + StringHelper.BRAND_NAME + " better" };
String[] telemetryUi = { "Telemetry", "Shares performance, usage, hardware and customization data about your browser with Mozilla to help us make " + mStringHelper.BRAND_NAME + " better" };
settingsMap.get(PATH_MOZILLA).add(telemetryUi);
}

View File

@ -26,10 +26,10 @@ import com.jayway.android.robotium.solo.Condition;
*/
public class testShareLink extends AboutHomeTest {
String url;
String urlTitle = StringHelper.ROBOCOP_BIG_LINK_TITLE;
String urlTitle = mStringHelper.ROBOCOP_BIG_LINK_TITLE;
public void testShareLink() {
url = getAbsoluteUrl(StringHelper.ROBOCOP_BIG_LINK_URL);
url = getAbsoluteUrl(mStringHelper.ROBOCOP_BIG_LINK_URL);
ArrayList<String> shareOptions;
blockForGeckoReady();
@ -39,7 +39,7 @@ public class testShareLink extends AboutHomeTest {
inputAndLoadUrl(url);
verifyUrlBarTitle(url); // Waiting for page title to ensure the page is loaded
selectMenuItem(StringHelper.SHARE_LABEL);
selectMenuItem(mStringHelper.SHARE_LABEL);
if (Build.VERSION.SDK_INT >= 14) {
// Check for our own sync in the submenu.
waitForText("Sync$");
@ -94,16 +94,16 @@ public class testShareLink extends AboutHomeTest {
// Prepopulate top sites with history items to overflow tiles.
// We are trying to move away from using reflection and doing more black-box testing.
inputAndLoadUrl(getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL));
inputAndLoadUrl(getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL));
inputAndLoadUrl(getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_03_URL));
inputAndLoadUrl(getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_04_URL));
inputAndLoadUrl(getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL));
inputAndLoadUrl(getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_02_URL));
inputAndLoadUrl(getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_03_URL));
inputAndLoadUrl(getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_04_URL));
if (mDevice.type.equals("tablet")) {
// Tablets have more tile spaces to fill.
inputAndLoadUrl(getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_05_URL));
inputAndLoadUrl(getAbsoluteUrl(StringHelper.ROBOCOP_BOXES_URL));
inputAndLoadUrl(getAbsoluteUrl(StringHelper.ROBOCOP_SEARCH_URL));
inputAndLoadUrl(getAbsoluteUrl(StringHelper.ROBOCOP_TEXT_PAGE_URL));
inputAndLoadUrl(getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_05_URL));
inputAndLoadUrl(getAbsoluteUrl(mStringHelper.ROBOCOP_BOXES_URL));
inputAndLoadUrl(getAbsoluteUrl(mStringHelper.ROBOCOP_SEARCH_URL));
inputAndLoadUrl(getAbsoluteUrl(mStringHelper.ROBOCOP_TEXT_PAGE_URL));
}
// Test the share popup in Top Sites.

View File

@ -29,15 +29,15 @@ public class testStumblerSetting extends BaseTest {
blockForGeckoReady();
selectMenuItem(StringHelper.SETTINGS_LABEL);
mAsserter.ok(mSolo.waitForText(StringHelper.SETTINGS_LABEL),
"The Settings menu did not load", StringHelper.SETTINGS_LABEL);
selectMenuItem(mStringHelper.SETTINGS_LABEL);
mAsserter.ok(mSolo.waitForText(mStringHelper.SETTINGS_LABEL),
"The Settings menu did not load", mStringHelper.SETTINGS_LABEL);
String section = "^" + StringHelper.MOZILLA_SECTION_LABEL + "$";
String section = "^" + mStringHelper.MOZILLA_SECTION_LABEL + "$";
waitForEnabledText(section);
mSolo.clickOnText(section);
String itemTitle = "^" + StringHelper.LOCATION_SERVICES_LABEL + "$";
String itemTitle = "^" + mStringHelper.LOCATION_SERVICES_LABEL + "$";
boolean foundText = waitForPreferencesText(itemTitle);
mAsserter.ok(foundText, "Waiting for settings item " + itemTitle + " in section " + section,
"The " + itemTitle + " option is present in section " + section);

View File

@ -12,25 +12,25 @@ public class testSystemPages extends PixelTest {
public void testSystemPages() {
blockForGeckoReady();
final String urls [] = { StringHelper.ABOUT_FIREFOX_URL, StringHelper.ABOUT_RIGHTS_URL,
StringHelper.ABOUT_ADDONS_URL, StringHelper.ABOUT_DOWNLOADS_URL,
StringHelper.ABOUT_BUILDCONFIG_URL, StringHelper.ABOUT_FEEDBACK_URL,
StringHelper.ABOUT_HEALTHREPORT_URL, StringHelper.ABOUT_SCHEME
final String urls [] = { mStringHelper.ABOUT_FIREFOX_URL, mStringHelper.ABOUT_RIGHTS_URL,
mStringHelper.ABOUT_ADDONS_URL, mStringHelper.ABOUT_DOWNLOADS_URL,
mStringHelper.ABOUT_BUILDCONFIG_URL, mStringHelper.ABOUT_FEEDBACK_URL,
mStringHelper.ABOUT_HEALTHREPORT_URL, mStringHelper.ABOUT_SCHEME
};
// Pages to be tested from the menu and their expected urls. This if of the form { {{ <path to item> }, { <expected url> }}* }
String menuItems [][][] = {{{ StringHelper.APPS_LABEL }, { StringHelper.ABOUT_APPS_URL }},
{{ StringHelper.DOWNLOADS_LABEL }, { StringHelper.ABOUT_DOWNLOADS_URL}},
{{ StringHelper.ADDONS_LABEL }, { StringHelper.ABOUT_ADDONS_URL }},
{{ StringHelper.SETTINGS_LABEL, StringHelper.MOZILLA_SECTION_LABEL, StringHelper.ABOUT_LABEL }, { StringHelper.ABOUT_SCHEME }},
{{ StringHelper.SETTINGS_LABEL, StringHelper.MOZILLA_SECTION_LABEL, StringHelper.FEEDBACK_LABEL }, { StringHelper.ABOUT_FEEDBACK_URL }},
{{ StringHelper.SETTINGS_LABEL, StringHelper.MOZILLA_SECTION_LABEL, StringHelper.MY_HEALTH_REPORT_LABEL }, { StringHelper.ABOUT_HEALTHREPORT_URL }}};
String menuItems [][][] = {{{ mStringHelper.APPS_LABEL }, { mStringHelper.ABOUT_APPS_URL }},
{{ mStringHelper.DOWNLOADS_LABEL }, { mStringHelper.ABOUT_DOWNLOADS_URL}},
{{ mStringHelper.ADDONS_LABEL }, { mStringHelper.ABOUT_ADDONS_URL }},
{{ mStringHelper.SETTINGS_LABEL, mStringHelper.MOZILLA_SECTION_LABEL, mStringHelper.ABOUT_LABEL }, { mStringHelper.ABOUT_SCHEME }},
{{ mStringHelper.SETTINGS_LABEL, mStringHelper.MOZILLA_SECTION_LABEL, mStringHelper.FEEDBACK_LABEL }, { mStringHelper.ABOUT_FEEDBACK_URL }},
{{ mStringHelper.SETTINGS_LABEL, mStringHelper.MOZILLA_SECTION_LABEL, mStringHelper.MY_HEALTH_REPORT_LABEL }, { mStringHelper.ABOUT_HEALTHREPORT_URL }}};
/* Load system pages from url and check that the pages are loaded in the same tab */
checkUrl(urls);
/* Verify that the search field is not in the focus by pressing back. That will load the previous
about: page if there is no the keyboard to dismiss, meaning that the search field was not in focus */
loadAndPaint(StringHelper.ABOUT_ABOUT_URL);
loadAndPaint(mStringHelper.ABOUT_ABOUT_URL);
// Press back to verify if the keyboard is dismissed or the previous about: page loads
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
@ -38,8 +38,8 @@ public class testSystemPages extends PixelTest {
mSolo.sleep(AFTER_BACK_SLEEP_MS);
// We will use the "about:" page as our reference page.
loadAndPaint(StringHelper.ABOUT_SCHEME);
verifyUrl(StringHelper.ABOUT_SCHEME); // Verify that the previous about: page is loaded, meaning no keyboard was present
loadAndPaint(mStringHelper.ABOUT_SCHEME);
verifyUrl(mStringHelper.ABOUT_SCHEME); // Verify that the previous about: page is loaded, meaning no keyboard was present
// Load system pages by navigating through the UI.
loadItemsByLevel(menuItems);
@ -72,7 +72,7 @@ public class testSystemPages extends PixelTest {
selectMenuItemByPath(pathToItem);
// Wait for the new tab and page to load
if (StringHelper.ABOUT_SCHEME.equals(expectedUrl)) {
if (mStringHelper.ABOUT_SCHEME.equals(expectedUrl)) {
waitForPaint(paintExpecter); // Waiting for the page to load
paintExpecter.unregisterListener();
} else {
@ -83,7 +83,7 @@ public class testSystemPages extends PixelTest {
contentEventExpecter.unregisterListener();
verifyUrl(expectedUrl);
if (StringHelper.ABOUT_SCHEME.equals(expectedUrl)) {
if (mStringHelper.ABOUT_SCHEME.equals(expectedUrl)) {
// Decreasing because we do not expect this to be in a different tab.
expectedTabCount--;
}

View File

@ -32,7 +32,7 @@ public class testThumbnails extends BaseTest {
mSolo.sleep(thumbnailDelay);
inputAndLoadUrl(site2Url);
mSolo.sleep(thumbnailDelay);
inputAndLoadUrl(StringHelper.ABOUT_HOME_URL);
inputAndLoadUrl(mStringHelper.ABOUT_HOME_URL);
waitForTest(new ThumbnailTest(site1Title, Color.GREEN), 5000);
mAsserter.is(getTopSiteThumbnailColor(site1Title), Color.GREEN, "Top site thumbnail updated for HTTP 200");
waitForTest(new ThumbnailTest(site2Title, Color.GREEN), 5000);
@ -43,7 +43,7 @@ public class testThumbnails extends BaseTest {
mSolo.sleep(thumbnailDelay);
inputAndLoadUrl(site2Url);
mSolo.sleep(thumbnailDelay);
inputAndLoadUrl(StringHelper.ABOUT_HOME_URL);
inputAndLoadUrl(mStringHelper.ABOUT_HOME_URL);
waitForTest(new ThumbnailTest(site1Title, Color.RED), 5000);
mAsserter.is(getTopSiteThumbnailColor(site1Title), Color.RED, "Top site thumbnail updated for HTTP 200");
waitForTest(new ThumbnailTest(site2Title, Color.GREEN), 5000);

View File

@ -20,39 +20,39 @@ public class testTitleBar extends PixelTest {
public void checkOption() {
String blank1 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String title = StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE;
String blank1 = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String title = mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE;
// Loading a page
inputAndLoadUrl(blank1);
verifyUrlBarTitle(blank1);
// Ensure the title is displayed in the URL Bar
selectOption(StringHelper.SHOW_PAGE_TITLE_LABEL);
selectOption(mStringHelper.SHOW_PAGE_TITLE_LABEL);
inputAndLoadUrl(blank1);
verifyUrlBarTitle(title);
// Ensure the full URL is displayed in the URL Bar
selectOption(StringHelper.SHOW_PAGE_ADDRESS_LABEL);
selectOption(mStringHelper.SHOW_PAGE_ADDRESS_LABEL);
inputAndLoadUrl(blank1);
verifyUrlBarTitle(blank1);
}
// Entering settings, changing the options: show title/page address option and verifing the device type because for phone there is an extra back action to exit the settings menu
public void selectOption(String option) {
selectSettingsItem(StringHelper.DISPLAY_SECTION_LABEL, StringHelper.TITLE_BAR_LABEL);
mAsserter.ok(waitForText(StringHelper.SHOW_PAGE_TITLE_LABEL), "Waiting for the pop-up to open", "Pop up with the options was openend");
selectSettingsItem(mStringHelper.DISPLAY_SECTION_LABEL, mStringHelper.TITLE_BAR_LABEL);
mAsserter.ok(waitForText(mStringHelper.SHOW_PAGE_TITLE_LABEL), "Waiting for the pop-up to open", "Pop up with the options was openend");
mSolo.clickOnText(option);
mAsserter.ok(waitForText(StringHelper.CHARACTER_ENCODING_LABEL), "Waiting to press the option", "The pop-up is dismissed once clicked");
mAsserter.ok(waitForText(mStringHelper.CHARACTER_ENCODING_LABEL), "Waiting to press the option", "The pop-up is dismissed once clicked");
if (mDevice.type.equals("phone")) {
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
mAsserter.ok(waitForText(StringHelper.CUSTOMIZE_SECTION_LABEL), "Waiting to perform one back", "One back performed");
mAsserter.ok(waitForText(mStringHelper.CUSTOMIZE_SECTION_LABEL), "Waiting to perform one back", "One back performed");
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
mAsserter.ok(waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_URL), "Waiting to exit settings", "Exit settings done");
mAsserter.ok(waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL), "Waiting to exit settings", "Exit settings done");
}
else {
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
mAsserter.ok(waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_URL), "Waiting to exit settings", "Exit settings done");
mAsserter.ok(waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL), "Waiting to exit settings", "Exit settings done");
}
}
}