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

Unified Diff: ui/webui/resources/js/parse_html_subset_test.html

Issue 16831021: Convert asynchronous closure test in cr.ui framework to a browser test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge trunk Created 7 years, 6 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 | « ui/webui/resources/js/cr/link_controller_test.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/parse_html_subset_test.html
diff --git a/ui/webui/resources/js/parse_html_subset_test.html b/ui/webui/resources/js/parse_html_subset_test.html
deleted file mode 100644
index e5b3d531a2240dfa03b9d4f03cfad27dbb8de020..0000000000000000000000000000000000000000
--- a/ui/webui/resources/js/parse_html_subset_test.html
+++ /dev/null
@@ -1,133 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title>parseHtmlSubset test</title>
-<script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/base.js"></script>
-<script src="parse_html_subset.js"></script>
-<script>
-
-goog.require('goog.testing.AsyncTestCase');
-goog.require('goog.testing.jsunit');
-
-</script>
-
-</head>
-<body>
-<script>
-
-var asyncTestCase = goog.testing.AsyncTestCase.createAndInstall();
-
-function parseAndAssertThrows() {
- var args = arguments;
- assertThrows(function() {
- parseHtmlSubset.apply(null, args);
- });
-}
-
-function parseAndAssertNotThrows() {
- var args = arguments;
- assertNotThrows(function() {
- parseHtmlSubset.apply(null, args);
- });
-}
-
-function testText() {
- parseAndAssertNotThrows('');
- parseAndAssertNotThrows('abc');
- parseAndAssertNotThrows('&nbsp;');
-}
-
-function testSupportedTags() {
- parseAndAssertNotThrows('<b>bold</b>');
- parseAndAssertNotThrows('Some <b>bold</b> text');
- parseAndAssertNotThrows('Some <strong>strong</strong> text');
- parseAndAssertNotThrows('<B>bold</B>');
- parseAndAssertNotThrows('Some <B>bold</B> text');
- parseAndAssertNotThrows('Some <STRONG>strong</STRONG> text');
-}
-
-function testInvalidTags() {
- parseAndAssertThrows('<unknown_tag>x</unknown_tag>');
- parseAndAssertThrows('<img>');
- parseAndAssertThrows('<script>alert(1)<' + '/script>');
-}
-
-function testInvalidAttributes() {
- parseAndAssertThrows('<b onclick="alert(1)">x</b>');
- parseAndAssertThrows('<b style="color:red">x</b>');
- parseAndAssertThrows('<b foo>x</b>');
- parseAndAssertThrows('<b foo=bar></b>');
-}
-
-function testValidAnchors() {
- parseAndAssertNotThrows('<a href="https://google.com">Google</a>');
- parseAndAssertNotThrows('<a href="chrome://settings">Google</a>');
-}
-
-function testInvalidAnchorHrefs() {
- parseAndAssertThrows('<a href="http://google.com">Google</a>');
- parseAndAssertThrows('<a href="ftp://google.com">Google</a>');
- parseAndAssertThrows('<a href="http/google.com">Google</a>');
- parseAndAssertThrows('<a href="javascript:alert(1)">Google</a>');
- parseAndAssertThrows('<a href="chrome-extension://whurblegarble">Google</a>');
-}
-
-function testInvalidAnchorAttributes() {
- parseAndAssertThrows('<a name=foo>Google</a>');
- parseAndAssertThrows(
- '<a onclick="alert(1)" href="https://google.com">Google</a>');
- parseAndAssertThrows('<a foo="bar(1)" href="https://google.com">Google</a>');
-}
-
-function testAnchorTarget() {
- parseAndAssertNotThrows(
- '<a href="https://google.com" target="blank_">Google</a>');
- parseAndAssertNotThrows(
- '<a href="https://google.com" target="foo">Google</a>');
-}
-
-function testCustomTags() {
- parseAndAssertNotThrows('yo <I>ho</i><bR>yo <EM>ho</em>', ['i', 'EM', 'Br']);
-}
-
-function testInvalidCustomTags() {
- parseAndAssertThrows("a pirate's<script>lifeForMe();<" + '/script>', ['br']);
-}
-
-function testCustomAttributes() {
- function returnsTruthy(node, value) {
- assertEquals('A', node.tagName);
- assertEquals('fancy', value);
- return true;
- }
- parseAndAssertNotThrows('<a class="fancy">I\'m fancy!</a>', null,
- {class: returnsTruthy});
-}
-
-function testInvalidCustomAttributes() {
- function returnsFalsey() {
- return false;
- }
- parseAndAssertThrows('<a class="fancy">I\'m fancy!</a>', null,
- {class: returnsFalsey});
- parseAndAssertThrows('<a class="fancy">I\'m fancy!</a>');
-}
-
-function testOnError() {
- window.called = false;
-
- asyncTestCase.waitForAsync('Waiting for image error callbacks');
-
- parseAndAssertThrows('<img onerror="window.called = true" src="_.png">');
- parseAndAssertThrows('<img src="_.png" onerror="window.called = true">');
-
- window.setTimeout(function() {
- asyncTestCase.continueTesting();
- assertFalse(window.called);
- });
-}
-
-</script>
-
-</body>
-</html>
« no previous file with comments | « ui/webui/resources/js/cr/link_controller_test.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698