Bug 1174878 - Update robocop test testSettingsMenuItems.java to use StringHelper.java in all cases.r=liuche
authorAllison Naaktgeboren <ally@mozilla.com>
Wed, 19 Aug 2015 20:46:46 -0700
changeset 258486 c9d91ba09a2f047ac03e820b6ad609058e652d1c
parent 258485 e0acb15cefd63db9bf1a5f467d3a8434ad4b54cd
child 258487 b83ffe470d28f8311d901bde5640b19ef3ccf92c
push id14743
push useranaaktgeboren@mozilla.com
push dateThu, 20 Aug 2015 03:47:03 +0000
treeherderfx-team@c9d91ba09a2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche
bugs1174878
milestone43.0a1
Bug 1174878 - Update robocop test testSettingsMenuItems.java to use StringHelper.java in all cases.r=liuche
mobile/android/tests/browser/robocop/StringHelper.java
mobile/android/tests/browser/robocop/testSettingsMenuItems.java
--- a/mobile/android/tests/browser/robocop/StringHelper.java
+++ b/mobile/android/tests/browser/robocop/StringHelper.java
@@ -109,16 +109,20 @@ public class StringHelper {
     public final String ROBOCOP_SEARCH_TITLE = "Robocop Search Engine";
     public final String ROBOCOP_TEXT_PAGE_TITLE = "Robocop Text Page";
     public final String ROBOCOP_INPUT_TITLE = "Robocop Input";
 
     // Distribution tile labels
     public final String DISTRIBUTION1_LABEL = "Distribution 1";
     public final String DISTRIBUTION2_LABEL = "Distribution 2";
 
+    // Import strings
+    public final String BOOKMARKS;
+    public final String IMPORT;
+
     // 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;
 
@@ -149,25 +153,44 @@ public class StringHelper {
     public final String TRACKING_PROTECTION_PROMPT_TITLE;
     public final String TRACKING_PROTECTION_PROMPT_BUTTON;
     public final String DNT_LABEL;
     public final String COOKIES_LABEL;
     public final String REMEMBER_LOGINS_LABEL;
     public final String MANAGE_LOGINS_LABEL;
     public final String MASTER_PASSWORD_LABEL;
     public final String CLEAR_PRIVATE_DATA_LABEL;
+    public final String ENABLED_EXCLUDE_3RD_PARTY;
+    public final String BROWSING_HISTORY;
+    public final String SEARCH_HISTORY;
+    public final String DOWNLOADS;
+    public final String FORM_HISTORY;
+    public final String COOKIES_AND_LOGINS;
+    public final String CACHE;
+    public final String OFFLINE_DATA;
+    public final String SITE_SETTINGS;
+    public final String CLEAR_DATA_BUTTON;
 
     // Mozilla
     public final String BRAND_NAME = "(Fennec|Nightly|Aurora|Firefox Beta|Firefox)";
     public final String ABOUT_LABEL = "About " + BRAND_NAME ;
     public final String FAQS_LABEL;
     public final String FEEDBACK_LABEL;
     public final String LOCATION_SERVICES_LABEL = "Mozilla Location Service";
     public final String HEALTH_REPORT_LABEL = BRAND_NAME + " Health Report";
     public final String MY_HEALTH_REPORT_LABEL;
+    public final String DATA_CHOICES;
+    public final String HEALTH_REPORT_EXPLANATION;
+    public final String MOZ_LOCATION;
+    public final String MOZ_LOCATION_MSG;
+    public final String LEARN_MORE;
+    public final String CRASH_REPORTER;
+    public final String CRASH_REPORTER_MSG;
+    public final String TELEMETRY;
+    public final String TELEMETRY_MSG;
 
     // Developer tools
     public final String REMOTE_DEBUGGING_USB_LABEL;
     public final String REMOTE_DEBUGGING_WIFI_LABEL;
     public final String LEARN_MORE_LABEL;
 
     // Labels for the about:home tabs
     public final String HISTORY_LABEL;
@@ -234,16 +257,47 @@ public class StringHelper {
 
     public final String POPUP_MESSAGE = "prevented this site from opening";
     public final String POPUP_ALLOW;
     public final String POPUP_DENY = "Don't show";
 
     // Strings used as content description, e.g. for ImageButtons
     public final String CONTENT_DESCRIPTION_READER_MODE_BUTTON = "Enter Reader View";
 
+    // Home Panel Settings
+    public final String CUSTOMIZE_HOME;
+    public final String ENABLED;
+    public final String HISTORY;
+    public final String PANELS;
+
+    // Search Settings
+    public final String SEARCH_TITLE;
+    public final String SEARCH_SUGGESTIONS;
+    public final String SEARCH_INSTALLED;
+
+    // Advanced Settings
+    public final String ADVANCED;
+    public final String DONT_SHOW_MENU;
+    public final String SHOW_MENU;
+    public final String DISABLED;
+    public final String TAP_TO_PLAY;
+    public final String HIDE_TITLE_BAR;
+
+    // Update Settings
+    public final String AUTOMATIC_UPDATES;
+    public final String OVER_WIFI_OPTION;
+    public final String DOWNLOAD_UPDATES_AUTO;
+    public final String ALWAYS;
+    public final String NEVER;
+
+    // Restore Tabs Settings
+    public final String DONT_RESTORE_TABS;
+    public final String ALWAYS_RESTORE_TABS;
+    public final String DONT_RESTORE_QUIT;
+
     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),
@@ -301,16 +355,20 @@ public class StringHelper {
                 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);
 
+        // Import strings
+        IMPORT = res.getString(R.string.bookmarkhistory_button_import);
+        BOOKMARKS = res.getString(R.string.bookmark);
+
         // 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);
 
@@ -336,21 +394,40 @@ public class StringHelper {
         TRACKING_PROTECTION_PROMPT_TITLE = res.getString(R.string.tracking_protection_prompt_title);
         TRACKING_PROTECTION_PROMPT_BUTTON = res.getString(R.string.tracking_protection_prompt_action_button);
         DNT_LABEL = res.getString(R.string.pref_donottrack_title);
         COOKIES_LABEL = res.getString(R.string.pref_cookies_menu);
         REMEMBER_LOGINS_LABEL = res.getString(R.string.pref_remember_signons);
         MANAGE_LOGINS_LABEL = res.getString(R.string.pref_manage_logins);
         MASTER_PASSWORD_LABEL = res.getString(R.string.pref_use_master_password);
         CLEAR_PRIVATE_DATA_LABEL = res.getString(R.string.pref_clear_private_data);
+        ENABLED_EXCLUDE_3RD_PARTY = res.getString(R.string.pref_cookies_not_accept_foreign);
+        BROWSING_HISTORY = res.getString(R.string.pref_private_data_history2);
+        SEARCH_HISTORY = res.getString(R.string.pref_private_data_searchHistory);
+        DOWNLOADS = res.getString(R.string.pref_private_data_downloadFiles2);
+        FORM_HISTORY = res.getString(R.string.pref_private_data_formdata2);
+        COOKIES_AND_LOGINS = res.getString(R.string.pref_private_data_cookies2);
+        CACHE = res.getString(R.string.pref_private_data_cache);
+        OFFLINE_DATA = res.getString(R.string.pref_private_data_offlineApps);
+        SITE_SETTINGS = res.getString(R.string.pref_private_data_siteSettings);
+        CLEAR_DATA_BUTTON = res.getString(R.string.button_clear_data);
 
         // Mozilla
         FAQS_LABEL = res.getString(R.string.pref_vendor_faqs);
         FEEDBACK_LABEL = res.getString(R.string.pref_vendor_feedback);
+        DATA_CHOICES = res.getString(R.string.pref_category_datareporting);
         MY_HEALTH_REPORT_LABEL = res.getString(R.string.datareporting_abouthr_title);
+        HEALTH_REPORT_EXPLANATION = res.getString(R.string.datareporting_fhr_summary2);
+        MOZ_LOCATION = res.getString(R.string.datareporting_wifi_title);
+        MOZ_LOCATION_MSG = res.getString(R.string.datareporting_wifi_geolocation_summary);
+        LEARN_MORE = res.getString(R.string.pref_learn_more);
+        CRASH_REPORTER = res.getString(R.string.datareporting_crashreporter_title_short);
+        CRASH_REPORTER_MSG = res.getString(R.string.datareporting_crashreporter_summary);
+        TELEMETRY = res.getString(R.string.datareporting_telemetry_title);
+        TELEMETRY_MSG = res.getString(R.string.datareporting_telemetry_summary);
 
         // Developer tools
         REMOTE_DEBUGGING_USB_LABEL = res.getString(R.string.pref_developer_remotedebugging_usb);
         REMOTE_DEBUGGING_WIFI_LABEL = res.getString(R.string.pref_developer_remotedebugging_wifi);
         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);
@@ -398,16 +475,47 @@ public class StringHelper {
 
         // Edit Bookmark screen
         EDIT_BOOKMARK = res.getString(R.string.bookmark_edit_title);
 
         // Strings used in doorhanger messages and buttons
         GEO_ALLOW = res.getString(R.string.share);
 
         POPUP_ALLOW = res.getString(R.string.pref_panels_show);
+
+        // Home Settings
+        PANELS = res.getString(R.string.pref_category_home_panels);
+        CUSTOMIZE_HOME = res.getString(R.string.pref_category_home);
+        ENABLED = res.getString(R.string.pref_home_updates_enabled);
+        HISTORY = res.getString(R.string.home_history_title);
+
+        // Search Settings
+        SEARCH_TITLE = res.getString(R.string.search);
+        SEARCH_SUGGESTIONS = res.getString(R.string.pref_search_suggestions);
+        SEARCH_INSTALLED = res.getString(R.string.pref_category_installed_search_engines);
+
+        // Advanced Settings
+        ADVANCED = res.getString(R.string.pref_category_advanced);
+        DONT_SHOW_MENU = res.getString(R.string.pref_char_encoding_off);
+        SHOW_MENU = res.getString(R.string.pref_char_encoding_on);
+        DISABLED = res.getString(R.string.pref_plugins_disabled );
+        TAP_TO_PLAY = res.getString(R.string.pref_plugins_tap_to_play);
+        HIDE_TITLE_BAR = res.getString(R.string.pref_scroll_title_bar_summary );
+
+        // Update Settings
+        AUTOMATIC_UPDATES = res.getString(R.string.pref_home_updates);
+        OVER_WIFI_OPTION = res.getString(R.string.pref_update_autodownload_wifi);
+        DOWNLOAD_UPDATES_AUTO = res.getString(R.string.pref_update_autodownload);
+        ALWAYS = res.getString(R.string.pref_update_autodownload_enabled);
+        NEVER = res.getString(R.string.pref_update_autodownload_disabled);
+
+        // Restore Tabs Settings
+        DONT_RESTORE_TABS = res.getString(R.string.pref_restore_quit);
+        ALWAYS_RESTORE_TABS = res.getString(R.string.pref_restore_always);
+        DONT_RESTORE_QUIT = res.getString(R.string.pref_restore_quit);
     }
 
     public static void initialize(Resources res) {
         if (instance != null) {
             throw new IllegalStateException(StringHelper.class.getSimpleName() + " already Initialized");
         }
         instance = new StringHelper(res);
     }
--- a/mobile/android/tests/browser/robocop/testSettingsMenuItems.java
+++ b/mobile/android/tests/browser/robocop/testSettingsMenuItems.java
@@ -64,58 +64,61 @@ public class testSettingsMenuItems exten
          * where defaultValue is optional, and there can be multiple options.
          *
          * These menu items are the ones that are always present - to test menu items that differ
          * based on build (e.g., release vs. nightly), add the items in <code>addConditionalSettings</code>.
          */
 
         PATH_CUSTOMIZE = new String[] { mStringHelper.CUSTOMIZE_SECTION_LABEL };
         OPTIONS_CUSTOMIZE = new String[][] {
-                { "Home" },
-                { "Search", "", "Show search suggestions", "Installed search engines"},
-                { 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" },
+                { mStringHelper.CUSTOMIZE_HOME},
+                { mStringHelper.SEARCH_TITLE, "", mStringHelper.SEARCH_SUGGESTIONS, mStringHelper.SEARCH_INSTALLED},
+                { mStringHelper.TABS_LABEL, mStringHelper.DONT_RESTORE_TABS, mStringHelper.ALWAYS_RESTORE_TABS, mStringHelper.DONT_RESTORE_QUIT },
+                { mStringHelper.IMPORT_FROM_ANDROID_LABEL, "", mStringHelper.BOOKMARKS, mStringHelper.HISTORY, mStringHelper.IMPORT },
         };
 
-        PATH_HOME = new String[] { mStringHelper.CUSTOMIZE_SECTION_LABEL, "Home" };
+        PATH_HOME = new String[] { mStringHelper.CUSTOMIZE_SECTION_LABEL, mStringHelper.CUSTOMIZE_HOME };
         OPTIONS_HOME = new String[][] {
-                { "Panels" },
-                { "Automatic updates", "Enabled", "Enabled", "Only over Wi-Fi" },
+                { mStringHelper.PANELS },
+                { mStringHelper.AUTOMATIC_UPDATES, mStringHelper.ENABLED, mStringHelper.ENABLED, mStringHelper.OVER_WIFI_OPTION},
         };
 
         PATH_DISPLAY = new String[] { mStringHelper.DISPLAY_SECTION_LABEL };
         TITLE_BAR_LABEL_ARR = new String[] { mStringHelper.TITLE_BAR_LABEL, mStringHelper.SHOW_PAGE_ADDRESS_LABEL,
                 mStringHelper.SHOW_PAGE_TITLE_LABEL, mStringHelper.SHOW_PAGE_ADDRESS_LABEL };
         OPTIONS_DISPLAY = new String[][] {
                 { mStringHelper.TEXT_SIZE_LABEL },
                 TITLE_BAR_LABEL_ARR,
-                { mStringHelper.SCROLL_TITLE_BAR_LABEL, "Hide the " + mStringHelper.BRAND_NAME + " title bar when scrolling down a page" },
-                { "Advanced" },
-                { 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" },
+                { mStringHelper.SCROLL_TITLE_BAR_LABEL, mStringHelper.HIDE_TITLE_BAR },
+                { mStringHelper.ADVANCED},
+                { mStringHelper.CHARACTER_ENCODING_LABEL, mStringHelper.DONT_SHOW_MENU, mStringHelper.SHOW_MENU, mStringHelper.DONT_SHOW_MENU },
+                { mStringHelper.PLUGINS_LABEL, mStringHelper.TAP_TO_PLAY, mStringHelper.ENABLED, mStringHelper.TAP_TO_PLAY, mStringHelper.DISABLED },
         };
 
         PATH_PRIVACY = new String[] { mStringHelper.PRIVACY_SECTION_LABEL };
         OPTIONS_PRIVACY = new String[][] {
                 { mStringHelper.TRACKING_PROTECTION_LABEL },
                 { mStringHelper.DNT_LABEL },
-                { mStringHelper.COOKIES_LABEL, "Enabled", "Enabled, excluding 3rd party", "Disabled" },
+                { mStringHelper.COOKIES_LABEL, mStringHelper.ENABLED, mStringHelper.ENABLED_EXCLUDE_3RD_PARTY, mStringHelper.ENABLED },
                 { mStringHelper.REMEMBER_LOGINS_LABEL },
                 { mStringHelper.MANAGE_LOGINS_LABEL },
                 { mStringHelper.MASTER_PASSWORD_LABEL },
-                { mStringHelper.CLEAR_PRIVATE_DATA_LABEL, "", "Browsing history", "Search history", "Downloads", "Form history", "Cookies & active logins", mStringHelper.CLEAR_PRIVATE_DATA_LABEL, "Cache", "Offline website data", "Site settings", "Clear data" },
+                { mStringHelper.CLEAR_PRIVATE_DATA_LABEL, "", mStringHelper.BROWSING_HISTORY,
+                        mStringHelper.SEARCH_HISTORY, mStringHelper.DOWNLOADS, mStringHelper.FORM_HISTORY,
+                        mStringHelper.COOKIES_AND_LOGINS, mStringHelper.CLEAR_PRIVATE_DATA_LABEL, mStringHelper.CACHE,
+                        mStringHelper.OFFLINE_DATA, mStringHelper.SITE_SETTINGS, mStringHelper.CLEAR_DATA_BUTTON },
         };
 
         PATH_MOZILLA = new String[] { mStringHelper.MOZILLA_SECTION_LABEL };
         OPTIONS_MOZILLA = new String[][] {
                 { mStringHelper.ABOUT_LABEL },
                 { mStringHelper.FAQS_LABEL },
                 { mStringHelper.FEEDBACK_LABEL },
-                { "Data choices" },
-                { mStringHelper.HEALTH_REPORT_LABEL, "Shares data with Mozilla about your browser health and helps you understand your browser performance" },
+                { mStringHelper.DATA_CHOICES },
+                { mStringHelper.HEALTH_REPORT_LABEL, mStringHelper.HEALTH_REPORT_EXPLANATION },
                 { mStringHelper.MY_HEALTH_REPORT_LABEL },
         };
 
         PATH_DEVELOPER = new String[] { mStringHelper.DEVELOPER_TOOLS_SECTION_LABEL };
         OPTIONS_DEVELOPER = new String[][] {
                 { mStringHelper.REMOTE_DEBUGGING_USB_LABEL },
                 { mStringHelper.LEARN_MORE_LABEL },
                 { mStringHelper.REMOTE_DEBUGGING_WIFI_LABEL },
@@ -179,45 +182,45 @@ public class testSettingsMenuItems exten
         // Preferences dependent on RELEASE_BUILD
         if (!AppConstants.RELEASE_BUILD) {
             // Text reflow - only built if *not* release build
             String[] textReflowUi = { mStringHelper.TEXT_REFLOW_LABEL };
             settingsMap.get(PATH_DISPLAY).add(textReflowUi);
 
             if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED) {
                 // Anonymous cell tower/wifi collection
-                String[] networkReportingUi = { "Mozilla Location Service", "Help Mozilla map the world! Share the approximate Wi-Fi and cellular location of your device to improve our geolocation service." };
+                String[] networkReportingUi = { mStringHelper.MOZ_LOCATION, mStringHelper.MOZ_LOCATION_MSG };
                 settingsMap.get(PATH_MOZILLA).add(networkReportingUi);
 
-                String[] learnMoreUi = { "Learn more" };
+                String[] learnMoreUi = { mStringHelper.LEARN_MORE };
                 settingsMap.get(PATH_MOZILLA).add(learnMoreUi);
             }
         }
 
         // Automatic updates
         if (AppConstants.MOZ_UPDATER) {
-            String[] autoUpdateUi = { "Download updates automatically", "Only over Wi-Fi", "Always", "Only over Wi-Fi", "Never" };
+            String[] autoUpdateUi = { mStringHelper.DOWNLOAD_UPDATES_AUTO, mStringHelper.OVER_WIFI_OPTION, mStringHelper.ALWAYS, mStringHelper.OVER_WIFI_OPTION, mStringHelper.NEVER };
             settingsMap.get(PATH_CUSTOMIZE).add(autoUpdateUi);
         }
 
         // Tab Queue
         if (AppConstants.MOZ_ANDROID_TAB_QUEUE) {
             final String[] tabQueue = { mStringHelper.TAB_QUEUE_LABEL, mStringHelper.TAB_QUEUE_SUMMARY };
             settingsMap.get(PATH_CUSTOMIZE).add(tabQueue);
         }
 
         // Crash reporter
         if (AppConstants.MOZ_CRASHREPORTER) {
-            String[] crashReporterUi = { "Crash Reporter", mStringHelper.BRAND_NAME + " submits crash reports to help Mozilla make your browser more stable and secure" };
+            String[] crashReporterUi = { mStringHelper.CRASH_REPORTER, mStringHelper.CRASH_REPORTER_MSG};
             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 " + mStringHelper.BRAND_NAME + " better" };
+            String[] telemetryUi = { mStringHelper.TELEMETRY, mStringHelper.TELEMETRY_MSG};
             settingsMap.get(PATH_MOZILLA).add(telemetryUi);
         }
 
         // Tablet: we don't allow a page title option.
         if (HardwareUtils.isTablet()) {
             settingsMap.get(PATH_DISPLAY).remove(TITLE_BAR_LABEL_ARR);
         }