diff --git a/components/bluetooth/lib.rs b/components/bluetooth/lib.rs index 5519d74f408..69b22b60e11 100644 --- a/components/bluetooth/lib.rs +++ b/components/bluetooth/lib.rs @@ -31,10 +31,6 @@ use std::thread; use std::time::Duration; use util::thread::spawn_named; -const ADAPTER_ERROR: &'static str = "No adapter found"; - -const ADAPTER_NOT_POWERED_ERROR: &'static str = "Bluetooth adapter not powered"; - // A transaction not completed within 30 seconds shall time out. Such a transaction shall be considered to have failed. // https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=286439 (Vol. 3, page 480) const MAXIMUM_TRANSACTION_TIME: u8 = 30; @@ -75,11 +71,11 @@ macro_rules! get_adapter_or_return_error( match $bl_manager.get_or_create_adapter() { Some(adapter) => { if !adapter.is_powered().unwrap_or(false) { - return drop($sender.send(Err(BluetoothError::Type(ADAPTER_NOT_POWERED_ERROR.to_string())))) + return drop($sender.send(Err(BluetoothError::NotFound))) } adapter }, - None => return drop($sender.send(Err(BluetoothError::Type(ADAPTER_ERROR.to_string())))), + None => return drop($sender.send(Err(BluetoothError::NotFound))), } ); ); @@ -701,7 +697,7 @@ impl BluetoothManager { } let mut adapter = match self.get_or_create_adapter() { Some(a) => a, - None => return drop(sender.send(Err(BluetoothError::Type(ADAPTER_ERROR.to_string())))), + None => return drop(sender.send(Err(BluetoothError::NotFound))), }; let device = match self.device_from_service_id(&service_id) { Some(device) => device, @@ -735,7 +731,7 @@ impl BluetoothManager { } let mut adapter = match self.get_or_create_adapter() { Some(a) => a, - None => return drop(sender.send(Err(BluetoothError::Type(ADAPTER_ERROR.to_string())))), + None => return drop(sender.send(Err(BluetoothError::NotFound))), }; let device = match self.device_from_service_id(&service_id) { Some(device) => device, diff --git a/tests/wpt/mozilla/meta/mozilla/bluetooth/requestDevice/adapter-not-present.html.ini b/tests/wpt/mozilla/meta/mozilla/bluetooth/requestDevice/adapter-not-present.html.ini deleted file mode 100644 index e3387360d4a..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/bluetooth/requestDevice/adapter-not-present.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[adapter-not-present.html] - type: testharness - [Reject with NotFoundError if the adapter is not present.] - expected: FAIL diff --git a/tests/wpt/mozilla/meta/mozilla/bluetooth/requestDevice/adapter-off.html.ini b/tests/wpt/mozilla/meta/mozilla/bluetooth/requestDevice/adapter-off.html.ini deleted file mode 100644 index b1efda59017..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/bluetooth/requestDevice/adapter-off.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[adapter-off.html] - type: testharness - [Reject with NotFoundError if the adapter is off.] - expected: FAIL