faft: Support menu UI in firmware_DevDefaultBoot

BUG=b:157432986
TEST=firmware_DevDefaultBoot passed on kaisa

Change-Id: Ibf830eac68c5403d692ce74b83ce55ec5fadf4a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2271085
Tested-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-by: Joel Kitching <kitching@chromium.org>
Reviewed-by: Greg Edelston <gredelston@google.com>
Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
diff --git a/server/cros/faft/utils/mode_switcher.py b/server/cros/faft/utils/mode_switcher.py
index a6b56c2..8d140e1 100644
--- a/server/cros/faft/utils/mode_switcher.py
+++ b/server/cros/faft/utils/mode_switcher.py
@@ -83,6 +83,12 @@
         self.servo.ctrl_u()
 
 
+    def bypass_dev_default_boot(self):
+        """Bypass the dev mode firmware logic to boot from default target."""
+        self.faft_framework.wait_for('firmware_screen', 'Pressing enter')
+        self.servo.enter_key()
+
+
     def bypass_rec_mode(self):
         """Bypass the rec mode firmware logic to boot USB."""
         self.servo.switch_usbkey('host')
@@ -719,6 +725,12 @@
         self.bypasser.bypass_dev_boot_usb()
 
 
+    def bypass_dev_default_boot(self):
+        """Bypass the dev mode firmware logic to boot from default target."""
+        logging.info("-[bypass_dev_default_boot]-")
+        self.bypasser.bypass_dev_default_boot()
+
+
     def bypass_rec_mode(self):
         """Bypass the rec mode firmware logic to boot USB."""
         logging.info("-[bypass_rec_mode]-")
@@ -881,10 +893,6 @@
         self.wait_for_client_offline()
         self.bypasser.trigger_dev_to_normal()
 
-    def bypass_dev_default_boot(self):
-        """Accept the default boot device from the Developer Options screen."""
-        self.bypasser.bypass_dev_default_boot()
-
 
 _SWITCHER_CLASSES = {
     'menu_switcher': _MenuSwitcher,
diff --git a/server/site_tests/firmware_DevDefaultBoot/firmware_DevDefaultBoot.py b/server/site_tests/firmware_DevDefaultBoot/firmware_DevDefaultBoot.py
index cf683b7..68a9568 100644
--- a/server/site_tests/firmware_DevDefaultBoot/firmware_DevDefaultBoot.py
+++ b/server/site_tests/firmware_DevDefaultBoot/firmware_DevDefaultBoot.py
@@ -52,7 +52,7 @@
 
     def try_menu_default_internal(self):
         """With dev_default_boot=disk, use menu default: should boot internal"""
-        logging.info("%s", self.try_menu_default_internal.__doc__.strip())
+        logging.info('%s', self.try_menu_default_internal.__doc__.strip())
 
         self.faft_client.system.set_dev_default_boot('disk')
         self.switcher.simple_reboot()
@@ -77,7 +77,7 @@
 
     def try_menu_default_usb(self):
         """With dev_default_boot=usb, use menu default: should boot USB"""
-        logging.info('%s', self.try_menu_default_usb.__doc__)
+        logging.info('%s', self.try_menu_default_usb.__doc__.strip())
 
         self.faft_client.system.set_dev_default_boot('usb')
         self.switcher.simple_reboot()
@@ -95,13 +95,17 @@
                                     "automated on non-Chrome-EC devices.")
 
         self.faft_client.system.set_dev_boot_usb(1)
+        has_menu = self.faft_config.mode_switcher_type in (
+                'menu_switcher',
+                'tablet_detachable_switcher',
+        )
 
         self.try_timeout_default_internal()
-        if self.faft_config.mode_switcher_type == 'tablet_detachable_switcher':
+        if has_menu:
             self.try_menu_default_internal()
 
         self.try_timeout_default_usb()
-        if self.faft_config.mode_switcher_type == 'tablet_detachable_switcher':
+        if has_menu:
             self.try_menu_default_usb()
 
         # try again to make sure it can be changed back