switch to autox.py and robustify login/logout code

This CL switches from using the autox binary to using autox.py.  This includes backwards
incompatible changes to site_login.py, and I haven't had a chance to fix the affected callsites
yet.

I've also made the login/logout code a little more robust.  Now it'll make sure that the login
manager is running under a NEW pid, that X is running, and that at a window is visible before
assuming we're ready to log in.

All of the wait loops have been refactored into wait_for(...), which spits out logging.info()
messages that could be parsed later to determine how long the operations are actually taking.
Perhaps this could make it into a different, non-login specific library soonish.

I'm out of the office for the next few days, but wanted to get this out there before the
trunk totally passed it by.  I'll return on Wednesday to finish the job.

Review URL: http://codereview.chromium.org/1534001
diff --git a/client/bin/site_utils.py b/client/bin/site_utils.py
index 50a0bdf..2e3caf3 100644
--- a/client/bin/site_utils.py
+++ b/client/bin/site_utils.py
@@ -6,23 +6,35 @@
 from autotest_lib.client.common_lib import error
 
 
+class TimeoutError(error.TestError):
+    """Error raised when we time out when waiting on a condition."""
+
+
 def poll_for_condition(
-    condition, exception=None, timeout=10, sleep_interval=0.1):
+    condition, exception=None, timeout=10, sleep_interval=0.1, desc=None):
     """Poll until a condition becomes true.
 
     condition: function taking no args and returning bool
     exception: exception to throw if condition doesn't become true
     timeout: maximum number of seconds to wait
     sleep_interval: time to sleep between polls
+    desc: description of default TimeoutError used if 'exception' is None
 
     Raises:
-        'exception' arg if supplied; error.TestError otherwise
+        'exception' arg if supplied; site_utils.TimeoutError otherwise
     """
     start_time = time.time()
     while True:
         if condition():
             return
         if time.time() + sleep_interval - start_time > timeout:
-            raise exception if exception else error.TestError(
-                'Timed out waiting for condition')
+            if exception:
+                raise exception
+
+            if desc:
+                desc = 'Timed out waiting for condition: %s' % desc
+            else:
+                desc = 'Timed out waiting for unnamed condition'
+            raise error.TestError(desc)
+
         time.sleep(sleep_interval)