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

Side by Side Diff: LayoutTests/fast/dom/Document/script-tests/createElementNS-namespace-err.js

Issue 106773003: Make arguments to Document methods non-optional (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 description("createElementNS tests from mozilla, attached to webkit bug 16833"); 1 description("createElementNS tests from mozilla, attached to webkit bug 16833");
2 2
3 function assert(c, m) 3 function assert(c, m)
4 { 4 {
5 if (!c) 5 if (!c)
6 testFailed(m); 6 testFailed(m);
7 else 7 else
8 testPassed(m); 8 testPassed(m);
9 } 9 }
10 10
(...skipping 19 matching lines...) Expand all
30 testFailed(m); 30 testFailed(m);
31 } else { 31 } else {
32 m += "; threw " + stringForExceptionCode(actual);; 32 m += "; threw " + stringForExceptionCode(actual);;
33 testPassed(m); 33 testPassed(m);
34 } 34 }
35 } 35 }
36 36
37 var allNSTests = [ 37 var allNSTests = [
38 { args: [undefined, undefined] }, 38 { args: [undefined, undefined] },
39 { args: [null, undefined] }, 39 { args: [null, undefined] },
40 { args: [undefined, null], code: 5 }, 40 { args: [undefined, null] },
41 { args: [null, null], code: 5 }, 41 { args: [null, null] },
42 { args: [null, ""], code: 5 }, 42 { args: [null, ""], code: 5 },
43 { args: ["", null], code: 5 }, 43 { args: ["", null] },
44 { args: ["", ""], code: 5 }, 44 { args: ["", ""], code: 5 },
45 { args: [null, "<div>"], code: 5 }, 45 { args: [null, "<div>"], code: 5 },
46 { args: [null, "0div"], code: 5 }, 46 { args: [null, "0div"], code: 5 },
47 { args: [null, "di v"], code: 5 }, 47 { args: [null, "di v"], code: 5 },
48 { args: [null, "di<v"], code: 5 }, 48 { args: [null, "di<v"], code: 5 },
49 { args: [null, "-div"], code: 5 }, 49 { args: [null, "-div"], code: 5 },
50 { args: [null, ".div"], code: 5 }, 50 { args: [null, ".div"], code: 5 },
51 { args: ["http://example.com/", "<div>"], code: 5 }, 51 { args: ["http://example.com/", "<div>"], code: 5 },
52 { args: ["http://example.com/", "0div"], code: 5 }, 52 { args: ["http://example.com/", "0div"], code: 5 },
53 { args: ["http://example.com/", "di<v"], code: 5 }, 53 { args: ["http://example.com/", "di<v"], code: 5 },
(...skipping 25 matching lines...) Expand all
79 { args: ["http://example.com/", "xml:test"], code: 14, message: "binding xml prefix wrong" }, 79 { args: ["http://example.com/", "xml:test"], code: 14, message: "binding xml prefix wrong" },
80 { args: ["http://example.com/", "xmlns:test"], code: 14, message: "binding xm lns prefix wrong" }, 80 { args: ["http://example.com/", "xmlns:test"], code: 14, message: "binding xm lns prefix wrong" },
81 { args: ["http://www.w3.org/2000/xmlns/", "x:test"], code: 14, message: "bind ing namespace namespace to wrong prefix" }, 81 { args: ["http://www.w3.org/2000/xmlns/", "x:test"], code: 14, message: "bind ing namespace namespace to wrong prefix" },
82 { args: ["http://www.w3.org/2000/xmlns/", "xmlns:test"] }, 82 { args: ["http://www.w3.org/2000/xmlns/", "xmlns:test"] },
83 { args: ["http://www.w3.org/XML/1998/namespace", "xml:test"] }, 83 { args: ["http://www.w3.org/XML/1998/namespace", "xml:test"] },
84 { args: ["http://www.w3.org/XML/1998/namespace", "x:test"] }, 84 { args: ["http://www.w3.org/XML/1998/namespace", "x:test"] },
85 ]; 85 ];
86 86
87 var allNoNSTests = [ 87 var allNoNSTests = [
88 { args: [undefined] }, 88 { args: [undefined] },
89 { args: [null], code: 5 }, 89 { args: [null] },
90 { args: [""], code: 5 }, 90 { args: [""], code: 5 },
91 { args: ["<div>"], code: 5 }, 91 { args: ["<div>"], code: 5 },
92 { args: ["0div"], code: 5 }, 92 { args: ["0div"], code: 5 },
93 { args: ["di v"], code: 5 }, 93 { args: ["di v"], code: 5 },
94 { args: ["di<v"], code: 5 }, 94 { args: ["di<v"], code: 5 },
95 { args: ["-div"], code: 5 }, 95 { args: ["-div"], code: 5 },
96 { args: [".div"], code: 5 }, 96 { args: [".div"], code: 5 },
97 { args: [":"], message: "valid XML name, invalid QName" }, 97 { args: [":"], message: "valid XML name, invalid QName" },
98 { args: [":div"], message: "valid XML name, invalid QName" }, 98 { args: [":div"], message: "valid XML name, invalid QName" },
99 { args: ["div:"], message: "valid XML name, invalid QName" }, 99 { args: ["div:"], message: "valid XML name, invalid QName" },
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 msg += "; " + test.message; 150 msg += "; " + test.message;
151 try { 151 try {
152 doc[createFunctionName].apply(doc, test.args); 152 doc[createFunctionName].apply(doc, test.args);
153 assert(!("code" in test), msg); 153 assert(!("code" in test), msg);
154 } catch (e) { 154 } catch (e) {
155 assertEquals(e.code, test.code || "expected no exception", msg); 155 assertEquals(e.code, test.code || "expected no exception", msg);
156 } 156 }
157 } 157 }
158 } 158 }
159 159
160 // Moz throws a "Not enough arguments" exception in these, we don't:
161 shouldBeEqualToString("document.createElementNS().toString()", "[object Element] ");
162 shouldBeEqualToString("document.createElementNS(\"http://www.example.com\").toSt ring()", "[object Element]");
163
164 debug("HTML tests:") 160 debug("HTML tests:")
165 runNSTests(allNSTests, document, "createElementNS"); 161 runNSTests(allNSTests, document, "createElementNS");
166 runNSTests(allNoNSTests, document, "createElement"); 162 runNSTests(allNoNSTests, document, "createElement");
167 163
168 debug("XHTML createElement tests:") 164 debug("XHTML createElement tests:")
169 var xhtmlDoc = document.implementation.createDocument("http://www.w3.org/1999/xh tml", "html", null); 165 var xhtmlDoc = document.implementation.createDocument("http://www.w3.org/1999/xh tml", "html", null);
170 runNSTests(allNoNSTests, xhtmlDoc, "createElement"); 166 runNSTests(allNoNSTests, xhtmlDoc, "createElement");
171 167
172 debug("XML createElement tests:") 168 debug("XML createElement tests:")
173 var xmlDoc = document.implementation.createDocument("http://www.example.com/foo" , "example", null); 169 var xmlDoc = document.implementation.createDocument("http://www.example.com/foo" , "example", null);
174 runNSTests(allNoNSTests, xmlDoc, "createElement"); 170 runNSTests(allNoNSTests, xmlDoc, "createElement");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698