| 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 | 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 hbox.pack_end(label_en, False, False) | 140 hbox.pack_end(label_en, False, False) |
| 141 eb.add(hbox) | 141 eb.add(hbox) |
| 142 return eb | 142 return eb |
| 143 | 143 |
| 144 def register_callbacks(self, window): | 144 def register_callbacks(self, window): |
| 145 window.connect('key-press-event', self.key_press_callback) | 145 window.connect('key-press-event', self.key_press_callback) |
| 146 window.add_events(gtk.gdk.KEY_PRESS_MASK) | 146 window.add_events(gtk.gdk.KEY_PRESS_MASK) |
| 147 window.connect('key-release-event', self.key_release_callback) | 147 window.connect('key-release-event', self.key_release_callback) |
| 148 window.add_events(gtk.gdk.KEY_RELEASE_MASK) | 148 window.add_events(gtk.gdk.KEY_RELEASE_MASK) |
| 149 | 149 |
| 150 def locate_asample(self, sample): | 150 def locate_audio_sample(self, path): |
| 151 if not sample: | 151 if not path: |
| 152 raise error.TestFail('ERROR: Must provide an audio sample') | 152 raise error.TestFail('ERROR: Must provide an audio sample') |
| 153 if not os.path.isabs(sample): | 153 if not os.path.isabs(path): |
| 154 # assume its in deps | 154 # Assume the relative path is based in autotest directory. |
| 155 sample = self.autodir + '/' + sample | 155 path = os.path.join(self.autodir, path) |
| 156 if not os.path.exists(sample): | 156 if not os.path.exists(path): |
| 157 raise error.TestFail('ERROR: Unable to find audio sample %s' \ | 157 raise error.TestFail('ERROR: Unable to find audio sample %s' % path) |
| 158 % sample) | 158 self._sample = path |
| 159 self._sample=sample | |
| 160 | 159 |
| 161 def run_once(self, | 160 def run_once(self, |
| 162 has_audio=False, | 161 has_audio=False, |
| 163 sample=None): | 162 audio_sample_path=None): |
| 164 | 163 |
| 165 factory.log('%s run_once' % self.__class__) | 164 factory.log('%s run_once' % self.__class__) |
| 166 | 165 |
| 167 # Src contains the audio files. | 166 # Src contains the audio files. |
| 168 os.chdir(self.autodir) | 167 os.chdir(self.autodir) |
| 169 | 168 |
| 170 self._started = False | 169 self._started = False |
| 171 | 170 |
| 172 if has_audio: | 171 if has_audio: |
| 173 self.locate_asample(sample) | 172 self.locate_audio_sample(audio_sample_path) |
| 174 _SUBTEST_LIST.append(_OPTIONAL) | 173 _SUBTEST_LIST.append(_OPTIONAL) |
| 175 | 174 |
| 176 self._subtest_queue = [x for x in reversed(_SUBTEST_LIST)] | 175 self._subtest_queue = [x for x in reversed(_SUBTEST_LIST)] |
| 177 self._status_map = dict((n, ful.UNTESTED) for n, c in _SUBTEST_LIST) | 176 self._status_map = dict((n, ful.UNTESTED) for n, c in _SUBTEST_LIST) |
| 178 | 177 |
| 179 | 178 |
| 180 prompt_label = ful.make_label(_LABEL_START_STR, fg=ful.WHITE) | 179 prompt_label = ful.make_label(_LABEL_START_STR, fg=ful.WHITE) |
| 181 self._prompt_label = prompt_label | 180 self._prompt_label = prompt_label |
| 182 | 181 |
| 183 vbox = gtk.VBox() | 182 vbox = gtk.VBox() |
| (...skipping 11 matching lines...) Expand all Loading... |
| 195 ful.run_test_widget(self.job, vbox, | 194 ful.run_test_widget(self.job, vbox, |
| 196 window_registration_callback=self.register_callbacks) | 195 window_registration_callback=self.register_callbacks) |
| 197 | 196 |
| 198 failed_set = set(name for name, status in self._status_map.items() | 197 failed_set = set(name for name, status in self._status_map.items() |
| 199 if status is not ful.PASSED) | 198 if status is not ful.PASSED) |
| 200 if failed_set: | 199 if failed_set: |
| 201 raise error.TestFail('some subtests failed (%s)' % | 200 raise error.TestFail('some subtests failed (%s)' % |
| 202 ', '.join(failed_set)) | 201 ', '.join(failed_set)) |
| 203 | 202 |
| 204 factory.log('%s run_once finished' % self.__class__) | 203 factory.log('%s run_once finished' % self.__class__) |
| OLD | NEW |