| OLD | NEW |
| 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 import glob, logging, os, sys, commands | 5 import glob, logging, os, sys, commands |
| 6 | 6 |
| 7 from autotest_lib.client.bin import test, utils | 7 from autotest_lib.client.bin import test, utils |
| 8 from autotest_lib.client.common_lib import error | 8 from autotest_lib.client.common_lib import error |
| 9 | 9 |
| 10 class hardware_Keyboard(test.test): | 10 class hardware_Keyboard(test.test): |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 'LeftControl', 'LeftAlt', 'Space', 'RightAlt', | 22 'LeftControl', 'LeftAlt', 'Space', 'RightAlt', |
| 23 'RightCtrl', 'Up', 'Down', 'Left', 'Right', | 23 'RightCtrl', 'Up', 'Down', 'Left', 'Right', |
| 24 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', | 24 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', |
| 25 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', | 25 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', |
| 26 'Z', 'X', 'C', 'V', 'B', 'N', 'M'] | 26 'Z', 'X', 'C', 'V', 'B', 'N', 'M'] |
| 27 live_test_key = 'LeftMeta' | 27 live_test_key = 'LeftMeta' |
| 28 preserve_srcdir = True | 28 preserve_srcdir = True |
| 29 | 29 |
| 30 def setup(self): | 30 def setup(self): |
| 31 os.chdir(self.srcdir) | 31 os.chdir(self.srcdir) |
| 32 utils.system('make') | 32 utils.make() |
| 33 | 33 |
| 34 def _supported(self, event, key_name): | 34 def _supported(self, event, key_name): |
| 35 cmd = os.path.join(self.srcdir, 'evtest') + ' ' + event | 35 cmd = os.path.join(self.srcdir, 'evtest') + ' ' + event |
| 36 cmd += ' -s ' + key_name | 36 cmd += ' -s ' + key_name |
| 37 (status, output) = commands.getstatusoutput(cmd) | 37 (status, output) = commands.getstatusoutput(cmd) |
| 38 if status: | 38 if status: |
| 39 logging.error('Unsupported Key : %s' % key_name) | 39 logging.error('Unsupported Key : %s' % key_name) |
| 40 return False | 40 return False |
| 41 logging.info('%s : %s' % (key_name, output)) | 41 logging.info('%s : %s' % (key_name, output)) |
| 42 return True | 42 return True |
| (...skipping 24 matching lines...) Expand all Loading... |
| 67 raise error.TestError('Required key unsupported in %s' % | 67 raise error.TestError('Required key unsupported in %s' % |
| 68 high_key_event) | 68 high_key_event) |
| 69 # Test one live keystroke. Test will wait on user input. | 69 # Test one live keystroke. Test will wait on user input. |
| 70 cmd = os.path.join(self.srcdir, 'evtest') + ' ' + high_key_event | 70 cmd = os.path.join(self.srcdir, 'evtest') + ' ' + high_key_event |
| 71 cmd += ' -k' | 71 cmd += ' -k' |
| 72 (status, output) = commands.getstatusoutput(cmd) | 72 (status, output) = commands.getstatusoutput(cmd) |
| 73 if status: | 73 if status: |
| 74 raise error.TestError('Key Capture Test failed : %s' % output); | 74 raise error.TestError('Key Capture Test failed : %s' % output); |
| 75 if (output != hardware_Keyboard.live_test_key): | 75 if (output != hardware_Keyboard.live_test_key): |
| 76 raise error.TestError('Incorrect key pressed : %s' % output); | 76 raise error.TestError('Incorrect key pressed : %s' % output); |
| OLD | NEW |