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

Unified Diff: client/site_tests/factory_Keyboard/factory_Keyboard.py

Issue 6686009: Keyboard localization (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | client/site_tests/factory_Keyboard/src/en-US.bindings » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/site_tests/factory_Keyboard/factory_Keyboard.py
diff --git a/client/site_tests/factory_Keyboard/factory_Keyboard.py b/client/site_tests/factory_Keyboard/factory_Keyboard.py
index 1f15cebb6512fee5f1f5e9c0e84b4eb57b186e4d..ad64fb3e747a08336d9d3165943950ce6d395599 100644
--- a/client/site_tests/factory_Keyboard/factory_Keyboard.py
+++ b/client/site_tests/factory_Keyboard/factory_Keyboard.py
@@ -21,6 +21,7 @@ import logging
import time
import os
import sys
+import utils
from gtk import gdk
@@ -128,12 +129,28 @@ class factory_Keyboard(test.test):
version = 1
preserve_srcdir = True
+ def get_layout_from_vpd(self):
+ """ vpd should contain "initial_locale"="en-US" or similar. """
+ cmd = 'vpd -l | grep initial_locale | cut -f4 -d\'"\''
+ layout = utils.system_output(cmd).strip()
+ if layout != '':
+ return layout
+ return None
+
def run_once(self, layout=None):
factory.log('%s run_once' % self.__class__)
os.chdir(self.srcdir)
+ # Autodetect from VPD.
+ if not layout:
+ layout = self.get_layout_from_vpd()
+ # Default to United States.
+ if not layout:
+ layout = 'en-US'
+
+ factory.log("Using keyboard layout %s" % layout)
try:
kbd_image = cairo.ImageSurface.create_from_png('%s.png' % layout)
image_size = (kbd_image.get_width(), kbd_image.get_height())
« no previous file with comments | « no previous file | client/site_tests/factory_Keyboard/src/en-US.bindings » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698