Commit 549b1f3b authored by jyasskin@chromium.org's avatar jyasskin@chromium.org

Update error message assertions for the new chooser.

And remove obsolete error messages.

3rd of 3 patches:
1. Add errors and prepare tests. (https://codereview.chromium.org/1293593003/)
2. Wire up the chooser on the Chrome side. (https://codereview.chromium.org/1286063002/)
3. This patch.

BUG=500989

Review URL: https://codereview.chromium.org/1284143006

git-svn-id: svn://svn.chromium.org/blink/trunk@201245 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b5080ddb
......@@ -27,8 +27,7 @@ promise_test(() => {
testRunner.setBluetoothMockDataSet('FailStartDiscoveryAdapter');
return assert_promise_rejects_with_message(
requestDeviceWithKeyDown({filters: [{services: ['generic_access']}]}),
// TODO(jyasskin): Uncomment the message when it's changed on the Chrome side.
{name: 'NotFoundError', /*message: 'User cancelled the requestDevice() chooser.'*/},
{name: 'NotFoundError', message: 'User cancelled the requestDevice() chooser.'},
'The adapter failed to start a discovery session.');
}, 'Discovery session fails to start.');
......@@ -46,8 +45,7 @@ promise_test(() => {
testRunner.setBluetoothMockDataSet('NotPoweredAdapter');
return assert_promise_rejects_with_message(
requestDeviceWithKeyDown({filters: [{services: ['generic_access']}]}),
// TODO(jyasskin): Uncomment the message when it's changed on the Chrome side.
{name: 'NotFoundError', /*message: 'User cancelled the requestDevice() chooser.'*/},
{name: 'NotFoundError', message: 'User cancelled the requestDevice() chooser.'},
'Bluetooth adapter is not powered.');
}, 'Reject with NotFoundError if the adapter is off.');
......@@ -57,8 +55,7 @@ promise_test(() => {
testRunner.setBluetoothMockDataSet('EmptyAdapter');
return assert_promise_rejects_with_message(
requestDeviceWithKeyDown({filters: [{services: ['generic_access']}]}),
// TODO(jyasskin): Uncomment the message when it's changed on the Chrome side.
{name: 'NotFoundError', /*message: 'User cancelled the requestDevice() chooser.'*/},
{name: 'NotFoundError', message: 'User cancelled the requestDevice() chooser.'},
'No Bluetooth devices in range.');
}, 'Reject with NotFoundError if there are no devices around.');
......
......@@ -39,14 +39,9 @@ DOMException* BluetoothError::take(ScriptPromiseResolver*, const WebBluetoothErr
MAP_ERROR(UntranslatedConnectErrorCode, NetworkError, "Unknown ConnectErrorCode.");
// NotFoundErrors:
MAP_ERROR(BluetoothAdapterOff, NotFoundError, "Bluetooth adapter is off.");
MAP_ERROR(NoBluetoothAdapter, NotFoundError, "Bluetooth adapter not available.");
MAP_ERROR(NoBluetoothChooser, NotFoundError, "Can't show Bluetooth chooser dialog.");
MAP_ERROR(DiscoverySessionStartFailed, NotFoundError, "Couldn't start discovery session.");
MAP_ERROR(DiscoverySessionStopFailed, NotFoundError, "Failed to stop discovery session.");
MAP_ERROR(ChosenDeviceVanished, NotFoundError, "User selected a device that doesn't exist anymore.");
MAP_ERROR(ChooserCancelled, NotFoundError, "User cancelled the requestDevice() chooser.");
MAP_ERROR(NoDevicesFound, NotFoundError, "No Bluetooth devices in range.");
MAP_ERROR(ServiceNotFound, NotFoundError, "Service not found in device.");
MAP_ERROR(CharacteristicNotFound, NotFoundError, "Characteristic not found in device.");
......
......@@ -34,12 +34,7 @@ enum class WebBluetoothError {
ConnectUnsupportedDevice,
UntranslatedConnectErrorCode,
// NotFoundError:
BluetoothAdapterOff,
NoBluetoothAdapter,
NoBluetoothChooser,
DiscoverySessionStartFailed,
DiscoverySessionStopFailed,
NoDevicesFound,
ChosenDeviceVanished,
ChooserCancelled,
ServiceNotFound,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment