Index: client/site_tests/desktopui_ImeTest/desktopui_ImeTest.py |
diff --git a/client/site_tests/desktopui_ImeTest/desktopui_ImeTest.py b/client/site_tests/desktopui_ImeTest/desktopui_ImeTest.py |
index 3d72ef79deef7041436b0ad7c8f0fff3694af9e4..2e29c34182310e0d8b83cf2e050186d9087379d9 100644 |
--- a/client/site_tests/desktopui_ImeTest/desktopui_ImeTest.py |
+++ b/client/site_tests/desktopui_ImeTest/desktopui_ImeTest.py |
@@ -4,7 +4,7 @@ |
import os, string, time, gtk |
from autotest_lib.client.bin import site_ui_test, test |
-from autotest_lib.client.common_lib import error, site_ui, utils |
+from autotest_lib.client.common_lib import error, site_ui, utils, site_httpd |
class desktopui_ImeTest(site_ui_test.UITest): |
@@ -15,6 +15,17 @@ class desktopui_ImeTest(site_ui_test.UITest): |
# TODO: We shouldn't use ibusclient, we should talk to Chrome directly |
self.job.setup_dep(['ibusclient']) |
+ def initialize(self, creds='$default'): |
+ self._test_url = 'http://localhost:8000/interaction_form.html' |
+ self._testServer = site_httpd.HTTPListener(8000, docroot=self.bindir) |
+ self._testServer.run() |
+ |
+ site_ui_test.UITest.initialize(self, creds) |
+ |
Zachary Kuznia
2010/11/10 09:15:55
Nit: Two lines between functions.
timothe
2010/11/16 10:02:52
Done.
|
+ def cleanup(self): |
+ self._testServer.stop() |
+ site_ui_test.UITest.cleanup(self) |
+ |
def log_error(self, test_name, message): |
self.job.record('ERROR', None, test_name, message) |
@@ -204,15 +215,13 @@ class desktopui_ImeTest(site_ui_test.UITest): |
(current_engine, expected_other_engine)) |
- def test_engine(self, engine_name, input_string, expected_string): |
+ def test_engine_omnibox(self, engine_name, input_string, expected_string): |
self.preload_engines([engine_name]) |
self.activate_engine(engine_name) |
ax = self.get_autox() |
- |
Zachary Kuznia
2010/11/10 09:15:55
Nit: No need to remove these lines.
timothe
2010/11/16 10:02:52
Done.
|
# Focus on the omnibox so that we can enter text. |
ax.send_hotkey('Ctrl-l') |
- |
# Sometimes there is a slight delay before input can be received in the |
# omnibox. |
time.sleep(1) |
@@ -223,9 +232,23 @@ class desktopui_ImeTest(site_ui_test.UITest): |
if text != expected_string: |
self.log_error( |
'test_engine %s' % engine_name, |
- 'Engine %s failed: Got %s, expected %s' % (engine_name, text, |
+ 'Engine %s failed in omnibox: Got %s, expected %s' % (engine_name, text, |
Zachary Kuznia
2010/11/10 09:15:55
Nit: Line is greater than 80 characters.
timothe
2010/11/16 10:02:52
Done.
|
expected_string)) |
+ ax.send_hotkey('BackSpace') |
Zachary Kuznia
2010/11/10 09:15:55
What does this line add?
timothe
2010/11/16 10:02:52
Before we were opening a new tab and closing it, n
|
Zachary Kuznia
2010/11/10 09:15:55
Nit: Two lines between functions.
timothe
2010/11/16 10:02:52
Done.
|
+ def test_engine_form(self, engine_name, input_string, expected_string): |
+ self.preload_engines([engine_name]) |
+ self.activate_engine(engine_name) |
+ |
+ ax = self.get_autox() |
+ ax.send_hotkey('Ctrl-r') |
+ ax.send_text(input_string) |
+ text = self.get_current_text() |
+ if text != expected_string: |
+ self.log_error( |
+ 'test_engine %s' % engine_name, |
+ 'Engine %s failed in form text input: Got %s, expected %s' % ( |
+ engine_name, text, expected_string)) |
Zachary Kuznia
2010/11/10 09:15:55
Nit: Two lines between functions.
timothe
2010/11/16 10:02:52
Done.
|
def run_once(self): |
self._failed = [] |
@@ -241,6 +264,10 @@ class desktopui_ImeTest(site_ui_test.UITest): |
# immediately after login get lost. |
time.sleep(5) |
+ #starting a session and waiting for the page to come up |
Zachary Kuznia
2010/11/10 09:15:55
Nit: Space between # and starting, capitalize and
timothe
2010/11/16 10:02:52
Done.
|
+ session = site_ui.ChromeSession(self._test_url) |
+ time.sleep(3) |
+ |
self.test_ibus_start_process() |
self.check_process('candidate_window', user='chronos') |
@@ -248,17 +275,26 @@ class desktopui_ImeTest(site_ui_test.UITest): |
self.check_process('ibus-memconf', user='chronos') |
self.test_keyboard_shortcut() |
- self.test_engine('mozc', 'nihongo \n', |
+ self.test_engine_omnibox('mozc', 'nihongo \n', |
+ '\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E') |
+ self.test_engine_omnibox('chewing', 'hol \n', '\xE6\x93\x8D') |
+ self.test_engine_omnibox('hangul', 'wl ', '\xEC\xA7\x80 ') |
+ self.test_engine_omnibox('pinyin', 'nihao ', '\xE4\xBD\xA0\xE5\xA5\xBD') |
+ self.test_engine_omnibox('m17n:zh:quick', 'aa ', '\xE9\x96\x93') |
+ |
+ self.test_engine_form('mozc', 'nihongo \n', |
'\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E') |
Zachary Kuznia
2010/11/10 09:15:55
Nit: The ' should line up one space after the ( ab
timothe
2010/11/16 10:02:52
Done.
|
- self.test_engine('chewing', 'hol \n', '\xE6\x93\x8D') |
- self.test_engine('hangul', 'wl ', '\xEC\xA7\x80 ') |
- self.test_engine('pinyin', 'nihao ', '\xE4\xBD\xA0\xE5\xA5\xBD') |
- self.test_engine('m17n:zh:quick', 'aa', '\xE9\x96\x93') |
+ self.test_engine_form('chewing', 'hol \n', '\xE6\x93\x8D') |
+ self.test_engine_form('hangul', 'wl ', '\xEC\xA7\x80 ') |
+ self.test_engine_form('pinyin', 'nihao ', '\xE4\xBD\xA0\xE5\xA5\xBD') |
+ self.test_engine_form('m17n:zh:quick', 'aa ', '\xE9\x96\x93') |
# Run a test on English last, so that we can type in English to |
# turn off the IME. |
- self.test_engine('xkb:us::eng', 'asdf', 'asdf') |
+ self.test_engine_omnibox('xkb:us::eng', 'asdf', 'asdf') |
+ self.test_engine_form('xkb:us::eng', 'asdf', 'asdf') |
Zachary Kuznia
2010/11/10 09:15:55
FYI: This line won't be needed once you sync and m
timothe
2010/11/16 10:02:52
Done.
|
self.test_ibus_stop_process() |
+ session.close() |
if len(self._failed) != 0: |
raise error.TestFail( |
'Failed: %s' % ','.join(self._failed)) |