| OLD | NEW |
| 1 # -*- coding: utf-8 -*- |
| 2 # |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 4 | 6 |
| 5 | 7 |
| 6 # DESCRIPTION : | 8 # DESCRIPTION : |
| 7 # | 9 # |
| 8 # This is a factory test to test the external display (hdmi/vga/other) | 10 # This is a factory test to test the external display (hdmi/vga/other) |
| 9 # UI based heavily on factory_Display/factory_Audio | 11 # UI based heavily on factory_Display/factory_Audio |
| 10 | 12 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 gtk.main_quit() | 63 gtk.main_quit() |
| 62 return | 64 return |
| 63 self._current_subtest = self._subtest_queue.pop() | 65 self._current_subtest = self._subtest_queue.pop() |
| 64 name, cfg = self._current_subtest | 66 name, cfg = self._current_subtest |
| 65 self._status_map[name] = ful.ACTIVE | 67 self._status_map[name] = ful.ACTIVE |
| 66 | 68 |
| 67 def start_subtest(self): | 69 def start_subtest(self): |
| 68 subtest_name, subtest_cfg = self._current_subtest | 70 subtest_name, subtest_cfg = self._current_subtest |
| 69 if 'cfg' in subtest_cfg: | 71 if 'cfg' in subtest_cfg: |
| 70 for cfg in subtest_cfg['cfg']: | 72 for cfg in subtest_cfg['cfg']: |
| 71 utils.system(cfg) | 73 try: |
| 74 utils.system(cfg) |
| 75 except error.CmdError: |
| 76 raise error.TestNAError('Setup failed\n設定失敗\nCmd: %s' % cfg) |
| 72 factory.log("cmd: " + cfg) | 77 factory.log("cmd: " + cfg) |
| 73 if 'cmd' in subtest_cfg: | 78 if 'cmd' in subtest_cfg: |
| 74 cmd = "%s %s" % (subtest_cfg['cmd'], self._sample) | 79 cmd = "%s %s" % (subtest_cfg['cmd'], self._sample) |
| 75 factory.log("cmd: " + cmd) | 80 factory.log("cmd: " + cmd) |
| 76 self._job = utils.BgJob(cmd, stderr_level=logging.DEBUG) | 81 self._job = utils.BgJob(cmd, stderr_level=logging.DEBUG) |
| 77 else: | 82 else: |
| 78 self._job = None | 83 self._job = None |
| 79 | 84 |
| 80 def finish_subtest(self): | 85 def finish_subtest(self): |
| 81 subtest_name, subtest_cfg = self._current_subtest | 86 subtest_name, subtest_cfg = self._current_subtest |
| 82 if 'postcfg' in subtest_cfg: | 87 if 'postcfg' in subtest_cfg: |
| 83 for cfg in subtest_cfg['postcfg']: | 88 for cfg in subtest_cfg['postcfg']: |
| 84 utils.system(cfg) | 89 try: |
| 90 utils.system(cfg) |
| 91 except error.CmdError: |
| 92 raise error.TestNAError('Setup failed\n設定失敗\nCmd: %s' % cfg) |
| 85 factory.log("cmd: " + cfg) | 93 factory.log("cmd: " + cfg) |
| 86 self.close_bgjob(subtest_cfg) | 94 self.close_bgjob(subtest_cfg) |
| 87 | 95 |
| 88 def key_press_callback(self, widget, event): | 96 def key_press_callback(self, widget, event): |
| 89 subtest_name, subtest_cfg = self._current_subtest | 97 subtest_name, subtest_cfg = self._current_subtest |
| 90 if event.keyval == gtk.keysyms.space and not self._started: | 98 if event.keyval == gtk.keysyms.space and not self._started: |
| 91 self._prompt_label.set_text(subtest_cfg['msg']) | 99 self._prompt_label.set_text(subtest_cfg['msg']) |
| 92 self._started = True | 100 self._started = True |
| 93 self._test_widget.queue_draw() | 101 self._test_widget.queue_draw() |
| 94 return True | 102 return True |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 ful.run_test_widget(self.job, vbox, | 202 ful.run_test_widget(self.job, vbox, |
| 195 window_registration_callback=self.register_callbacks) | 203 window_registration_callback=self.register_callbacks) |
| 196 | 204 |
| 197 failed_set = set(name for name, status in self._status_map.items() | 205 failed_set = set(name for name, status in self._status_map.items() |
| 198 if status is not ful.PASSED) | 206 if status is not ful.PASSED) |
| 199 if failed_set: | 207 if failed_set: |
| 200 raise error.TestFail('some subtests failed (%s)' % | 208 raise error.TestFail('some subtests failed (%s)' % |
| 201 ', '.join(failed_set)) | 209 ', '.join(failed_set)) |
| 202 | 210 |
| 203 factory.log('%s run_once finished' % self.__class__) | 211 factory.log('%s run_once finished' % self.__class__) |
| OLD | NEW |