| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import logging, os, time | 5 import logging, os, time |
| 6 from autotest_lib.client.bin import site_login, test | 6 from autotest_lib.client.bin import site_login, test |
| 7 from autotest_lib.client.common_lib import error, site_ui, utils | 7 from autotest_lib.client.common_lib import error, site_ui, utils |
| 8 | 8 |
| 9 def wait_for_ibus_daemon_or_die(timeout=10): | 9 def wait_for_ibus_daemon_or_die(timeout=10): |
| 10 # Wait until ibus-daemon starts. ibus-daemon starts after a user | 10 # Wait until ibus-daemon starts. ibus-daemon starts after a user |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 out = self.run_ibusclient('list_engines') | 42 out = self.run_ibusclient('list_engines') |
| 43 engine_names = out.splitlines() | 43 engine_names = out.splitlines() |
| 44 # We expect these engines to exist. | 44 # We expect these engines to exist. |
| 45 expected_engine_names = ['chewing', 'hangul', 'pinyin', 'm17n:ar:kbd'] | 45 expected_engine_names = ['chewing', 'hangul', 'pinyin', 'm17n:ar:kbd'] |
| 46 for expected_engine_name in expected_engine_names: | 46 for expected_engine_name in expected_engine_names: |
| 47 if not expected_engine_name in engine_names: | 47 if not expected_engine_name in engine_names: |
| 48 raise error.TestFail('Engine not found: ' + | 48 raise error.TestFail('Engine not found: ' + |
| 49 expected_engine_name) | 49 expected_engine_name) |
| 50 | 50 |
| 51 | 51 |
| 52 def test_config(self, type_name): |
| 53 out = self.run_ibusclient('set_config %s' % type_name) |
| 54 if not 'OK' in out: |
| 55 raise error.TestFail('Failed to set %s value to ' |
| 56 'the ibus config service' % type_name) |
| 57 out = self.run_ibusclient('get_config %s' % type_name) |
| 58 if not 'OK' in out: |
| 59 raise error.TestFail('Failed to get %s value from ' |
| 60 'the ibus config service' % type_name) |
| 61 out = self.run_ibusclient('unset_config') |
| 62 if not 'OK' in out: |
| 63 raise error.TestFail('Failed to unset %s value from ' |
| 64 'the ibus config service' % type_name) |
| 65 out = self.run_ibusclient('get_config %s' % type_name) |
| 66 # the value no longer exists. |
| 67 if 'OK' in out: |
| 68 raise error.TestFail('Failed to unset %s value from ' |
| 69 'the ibus config service' % type_name) |
| 70 |
| 71 |
| 52 def run_once(self): | 72 def run_once(self): |
| 53 logged_in = site_login.logged_in() | 73 logged_in = site_login.logged_in() |
| 54 if not logged_in: | 74 if not logged_in: |
| 55 if not site_login.attempt_login(self, 'autox_script.json'): | 75 if not site_login.attempt_login(self, 'autox_script.json'): |
| 56 raise error.TestFail('Could not login') | 76 raise error.TestFail('Could not login') |
| 57 try: | 77 try: |
| 58 wait_for_ibus_daemon_or_die() | 78 wait_for_ibus_daemon_or_die() |
| 59 dep = 'ibusclient' | 79 dep = 'ibusclient' |
| 60 dep_dir = os.path.join(self.autodir, 'deps', dep) | 80 dep_dir = os.path.join(self.autodir, 'deps', dep) |
| 61 self.job.install_pkg(dep, 'dep', dep_dir) | 81 self.job.install_pkg(dep, 'dep', dep_dir) |
| 62 | 82 |
| 63 self.exefile = os.path.join(self.autodir, | 83 self.exefile = os.path.join(self.autodir, |
| 64 'deps/ibusclient/ibusclient') | 84 'deps/ibusclient/ibusclient') |
| 65 self.test_reachable() | 85 self.test_reachable() |
| 66 self.test_supported_engines() | 86 self.test_supported_engines() |
| 87 for type_name in ['boolean', 'int', 'double', 'string']: |
| 88 self.test_config(type_name) |
| 67 finally: | 89 finally: |
| 68 # If we started logged out, log back out. | 90 # If we started logged out, log back out. |
| 69 if not logged_in: | 91 if not logged_in: |
| 70 site_login.attempt_logout() | 92 site_login.attempt_logout() |
| OLD | NEW |