Bug 1153904 - Voice input setting item UI test. r=liuche
authorKarim Benhmida <kbenhmida@mozilla.com>
Thu, 18 Jun 2015 17:29:56 -0700
changeset 250363 d6999339a68ec6bc6af3f46ea55bff5307505ff2
parent 250362 b3f1aedcf9ba93825bc758684e722435cb0d296c
child 250364 9f307a1aba5c44071d4f7a74a1ac4e48c61d0dba
push id13755
push usercliu@mozilla.com
push dateSat, 27 Jun 2015 16:22:04 +0000
treeherderfx-team@9f307a1aba5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche
bugs1153904
milestone41.0a1
Bug 1153904 - Voice input setting item UI test. 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
@@ -128,16 +128,18 @@ public class StringHelper {
     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 = "Title bar";
     public final String SCROLL_TITLE_BAR_LABEL;
+    public final String VOICE_INPUT_TITLE_LABEL;
+    public final String VOICE_INPUT_SUMMARY_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 = "Show page title";
     public final String SHOW_PAGE_ADDRESS_LABEL = "Show page address";
 
@@ -313,16 +315,18 @@ public class StringHelper {
         // 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);
         SCROLL_TITLE_BAR_LABEL = res.getString(R.string.pref_scroll_title_bar2);
+        VOICE_INPUT_TITLE_LABEL = res.getString(R.string.pref_voice_input);
+        VOICE_INPUT_SUMMARY_LABEL = res.getString(R.string.pref_voice_input_summary);
         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);
 
         // 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);
--- a/mobile/android/tests/browser/robocop/testSettingsMenuItems.java
+++ b/mobile/android/tests/browser/robocop/testSettingsMenuItems.java
@@ -4,16 +4,17 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
 import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.util.HardwareUtils;
+import org.mozilla.gecko.util.VoiceRecognizerUtils;
 
 /** This patch tests the Sections present in the Settings Menu and the
  *  default values for them
  */
 public class testSettingsMenuItems extends PixelTest {
     // Customize menu items.
     String[] PATH_CUSTOMIZE;
     String[][] OPTIONS_CUSTOMIZE;
@@ -220,16 +221,22 @@ public class testSettingsMenuItems exten
             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);
         }
 
         // Tablet: we don't allow a page title option.
         if (HardwareUtils.isTablet()) {
             settingsMap.get(PATH_DISPLAY).remove(TITLE_BAR_LABEL_ARR);
         }
+
+        // Voice input
+        if (AppConstants.NIGHTLY_BUILD && VoiceRecognizerUtils.supportsVoiceRecognizer(this.getActivity().getApplicationContext(), this.getActivity().getResources())) {
+            String[] voiceInputUi = { mStringHelper.VOICE_INPUT_TITLE_LABEL, mStringHelper.VOICE_INPUT_SUMMARY_LABEL };
+            settingsMap.get(PATH_DISPLAY).add(voiceInputUi);
+        }
     }
 
     public void checkMenuHierarchy(Map<String[], List<String[]>> settingsMap) {
         // Check the items within each category.
         String section = null;
         for (Entry<String[], List<String[]>> e : settingsMap.entrySet()) {
             final String[] menuPath = e.getKey();