FAFT: Enhancing the test to check G3 state in shutdown on x86 device

firmware_FwScreenPressPower & firmware_FwScreenCloseLid tests triggers
shutdown in different Firmware screens. These tests confirms the
shutdown state by pinging the device.

Checking the shutdown state by verifying the EC power states is reliable
than pinging the device. Because test may consider non-pingable
condition as shutdown state (i.e.,) if the device stuck in FW screens
instead of shutdown.

So, adding the check for G3 state in shutdown for x86 devices.

TEST= Verified firmware_FwScreenPressPower & firmware_FwScreenCloseLid
tests and both tests are passing.

Change-Id: I2804923abbbfd3547358de724afd22d40c7d844a
Signed-off-by: Lenine Ajagappane <leninex.ajagappane@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/936949
Reviewed-by: Naresh Solanki <naresh.solanki@intel.com>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
diff --git a/server/cros/faft/firmware_test.py b/server/cros/faft/firmware_test.py
index 0a6f00e..f475758 100644
--- a/server/cros/faft/firmware_test.py
+++ b/server/cros/faft/firmware_test.py
@@ -1134,6 +1134,12 @@
                     'Should shut the device down after calling %s.' %
         except ConnectionError:
+            if self.check_ec_capability(['x86'], suppress_warning=True):
+                PWR_RETRIES=5
+                if not self.wait_power_state("G3", PWR_RETRIES):
+                    raise error.TestFail("System not shutdown properly and EC"
+                                         "fails to enter into G3 state.")
+                logging.info('System entered into G3 state..')
                 'DUT is surely shutdown. We are going to power it on again...')