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

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

Issue 3226005: Refactory UI to grab shortcut keys, and tests to not look for triggers. (Closed) Base URL: http://git.chromium.org/git/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
OLDNEW
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # 2 #
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 7
8 # DESCRIPTION : 8 # DESCRIPTION :
9 # 9 #
10 # This is a factory test to test the LEDs (wifi, battery, etc). 10 # This is a factory test to test the LEDs (wifi, battery, etc).
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 if event.keyval == gtk.keysyms.Tab: 159 if event.keyval == gtk.keysyms.Tab:
160 self._status_map[self._current_pattern] = ful.FAILED 160 self._status_map[self._current_pattern] = ful.FAILED
161 self.goto_next_pattern() 161 self.goto_next_pattern()
162 elif event.keyval == gtk.keysyms.Return: 162 elif event.keyval == gtk.keysyms.Return:
163 self._status_map[self._current_pattern] = ful.PASSED 163 self._status_map[self._current_pattern] = ful.PASSED
164 self.goto_next_pattern() 164 self.goto_next_pattern()
165 elif self._current_pattern.startswith("shift") and \ 165 elif self._current_pattern.startswith("shift") and \
166 event.keyval == gtk.keysyms.Shift_L: 166 event.keyval == gtk.keysyms.Shift_L:
167 self._shift_cnt += 1 167 self._shift_cnt += 1
168 self._pattern_da.queue_draw() 168 self._pattern_da.queue_draw()
169 else:
170 self._ft_state.exit_on_trigger(event)
171 return True 169 return True
172 170
173 def register_callbacks(self, window): 171 def register_callbacks(self, window):
174 window.connect('key-release-event', self.key_release_callback) 172 window.connect('key-release-event', self.key_release_callback)
175 window.add_events(gdk.KEY_RELEASE_MASK) 173 window.add_events(gdk.KEY_RELEASE_MASK)
176 174
177 def run_once(self, 175 def run_once(self, led_ctl_path=None):
178 test_widget_size=None,
179 trigger_set=None,
180 led_ctl_path=None):
181 176
182 factory.log('%s run_once' % self.__class__) 177 factory.log('%s run_once' % self.__class__)
183 178
184 self._ft_state = ful.State(trigger_set)
185
186 self._led_ctl_path = led_ctl_path 179 self._led_ctl_path = led_ctl_path
187 180
188 self._shift_color = ful.BLACK 181 self._shift_color = ful.BLACK
189 self._shift_cnt = 0 182 self._shift_cnt = 0
190 183
191 os.chdir(self.srcdir) 184 os.chdir(self.srcdir)
192 image = cairo.ImageSurface.create_from_png('leds.png') 185 image = cairo.ImageSurface.create_from_png('leds.png')
193 image_size = (image.get_width(), image.get_height()) 186 image_size = (image.get_width(), image.get_height())
194 self._leds_image = image 187 self._leds_image = image
195 188
(...skipping 27 matching lines...) Expand all
223 vbox.pack_start(pattern_box, False, False) 216 vbox.pack_start(pattern_box, False, False)
224 vbox.pack_start(subvbox, False, False) 217 vbox.pack_start(subvbox, False, False)
225 218
226 test_widget = gtk.EventBox() 219 test_widget = gtk.EventBox()
227 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK) 220 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK)
228 test_widget.add(vbox) 221 test_widget.add(vbox)
229 self._test_widget = test_widget 222 self._test_widget = test_widget
230 223
231 self.goto_next_pattern() 224 self.goto_next_pattern()
232 225
233 self._ft_state.run_test_widget( 226 ful.run_test_widget(self.job, test_widget,
234 test_widget=test_widget,
235 test_widget_size=test_widget_size,
236 window_registration_callback=self.register_callbacks, 227 window_registration_callback=self.register_callbacks,
237 cleanup_callback=self.quit) 228 cleanup_callback=self.quit)
238 229
239 failed_set = set(name for name, status in self._status_map.items() 230 failed_set = set(name for name, status in self._status_map.items()
240 if status is not ful.PASSED) 231 if status is not ful.PASSED)
241 if failed_set: 232 if failed_set:
242 raise error.TestFail('Some patterns failed\n' \ 233 raise error.TestFail('Some patterns failed\n' \
243 '以下圖樣測試未通過: %s' % 234 '以下圖樣測試未通過: %s' %
244 ', '.join(failed_set)) 235 ', '.join(failed_set))
245 236
246 factory.log('%s run_once finished' % self.__class__) 237 factory.log('%s run_once finished' % self.__class__)
OLDNEW
« no previous file with comments | « client/site_tests/factory_Keyboard/factory_Keyboard.py ('k') | client/site_tests/factory_LightSensor/factory_LightSensor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698