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

Unified Diff: chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js

Issue 292313004: Port aria_util_test.js to run as a WebUI test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 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 | « chrome/browser/resources/chromeos/chromevox/common/aria_util_test.js ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js
diff --git a/chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js b/chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js
new file mode 100644
index 0000000000000000000000000000000000000000..7030b1969578c7c836a256645258d5d4e5288fca
--- /dev/null
+++ b/chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * Shortcut for document.getElementById.
+ * @param {string} id of the element.
+ * @return {HTMLElement} with the id.
+ */
+function $(id) {
+ return document.getElementById(id);
+}
+
+/**
+ * Base test fixture for ChromeVox unit tests.
+ *
+ * Note that while conceptually these are unit tests, these tests need
+ * to run in a full web page, so they're actually run as WebUI browser
+ * tests.
+ *
+ * @constructor
+ * @extends {testing.Test}
+ */
+function ChromeVoxUnitTestBase() {}
+
+ChromeVoxUnitTestBase.prototype = {
+ __proto__: testing.Test.prototype,
+
+ /** @override */
+ browsePreload: DUMMY_URL,
+
+ /**
+ * Loads some inlined html into the current document, replacing
+ * whatever was there previously. To use it, call it with the html
+ * inside an inline comment, like this:
+ *
+ * this.loadDoc(function() {/*!
+ * <p>Html goes here</p>
+ * * /});
+ */
+ loadDoc: function(commentEncodedHtml) {
+ var html = commentEncodedHtml.toString().
+ replace(/^[^\/]+\/\*!?/, '').
+ replace(/\*\/[^\/]+$/, '');
+ document.open();
+ document.write(html);
+ document.close();
+ }
+};
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/common/aria_util_test.js ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698