A FAFT test case for both firmware A and B corruption.

This test requires a USB disk plugged-in, which contains a Chrome OS test
image (built by "build_image --test"). On runtime, this test corrupts
both firmware A and B. On next reboot, the firmware verification fails
and enters recovery mode. This test then checks the success of the
recovery boot.

BUG=chromium-os:19710
TEST=run_remote_tests.sh --remote=$REMOTE_IP -a \
     "servo_vid=0x18d1 servo_pid=0x5001" firmware_CorruptFwAB

Change-Id: Ica460bed5fa29fa2aefea98f63f3f3d8f03a77db
Reviewed-on: https://gerrit.chromium.org/gerrit/10703
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/client/cros/faft_client.py b/client/cros/faft_client.py
index a9a6305..e17f166 100644
--- a/client/cros/faft_client.py
+++ b/client/cros/faft_client.py
@@ -9,6 +9,7 @@
 libraries.
 """
 
+import functools
 import os
 import sys
 import tempfile
@@ -24,6 +25,17 @@
 import tpm_handler
 
 
+def allow_multiple_section_input(image_operator):
+    @functools.wraps(image_operator)
+    def wrapper(self, section):
+        if type(section) in (tuple, list):
+            for sec in section:
+                image_operator(self, sec)
+        else:
+            image_operator(self, section)
+    return wrapper
+
+
 class FAFTClient(object):
     """A class of FAFT client which aggregates some useful functions of SAFT.
 
@@ -124,6 +136,7 @@
         self._chromeos_interface.cs.request_recovery()
 
 
+    @allow_multiple_section_input
     def corrupt_firmware(self, section):
         """Corrupt the requested firmware section.
 
@@ -134,6 +147,7 @@
         self._flashrom_handler.corrupt_firmware(section)
 
 
+    @allow_multiple_section_input
     def restore_firmware(self, section):
         """Restore the requested firmware section (previously corrupted).