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

Side by Side Diff: client/site_tests/factory_ScriptWrapper/factory_ScriptWrapper.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 factory test allows execution of a test-based script, with the 8 # This factory test allows execution of a test-based script, with the
9 # stdout of the script displayed in a the testing widget via gtk 9 # stdout of the script displayed in a the testing widget via gtk
10 # label. Keyboard input will be passed to the script via its stdin. 10 # label. Keyboard input will be passed to the script via its stdin.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 self._proc.sendline(self._ibuf) 58 self._proc.sendline(self._ibuf)
59 self._ibuf = '' 59 self._ibuf = ''
60 60
61 61
62 class factory_ScriptWrapper(test.test): 62 class factory_ScriptWrapper(test.test):
63 version = 1 63 version = 1
64 64
65 def key_release_callback(self, widget, event): 65 def key_release_callback(self, widget, event):
66 char = event.keyval in range(32,127) and chr(event.keyval) or None 66 char = event.keyval in range(32,127) and chr(event.keyval) or None
67 char = event.keyval == gdk.keyval_from_name('Return') and '\n' or char 67 char = event.keyval == gdk.keyval_from_name('Return') and '\n' or char
68 if not self._ft_state.exit_on_trigger(event) and char is not None: 68 if char is not None:
69 self._script.send(char) 69 self._script.send(char)
70 return True 70 return True
71 71
72 def register_callbacks(self, window): 72 def register_callbacks(self, window):
73 window.connect('key-release-event', self.key_release_callback) 73 window.connect('key-release-event', self.key_release_callback)
74 window.add_events(gdk.KEY_RELEASE_MASK) 74 window.add_events(gdk.KEY_RELEASE_MASK)
75 75
76 def run_once(self, 76 def run_once(self, cmdline=None):
77 test_widget_size=None,
78 trigger_set=None,
79 cmdline=None):
80 77
81 factory.log('%s run_once' % self.__class__) 78 factory.log('%s run_once' % self.__class__)
82 79
83 self._ft_state = ful.State(trigger_set)
84
85 label = ful.make_label('', alignment=(0.5, 0.5)) 80 label = ful.make_label('', alignment=(0.5, 0.5))
86 81
87 test_widget = gtk.EventBox() 82 test_widget = gtk.EventBox()
88 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK) 83 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK)
89 test_widget.add(label) 84 test_widget.add(label)
90 85
91 self._script = Script(cmdline, pexpect, label) 86 self._script = Script(cmdline, pexpect, label)
92 87
93 self._ft_state.run_test_widget( 88 ful.run_test_widget(self.job, test_widget,
94 test_widget=test_widget,
95 test_widget_size=test_widget_size,
96 window_registration_callback=self.register_callbacks) 89 window_registration_callback=self.register_callbacks)
97 90
98 factory.log('%s run_once finished' % self.__class__) 91 factory.log('%s run_once finished' % self.__class__)
OLDNEW
« no previous file with comments | « client/site_tests/factory_Review/factory_Review.py ('k') | client/site_tests/factory_Touchpad/factory_Touchpad.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698