servo_test: Fix incorrect timeout unit

Current 'timeout' parameter is actually treated as half of the real
timeout value. This removes the redundant delay and also expose timeout
as a parameter for wait_for_client().

BUG=chromium-os:34351
TEST=Run a test involving rebooting DUT and passed.

Change-Id: I470f00625a43550a2ea52f7adb313482f3fbfc77
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/33169
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/servo_test.py b/server/cros/servo_test.py
index aad3780..f179a07 100644
--- a/server/cros/servo_test.py
+++ b/server/cros/servo_test.py
@@ -234,21 +234,21 @@
         assert succeed, 'Timed out connecting to client RPC server.'
 
 
-    def wait_for_client(self, install_deps=False):
+    def wait_for_client(self, install_deps=False, timeout=100):
         """Wait for the client to come back online.
 
         New remote processes will be launched if their used flags are enabled.
 
         Args:
             install_deps: If True, install the Autotest dependency when ready.
+            timeout: Time in seconds to wait for the client SSH daemon to
+              come up.
         """
-        timeout = 10
         # Ensure old ssh connections are terminated.
         self._terminate_all_ssh()
         # Wait for the client to come up.
-        while timeout > 0 and not self._sshd_test(self._client.ip):
-            time.sleep(5)
-            timeout -= 1
+        while timeout > 0 and not self._sshd_test(self._client.ip, timeout=5):
+            timeout -= 5
         assert timeout, 'Timed out waiting for client to reboot.'
         logging.info('Server: Client machine is up.')
         # Relaunch remote clients.
@@ -262,7 +262,7 @@
                 logging.info('Server: Relaunched remote %s.' % name)
 
 
-    def wait_for_client_offline(self, timeout=30):
+    def wait_for_client_offline(self, timeout=60):
         """Wait for the client to come offline.
 
         Args:
@@ -270,7 +270,6 @@
         """
         # Wait for the client to come offline.
         while timeout > 0 and self._ping_test(self._client.ip, timeout=1):
-            time.sleep(1)
             timeout -= 1
         assert timeout, 'Timed out waiting for client offline.'
         logging.info('Server: Client machine is offline.')