Remove dead code that caused an unwanted dependency.

This deletes client.cros_ui.Dialog and some related code.  The code
was out of place, unused, and generally troublesome.  In particular,
the code was causing import dependencies that broke server side code
by pulling in modules that are only present in clients.

This change doesn't fix the underlying problem that the server side
code depends on client.cros_ui, which is outside of
client.common_lib.  However, it should leave us with breathing room
to fix the underlying problem on a more appropriate schedule.

BUG=chromium:431429
TEST=run cli/atest host list, see no dependency failure

Change-Id: I0d372cab826fbffd703c49d3b30d8f863c936680
Reviewed-on: https://chromium-review.googlesource.com/228609
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
diff --git a/client/cros/cros_ui.py b/client/cros/cros_ui.py
index e832880..fbd6ebf 100644
--- a/client/cros/cros_ui.py
+++ b/client/cros/cros_ui.py
@@ -6,8 +6,7 @@
 
 from autotest_lib.client.bin import utils
 from autotest_lib.client.common_lib import error
-from autotest_lib.client.cros import constants, httpd
-from autotest_lib.client.cros.graphics import graphics_utils
+from autotest_lib.client.cros import constants
 
 # Log messages used to signal when we're restarting UI. Used to detect
 # crashes by cros_ui_test.UITest.
@@ -150,135 +149,3 @@
             os.unlink(filename)
         except OSError:
             pass  # It's already gone.
-
-
-class ChromeSession(object):
-    """
-    A class to open a tab within the running browser process.
-    """
-
-    def __init__(self, args=''):
-        self.start(args)
-
-
-    def start(self, args=''):
-
-        cmd = '%s --no-first-run --user-data-dir=%s %s' % (
-            constants.BROWSER_EXE, constants.USER_DATA_DIR, args)
-        graphics_utils.xsystem(cmd, user='chronos')
-
-
-_HTML_HEADER_ = '''
-<html><head>
-<title>Question Dialog</title>
-<script language="Javascript">
-function do_submit(value) {
-    document.forms[0].result.value = value;
-    document.forms[0].submit();
-}
-</script>
-</head><body>
-<h3>%s</h3>
-<form action="/answer" method="post">
-    <input type="hidden" name="result" value="">
-'''
-
-_HTML_BUTTON_ = '''<input type="button" value="%s" onclick="do_submit('%s')">'''
-_HTML_CHECKBOX_ = '''<input type="checkbox" name="%s">%s'''
-_HTML_TEXT_ = '''%s <input type="text" name="%s">'''
-
-_HTML_FOOTER_ = '''</form></body></html>'''
-
-
-def add_html_elements(template, values):
-    if not values:
-        return ''
-    html_elements = ['<table><tr>']
-    for value in values:
-        html_elements.append('<td>' + template % (value, value))
-    html_elements.append('</table><p>')
-    return ' '.join(html_elements)
-
-
-class Dialog(object):
-    """
-    A class to create a simple interaction with a user, like asking a question
-    and receiving the answer.
-    """
-
-    def __init__(self, question='',
-                 choices=['Pass', 'Fail'],
-                 checkboxes=[],
-                 textinputs=[],
-                 timeout=60):
-        self.init(question, choices, checkboxes, textinputs, timeout)
-
-
-    def init(self, question='',
-             choices=['Pass', 'Fail'],
-             checkboxes=[],
-             textinputs=[],
-             timeout=60):
-        self._question = question
-        self._choices = choices
-        self._checkboxes = checkboxes
-        self._textinputs = textinputs
-        self._timeout = timeout
-
-
-    def return_html(self, server, args):
-        html = _HTML_HEADER_ % self._question
-        html += add_html_elements(_HTML_CHECKBOX_, self._checkboxes)
-        html += add_html_elements(_HTML_TEXT_, self._textinputs)
-        html += add_html_elements(_HTML_BUTTON_, self._choices)
-        html += _HTML_FOOTER_
-        server.wfile.write(html)
-
-
-    def get_entries(self):
-        # Run a HTTP server.
-        base_port = 8000
-        while base_port < 9000:
-            url = 'http://localhost:%d/' % base_port
-            try:
-                http_server = httpd.HTTPListener(base_port)
-                break
-            except httpd.socket.error:
-                # The socket must be still bound since last time.
-                base_port = base_port + 1
-                continue
-        else:
-            # This is unlikely to happen, but just in case.
-            raise error.TestError('Failed to start HTTP server.')
-
-        http_server.run()
-
-        try:
-            # Assign the handlers.
-            http_server.add_url_handler('/',
-                lambda server, form, o=self: o.return_html(server, form))
-            http_server.add_url_handler('/answer',
-                lambda server, form, o=self: o.return_html(server, form))
-
-            # Start a Chrome session to load the page.
-            session = ChromeSession(url)
-            latch = http_server.add_wait_url('/answer')
-            latch.wait(self._timeout)
-        finally:
-            http_server.stop()
-
-        # Return None if timeout.
-        if not latch.is_set():
-            http_server.stop()
-            return None
-
-        entries = http_server.get_form_entries()
-        http_server.stop()
-        return entries
-
-
-    def get_result(self):
-        entries = self.get_entries()
-        if not entries:
-            return None
-        return entries.get('result')