Modify factory_AudioLoop messages

Add an option to toggle display require audio dongle
messages.

BUG=None
TEST=Manual run factory_AudioLoop, with 'require_dongle'
on or off, can see different message on factory UI.

Change-Id: I81345e27bdffdac617f6289a0d3a111f359566cc
Reviewed-on: https://gerrit.chromium.org/gerrit/48777
Commit-Queue: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
diff --git a/client/site_tests/factory_AudioLoop/factory_AudioLoop.py b/client/site_tests/factory_AudioLoop/factory_AudioLoop.py
index f3c7830..34d59d1 100755
--- a/client/site_tests/factory_AudioLoop/factory_AudioLoop.py
+++ b/client/site_tests/factory_AudioLoop/factory_AudioLoop.py
@@ -176,7 +176,8 @@
             mute_right_mixer_settings=_MUTE_RIGHT_MIXER_SETTINGS,
             unmute_mixer_settings=_UNMUTE_MIXER_SETTINGS,
             mute_device_mixer_settings=None,
-            autostart=False):
+            autostart=False,
+            require_dongle=False):
         factory.console.info('%s run_once' % self.__class__)
 
         self._audiofuntest = audiofuntest
@@ -215,7 +216,7 @@
 
         # If autostart, JS triggers start_run_test event.
         # Otherwise, it binds start_run_test with 's' key pressed.
-        self.ui.CallJSFunction('init', autostart)
+        self.ui.CallJSFunction('init', autostart, require_dongle)
         factory.console.info('Run UI')
         self.ui.Run()
 
diff --git a/client/site_tests/factory_AudioLoop/static/factory_AudioLoop.html b/client/site_tests/factory_AudioLoop/static/factory_AudioLoop.html
index f806767..756ac30 100644
--- a/client/site_tests/factory_AudioLoop/static/factory_AudioLoop.html
+++ b/client/site_tests/factory_AudioLoop/static/factory_AudioLoop.html
@@ -1,7 +1,9 @@
 <h1 id="message" style="position:absolute; top:45%">
 <center style="font-size: 20pt">
-    <span class="goofy-label-en">Plug in audio jack dongle if needed</span>
-    <span class="goofy-label-zh">如果需要, 請放入音源孔測試置具</span>
+    <div id="require_dongle">
+        <span class="goofy-label-en">Plug in audio jack dongle</span>
+        <span class="goofy-label-zh">請放入音源孔測試置具</span>
+    </div>
     <br/>
     <span class="goofy-label-en">Hit s to start loopback test</span>
     <span class="goofy-label-zh">请按下s键开始音源回放测试</span>
diff --git a/client/site_tests/factory_AudioLoop/static/factory_AudioLoop.js b/client/site_tests/factory_AudioLoop/static/factory_AudioLoop.js
index 8a29dc1..09c3378 100644
--- a/client/site_tests/factory_AudioLoop/static/factory_AudioLoop.js
+++ b/client/site_tests/factory_AudioLoop/static/factory_AudioLoop.js
@@ -1,4 +1,6 @@
-init = function(autostart) {
+init = function(autostart, require_dongle) {
+  if (!require_dongle)
+    document.getElementById("require_dongle").style.display = "None";
   if (autostart) {
     document.getElementById("message").innerHTML = "";
     test.sendTestEvent("start_run_test", {});