mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #14393 - dati91:fix, r=jdm
WriteValue should return undefined <!-- Please describe your changes on the following line: --> <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors <!-- Either: --> - [X] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14393) <!-- Reviewable:end -->
This commit is contained in:
commit
7be32770b1
4 changed files with 8 additions and 8 deletions
|
@ -307,9 +307,8 @@ impl AsyncBluetoothListener for BluetoothRemoteGATTCharacteristic {
|
||||||
promise.resolve_native(promise_cx, &value);
|
promise.resolve_native(promise_cx, &value);
|
||||||
},
|
},
|
||||||
BluetoothResponse::WriteValue(result) => {
|
BluetoothResponse::WriteValue(result) => {
|
||||||
let value = ByteString::new(result);
|
*self.value.borrow_mut() = Some(ByteString::new(result));
|
||||||
*self.value.borrow_mut() = Some(value.clone());
|
promise.resolve_native(promise_cx, &());
|
||||||
promise.resolve_native(promise_cx, &value);
|
|
||||||
},
|
},
|
||||||
BluetoothResponse::EnableNotification(_result) => {
|
BluetoothResponse::EnableNotification(_result) => {
|
||||||
promise.resolve_native(promise_cx, self);
|
promise.resolve_native(promise_cx, self);
|
||||||
|
|
|
@ -137,9 +137,8 @@ impl AsyncBluetoothListener for BluetoothRemoteGATTDescriptor {
|
||||||
promise.resolve_native(promise_cx, &value);
|
promise.resolve_native(promise_cx, &value);
|
||||||
},
|
},
|
||||||
BluetoothResponse::WriteValue(result) => {
|
BluetoothResponse::WriteValue(result) => {
|
||||||
let value = ByteString::new(result);
|
*self.value.borrow_mut() = Some(ByteString::new(result));
|
||||||
*self.value.borrow_mut() = Some(value.clone());
|
promise.resolve_native(promise_cx, &());
|
||||||
promise.resolve_native(promise_cx, &value);
|
|
||||||
},
|
},
|
||||||
_ => promise.reject_error(promise_cx, Error::Type("Something went wrong...".to_owned())),
|
_ => promise.reject_error(promise_cx, Error::Type("Something went wrong...".to_owned())),
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ promise_test(() => {
|
||||||
.then(device => device.gatt.connect())
|
.then(device => device.gatt.connect())
|
||||||
.then(gattServer => gattServer.getPrimaryService(generic_access.name))
|
.then(gattServer => gattServer.getPrimaryService(generic_access.name))
|
||||||
.then(service => service.getCharacteristic(device_name.name))
|
.then(service => service.getCharacteristic(device_name.name))
|
||||||
.then(characteristic => characteristic.writeValue(new Uint8Array(1)));
|
.then(characteristic => characteristic.writeValue(new Uint8Array(1)))
|
||||||
|
.then(result => assert_equals(result, undefined));
|
||||||
}, 'A regular write request to a writable characteristic should succeed.');
|
}, 'A regular write request to a writable characteristic should succeed.');
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -14,6 +14,7 @@ promise_test(t => {
|
||||||
.then(gattServer => gattServer.getPrimaryService(generic_access.name))
|
.then(gattServer => gattServer.getPrimaryService(generic_access.name))
|
||||||
.then(service => service.getCharacteristic(device_name.name))
|
.then(service => service.getCharacteristic(device_name.name))
|
||||||
.then(characteristic => characteristic.getDescriptor(number_of_digitals.name))
|
.then(characteristic => characteristic.getDescriptor(number_of_digitals.name))
|
||||||
.then(descriptor => descriptor.writeValue(new Uint8Array(1)));
|
.then(descriptor => descriptor.writeValue(new Uint8Array(1)))
|
||||||
|
.then(result => assert_equals(result, undefined));
|
||||||
}, 'A regular write request to a writable descriptor should succeed.');
|
}, 'A regular write request to a writable descriptor should succeed.');
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue