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

Unified Diff: LayoutTests/bluetooth/requestDevice.html

Issue 650613005: bluetooth: Initial WebBluetooth & WebBluetoothError. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Abandoned initial approach implementing BluetoothMock in Blink. Created 6 years, 2 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: LayoutTests/bluetooth/requestDevice.html
diff --git a/LayoutTests/bluetooth/requestDevice.html b/LayoutTests/bluetooth/requestDevice.html
index f99d46f8f304f7636f03959ad57ba5cea0fffeaa..8faf769eb803da983d596dc7ec4a7cc3b5fd75cd 100644
--- a/LayoutTests/bluetooth/requestDevice.html
+++ b/LayoutTests/bluetooth/requestDevice.html
@@ -2,11 +2,46 @@
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
+
async_test(function(t) {
navigator.bluetooth.requestDevice()
.then(
- t.step_func(function() { assert_unreached(
- 'bluetooth.requestDevice() should not succeed until implemented.'); }),
- t.step_func(function() { t.done() }));
-}, 'navigator.bluetooth.requestDevice not yet supported');
+ t.step_func(function() { assert_unreached('Expected no default implementation.'); }),
+ t.step_func(function(e) {
+ assert_equals(e.name, 'NotSupportedError');
+ t.done();
+ }));
+}, 'NotSupportedError.');
+
+async_test(function(t) {
+ internals.resetBluetoothMock(navigator);
+ internals.bluetoothRequestDeviceWillReject(navigator, 'NotFoundError');
+ navigator.bluetooth.requestDevice()
+ .then(
+ t.step_func(function() { assert_unreached('Mock was set to reject.'); }),
+ t.step_func(function(e) {
+ assert_equals(e.name, 'NotFoundError');
+ t.done();
+ }));
+}, 'Reject with NotFoundError.');
+
+async_test(function(t) {
+ internals.resetBluetoothMock(navigator);
+ internals.bluetoothRequestDeviceWillReject(navigator, 'SecurityError');
+ navigator.bluetooth.requestDevice()
+ .then(
+ t.step_func(function() { assert_unreached('Mock was set to reject.'); }),
+ t.step_func(function(e) {
+ assert_equals(e.name, 'SecurityError');
+ t.done();
+ }));
+}, 'Reject with SecurityError.');
+
+async_test(function(t) {
+ internals.resetBluetoothMock(navigator);
+ navigator.bluetooth.requestDevice()
+ .then(
+ t.step_func(function() { t.done() }),
+ t.step_func(function() { assert_unreached('Mock was set to resolve.'); }));
+}, 'Mock will resolve.');
</script>
« no previous file with comments | « no previous file | Source/modules/bluetooth/BluetoothDiscovery.h » ('j') | Source/modules/bluetooth/BluetoothDiscovery.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698