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

Side by Side Diff: client/site_tests/factory_Dummy/factory_Dummy.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 15 matching lines...) Expand all
26 26
27 27
28 class factory_Dummy(test.test): 28 class factory_Dummy(test.test):
29 version = 1 29 version = 1
30 30
31 def key_release_callback(self, widget, event): 31 def key_release_callback(self, widget, event):
32 char = event.keyval in range(32,127) and chr(event.keyval) or None 32 char = event.keyval in range(32,127) and chr(event.keyval) or None
33 factory.log('key_release %s(%s)' % (event.keyval, char)) 33 factory.log('key_release %s(%s)' % (event.keyval, char))
34 if event.keyval == self._quit_key: 34 if event.keyval == self._quit_key:
35 gtk.main_quit() 35 gtk.main_quit()
36 self._ft_state.exit_on_trigger(event)
37 return True 36 return True
38 37
39 def register_callbacks(self, window): 38 def register_callbacks(self, window):
40 window.connect('key-release-event', self.key_release_callback) 39 window.connect('key-release-event', self.key_release_callback)
41 window.add_events(gdk.KEY_RELEASE_MASK) 40 window.add_events(gdk.KEY_RELEASE_MASK)
42 41
43 def run_once(self, 42 def run_once(self,
44 test_widget_size=None,
45 trigger_set=None,
46 quit_key=ord('Q'), 43 quit_key=ord('Q'),
47 msg='factory_Dummy'): 44 msg='factory_Dummy'):
48 45
49 factory.log('%s run_once' % self.__class__) 46 factory.log('%s run_once' % self.__class__)
50 47
51 self._quit_key = quit_key 48 self._quit_key = quit_key
52 49
53 self._ft_state = ful.State(trigger_set)
54
55 label = ful.make_label(msg) 50 label = ful.make_label(msg)
56 51
57 test_widget = gtk.EventBox() 52 test_widget = gtk.EventBox()
58 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK) 53 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK)
59 test_widget.add(label) 54 test_widget.add(label)
60 55
61 self._ft_state.run_test_widget( 56 ful.run_test_widget(self.job, test_widget,
62 test_widget=test_widget,
63 test_widget_size=test_widget_size,
64 window_registration_callback=self.register_callbacks) 57 window_registration_callback=self.register_callbacks)
65 58
66 factory.log('%s run_once finished' % self.__class__) 59 factory.log('%s run_once finished' % repr(self.__class__))
OLDNEW
« no previous file with comments | « client/site_tests/factory_Display/factory_Display.py ('k') | client/site_tests/factory_ExtDisplay/factory_ExtDisplay.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698