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

Unified Diff: chrome/test/data/webui/test_api.js

Issue 2627243002: bluetooth: Add control for reading/writing of characteristics to internals page. (Closed)
Patch Set: Add expectThrows, check thrown exceptions Created 3 years, 11 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: chrome/test/data/webui/test_api.js
diff --git a/chrome/test/data/webui/test_api.js b/chrome/test/data/webui/test_api.js
index c089715f5644275848e890d3e42625bcad098dc9..1a4841f7c938bfd58ae64cd11bdeda608cf5db75 100644
--- a/chrome/test/data/webui/test_api.js
+++ b/chrome/test/data/webui/test_api.js
@@ -942,6 +942,18 @@ var testing = {};
}
/**
+ * @param {Function} testFunction
+ * @param {Function=|string=|RegExp=} opt_expected The expected Error
+ * constructor, partial or complete error message string, or RegExp to
+ * test the error message.
+ * @param {string=} opt_message Additional error message.
+ * @throws {Error}
+ */
+ function assertThrows(testFunction, opt_expected, opt_message) {
+ chai.assert.throws(testFunction, opt_expected, opt_message);
+ }
+
+ /**
* Run an accessibility audit on the current page state.
* @type {Function}
* @param {Array} a11yResults
@@ -1685,6 +1697,7 @@ var testing = {};
exports.assertLT = assertLT;
exports.assertNotEquals = assertNotEquals;
exports.assertNotReached = assertNotReached;
+ exports.assertThrows = assertThrows;
}
/**
@@ -1703,6 +1716,7 @@ var testing = {};
exports.expectNotEquals = createExpect(assertNotEquals);
exports.expectNotReached = createExpect(assertNotReached);
exports.expectAccessibilityOk = createExpect(assertAccessibilityOk);
+ exports.expectThrows = createExpect(assertThrows);
}
/**

Powered by Google App Engine
This is Rietveld 408576698