| 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 an example factory test that does not really do anything -- | 8 # This is an example factory test that does not really do anything -- |
| 9 # it displays a message in the center of the testing area, as | 9 # it displays a message in the center of the testing area, as |
| 10 # communicated by arguments to run_once(). This test makes use of the | 10 # communicated by arguments to run_once(). This test makes use of the |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 def run_once(self, | 39 def run_once(self, |
| 40 test_widget_size=None, | 40 test_widget_size=None, |
| 41 trigger_set=None, | 41 trigger_set=None, |
| 42 status_file_path=None, | 42 status_file_path=None, |
| 43 test_list=None): | 43 test_list=None): |
| 44 | 44 |
| 45 factory.log('%s run_once' % self.__class__) | 45 factory.log('%s run_once' % self.__class__) |
| 46 | 46 |
| 47 self._ft_state = ful.State(trigger_set) | 47 self._ft_state = ful.State(trigger_set) |
| 48 | 48 |
| 49 status_map = ful.StatusMap(status_file_path, test_list) | 49 status_map = factory.StatusMap(test_list, status_file_path) |
| 50 untested = status_map.filter(ful.UNTESTED) | 50 untested = status_map.filter(ful.UNTESTED) |
| 51 passed = status_map.filter(ful.PASSED) | 51 passed = status_map.filter(ful.PASSED) |
| 52 failed = status_map.filter(ful.FAILED) | 52 failed = status_map.filter(ful.FAILED) |
| 53 | 53 |
| 54 top_label = ful.make_label('UNTESTED=%d\t' % len(untested) + | 54 top_label = ful.make_label('UNTESTED=%d\t' % len(untested) + |
| 55 'PASSED=%d\t' % len(passed) + | 55 'PASSED=%d\t' % len(passed) + |
| 56 'FAILED=%d' % len(failed)) | 56 'FAILED=%d' % len(failed)) |
| 57 | 57 |
| 58 failed_msgs_map = [(t, status_map.lookup_error(t)) for t in failed] | 58 failed_msgs_map = [(t, status_map.lookup_error_msg(t)) for t in failed] |
| 59 failure_report_list = ['%s : %s' % (t.label_en, e) | 59 failure_report_list = ['%s : %s' % (t.label_en, e) |
| 60 for t, e in failed_msgs_map] | 60 for t, e in failed_msgs_map] |
| 61 failure_report = ful.make_label('\n'.join(failure_report_list)) | 61 failure_report = ful.make_label('\n'.join(failure_report_list)) |
| 62 | 62 |
| 63 vbox = gtk.VBox() | 63 vbox = gtk.VBox() |
| 64 vbox.set_spacing(20) | 64 vbox.set_spacing(20) |
| 65 vbox.pack_start(top_label, False, False) | 65 vbox.pack_start(top_label, False, False) |
| 66 vbox.pack_start(failure_report, False, False) | 66 vbox.pack_start(failure_report, False, False) |
| 67 | 67 |
| 68 test_widget = gtk.EventBox() | 68 test_widget = gtk.EventBox() |
| 69 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK) | 69 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK) |
| 70 test_widget.add(vbox) | 70 test_widget.add(vbox) |
| 71 | 71 |
| 72 self._ft_state.run_test_widget( | 72 self._ft_state.run_test_widget( |
| 73 test_widget=test_widget, | 73 test_widget=test_widget, |
| 74 test_widget_size=test_widget_size, | 74 test_widget_size=test_widget_size, |
| 75 window_registration_callback=self.register_callbacks) | 75 window_registration_callback=self.register_callbacks) |
| 76 | 76 |
| 77 factory.log('%s run_once finished' % self.__class__) | 77 factory.log('%s run_once finished' % self.__class__) |
| OLD | NEW |