FAFT: When setting AP WP check for EC attribute before rebooting EC

The set_ap_write_protect_and_reboot() function sets the AP write
protect and then reboots the DUT through the EC, this is only supported
on devices with chrome EC so it's necessary to check the EC attribute
exists before calling sync_and_ec_reboot().

BUG=b:174604060
TEST=Ran firmware_WriteProtectFunc on drallion device

Change-Id: If9cb70237a0f2f2e4522876fd636b9e1e7469376
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2582547
Tested-by: Brent Peterson <brentpeterson@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Commit-Queue: Brent Peterson <brentpeterson@chromium.org>
diff --git a/server/cros/faft/firmware_test.py b/server/cros/faft/firmware_test.py
index 55e7c1a..febee71 100644
--- a/server/cros/faft/firmware_test.py
+++ b/server/cros/faft/firmware_test.py
@@ -1003,8 +1003,9 @@
         @param enable: True if asserting write protect. Otherwise, False.
         """
         self.set_hardware_write_protect(enable)
-        self.sync_and_ec_reboot()
-        self.switcher.wait_for_client()
+        if hasattr(self, 'ec'):
+            self.sync_and_ec_reboot()
+            self.switcher.wait_for_client()
 
     def run_chromeos_firmwareupdate(self, mode, append=None, options=(),
             ignore_status=False):