autotest: Add fw_tries_checker function for handling fwb_tries in vboot2

The firmware_FWtries test uses the fwb_tries field to switch between FW A and B,
which is only supported by vboot1.  Adding fw_tries_checker function so that if
it detects that we are in vboot2, it ignores the tried_fwb flag (because this
flag has no meaning in vboot2).  If it detects that we are checking the
fwb_tries field, then it tried to check the fw_try_count field instead for
vboot2.

BUG=chrome-os-partner:33451 (portion of it)
TEST=test_that --board=veyron_pinky <ip> firmware_FWtries
     test_that --board=veyron_pinky <ip> firmware_CorruptFwBodyA
     test_that --board=veyron_pinky <ip> firmware_RollbackFirmware
     test_that --board=veyron_pinky <ip> firmware_CorruptFwSigB
     test_that --board=veyron_pinky <ip> firmware_UpdateFirmwareVersion
     test_that --board=veyron_pinky <ip> firmware_CorruptFwBodyB
     test_that --board=veyron_pinky <ip> firmware_TryFwB
     test_that --board=veyron_pinky <ip> firmware_CorruptFwSigA
     test_that --board=nyan_blaze <ip> firwmare_FWtries
     test_that --board=nyan_blaze <ip> firwmare_CorruptFwBodyA
     test_that --board=nyan_blaze <ip> firwmare_CorruptFwSigB
     test_that --board=nyan_blaze <ip> firwmare_CorruptFwBodyB
     test_that --board=nyan_blaze <ip> firwmare_TryFwB
     test_that --board=nyan_blaze <ip> firwmare_CorruptFwSigA

     * All veyron testing with vboot2, nyan testing with vboot1.  Tests included
     above are all passing with code change.  No new failures detected with
     modification.

Change-Id: I91bfa5c3419287a7910360d19932ba26c806e4db
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/238071
Reviewed-by: Julius Werner <jwerner@chromium.org>
diff --git a/client/cros/faft/rpc_functions.py b/client/cros/faft/rpc_functions.py
index bef256e..5157ef7 100755
--- a/client/cros/faft/rpc_functions.py
+++ b/client/cros/faft/rpc_functions.py
@@ -251,13 +251,22 @@
         """
         return self._chromeos_interface.get_root_part()
 
-    def _system_set_try_fw_b(self):
-        """Set 'Try Frimware B' flag in crossystem."""
-        self._chromeos_interface.cs.fwb_tries = 1
+    def _system_set_try_fw_b(self, count=1):
+        """Set 'Try Frimware B' flag in crossystem.
 
-    def _system_set_fw_try_next(self, next):
-        """Set fw_try_next to A or B"""
+        @param count: # times to try booting into FW B
+        """
+        self._chromeos_interface.cs.fwb_tries = count
+
+    def _system_set_fw_try_next(self, next, count=0):
+        """Set fw_try_next to A or B
+
+        @param next: Next FW to reboot to (A or B)
+        @param count: # of times to try booting into FW <next>
+        """
         self._chromeos_interface.cs.fw_try_next = next
+        if count:
+            self._chromeos_interface.cs.fw_try_count = count
 
     def _system_get_fw_vboot2(self):
         """Get fw_vboot2"""