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

Unified Diff: chrome/test/data/extensions/api_test/bluetooth_low_energy/characteristic_properties/runtest.js

Issue 593163002: Short-circuit failures in BLE js tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 6 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/bluetooth_low_energy/connect_in_progress/runtest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/bluetooth_low_energy/characteristic_properties/runtest.js
diff --git a/chrome/test/data/extensions/api_test/bluetooth_low_energy/characteristic_properties/runtest.js b/chrome/test/data/extensions/api_test/bluetooth_low_energy/characteristic_properties/runtest.js
index 188d20951f92478e6c7093fbd18a5f82adf21cf4..e09ce26f496b35d76919fd5c8309bb938ed1b91a 100644
--- a/chrome/test/data/extensions/api_test/bluetooth_low_energy/characteristic_properties/runtest.js
+++ b/chrome/test/data/extensions/api_test/bluetooth_low_energy/characteristic_properties/runtest.js
@@ -2,7 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+var error;
+
function testCharacteristicProperties() {
+ if (error !== undefined) {
+ chrome.test.sendMessage('fail');
+ chrome.test.fail(error);
+ }
chrome.test.assertEq(requestCount, characteristics.length);
for (var i = 0; i < requestCount; i++) {
@@ -43,14 +49,21 @@ function compareProperties(a, b) {
}
function failOnError() {
+ if (error !== undefined)
+ return true;
+
if (chrome.runtime.lastError) {
- chrome.test.fail(chrome.runtime.lastError.message);
+ error = 'Unexpected error: ' + chrome.runtime.lastError.message;
+ chrome.test.runTests([testCharacteristicProperties]);
}
+ return false;
}
for (var i = 0; i < requestCount; i++) {
chrome.bluetoothLowEnergy.getCharacteristic(charId, function (result) {
- failOnError();
+ if (failOnError())
+ return;
+
characteristics.push(result);
if (characteristics.length == requestCount) {
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/bluetooth_low_energy/connect_in_progress/runtest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698