| 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 dbus, dbus.mainloop.glib, dbus.service, gobject, logging, re | 5 import dbus, dbus.mainloop.glib, dbus.service, gobject, logging, re |
| 6 from autotest_lib.client.bin import utils | 6 from autotest_lib.client.bin import utils |
| 7 from autotest_lib.client.common_lib import error | 7 from autotest_lib.client.common_lib import error |
| 8 from autotest_lib.client.cros import ui, ui_test | 8 from autotest_lib.client.cros import cros_ui_test, ui |
| 9 | 9 |
| 10 | 10 |
| 11 _QUESTION_START = ''' | 11 _QUESTION_START = ''' |
| 12 <h5> | 12 <h5> |
| 13 The Bluetooth scan discovered the following devices.<br> | 13 The Bluetooth scan discovered the following devices.<br> |
| 14 If a device is not on the list, switch it into pairing mode and rescan.<br> | 14 If a device is not on the list, switch it into pairing mode and rescan.<br> |
| 15 <br> | 15 <br> |
| 16 You can click on an input device (e.g., mouse) to pair with it.<br> | 16 You can click on an input device (e.g., mouse) to pair with it.<br> |
| 17 </h5> | 17 </h5> |
| 18 <table border="1"><tr><td>Address</td><td>Name</td></tr> | 18 <table border="1"><tr><td>Address</td><td>Name</td></tr> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 37 logging.debug('Agent: RequestPinCode (%s), sending %s.', device, pin) | 37 logging.debug('Agent: RequestPinCode (%s), sending %s.', device, pin) |
| 38 return pin | 38 return pin |
| 39 | 39 |
| 40 | 40 |
| 41 @dbus.service.method("org.bluez.Agent", | 41 @dbus.service.method("org.bluez.Agent", |
| 42 in_signature="", out_signature="") | 42 in_signature="", out_signature="") |
| 43 def Cancel(self): | 43 def Cancel(self): |
| 44 logging.debug('Agent: Cancel') | 44 logging.debug('Agent: Cancel') |
| 45 | 45 |
| 46 | 46 |
| 47 class hardware_BluetoothSemiAuto(ui_test.UITest): | 47 class hardware_BluetoothSemiAuto(cros_ui_test.UITest): |
| 48 version = 1 | 48 version = 1 |
| 49 | 49 |
| 50 | 50 |
| 51 def initialize(self, creds = '$default'): |
| 52 cros_ui_test.UITest.initialize(self, creds) |
| 53 |
| 54 |
| 51 def cleanup(self): | 55 def cleanup(self): |
| 52 ui_test.UITest.cleanup(self) | 56 cros_ui_test.UITest.cleanup(self) |
| 53 self.disconnect_all() | 57 self.disconnect_all() |
| 54 | 58 |
| 55 | 59 |
| 56 def handle_reply(self, device): | 60 def handle_reply(self, device): |
| 57 logging.debug("Device created: %s", device) | 61 logging.debug("Device created: %s", device) |
| 58 self.mainloop.quit() | 62 self.mainloop.quit() |
| 59 | 63 |
| 60 | 64 |
| 61 def handle_error(self, error): | 65 def handle_error(self, error): |
| 62 logging.debug('Unable to create device: %s', error) | 66 logging.debug('Unable to create device: %s', error) |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 bt_errors = [] | 190 bt_errors = [] |
| 187 for check in checkboxes: | 191 for check in checkboxes: |
| 188 if form_entries.get(check) != 'on': | 192 if form_entries.get(check) != 'on': |
| 189 bt_errors.append('"%s" not checked' % check) | 193 bt_errors.append('"%s" not checked' % check) |
| 190 for text in textinputs: | 194 for text in textinputs: |
| 191 if not form_entries.get(text): | 195 if not form_entries.get(text): |
| 192 bt_errors.append('no input in "%s" field' % text) | 196 bt_errors.append('no input in "%s" field' % text) |
| 193 if bt_errors: | 197 if bt_errors: |
| 194 raise error.TestFail('Bluetooth input errors:\n%s' % | 198 raise error.TestFail('Bluetooth input errors:\n%s' % |
| 195 '\n'.join(bt_errors)) | 199 '\n'.join(bt_errors)) |
| OLD | NEW |