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

Unified Diff: LayoutTests/fast/dom/Document/createCDATASection.html

Issue 22911020: Block "]]>" in createCDataSection (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Now with tests Created 7 years, 4 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 | « no previous file | LayoutTests/fast/dom/Document/createCDATASection-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/Document/createCDATASection.html
diff --git a/LayoutTests/fast/dom/Document/createCDATASection.html b/LayoutTests/fast/dom/Document/createCDATASection.html
new file mode 100644
index 0000000000000000000000000000000000000000..85a8f0ac880c5eeda09ddda5807780f04806c0e4
--- /dev/null
+++ b/LayoutTests/fast/dom/Document/createCDATASection.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+function assert(c, msg) {
+if (c)
+ testPassed(msg);
+else
+ testFailed(msg)
+}
+var domParser = new DOMParser();
+var xmlDoc = domParser.parseFromString("<example></example>", "text/xml");
+assert("createCDATASection" in xmlDoc, "createCDATASection exists")
arv (Not doing code reviews) 2013/08/20 14:09:54 shouldBe('"createCDATASection" in xmlDoc', 'true')
Daniel Bratell 2013/08/20 15:37:58 Thanks! I have still a lot to learn about all the
+testData = [
+ { arg: "Hello" },
+ { arg: "Ha]]>o", code: 5 },
+ { arg: null },
+ { arg: new Date(1234567890) },
+ { arg: 42 },
+ { arg: "" }
+];
+
+for (var i = 0; i < testData.length; i++) {
arv (Not doing code reviews) 2013/08/20 14:09:54 This test is overly complex. shouldBeEqualToStrin
+ arg = testData[i].arg;
+ if (typeof arg == "string")
+ msg = "createCDATASection('" + arg + "')";
+ else if (arg instanceof Date)
+ msg = "createCDATASection(<Date>)";
+ else
+ msg = "createCDATASection(" + arg + ")";
+ try {
+ res = xmlDoc.createCDATASection(arg);
+ if ("code" in testData[i])
arv (Not doing code reviews) 2013/08/20 14:09:54 Don't test the code. Test the whole string. See ab
+ testFailed(msg + ": expected exception");
+ else
+ assert(res && res.textContent == String(arg), msg);
+ } catch(e) {
+ if ("code" in testData[i]) {
+ if (e.code == testData[i].code)
+ testPassed(msg)
+ else
+ testFailed(msg + "; expected exception " + testData[i].code +
+ ", got " + e.code)
+ } else {
+ testFailed(msg)
+ }
+ }
+}
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Document/createCDATASection-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698