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/server/cros/faft/firmware_test.py b/server/cros/faft/firmware_test.py
index b056706..5d735c2 100644
--- a/server/cros/faft/firmware_test.py
+++ b/server/cros/faft/firmware_test.py
@@ -1663,3 +1663,21 @@
         self.wait_for_client()
 
         logging.info('Successfully restored CGPT table.')
+
+    def try_fwb(self, count=0):
+        """set to try booting FWB count # times
+
+        Wrapper to set fwb_tries for vboot1 and fw_try_count,fw_try_next for
+        vboot2
+
+        @param count: an integer specifying value to program into
+                      fwb_tries(vb1)/fw_try_next(vb2)
+        """
+        if self.fw_vboot2:
+            self.faft_client.system.set_fw_try_next('B', count)
+        else:
+            # vboot1: we need to boot into fwb at least once
+            if not count:
+                count = count + 1
+            self.faft_client.system.set_try_fw_b(count)
+