Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: third_party/WebKit/LayoutTests/bluetooth/idl-BluetoothUUID.html

Issue 2380843002: Throw a TypeError instead of a SyntaxError on invalid UUIDs. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/bluetooth/idl-BluetoothUUID.html
diff --git a/third_party/WebKit/LayoutTests/bluetooth/idl-BluetoothUUID.html b/third_party/WebKit/LayoutTests/bluetooth/idl-BluetoothUUID.html
index 64d3d147d27a0f3b1dd18eef95014240bb41c156..9a7252ea2773a5143c182eb2c0f0ae7e3aac64f9 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/idl-BluetoothUUID.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/idl-BluetoothUUID.html
@@ -67,23 +67,23 @@ test(() => {
test(() => {
let all_caps_uuid = '1A2B3C4D-5E6F-7A8B-9C0D-1E2F3A4B5C6D';
- assert_throws('SyntaxError', () => BluetoothUUID.getService(all_caps_uuid));
- assert_throws('SyntaxError', () => BluetoothUUID.getCharacteristic(all_caps_uuid));
- assert_throws('SyntaxError', () => BluetoothUUID.getDescriptor(all_caps_uuid));
+ assert_throws(TypeError(), () => BluetoothUUID.getService(all_caps_uuid));
+ assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(all_caps_uuid));
+ assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(all_caps_uuid));
}, 'A UUID String with uppercase letters is an invalid UUID.');
test(() => {
let string_alias = 'deadbeef';
- assert_throws('SyntaxError', () => BluetoothUUID.getService(string_alias));
- assert_throws('SyntaxError', () => BluetoothUUID.getCharacteristic(string_alias));
- assert_throws('SyntaxError', () => BluetoothUUID.getDescriptor(string_alias));
+ assert_throws(TypeError(), () => BluetoothUUID.getService(string_alias));
+ assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(string_alias));
+ assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(string_alias));
}, 'A 32bit *String* alias is invalid.');
test(() => {
let invalid_character_uuid = '0000000g-0000-1000-8000-00805f9b34fb';
- assert_throws('SyntaxError', () => BluetoothUUID.getService(invalid_character_uuid));
- assert_throws('SyntaxError', () => BluetoothUUID.getCharacteristic(invalid_character_uuid));
- assert_throws('SyntaxError', () => BluetoothUUID.getDescriptor(invalid_character_uuid));
+ assert_throws(TypeError(), () => BluetoothUUID.getService(invalid_character_uuid));
+ assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(invalid_character_uuid));
+ assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(invalid_character_uuid));
}, 'A UUID with invalid characters is an invalid UUID.');
test(() => {
@@ -96,31 +96,31 @@ test(() => {
}, 'A valid UUID from a name.');
test(() => {
- assert_throws('SyntaxError', () => {
+ assert_throws(TypeError(), () => {
BluetoothUUID.getService('aerobic_heart_rate_lower_limit');
});
- assert_throws('SyntaxError', () => {
+ assert_throws(TypeError(), () => {
BluetoothUUID.getService('gatt.characteristic_extended_properties');
});
- assert_throws('SyntaxError', () => {
+ assert_throws(TypeError(), () => {
BluetoothUUID.getCharacteristic('alert_notification');
});
- assert_throws('SyntaxError', () => {
+ assert_throws(TypeError(), () => {
BluetoothUUID.getCharacteristic('gatt.characteristic_extended_properties');
});
- assert_throws('SyntaxError', () => {
+ assert_throws(TypeError(), () => {
BluetoothUUID.getDescriptor('alert_notification');
});
- assert_throws('SyntaxError', () => {
+ assert_throws(TypeError(), () => {
BluetoothUUID.getDescriptor('aerobic_heart_rate_lower_limit');
});
}, 'Make sure attributes don\'t share a map');
test(() => {
let wrong_name = 'wrong_name';
- assert_throws('SyntaxError', () => BluetoothUUID.getService(wrong_name));
- assert_throws('SyntaxError', () => BluetoothUUID.getCharacteristic(wrong_name));
- assert_throws('SyntaxError', () => BluetoothUUID.getDescriptor(wrong_name));
+ assert_throws(TypeError(), () => BluetoothUUID.getService(wrong_name));
+ assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(wrong_name));
+ assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(wrong_name));
}, 'Invalid Descriptor name');
test(() => {
@@ -140,27 +140,27 @@ test(() => {
assert_throws(new TypeError, () => BluetoothUUID.canonicalUUID(NaN));
// getService
- assert_throws('SyntaxError', () => BluetoothUUID.getService(object));
- assert_throws('SyntaxError', () => BluetoothUUID.getService(array));
- assert_throws('SyntaxError', () => BluetoothUUID.getService(func));
- assert_throws('SyntaxError', () => BluetoothUUID.getService(undefined));
- assert_throws('SyntaxError', () => BluetoothUUID.getService(null));
- assert_throws('SyntaxError', () => BluetoothUUID.getService(false));
+ assert_throws(TypeError(), () => BluetoothUUID.getService(object));
+ assert_throws(TypeError(), () => BluetoothUUID.getService(array));
+ assert_throws(TypeError(), () => BluetoothUUID.getService(func));
+ assert_throws(TypeError(), () => BluetoothUUID.getService(undefined));
+ assert_throws(TypeError(), () => BluetoothUUID.getService(null));
+ assert_throws(TypeError(), () => BluetoothUUID.getService(false));
// getCharacteristic
- assert_throws('SyntaxError', () => BluetoothUUID.getCharacteristic(object));
- assert_throws('SyntaxError', () => BluetoothUUID.getCharacteristic(array));
- assert_throws('SyntaxError', () => BluetoothUUID.getCharacteristic(func));
- assert_throws('SyntaxError', () => BluetoothUUID.getCharacteristic(undefined));
- assert_throws('SyntaxError', () => BluetoothUUID.getCharacteristic(null));
- assert_throws('SyntaxError', () => BluetoothUUID.getCharacteristic(false));
+ assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(object));
+ assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(array));
+ assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(func));
+ assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(undefined));
+ assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(null));
+ assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(false));
// getDescriptor
- assert_throws('SyntaxError', () => BluetoothUUID.getDescriptor(object));
- assert_throws('SyntaxError', () => BluetoothUUID.getDescriptor(array));
- assert_throws('SyntaxError', () => BluetoothUUID.getDescriptor(func));
- assert_throws('SyntaxError', () => BluetoothUUID.getDescriptor(undefined));
- assert_throws('SyntaxError', () => BluetoothUUID.getDescriptor(null));
- assert_throws('SyntaxError', () => BluetoothUUID.getDescriptor(false));
+ assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(object));
+ assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(array));
+ assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(func));
+ assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(undefined));
+ assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(null));
+ assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(false));
}, 'Non-number and non-strings');
</script>

Powered by Google App Engine
This is Rietveld 408576698