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

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

Issue 2008773002: Begin using ChromeVox Next to read tab and window titles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a bunch of tests. Created 4 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
Index: chrome/browser/resources/chromeos/chromevox/testing/common.js
diff --git a/chrome/browser/resources/chromeos/chromevox/testing/common.js b/chrome/browser/resources/chromeos/chromevox/testing/common.js
index b6e6d33d49279bee457170ccba8a63fa75b9e705..9c0fc0bf70c647a75c7c64a49051b7608608de55 100644
--- a/chrome/browser/resources/chromeos/chromevox/testing/common.js
+++ b/chrome/browser/resources/chromeos/chromevox/testing/common.js
@@ -42,6 +42,28 @@ TestUtils.extractHtmlFromCommentEncodedString =
return stringified.replace(/^[^\/]+\/\*!?/, '').replace(/\*\/[^\/]+$/, '');
};
+
+ /**
+ * Creates a data url for a document.
+ * @param {function() : void} doc Snippet wrapped inside of a function.
+ * @return {string}
+ */
+TestUtils.createUrlForDoc = function(doc) {
+ var docString = TestUtils.extractHtmlFromCommentEncodedString(doc);
+ return TestUtils.collapseWhitespace('data:text/html,<!doctype html>' +
+ docString.replace(/[\n\r]/g, '')
+ .trim());
+};
+
+/**
+ * Collapses inner whitespace.
+ * @param {string} str
+ * @return {string}
+ */
+TestUtils.collapseWhitespace = function(str) {
+ return str.replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '');
+};
+
/**
* Similar to |TEST_F|. Generates a test for the given |testFixture|,
* |testName|, and |testFunction|.

Powered by Google App Engine
This is Rietveld 408576698