FAFT: Use firmware_screen time to when pressing ctrl-D repeatedly

This patch replaces the time allowed for firmware_DevScreenTimeout
to press ctrl-D from a hard-coded 20sec (increased in CL:240105) to
firmware_screen * 2. Since firmware_screen is currently 10sec by
default, this will not have an impact on most platforms.

The idea for firmware_DevScreenTimeout is to obtain an aggessively
low dev mode boot time value by spamming the AP with ctrl-D every
half second. So firmware_screen in this case acts as a ceiling and
we expect that the AP will be ready to accept ctrl-D earlier.

BUG=chrome-os-partner:43704
BRANCH=firmware-veyron
TEST=firmware_DevScreenTimeout passes more reliably on veyron_mickey

Change-Id: I74fe1060b00a3c027572fc76c44ec54382c3c50f
Signed-off-by: David Hendricks <[email protected]>
Reviewed-on: https://chromium-review.googlesource.com/295294
Reviewed-by: Wai-Hong Tam <[email protected]>
Reviewed-by: Julius Werner <[email protected]>
diff --git a/server/site_tests/firmware_DevScreenTimeout/firmware_DevScreenTimeout.py b/server/site_tests/firmware_DevScreenTimeout/firmware_DevScreenTimeout.py
index 38a1260..7a41e11 100644
--- a/server/site_tests/firmware_DevScreenTimeout/firmware_DevScreenTimeout.py
+++ b/server/site_tests/firmware_DevScreenTimeout/firmware_DevScreenTimeout.py
@@ -25,9 +25,6 @@
     """
     version = 1
 
-    CTRL_D_REPEAT_COUNT = 20
-    CTRL_D_REPEAT_DELAY = 0.5
-
     # We accept 5s timeout margin as we need 5s to ensure client is offline.
     # If the margin is too small and firmware initialization is too fast,
     # the test will fail incorrectly.
@@ -36,10 +33,14 @@
     fw_time_record = {}
 
     def ctrl_d_repeatedly(self):
-        """Press Ctrl-D repeatedly."""
-        for _ in range(self.CTRL_D_REPEAT_COUNT):
+        """Press Ctrl-D repeatedly. We want to be aggressive and obtain a
+        low firmware boot time when developer mode is enabled, so spam the
+        AP console with ctrl-D every half second until the firmware_screen
+        delay has been reached.
+        """
+        for _ in range(self.faft_config.firmware_screen * 2):
             self.servo.ctrl_d()
-            time.sleep(self.CTRL_D_REPEAT_DELAY)
+            time.sleep(0.5)
 
     def record_fw_boot_time(self, tag):
         """Record the current firmware boot time with the tag.