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

Side by Side Diff: client/site_tests/factory_Review/factory_Review.py

Issue 3438007: Replace newline characters in factory tests (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git
Patch Set: Address review comments 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
11 # factory_ui_lib library to display its UI, and to monitor keyboard 11 # factory_ui_lib library to display its UI, and to monitor keyboard
12 # events for test-switching triggers. This test can be terminated by 12 # events for test-switching triggers. This test can be terminated by
13 # typing SHIFT-Q. 13 # typing SHIFT-Q.
14 14
15 15
16 import gtk 16 import gtk
17 import pango 17 import pango
18 import sys 18 import sys
19 19
20 from gtk import gdk 20 from gtk import gdk
21 from itertools import count, izip, product 21 from itertools import count, izip, product
22 22
23 from autotest_lib.client.bin import factory 23 from autotest_lib.client.bin import factory
24 from autotest_lib.client.bin import factory_ui_lib as ful 24 from autotest_lib.client.bin import factory_ui_lib as ful
25 from autotest_lib.client.bin import test 25 from autotest_lib.client.bin import test
26 from autotest_lib.client.common_lib import error
27 26
28 from factory import AutomatedSequence 27 from factory import AutomatedSequence
29 28
30 N_ROW = 15 29 N_ROW = 15
31 LABEL_EN_SIZE = (170, 35) 30 LABEL_EN_SIZE = (170, 35)
32 LABEL_EN_SIZE_2 = (450, 25) 31 LABEL_EN_SIZE_2 = (450, 25)
33 LABEL_EN_FONT = pango.FontDescription('courier new extra-condensed 16') 32 LABEL_EN_FONT = pango.FontDescription('courier new extra-condensed 16')
34 TAB_BORDER = 20 33 TAB_BORDER = 20
35 34
36 def trim(text, length): 35 def trim(text, length):
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 fg=ful.LABEL_COLORS[status]) 73 fg=ful.LABEL_COLORS[status])
75 status_table.attach(status_label, j, j+1, i, i+1) 74 status_table.attach(status_label, j, j+1, i, i+1)
76 75
77 vbox = gtk.VBox() 76 vbox = gtk.VBox()
78 vbox.set_spacing(20) 77 vbox.set_spacing(20)
79 vbox.pack_start(info_box, False, False) 78 vbox.pack_start(info_box, False, False)
80 vbox.pack_start(status_table, False, False) 79 vbox.pack_start(status_table, False, False)
81 return vbox 80 return vbox
82 81
83 def make_error_tab(self, status_map, t): 82 def make_error_tab(self, status_map, t):
84 msg = '%s (%s)\n%s' % (t.label_en, t.label_zw, 83 msg = status_map.lookup_error_msg(t)
85 status_map.lookup_error_msg(t)) 84 if isinstance(msg, str) or isinstance(msg, str):
85 msg = msg.replace('<br/>', '\n')
86 msg = '%s (%s)\n%s' % (t.label_en, t.label_zw, msg)
86 label = ful.make_label(msg, 87 label = ful.make_label(msg,
87 font=LABEL_EN_FONT, 88 font=LABEL_EN_FONT,
88 alignment=(0.0, 0.0)) 89 alignment=(0.0, 0.0))
89 label.set_line_wrap(True) 90 label.set_line_wrap(True)
90 frame = gtk.Frame() 91 frame = gtk.Frame()
91 frame.add(label) 92 frame.add(label)
92 return frame 93 return frame
93 94
94 def key_release_callback(self, widget, event): 95 def key_release_callback(self, widget, event):
95 factory.log('key_release_callback %s(%s)' % 96 factory.log('key_release_callback %s(%s)' %
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 vbox.pack_start(self.notebook, False, False) 141 vbox.pack_start(self.notebook, False, False)
141 142
142 test_widget = gtk.EventBox() 143 test_widget = gtk.EventBox()
143 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK) 144 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK)
144 test_widget.add(vbox) 145 test_widget.add(vbox)
145 146
146 ful.run_test_widget(self.job, test_widget, 147 ful.run_test_widget(self.job, test_widget,
147 window_registration_callback=self.register_callback) 148 window_registration_callback=self.register_callback)
148 149
149 factory.log('%s run_once finished' % self.__class__) 150 factory.log('%s run_once finished' % self.__class__)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698