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

Side by Side Diff: client/site_tests/factory_Review/factory_Review.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 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 10 matching lines...) Expand all
21 21
22 from autotest_lib.client.bin import factory 22 from autotest_lib.client.bin import factory
23 from autotest_lib.client.bin import factory_ui_lib as ful 23 from autotest_lib.client.bin import factory_ui_lib as ful
24 from autotest_lib.client.bin import test 24 from autotest_lib.client.bin import test
25 from autotest_lib.client.common_lib import error 25 from autotest_lib.client.common_lib import error
26 26
27 27
28 class factory_Review(test.test): 28 class factory_Review(test.test):
29 version = 1 29 version = 1
30 30
31 def key_release_callback(self, widget, event):
32 self._ft_state.exit_on_trigger(event)
33 return True
34
35 def register_callbacks(self, window):
36 window.connect('key-release-event', self.key_release_callback)
37 window.add_events(gdk.KEY_RELEASE_MASK)
38
39 def run_once(self, 31 def run_once(self,
40 test_widget_size=None,
41 trigger_set=None,
42 status_file_path=None, 32 status_file_path=None,
43 test_list=None): 33 test_list=None):
44 34
45 factory.log('%s run_once' % self.__class__) 35 factory.log('%s run_once' % self.__class__)
46 36
47 self._ft_state = ful.State(trigger_set)
48
49 status_map = factory.StatusMap(test_list, status_file_path) 37 status_map = factory.StatusMap(test_list, status_file_path)
50 untested = status_map.filter(ful.UNTESTED) 38 untested = status_map.filter(ful.UNTESTED)
51 passed = status_map.filter(ful.PASSED) 39 passed = status_map.filter(ful.PASSED)
52 failed = status_map.filter(ful.FAILED) 40 failed = status_map.filter(ful.FAILED)
53 41
54 top_label = ful.make_label('UNTESTED=%d\t' % len(untested) + 42 top_label = ful.make_label('UNTESTED=%d\t' % len(untested) +
55 'PASSED=%d\t' % len(passed) + 43 'PASSED=%d\t' % len(passed) +
56 'FAILED=%d' % len(failed)) 44 'FAILED=%d' % len(failed))
57 45
58 failed_msgs_map = [(t, status_map.lookup_error_msg(t)) for t in failed] 46 failed_msgs_map = [(t, status_map.lookup_error_msg(t)) for t in failed]
59 failure_report_list = ['%s : %s' % (t.label_en, e) 47 failure_report_list = ['%s : %s' % (t.label_en, e)
60 for t, e in failed_msgs_map] 48 for t, e in failed_msgs_map]
61 failure_report = ful.make_label('\n'.join(failure_report_list)) 49 failure_report = ful.make_label('\n'.join(failure_report_list))
62 50
63 vbox = gtk.VBox() 51 vbox = gtk.VBox()
64 vbox.set_spacing(20) 52 vbox.set_spacing(20)
65 vbox.pack_start(top_label, False, False) 53 vbox.pack_start(top_label, False, False)
66 vbox.pack_start(failure_report, False, False) 54 vbox.pack_start(failure_report, False, False)
67 55
68 test_widget = gtk.EventBox() 56 test_widget = gtk.EventBox()
69 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK) 57 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK)
70 test_widget.add(vbox) 58 test_widget.add(vbox)
71 59
72 self._ft_state.run_test_widget( 60 ful.run_test_widget(self.job, test_widget)
73 test_widget=test_widget,
74 test_widget_size=test_widget_size,
75 window_registration_callback=self.register_callbacks)
76 61
77 factory.log('%s run_once finished' % self.__class__) 62 factory.log('%s run_once finished' % self.__class__)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698