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

Unified Diff: LayoutTests/bluetooth/requestDevice.html

Issue 1062393002: bluetooth: Use sequential_promise_test to stop test from running in parallel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/bluetooth/requestDevice.html
diff --git a/LayoutTests/bluetooth/requestDevice.html b/LayoutTests/bluetooth/requestDevice.html
index c4e712cfa4a9fad4eb2a84d11b00f6b21ed2a1b8..7aa06cf9deffabc659d0cbadbc00cc094c7911fc 100644
--- a/LayoutTests/bluetooth/requestDevice.html
+++ b/LayoutTests/bluetooth/requestDevice.html
@@ -3,40 +3,55 @@
<script src="../resources/testharnessreport.js"></script>
<script>
+var promise_tests = Promise.resolve();
+// Helper function to run promise tests one after the other.
Jeffrey Yasskin 2015/04/10 23:56:13 Add a TODO to remove this once https://github.com/
+function sequential_promise_test(func, name) {
+ var test = async_test(name);
+ promise_tests = promise_tests.then(function() {
+ return Promise.resolve(test.step(func, test, test))
+ .then(
+ function() {
+ test.done();
+ })
+ .catch(test.step_func(
+ function(value) {
+ throw value;
+ }));
+ });
+}
+
test(function(t) { assert_exists(window, "testRunner"); t.done(); },
"window.testRunner is required for the following tests.");
-async_test(function(t) {
+sequential_promise_test(function(t) {
testRunner.setBluetoothMockDataSet('RejectRequestDevice_NotFoundError');
- navigator.bluetooth.requestDevice()
+ return 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();
- }));
+ function() {
+ assert_unreached('Mock was set to reject.');
+ },
+ function(e) {
+ assert_equals(e.name, 'NotFoundErrora');
+ });
}, 'Reject with NotFoundError.');
-async_test(function(t) {
+sequential_promise_test(function(t) {
testRunner.setBluetoothMockDataSet('RejectRequestDevice_SecurityError');
- navigator.bluetooth.requestDevice()
+ return navigator.bluetooth.requestDevice()
.then(
- t.step_func(function() { assert_unreached('Mock was set to reject.'); }),
- t.step_func(function(e) {
+ function() {
+ assert_unreached('Mock was set to reject.');
+ },
+ function(e) {
assert_equals(e.name, 'SecurityError');
- t.done();
- }));
+ });
}, 'Reject with SecurityError.');
-async_test(function(t) {
+sequential_promise_test(function() {
testRunner.setBluetoothMockDataSet('Single Empty Device');
- navigator.bluetooth.requestDevice()
- .then(
- t.step_func(function(device) {
- assert_equals(device.constructor.name, "BluetoothDevice");
- t.done();
- }),
- t.step_func(function() { assert_unreached('Mock was set to resolve.'); }));
+ return navigator.bluetooth.requestDevice()
+ .then(function(device) {
+ assert_equals(device.constructor.name, "BluetoothDevice");
+ });
}, 'Mock will resolve.');
-
</script>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698