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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Document/createCDATASection-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <script>
8 function assert(c, msg) {
9 if (c)
10 testPassed(msg);
11 else
12 testFailed(msg)
13 }
14 var domParser = new DOMParser();
15 var xmlDoc = domParser.parseFromString("<example></example>", "text/xml");
16 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
17 testData = [
18 { arg: "Hello" },
19 { arg: "Ha]]>o", code: 5 },
20 { arg: null },
21 { arg: new Date(1234567890) },
22 { arg: 42 },
23 { arg: "" }
24 ];
25
26 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
27 arg = testData[i].arg;
28 if (typeof arg == "string")
29 msg = "createCDATASection('" + arg + "')";
30 else if (arg instanceof Date)
31 msg = "createCDATASection(<Date>)";
32 else
33 msg = "createCDATASection(" + arg + ")";
34 try {
35 res = xmlDoc.createCDATASection(arg);
36 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
37 testFailed(msg + ": expected exception");
38 else
39 assert(res && res.textContent == String(arg), msg);
40 } catch(e) {
41 if ("code" in testData[i]) {
42 if (e.code == testData[i].code)
43 testPassed(msg)
44 else
45 testFailed(msg + "; expected exception " + testData[i].code +
46 ", got " + e.code)
47 } else {
48 testFailed(msg)
49 }
50 }
51 }
52 </script>
53 <script src="../../js/resources/js-test-post.js"></script>
54 </body>
55 </html>
OLDNEW
« 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