Improve the check for end of update at OOBE.

Today we check for a None return value from get_update_engine_status()
to tell us that the DUT has automatically rebooted. However when the
update-engine takes a while to return a result it also returns None.

If the command timed out, Im checking for update_engine_client --status
showing some progress. If it never started, the DUT must have rebooted.

BUG=chromium:1032786
TEST=autoupdate_ForcedOOBEUpdate locally

Change-Id: Ie2c3f965204ef12442bbff6a3cfd403b1744458c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1960976
Commit-Queue: David Haddock <dhaddock@chromium.org>
Tested-by: David Haddock <dhaddock@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py b/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py
index 48834a5..561a2d1 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py
@@ -40,17 +40,18 @@
         boot_id = self._host.get_boot_id()
 
         while True:
-            status = self._get_update_engine_status(timeout=10)
+            try:
+                self._get_update_engine_status(timeout=10,
+                                               ignore_timeout=False)
+            except error.AutoservRunError as e:
+                # Check if command timed out because update-engine was taking
+                # a while or if the command didn't even start.
+                query = 'Querying Update Engine status...'
+                if query not in e.result_obj.stderr:
+                    # Command did not start. DUT rebooted at end of update.
+                    self._host.test_wait_for_boot(boot_id)
+                    break
 
-            # During reboot, status will be None
-            if status is None:
-                # Checking only for the status to change to IDLE can hide
-                # errors that occurred between status checks. When the forced
-                # update is complete, it will automatically reboot the device.
-                # So we wait for an explict reboot. We will verify that the
-                # update completed successfully later in verify_update_events()
-                self._host.test_wait_for_boot(boot_id)
-                break
             time.sleep(1)
             if time.time() > timeout:
                 raise error.TestFail('OOBE update did not finish in %d '