GEN_INCLUDE([
'chrome/browser/resources/chromeos/chromevox/testing/assert_additions.js']);
-
-/**
- * Shortcut for document.getElementById.
- * @param {string} id of the element.
- * @return {HTMLElement} with the id.
- */
-function $(id) {
- return document.getElementById(id);
-}
+GEN_INCLUDE([
+ 'chrome/browser/resources/chromeos/chromevox/testing/common.js']);
/**
* Base test fixture for ChromeVox unit tests.
* comment inside an anonymous function - see example, above.
*/
loadDoc: function(commentEncodedHtml) {
- var html = this.extractHtmlFromCommentEncodedString_(commentEncodedHtml);
+ var html =
+ TestUtils.extractHtmlFromCommentEncodedString(commentEncodedHtml);
this.loadHtml(html);
},
* comment inside an anonymous function - see example, above.
*/
appendDoc: function(commentEncodedHtml) {
- var html = this.extractHtmlFromCommentEncodedString_(commentEncodedHtml);
+ var html =
+ TestUtils.extractHtmlFromCommentEncodedString(commentEncodedHtml);
this.appendHtml(html);
},
},
/**
- * Extracts some inlined html encoded as a comment inside a function,
- * so you can use it like this:
- *
- * this.appendDoc(function() {/*!
- * <p>Html goes here</p>
- * * /});
- *
- * @param {Function} commentEncodedHtml The html , embedded as a
- * comment inside an anonymous function - see example, above.
- @ @return {String} The html text.
- */
- extractHtmlFromCommentEncodedString_: function(commentEncodedHtml) {
- return commentEncodedHtml.toString().
- replace(/^[^\/]+\/\*!?/, '').
- replace(/\*\/[^\/]+$/, '');
- },
-
- /**
* Waits for the queued events in ChromeVoxEventWatcher to be
* handled, then calls a callback function with provided arguments
* in the test case scope. Very useful for asserting the results of events.