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

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

Issue 6679050: Use keyboard_layout instead of initial_locale (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@0.11.241.B
Patch Set: typos Created 9 years, 9 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 # Select the keyboard type, and write to VPD. 8 # Select the keyboard type, and write to VPD.
9 9
10 10
11 import gtk 11 import gtk
12 import pango 12 import pango
13 import sys 13 import sys
14 import utils 14 import utils
15 15
16 from gtk import gdk 16 from gtk import gdk
17 17
18 from autotest_lib.client.bin import factory 18 from autotest_lib.client.bin import factory
19 from autotest_lib.client.bin import factory_ui_lib as ful 19 from autotest_lib.client.bin import factory_ui_lib as ful
20 from autotest_lib.client.bin import test 20 from autotest_lib.client.bin import test
21 from autotest_lib.client.common_lib import error 21 from autotest_lib.client.common_lib import error
22 22
23 # Mapping between menu choice and KB. 23 # Mapping between menu choice and KB.
24 kb_map = { 24 kb_map = {
25 '1': 'en-US', 25 '1': ('United Stattes', 'en-US', 'xkb:us::eng'),
yongjaek 2011/03/14 23:08:33 Stattes -> States ;-)
26 '2': 'en-GB', 26 '2': ('United Kingdom', 'en-GB', 'xkb:gb:extd:eng'),
27 'q': None, 27 'q': ('None', None, None)
28 } 28 }
29 29
30 # Message to display. 30 # Message to display.
31 msg = ('Choose a keyboard:\n' + 31 msg = ('Choose a keyboard:\n' +
32 "".join([ '%s) %s\n' % (i, kb_map[i]) for i in sorted(kb_map)])) 32 "".join([ '%s) %s - %s\n' % (i, kb_map[i][0], kb_map[i][1])
33 for i in sorted(kb_map)]))
33 34
34 class factory_SelectKeyboard(test.test): 35 class factory_SelectKeyboard(test.test):
35 version = 1 36 version = 1
36 37
37 def write_kb(self, kb): 38 def write_kb(self, kb):
38 cmd = 'vpd -s "initial_locale"="%s"' % kb 39 cmd = 'vpd -i RO_VPD -s "initial_locale"="%s"' % kb[1]
40 utils.system_output(cmd)
41 cmd = 'vpd -i RO_VPD -s "keyboard_layout"="%s"' % kb[2]
39 utils.system_output(cmd) 42 utils.system_output(cmd)
40 43
41 def key_release_callback(self, widget, event): 44 def key_release_callback(self, widget, event):
42 char = event.keyval in range(32,127) and chr(event.keyval) or None 45 char = event.keyval in range(32,127) and chr(event.keyval) or None
43 factory.log('key_release %s(%s)' % (event.keyval, char)) 46 factory.log('key_release %s(%s)' % (event.keyval, char))
44 if char in kb_map: 47 if char in kb_map:
45 kb = kb_map[char] 48 kb = kb_map[char]
46 factory.log('Keyboard specified as %s, (pressed %s)' % ( 49 factory.log('Keyboard specified as %s, (pressed %s)' % (
47 kb, char)) 50 kb, char))
48 51
(...skipping 13 matching lines...) Expand all
62 label = ful.make_label(msg) 65 label = ful.make_label(msg)
63 66
64 test_widget = gtk.EventBox() 67 test_widget = gtk.EventBox()
65 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK) 68 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK)
66 test_widget.add(label) 69 test_widget.add(label)
67 70
68 ful.run_test_widget(self.job, test_widget, 71 ful.run_test_widget(self.job, test_widget,
69 window_registration_callback=self.register_callbacks) 72 window_registration_callback=self.register_callbacks)
70 73
71 factory.log('%s run_once finished' % repr(self.__class__)) 74 factory.log('%s run_once finished' % repr(self.__class__))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698