[Autotest] Remove max times for ChromeVox sound.

Test is flaky with error about sound being too long.
This CL removes that check because:
- we can't actually know what ChromeVox is saying
- ChromeVox can say whatever it wants in the way of extra tips
    or messages, and that shouldn't affect this test
- it's too flaky to be a useful detection
- the test still checks whether ChromeVox makes noise at all,
    which is really what we want to know

Fail the test if the max record time is reached, since something
must have gone wrong (and any following checks will be
contaminated by this very long sound).

Also swap out the old ChromeVox move command gesture files for the
new ones and re-add the playback function.  It is unused at this
time.

TEST=ran it multiple times across several machines.  no failures seen
BUG=chromium:740755

Change-Id: I42ec7aa97bfa11a57695084041550075a9cca1ae
Reviewed-on: https://chromium-review.googlesource.com/566032
Commit-Ready: Katherine Threlkeld <kathrelkeld@chromium.org>
Tested-by: Katherine Threlkeld <kathrelkeld@chromium.org>
Reviewed-by: Kalin Stoyanov <kalin@chromium.org>
diff --git a/client/cros/a11y/a11y_test_base.py b/client/cros/a11y/a11y_test_base.py
index 97804e0..494cb7f 100644
--- a/client/cros/a11y/a11y_test_base.py
+++ b/client/cros/a11y/a11y_test_base.py
@@ -44,6 +44,15 @@
         self._player.blocking_playback_of_default_file(
                 input_type='keyboard', filename='keyboard_ctrl+alt+z')
 
+    def _chromevox_move(self, direction):
+        """Use ChromeVox move commands (search + arrow key).
+
+        @param direction:  The direction in which to move, e.g. 'down'.
+
+        """
+        self._player.blocking_playback_of_default_file(
+                input_type='keyboard',
+                filename='keyboard_search+%s' % direction)
 
     def _set_feature(self, feature, value):
         """Set given feature to given value using a11y API call.
diff --git a/client/cros/input_playback/keyboard_search+down b/client/cros/input_playback/keyboard_search+down
new file mode 100644
index 0000000..ece72fc
--- /dev/null
+++ b/client/cros/input_playback/keyboard_search+down
@@ -0,0 +1,22 @@
+E: 1498157310.622325 0004 0004 458979
+E: 1498157310.622325 0001 007d 1
+E: 1498157310.622325 0000 0000 0
+E: 1498157310.872425 0001 007d 2
+E: 1498157310.872425 0000 0000 1
+E: 1498157310.905443 0001 007d 2
+E: 1498157310.905443 0000 0000 1
+E: 1498157310.938424 0001 007d 2
+E: 1498157310.938424 0000 0000 1
+E: 1498157310.971420 0001 007d 2
+E: 1498157310.971420 0000 0000 1
+E: 1498157311.004427 0001 007d 2
+E: 1498157311.004427 0000 0000 1
+E: 1498157311.030123 0004 0004 458833
+E: 1498157311.030123 0001 006c 1
+E: 1498157311.030123 0000 0000 0
+E: 1498157311.246136 0004 0004 458833
+E: 1498157311.246136 0001 006c 0
+E: 1498157311.246136 0000 0000 0
+E: 1498157311.438138 0004 0004 458979
+E: 1498157311.438138 0001 007d 0
+E: 1498157311.438138 0000 0000 0
diff --git a/client/cros/input_playback/keyboard_search+left b/client/cros/input_playback/keyboard_search+left
new file mode 100644
index 0000000..1e6a1c8
--- /dev/null
+++ b/client/cros/input_playback/keyboard_search+left
@@ -0,0 +1,16 @@
+E: 1498157324.390195 0004 0004 458979
+E: 1498157324.390195 0001 007d 1
+E: 1498157324.390195 0000 0000 0
+E: 1498157324.639235 0001 007d 2
+E: 1498157324.639235 0000 0000 1
+E: 1498157324.672246 0001 007d 2
+E: 1498157324.672246 0000 0000 1
+E: 1498157324.678140 0004 0004 458832
+E: 1498157324.678140 0001 0069 1
+E: 1498157324.678140 0000 0000 0
+E: 1498157324.814220 0004 0004 458832
+E: 1498157324.814220 0001 0069 0
+E: 1498157324.814220 0000 0000 0
+E: 1498157325.086224 0004 0004 458979
+E: 1498157325.086224 0001 007d 0
+E: 1498157325.086224 0000 0000 0
diff --git a/client/cros/input_playback/keyboard_search+right b/client/cros/input_playback/keyboard_search+right
new file mode 100644
index 0000000..e118080
--- /dev/null
+++ b/client/cros/input_playback/keyboard_search+right
@@ -0,0 +1,16 @@
+E: 1498157330.358166 0004 0004 458979
+E: 1498157330.358166 0001 007d 1
+E: 1498157330.358166 0000 0000 0
+E: 1498157330.608320 0001 007d 2
+E: 1498157330.608320 0000 0000 1
+E: 1498157330.641233 0001 007d 2
+E: 1498157330.641233 0000 0000 1
+E: 1498157330.670156 0004 0004 458831
+E: 1498157330.670156 0001 006a 1
+E: 1498157330.670156 0000 0000 0
+E: 1498157330.782347 0004 0004 458831
+E: 1498157330.782347 0001 006a 0
+E: 1498157330.782347 0000 0000 0
+E: 1498157331.022177 0004 0004 458979
+E: 1498157331.022177 0001 007d 0
+E: 1498157331.022177 0000 0000 0
diff --git a/client/cros/input_playback/keyboard_search+shift+down b/client/cros/input_playback/keyboard_search+shift+down
deleted file mode 100644
index cfd6809..0000000
--- a/client/cros/input_playback/keyboard_search+shift+down
+++ /dev/null
@@ -1,17 +0,0 @@
-E: 1456536750.158855 0004 0004 458977
-E: 1456536750.158855 0001 002a 1
-E: 1456536750.158855 0000 0000 0
-E: 1456536750.174771 0004 0004 458979
-E: 1456536750.174771 0001 007d 1
-E: 1456536750.174771 0000 0000 0
-E: 1456536750.302853 0004 0004 458833
-E: 1456536750.302853 0001 006c 1
-E: 1456536750.302853 0000 0000 0
-E: 1456536750.422828 0004 0004 458833
-E: 1456536750.422828 0001 006c 0
-E: 1456536750.422828 0000 0000 0
-E: 1456536750.462771 0004 0004 458977
-E: 1456536750.462771 0001 002a 0
-E: 1456536750.462771 0004 0004 458979
-E: 1456536750.462771 0001 007d 0
-E: 1456536750.462771 0000 0000 0
diff --git a/client/cros/input_playback/keyboard_search+shift+left b/client/cros/input_playback/keyboard_search+shift+left
deleted file mode 100644
index 45963d5..0000000
--- a/client/cros/input_playback/keyboard_search+shift+left
+++ /dev/null
@@ -1,17 +0,0 @@
-E: 1456536738.734779 0004 0004 458977
-E: 1456536738.734779 0001 002a 1
-E: 1456536738.734779 0000 0000 0
-E: 1456536738.750770 0004 0004 458979
-E: 1456536738.750770 0001 007d 1
-E: 1456536738.750770 0000 0000 0
-E: 1456536738.862851 0004 0004 458832
-E: 1456536738.862851 0001 0069 1
-E: 1456536738.862851 0000 0000 0
-E: 1456536739.046878 0004 0004 458832
-E: 1456536739.046878 0001 0069 0
-E: 1456536739.046878 0000 0000 0
-E: 1456536739.094774 0004 0004 458977
-E: 1456536739.094774 0001 002a 0
-E: 1456536739.094774 0004 0004 458979
-E: 1456536739.094774 0001 007d 0
-E: 1456536739.094774 0000 0000 0
diff --git a/client/cros/input_playback/keyboard_search+shift+right b/client/cros/input_playback/keyboard_search+shift+right
deleted file mode 100644
index 6478368..0000000
--- a/client/cros/input_playback/keyboard_search+shift+right
+++ /dev/null
@@ -1,17 +0,0 @@
-E: 1456536732.926870 0004 0004 458977
-E: 1456536732.926870 0001 002a 1
-E: 1456536732.926870 0000 0000 0
-E: 1456536732.950773 0004 0004 458979
-E: 1456536732.950773 0001 007d 1
-E: 1456536732.950773 0000 0000 0
-E: 1456536733.054868 0004 0004 458831
-E: 1456536733.054868 0001 006a 1
-E: 1456536733.054868 0000 0000 0
-E: 1456536733.246789 0004 0004 458831
-E: 1456536733.246789 0001 006a 0
-E: 1456536733.246789 0000 0000 0
-E: 1456536733.270768 0004 0004 458977
-E: 1456536733.270768 0001 002a 0
-E: 1456536733.270768 0004 0004 458979
-E: 1456536733.270768 0001 007d 0
-E: 1456536733.270768 0000 0000 0
diff --git a/client/cros/input_playback/keyboard_search+shift+up b/client/cros/input_playback/keyboard_search+shift+up
deleted file mode 100644
index 97795f8..0000000
--- a/client/cros/input_playback/keyboard_search+shift+up
+++ /dev/null
@@ -1,17 +0,0 @@
-E: 1456536744.662878 0004 0004 458977
-E: 1456536744.662878 0001 002a 1
-E: 1456536744.662878 0000 0000 0
-E: 1456536744.702771 0004 0004 458979
-E: 1456536744.702771 0001 007d 1
-E: 1456536744.702771 0000 0000 0
-E: 1456536744.846867 0004 0004 458834
-E: 1456536744.846867 0001 0067 1
-E: 1456536744.846867 0000 0000 0
-E: 1456536745.006866 0004 0004 458834
-E: 1456536745.006866 0001 0067 0
-E: 1456536745.006866 0000 0000 0
-E: 1456536745.062771 0004 0004 458977
-E: 1456536745.062771 0001 002a 0
-E: 1456536745.062771 0004 0004 458979
-E: 1456536745.062771 0001 007d 0
-E: 1456536745.062771 0000 0000 0
diff --git a/client/cros/input_playback/keyboard_search+up b/client/cros/input_playback/keyboard_search+up
new file mode 100644
index 0000000..00da4bd
--- /dev/null
+++ b/client/cros/input_playback/keyboard_search+up
@@ -0,0 +1,20 @@
+E: 1498157316.454215 0004 0004 458979
+E: 1498157316.454215 0001 007d 1
+E: 1498157316.454215 0000 0000 0
+E: 1498157316.704231 0001 007d 2
+E: 1498157316.704231 0000 0000 1
+E: 1498157316.737266 0001 007d 2
+E: 1498157316.737266 0000 0000 1
+E: 1498157316.770240 0001 007d 2
+E: 1498157316.770240 0000 0000 1
+E: 1498157316.803248 0001 007d 2
+E: 1498157316.803248 0000 0000 1
+E: 1498157316.822214 0004 0004 458834
+E: 1498157316.822214 0001 0067 1
+E: 1498157316.822214 0000 0000 0
+E: 1498157316.950335 0004 0004 458834
+E: 1498157316.950335 0001 0067 0
+E: 1498157316.950335 0000 0000 0
+E: 1498157317.230336 0004 0004 458979
+E: 1498157317.230336 0001 007d 0
+E: 1498157317.230336 0000 0000 0
diff --git a/client/site_tests/accessibility_ChromeVoxSound/accessibility_ChromeVoxSound.py b/client/site_tests/accessibility_ChromeVoxSound/accessibility_ChromeVoxSound.py
index e2ad63b..58486fa 100644
--- a/client/site_tests/accessibility_ChromeVoxSound/accessibility_ChromeVoxSound.py
+++ b/client/site_tests/accessibility_ChromeVoxSound/accessibility_ChromeVoxSound.py
@@ -21,7 +21,7 @@
     _detect_time = 40 # Max length of time to spend detecting audio in seconds.
 
 
-    def _detect_audio(self, name, min_time, max_time):
+    def _detect_audio(self, name, min_time):
         """Detects whether audio was heard and returns the approximate time.
 
         Runs for at most self._detect_time, checking each chunk for sound.
@@ -32,7 +32,6 @@
 
         @param name: a string representing which sound is expected.
         @param min_time: the minimum allowed sound length in seconds.
-        @param max_time: the maximum allowed sound length in seconds.
 
         @raises: error.TestFail if the observed behavior doesn't match
                  expected: either no sound or sound of bad length.
@@ -40,6 +39,7 @@
         """
         count = 0
         counting = False
+        saw_sound_end = False
 
         for i in xrange(self._detect_time / self._audio_chunk_size):
             rms = self._rms_of_next_audio_chunk()
@@ -51,17 +51,18 @@
                 count += 1
             elif counting:
                 audio_length = time.time() - start_time
+                saw_sound_end = True
                 break
         if not counting:
             raise error.TestFail('No audio for %s was found!' % name)
+        if not saw_sound_end:
+            raise error.TestFail('Audio for %s was more than % seconds!' % (
+                    name, self._detect_time))
 
         logging.info('Time taken - %s: %f', name, audio_length)
         if audio_length < min_time:
             raise error.TestFail(
                     '%s audio was only %f seconds long!' % (name, audio_length))
-        elif audio_length > max_time:
-            raise error.TestFail(
-                    '%s audio was too long: %f seconds!' % (name, audio_length))
         return
 
 
@@ -89,22 +90,20 @@
 
         # TODO: this sound doesn't play for Telemetry user.  crbug.com/590403
         # Welcome ding
-        # self._detect_audio('enable ChromeVox ding', 1, 2)
+        # self._detect_audio('enable ChromeVox ding', 1)
 
         # "ChromeVox Spoken Feedback is ready!"
-        # This sound can vary in length when extra messages are added, so
-        # max_time is intentionally very long.
-        self._detect_audio('welcome message', 2, 20)
+        self._detect_audio('welcome message', 2)
         chromevox_open_time = time.time() - chromevox_start_time
         logging.info('ChromeVox took %f seconds to start.')
 
-        # Page navigation sound.
-        cr.browser.tabs[0].Navigate('chrome://version')
-        self._detect_audio('page navigation sound', 2, 6)
-
-        # New tab sound
+        # New tab sound.
         tab = cr.browser.tabs.New()
-        self._detect_audio('new tab ding', 2, 6)
+        self._detect_audio('new tab ding', 2)
+
+        # Page navigation sound.
+        tab.Navigate('chrome://version')
+        self._detect_audio('page navigation sound', 2)
 
 
     def run_once(self):