test: add response to bluetooth request possibilities (#47745)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot] 2025-07-15 11:31:20 +02:00 committed by GitHub
parent ca563d5464
commit 102f740ec2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3637,8 +3637,14 @@ describe('navigator.bluetooth', () => {
it('can request bluetooth devices', async () => {
const bluetooth = await w.webContents.executeJavaScript(`
navigator.bluetooth.requestDevice({ acceptAllDevices: true}).then(device => "Found a device!").catch(err => err.message);`, true);
expect(bluetooth).to.be.oneOf(['Found a device!', 'Bluetooth adapter not available.', 'User cancelled the requestDevice() chooser.']);
navigator.bluetooth.requestDevice({ acceptAllDevices: true }).then(device => "Found a device!").catch(err => err.message);`, true);
const requestResponses = [
'Found a device!',
'Bluetooth adapter not available.',
'User cancelled the requestDevice() chooser.',
'User denied the browser permission to scan for Bluetooth devices.'
];
expect(bluetooth).to.be.oneOf(requestResponses, `Unexpected response: ${bluetooth}`);
});
});
@ -3668,6 +3674,7 @@ describe('navigator.hid', () => {
server.close();
closeAllWindows();
});
afterEach(() => {
session.defaultSession.setPermissionCheckHandler(null);
session.defaultSession.setDevicePermissionHandler(null);