Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: client/site_tests/desktopui_IBusTest/desktopui_IBusTest.py

Issue 3451014: Ignore ibus preferences that get set at an indeterminate time (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, re, string, time 5 import logging, os, re, string, 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 class desktopui_IBusTest(site_ui_test.UITest): 9 class desktopui_IBusTest(site_ui_test.UITest):
10 version = 1 10 version = 1
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 'engine/PinyinFuzzyPinyin_S_SH', 164 'engine/PinyinFuzzyPinyin_S_SH',
165 'engine/PinyinFuzzyPinyin_UANG_UAN', 165 'engine/PinyinFuzzyPinyin_UANG_UAN',
166 'engine/PinyinFuzzyPinyin_UAN_UANG', 166 'engine/PinyinFuzzyPinyin_UAN_UANG',
167 'engine/PinyinFuzzyPinyin_ZH_Z', 167 'engine/PinyinFuzzyPinyin_ZH_Z',
168 'engine/PinyinFuzzyPinyin_Z_ZH', 168 'engine/PinyinFuzzyPinyin_Z_ZH',
169 'engine/PinyinCorrectPinyin_UEI_UI', 169 'engine/PinyinCorrectPinyin_UEI_UI',
170 'engine/PinyinIncompletePinyin', 170 'engine/PinyinIncompletePinyin',
171 'engine/PinyinLookupTableOrientation', 171 'engine/PinyinLookupTableOrientation',
172 'engine/PinyinSpecialPhrases', 172 'engine/PinyinSpecialPhrases',
173 173
174 # These preferences are actually read, but
175 # ibus-daemon reads them before chrome
176 # connects, so they show up as a false
177 # failure.
178 'general/hotkeynext_engine_in_menu',
179 'general/hotkeyprevious_engine',
180 'generalglobal_engine',
181
182 # We don't set these prefernces. 174 # We don't set these prefernces.
183 'general/hotkeytrigger', 175 'general/hotkeytrigger',
184 'generalembed_preedit_text', 176 'generalembed_preedit_text',
185 'generalenable_by_default', 177 'generalenable_by_default',
186 'generalpreload_engines', 178 'generalpreload_engines',
187 'generaluse_global_engine', 179 'generaluse_global_engine',
188 'generaluse_system_keyboard_layout']) 180 'generaluse_system_keyboard_layout'])
189 181
182 # These preferences are actually written, but due to a race condition
183 # on startup, they can be read by ibus-daemon before chrome connects,
184 # and so sometimes they show up as a false failure.
185 ignored_unwritten = set(['general/hotkeynext_engine_in_menu',
186 'general/hotkeyprevious_engine',
187 'generalglobal_engine'])
188
190 self.preload_engines(engine_list) 189 self.preload_engines(engine_list)
191 190
192 # ibus takes some time to preload the engines, and they can't be 191 # ibus takes some time to preload the engines, and they can't be
193 # activated until they are done loading. Since we don't get notified 192 # activated until they are done loading. Since we don't get notified
194 # when they are ready, we have to wait here to give them time. 193 # when they are ready, we have to wait here to give them time.
195 time.sleep(2) 194 time.sleep(2)
196 195
197 # Send a ctrl+l to enter a text field. 196 # Send a ctrl+l to enter a text field.
198 ax = self.get_autox() 197 ax = self.get_autox()
199 ax.send_hotkey('Ctrl-l') 198 ax.send_hotkey('Ctrl-l')
200 199
201 for engine_name in engine_list: 200 for engine_name in engine_list:
202 self.activate_engine(engine_name) 201 self.activate_engine(engine_name)
203 202
204 out = self.run_ibusclient('get_unused') 203 out = self.run_ibusclient('get_unused')
205 match = re.match(r"Unread:(.*)Unwritten:(.*)", out, re.DOTALL) 204 match = re.match(r"Unread:(.*)Unwritten:(.*)", out, re.DOTALL)
206 if not match: 205 if not match:
207 raise error.TestFail('Could not read unused values from ibus') 206 raise error.TestFail('Could not read unused values from ibus')
208 207
209 actual_unread = set(re.split('\n', match.group(1).strip())) 208 actual_unread = set(re.split('\n', match.group(1).strip()))
210 actual_unwritten = set(re.split('\n', match.group(2).strip())) 209 actual_unwritten = set(re.split('\n', match.group(2).strip()))
211 210
211 # Filter out any preferences we're ignoring
212 actual_unwritten.difference_update(ignored_unwritten)
213
212 new_unread = actual_unread.difference(expected_unread) 214 new_unread = actual_unread.difference(expected_unread)
213 now_read = expected_unread.difference(actual_unread) 215 now_read = expected_unread.difference(actual_unread)
214 new_unwritten = actual_unwritten.difference(expected_unwritten) 216 new_unwritten = actual_unwritten.difference(expected_unwritten)
215 now_written = expected_unwritten.difference(actual_unwritten) 217 now_written = expected_unwritten.difference(actual_unwritten)
216 218
217 if new_unread or now_read or new_unwritten or now_written: 219 if new_unread or now_read or new_unwritten or now_written:
218 message = ['iBus config has changed:'] 220 message = ['iBus config has changed:']
219 if new_unread: 221 if new_unread:
220 message.append('New unread values:') 222 message.append('New unread values:')
221 for key in new_unread: 223 for key in new_unread:
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 "/usr/bin/ibus-daemon --panel=disable --cache=none --restart") 276 "/usr/bin/ibus-daemon --panel=disable --cache=none --restart")
275 time.sleep(2) 277 time.sleep(2)
276 self._candidate_window_job = utils.BgJob( 278 self._candidate_window_job = utils.BgJob(
277 "su chronos -c '/opt/google/chrome/candidate_window'") 279 "su chronos -c '/opt/google/chrome/candidate_window'")
278 start_time = time.time() 280 start_time = time.time()
279 while time.time() - start_time < timeout: 281 while time.time() - start_time < timeout:
280 if os.system('pgrep ^ibus-daemon$') == 0: 282 if os.system('pgrep ^ibus-daemon$') == 0:
281 return 283 return
282 time.sleep(1) 284 time.sleep(1)
283 raise error.TestFail('ibus-daemon is not running') 285 raise error.TestFail('ibus-daemon is not running')
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698