| OLD | NEW |
| 1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
| 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 | 6 |
| 7 # DESCRIPTION : | 7 # DESCRIPTION : |
| 8 # | 8 # |
| 9 # This is a factory test to test the audio. Operator will test both record and | 9 # This is a factory test to test the audio. Operator will test both record and |
| 10 # playback for headset and built-in audio. Recordings are played back for | 10 # playback for headset and built-in audio. Recordings are played back for |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 def register_callbacks(self, window): | 165 def register_callbacks(self, window): |
| 166 window.connect('key-press-event', self.key_press_callback) | 166 window.connect('key-press-event', self.key_press_callback) |
| 167 window.add_events(gtk.gdk.KEY_PRESS_MASK) | 167 window.add_events(gtk.gdk.KEY_PRESS_MASK) |
| 168 window.connect('key-release-event', self.key_release_callback) | 168 window.connect('key-release-event', self.key_release_callback) |
| 169 window.add_events(gtk.gdk.KEY_RELEASE_MASK) | 169 window.add_events(gtk.gdk.KEY_RELEASE_MASK) |
| 170 | 170 |
| 171 def locate_audio_sample(self, path): | 171 def locate_audio_sample(self, path): |
| 172 if path is None: | 172 if path is None: |
| 173 raise error.TestFail('ERROR: Must provide an audio sample') | 173 raise error.TestFail('ERROR: Must provide an audio sample') |
| 174 if not os.path.isabs(path): | 174 if not os.path.isabs(path): |
| 175 # Assume rel-path samples are in deps/factory. | 175 # Assume the relative path is based in autotest directory. |
| 176 path = self.job.autodir + '/deps/factory/' + path | 176 path = os.path.join(self.job.autodir, path) |
| 177 if not os.path.exists(path): | 177 if not os.path.exists(path): |
| 178 raise error.TestFail('ERROR: Unable to find audio sample %s' % path) | 178 raise error.TestFail('ERROR: Unable to find audio sample %s' % path) |
| 179 return path | 179 return path |
| 180 | 180 |
| 181 def run_once(self, audio_sample_path=None): | 181 def run_once(self, audio_sample_path=None): |
| 182 | 182 |
| 183 factory.log('%s run_once' % self.__class__) | 183 factory.log('%s run_once' % self.__class__) |
| 184 | 184 |
| 185 # Write recordings in tmpdir. | 185 # Write recordings in tmpdir. |
| 186 os.chdir(self.tmpdir) | 186 os.chdir(self.tmpdir) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 211 ful.run_test_widget(self.job, self._test_widget, | 211 ful.run_test_widget(self.job, self._test_widget, |
| 212 window_registration_callback=self.register_callbacks) | 212 window_registration_callback=self.register_callbacks) |
| 213 | 213 |
| 214 failed_set = set(name for name, status in self._status_map.items() | 214 failed_set = set(name for name, status in self._status_map.items() |
| 215 if status is not ful.PASSED) | 215 if status is not ful.PASSED) |
| 216 if failed_set: | 216 if failed_set: |
| 217 raise error.TestFail('some samples failed (%s)' % | 217 raise error.TestFail('some samples failed (%s)' % |
| 218 ', '.join(failed_set)) | 218 ', '.join(failed_set)) |
| 219 | 219 |
| 220 factory.log('%s run_once finished' % self.__class__) | 220 factory.log('%s run_once finished' % self.__class__) |
| OLD | NEW |