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

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..7a394c6b37f6bebbf25d3372e30277b6fdb5c330 100644
--- a/LayoutTests/bluetooth/requestDevice.html
+++ b/LayoutTests/bluetooth/requestDevice.html
@@ -2,41 +2,74 @@
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
+var lock = false;
+var testQueue = [];
+
+var getLock = function(test) {
esprehn 2015/04/08 00:10:29 function getLock, no need for the var.
+ if (lock) {
+ testQueue.push(test);
+ } else {
+ lock = true;
+ test();
+ }
+};
+
+var releaseLock = function() {
esprehn 2015/04/08 00:10:29 function releaseLock()
+ var nextTest = testQueue.shift();
+ if (nextTest) {
+ nextTest();
Jeffrey Yasskin 2015/04/07 23:46:38 Probably use `Promise.resolve().then(nextTest)` or
+ } else {
+ lock = false;
+ }
+};
test(function(t) { assert_exists(window, "testRunner"); t.done(); },
"window.testRunner is required for the following tests.");
-async_test(function(t) {
- testRunner.setBluetoothMockDataSet('RejectRequestDevice_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) {
- testRunner.setBluetoothMockDataSet('RejectRequestDevice_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.');
+getLock(function(t) {
Jeffrey Yasskin 2015/04/07 23:46:38 I'm not sure the test will wait for all of the tes
+ async_test(function(t) {
+ testRunner.setBluetoothMockDataSet('RejectRequestDevice_NotFoundError');
Jeffrey Yasskin 2015/04/07 23:46:38 If this throws, it'll hang the test. It'd be bette
+ navigator.bluetooth.requestDevice()
+ .then(
+ t.step_func(function() {
+ releaseLock();
+ assert_unreached('Mock was set to reject.'); }),
+ t.step_func(function(e) {
+ releaseLock();
+ assert_equals(e.name, 'NotFoundError');
+ t.done();
+ }));
+ }, 'Reject with NotFoundError.')});
-async_test(function(t) {
- 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.'); }));
-}, 'Mock will resolve.');
+getLock(function(t) {
+ async_test(function(t) {
+ testRunner.setBluetoothMockDataSet('RejectRequestDevice_SecurityError');
+ navigator.bluetooth.requestDevice()
+ .then(
+ t.step_func(function() {
+ releaseLock();
+ assert_unreached('Mock was set to reject.');
+ }),
+ t.step_func(function(e) {
+ releaseLock();
+ assert_equals(e.name, 'SecurityError');
+ t.done();
+ }));
+ }, 'Reject with SecurityError.')});
+getLock(function(t) {
+ async_test(function(t) {
+ testRunner.setBluetoothMockDataSet('Single Empty Device');
+ navigator.bluetooth.requestDevice()
+ .then(
+ t.step_func(function(device) {
+ releaseLock();
+ assert_equals(device.constructor.name, "BluetoothDevice");
+ t.done();
+ }),
+ t.step_func(function() {
+ releaseLock();
+ assert_unreached('Mock was set to resolve.');
+ }));
+ }, '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