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

Side by Side Diff: client/site_tests/factory_ExtDisplay/factory_ExtDisplay.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 # 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 5
6 # DESCRIPTION : 6 # DESCRIPTION :
7 # 7 #
8 # This is a factory test to test the external display (hdmi/vga/other) 8 # This is a factory test to test the external display (hdmi/vga/other)
9 # UI based heavily on factory_Display/factory_Audio 9 # UI based heavily on factory_Display/factory_Audio
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 self._status_map[subtest_name] = ful.FAILED 102 self._status_map[subtest_name] = ful.FAILED
103 self.finish_subtest() 103 self.finish_subtest()
104 self.goto_next_subtest() 104 self.goto_next_subtest()
105 elif event.keyval == gtk.keysyms.Return and \ 105 elif event.keyval == gtk.keysyms.Return and \
106 self._status_map[subtest_name] is ful.ACTIVE: 106 self._status_map[subtest_name] is ful.ACTIVE:
107 self._status_map[subtest_name] = ful.PASSED 107 self._status_map[subtest_name] = ful.PASSED
108 self.finish_subtest() 108 self.finish_subtest()
109 self.goto_next_subtest() 109 self.goto_next_subtest()
110 elif event.keyval == ord('Q'): 110 elif event.keyval == ord('Q'):
111 gtk.main_quit() 111 gtk.main_quit()
112 else:
113 self._ft_state.exit_on_trigger(event)
114 112
115 # evaluating a new subtest now 113 # evaluating a new subtest now
116 if subtest_name is not self._current_subtest[0]: 114 if subtest_name is not self._current_subtest[0]:
117 subtest_name, subtest_cfg = self._current_subtest 115 subtest_name, subtest_cfg = self._current_subtest
118 self.start_subtest() 116 self.start_subtest()
119 self._prompt_label.set_text(subtest_cfg['msg']) 117 self._prompt_label.set_text(subtest_cfg['msg'])
120 118
121 self._test_widget.queue_draw() 119 self._test_widget.queue_draw()
122 return True 120 return True
123 121
(...skipping 30 matching lines...) Expand all
154 raise error.TestFail('ERROR: Must provide an audio sample') 152 raise error.TestFail('ERROR: Must provide an audio sample')
155 if not os.path.isabs(sample): 153 if not os.path.isabs(sample):
156 # assume its in deps 154 # assume its in deps
157 sample = self.autodir + '/' + sample 155 sample = self.autodir + '/' + sample
158 if not os.path.exists(sample): 156 if not os.path.exists(sample):
159 raise error.TestFail('ERROR: Unable to find audio sample %s' \ 157 raise error.TestFail('ERROR: Unable to find audio sample %s' \
160 % sample) 158 % sample)
161 self._sample=sample 159 self._sample=sample
162 160
163 def run_once(self, 161 def run_once(self,
164 test_widget_size=None,
165 trigger_set=None,
166 has_audio=False, 162 has_audio=False,
167 sample=None, 163 sample=None):
168 ):
169 164
170 factory.log('%s run_once' % self.__class__) 165 factory.log('%s run_once' % self.__class__)
171 # because audio files relative to that 166
167 # Src contains the audio files.
172 os.chdir(self.autodir) 168 os.chdir(self.autodir)
173 169
174 self._ft_state = ful.State(trigger_set=trigger_set)
175 self._test_widget_size = test_widget_size
176 self._started = False 170 self._started = False
177 171
178 if has_audio: 172 if has_audio:
179 self.locate_asample(sample) 173 self.locate_asample(sample)
180 _SUBTEST_LIST.append(_OPTIONAL) 174 _SUBTEST_LIST.append(_OPTIONAL)
181 175
182 self._subtest_queue = [x for x in reversed(_SUBTEST_LIST)] 176 self._subtest_queue = [x for x in reversed(_SUBTEST_LIST)]
183 self._status_map = dict((n, ful.UNTESTED) for n, c in _SUBTEST_LIST) 177 self._status_map = dict((n, ful.UNTESTED) for n, c in _SUBTEST_LIST)
184 178
185 179
186 prompt_label = ful.make_label(_LABEL_START_STR, fg=ful.WHITE) 180 prompt_label = ful.make_label(_LABEL_START_STR, fg=ful.WHITE)
187 self._prompt_label = prompt_label 181 self._prompt_label = prompt_label
188 182
189 vbox = gtk.VBox() 183 vbox = gtk.VBox()
190 vbox.pack_start(prompt_label, False, False) 184 vbox.pack_start(prompt_label, False, False)
191 185
192 for name, cfg in _SUBTEST_LIST: 186 for name, cfg in _SUBTEST_LIST:
193 label_box = self.make_subtest_label_box(name) 187 label_box = self.make_subtest_label_box(name)
194 vbox.pack_start(label_box, False, False) 188 vbox.pack_start(label_box, False, False)
195 189
196 self._test_widget = vbox 190 self._test_widget = vbox
197 191
198 self.goto_next_subtest() 192 self.goto_next_subtest()
199 self.start_subtest() 193 self.start_subtest()
200 194
201 self._ft_state.run_test_widget( 195 ful.run_test_widget(self.job, vbox,
202 test_widget=vbox,
203 test_widget_size=test_widget_size,
204 window_registration_callback=self.register_callbacks) 196 window_registration_callback=self.register_callbacks)
205 197
206 failed_set = set(name for name, status in self._status_map.items() 198 failed_set = set(name for name, status in self._status_map.items()
207 if status is not ful.PASSED) 199 if status is not ful.PASSED)
208 if failed_set: 200 if failed_set:
209 raise error.TestFail('some subtests failed (%s)' % 201 raise error.TestFail('some subtests failed (%s)' %
210 ', '.join(failed_set)) 202 ', '.join(failed_set))
211 203
212 factory.log('%s run_once finished' % self.__class__) 204 factory.log('%s run_once finished' % self.__class__)
OLDNEW
« no previous file with comments | « client/site_tests/factory_Dummy/factory_Dummy.py ('k') | client/site_tests/factory_ExternalStorage/factory_ExternalStorage.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698