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_ui_test, test | 6 from autotest_lib.client.bin import site_ui_test, 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 engine_names = out.splitlines() | 42 engine_names = out.splitlines() |
43 # We expect these engines to exist. | 43 # We expect these engines to exist. |
44 expected_engine_names = ['chewing', 'hangul', 'pinyin', 'm17n:ar:kbd'] | 44 expected_engine_names = ['chewing', 'hangul', 'pinyin', 'm17n:ar:kbd'] |
45 for expected_engine_name in expected_engine_names: | 45 for expected_engine_name in expected_engine_names: |
46 if not expected_engine_name in engine_names: | 46 if not expected_engine_name in engine_names: |
47 raise error.TestFail('Engine not found: ' + | 47 raise error.TestFail('Engine not found: ' + |
48 expected_engine_name) | 48 expected_engine_name) |
49 | 49 |
50 | 50 |
51 def test_config(self, type_name): | 51 def test_config(self, type_name): |
| 52 wrong_type_name = 'string' |
| 53 if type_name == 'string': |
| 54 wrong_type_name = 'int' |
| 55 # First, write a dummy value which is not |type_name| type to make sure |
| 56 # the second set_config overwrites this |wrong_type_name| value. |
| 57 out = self.run_ibusclient('set_config %s' % wrong_type_name) |
| 58 if not 'OK' in out: |
| 59 raise error.TestFail('Failed to set %s value to ' |
| 60 'the ibus config service' % wrong_type_name) |
| 61 # Then overwrite a value of |type_name| type. |
52 out = self.run_ibusclient('set_config %s' % type_name) | 62 out = self.run_ibusclient('set_config %s' % type_name) |
53 if not 'OK' in out: | 63 if not 'OK' in out: |
54 raise error.TestFail('Failed to set %s value to ' | 64 raise error.TestFail('Failed to set %s value to ' |
55 'the ibus config service' % type_name) | 65 'the ibus config service' % type_name) |
56 out = self.run_ibusclient('get_config %s' % type_name) | 66 out = self.run_ibusclient('get_config %s' % type_name) |
57 if not 'OK' in out: | 67 if not 'OK' in out: |
58 raise error.TestFail('Failed to get %s value from ' | 68 raise error.TestFail('Failed to get %s value from ' |
59 'the ibus config service' % type_name) | 69 'the ibus config service' % type_name) |
60 out = self.run_ibusclient('unset_config') | 70 out = self.run_ibusclient('unset_config') |
61 if not 'OK' in out: | 71 if not 'OK' in out: |
62 raise error.TestFail('Failed to unset %s value from ' | 72 raise error.TestFail('Failed to unset %s value from ' |
63 'the ibus config service' % type_name) | 73 'the ibus config service' % type_name) |
64 out = self.run_ibusclient('get_config %s' % type_name) | 74 out = self.run_ibusclient('get_config %s' % type_name) |
65 # the value no longer exists. | 75 # the value no longer exists. |
66 if 'OK' in out: | 76 if 'OK' in out: |
67 raise error.TestFail('Failed to unset %s value from ' | 77 raise error.TestFail('Failed to unset %s value from ' |
68 'the ibus config service' % type_name) | 78 'the ibus config service' % type_name) |
69 | 79 |
70 | 80 |
71 def run_once(self): | 81 def run_once(self): |
72 wait_for_ibus_daemon_or_die() | 82 wait_for_ibus_daemon_or_die() |
73 dep = 'ibusclient' | 83 dep = 'ibusclient' |
74 dep_dir = os.path.join(self.autodir, 'deps', dep) | 84 dep_dir = os.path.join(self.autodir, 'deps', dep) |
75 self.job.install_pkg(dep, 'dep', dep_dir) | 85 self.job.install_pkg(dep, 'dep', dep_dir) |
76 | 86 |
77 self.exefile = os.path.join(self.autodir, | 87 self.exefile = os.path.join(self.autodir, |
78 'deps/ibusclient/ibusclient') | 88 'deps/ibusclient/ibusclient') |
79 self.test_reachable() | 89 self.test_reachable() |
80 self.test_supported_engines() | 90 self.test_supported_engines() |
81 for type_name in ['boolean', 'int', 'double', 'string']: | 91 for type_name in ['boolean', 'int', 'double', 'string', 'boolean_list', |
| 92 'int_list', 'double_list', 'string_list']: |
82 self.test_config(type_name) | 93 self.test_config(type_name) |
OLD | NEW |