def setUp(self): GaiaTestCase.setUp(self) # Bluetooth host object self.bluetooth_host = BluetoothHost(self.marionette) # Disable/enable device bluetooth in case are any active connections self.data_layer.bluetooth_disable() self.assertFalse(self.data_layer.bluetooth_is_enabled) self.data_layer.bluetooth_enable() self.assertTrue(self.data_layer.bluetooth_is_enabled) time.sleep(30) # Remove any existing device pairings so we are starting clean self.data_layer.bluetooth_unpair_all_devices()
class TestBluetoothSettings(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) # Bluetooth host object from gaiatest.utils.bluetooth.bluetooth_host import BluetoothHost self.bluetooth_host = BluetoothHost(self.marionette) def test_toggle_bluetooth_settings(self): """Toggle Bluetooth via Settings - Networks & Connectivity https://moztrap.mozilla.org/manage/case/6071/ """ device_name = str(time.time()) settings = Settings(self.marionette) settings.launch() bluetooth_settings = settings.open_bluetooth_settings() bluetooth_settings.enable_bluetooth() bluetooth_settings.tap_rename_my_device() bluetooth_settings.type_phone_name(device_name) bluetooth_settings.tap_update_device_name_ok() bluetooth_settings.enable_visible_to_all() # Now have host machine inquire and shouldn't find our device device_found = self.bluetooth_host.is_device_visible(device_name) self.assertTrue(device_found, "Host should see our device (device discoverable mode is ON)")
class TestBluetoothDiscoverable(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) # Bluetooth host object self.bluetooth_host = BluetoothHost(self.marionette) # Disable/enable device bluetooth in case are any active connections self.data_layer.bluetooth_disable() self.assertFalse(self.data_layer.bluetooth_is_enabled) self.data_layer.bluetooth_enable() self.assertTrue(self.data_layer.bluetooth_is_enabled) time.sleep(30) # Remove any existing device pairings so we are starting clean self.data_layer.bluetooth_unpair_all_devices() def test_discoverable(self): # Set our device's bluetooth name uniquely so we can identify it device_name = str(time.time()) self.marionette.log("Setting device's bluetooth name to '%s'" % device_name) self.data_layer.bluetooth_set_device_name(device_name) time.sleep(5) # Place our device in discoverable mode so it can be found by host machine self.marionette.log("Setting device discoverable mode ON") self.data_layer.bluetooth_set_device_discoverable_mode(True) # Have host machine perform inquiry and look for our device device_found = self.bluetooth_host.is_device_visible(device_name) self.assertTrue(device_found, "Host should see our device (device discoverable mode is ON)") # Take the device out of discoverable mode self.marionette.log("Setting device discoverable mode OFF") self.data_layer.bluetooth_set_device_discoverable_mode(False) time.sleep(10) # Now have host machine inquire and shouldn't find our device device_found = self.bluetooth_host.is_device_visible(device_name) self.assertFalse(device_found, "Host shouldn't see our device (device discoverable mode is OFF)") # Disable device-side bluetooth self.data_layer.bluetooth_disable() self.assertFalse(self.data_layer.bluetooth_is_enabled)
def setUp(self): GaiaTestCase.setUp(self) # Bluetooth host object from gaiatest.utils.bluetooth.bluetooth_host import BluetoothHost self.bluetooth_host = BluetoothHost(self.marionette)
def setUp(self): GaiaTestCase.setUp(self) # Bluetooth host object self.bluetooth_host = BluetoothHost(self.marionette)
def setUp(self): GaiaTestCase.setUp(self) # Bluetooth host object self.bluetooth_host = BluetoothHost(self.marionette)