faft: Unify ro_normal_checker method in FAFTSequence

We define a common used ro_normal_checker method in FAFTSequence. It
also checks the VbSharedData flags and active EC firmware for the
All-A/All-B/All-RO design on Chrome EC devices.

BUG=chromium-os:34147
TEST=Run the following tests:
$ run_remote_test.sh --remote=$IP RONormalBoot/control$
$ run_remote_test.sh --remote=$IP UpdateECBin/control$
$ run_remote_test.sh --remote=$IP ECWriteProtect/control$

Change-Id: Iee3104d0da1931aa21d256e0245eb706f4e080e1
Reviewed-on: https://gerrit.chromium.org/gerrit/32203
Reviewed-by: Mike Truty <truty@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/faftsequence.py b/server/cros/faftsequence.py
index f77746d..33d0603 100644
--- a/server/cros/faftsequence.py
+++ b/server/cros/faftsequence.py
@@ -649,6 +649,30 @@
         return True
 
 
+    def ro_normal_checker(self, expected_fw=None, twostop=False):
+        """Check the current boot uses RO boot.
+
+        Args:
+          expected_fw: A string of expected firmware, 'A', 'B', or
+                       None if don't care.
+          twostop: True to expect a TwoStop boot; False to expect a RO boot.
+
+        Returns:
+          True if the currect boot firmware matched and used RO boot;
+          otherwise, False.
+        """
+        crossystem_dict = {'tried_fwb': '0'}
+        if expected_fw:
+            crossystem_dict['mainfw_act'] = expected_fw.upper()
+        if self.check_ec_capability():
+            crossystem_dict['ecfw_act'] = ('RW' if twostop else 'RO')
+
+        return (self.vdat_flags_checker(
+                    self.VDAT_FLAG_LF_USE_RO_NORMAL,
+                    0 if twostop else self.VDAT_FLAG_LF_USE_RO_NORMAL) and
+                self.crossystem_checker(crossystem_dict))
+
+
     def root_part_checker(self, expected_part):
         """Check the partition number of the root device matched.