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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/DOMImplementation-createDocument.html

Issue 2303013002: Add UMA metric to track usage of sending a mousedown to select elements. (Closed)
Patch Set: W3C auto test import CL. Created 4 years, 3 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
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <meta charset=utf-8> 2 <meta charset=utf-8>
3 <title>DOMImplementation.createDocument(namespace, qualifiedName, doctype)</titl e> 3 <title>DOMImplementation.createDocument(namespace, qualifiedName, doctype)</titl e>
4 <link rel=help href="https://dom.spec.whatwg.org/#dom-domimplementation-createdo cument"> 4 <link rel=help href="https://dom.spec.whatwg.org/#dom-domimplementation-createdo cument">
5 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-createelementns"> 5 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-createelementns">
6 <link rel=help href="https://dom.spec.whatwg.org/#dom-node-nodetype"> 6 <link rel=help href="https://dom.spec.whatwg.org/#dom-node-nodetype">
7 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-documentelement"> 7 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-documentelement">
8 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-doctype"> 8 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-doctype">
9 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharness.js"></script>
10 <script src="/resources/testharnessreport.js"></script> 10 <script src="/resources/testharnessreport.js"></script>
11 <script src="Document-createElementNS.js"></script> 11 <script src="Document-createElementNS.js"></script>
12 <div id="log"></div> 12 <div id="log"></div>
13 <script> 13 <script>
14 var htmlNamespace = "http://www.w3.org/1999/xhtml" 14 var htmlNamespace = "http://www.w3.org/1999/xhtml"
15 var svgNamespace = "http://www.w3.org/2000/svg" 15 var svgNamespace = "http://www.w3.org/2000/svg"
16 var mathMLNamespace = "http://www.w3.org/1998/Math/MathML" 16 var mathMLNamespace = "http://www.w3.org/1998/Math/MathML"
17 17
18 // Make DocumentTypes distinct
19 function my_format_value(val) {
20 if (val instanceof DocumentType) {
21 return "DocumentType node <!DOCTYPE " + val.name
22 + (val.publicId ? " " + val.publicId : "")
23 + (val.systemId ? " " + val.systemId : "")
24 + ">";
25 }
26 return format_value(val);
27 }
28
18 test(function() { 29 test(function() {
19 var tests = createElementNS_tests.map(function(t) { 30 var tests = createElementNS_tests.map(function(t) {
20 return [t[0], t[1], null, t[2]] 31 return [t[0], t[1], null, t[2]]
21 }).concat([ 32 }).concat([
22 /* Arrays with four elements: 33 /* Arrays with four elements:
23 * the namespace argument 34 * the namespace argument
24 * the qualifiedName argument 35 * the qualifiedName argument
25 * the doctype argument 36 * the doctype argument
26 * the expected exception, or null if none 37 * the expected exception, or null if none
27 */ 38 */
28 [null, null, false, new TypeError()], 39 [null, null, false, new TypeError()],
29 [null, null, null, null], 40 [null, null, null, null],
30 [null, "", null, null], 41 [null, "", null, null],
31 [undefined, null, undefined, null], 42 [undefined, null, undefined, null],
32 [undefined, undefined, undefined, null], 43 [undefined, undefined, undefined, null],
33 [undefined, "", undefined, null], 44 [undefined, "", undefined, null],
34 ["http://example.com/", null, null, null], 45 ["http://example.com/", null, null, null],
35 ["http://example.com/", "", null, null], 46 ["http://example.com/", "", null, null],
36 ["/", null, null, null], 47 ["/", null, null, null],
37 ["/", "", null, null], 48 ["/", "", null, null],
38 ["http://www.w3.org/XML/1998/namespace", null, null, null], 49 ["http://www.w3.org/XML/1998/namespace", null, null, null],
39 ["http://www.w3.org/XML/1998/namespace", "", null, null], 50 ["http://www.w3.org/XML/1998/namespace", "", null, null],
40 ["http://www.w3.org/2000/xmlns/", null, null, null], 51 ["http://www.w3.org/2000/xmlns/", null, null, null],
41 ["http://www.w3.org/2000/xmlns/", "", null, null], 52 ["http://www.w3.org/2000/xmlns/", "", null, null],
42 ["foo:", null, null, null], 53 ["foo:", null, null, null],
43 ["foo:", "", null, null], 54 ["foo:", "", null, null],
44 [null, null, document.implementation.createDocumentType("foo", "", ""), null ], 55 [null, null, document.implementation.createDocumentType("foo", "", ""), null ],
45 [null, null, document.doctype, null], // This causes a horrible WebKit bug ( now fixed in trunk). 56 [null, null, document.doctype, null], // This causes a horrible WebKit bug ( now fixed in trunk).
46 [null, null, function() { 57 [null, null, function() {
47 var foo = document.implementation.createDocumentType("foo", "", ""); 58 var foo = document.implementation.createDocumentType("bar", "", "");
48 document.implementation.createDocument(null, null, foo); 59 document.implementation.createDocument(null, null, foo);
49 return foo; 60 return foo;
50 }(), null], // DOCTYPE already associated with a document. 61 }(), null], // DOCTYPE already associated with a document.
51 [null, null, function() { 62 [null, null, function() {
52 var bar = document.implementation.createDocument(null, null, null); 63 var bar = document.implementation.createDocument(null, null, null);
53 return bar.implementation.createDocumentType("bar", "", ""); 64 return bar.implementation.createDocumentType("baz", "", "");
54 }(), null], // DOCTYPE created by a different implementation. 65 }(), null], // DOCTYPE created by a different implementation.
55 [null, null, function() { 66 [null, null, function() {
56 var bar = document.implementation.createDocument(null, null, null); 67 var bar = document.implementation.createDocument(null, null, null);
57 var magic = bar.implementation.createDocumentType("bar", "", ""); 68 var magic = bar.implementation.createDocumentType("quz", "", "");
58 bar.implementation.createDocument(null, null, magic); 69 bar.implementation.createDocument(null, null, magic);
59 return magic; 70 return magic;
60 }(), null], // DOCTYPE created by a different implementation and already as sociated with a document. 71 }(), null], // DOCTYPE created by a different implementation and already as sociated with a document.
61 [null, "foo", document.implementation.createDocumentType("foo", "", ""), nul l], 72 [null, "foo", document.implementation.createDocumentType("foo", "", ""), nul l],
62 ["foo", null, document.implementation.createDocumentType("foo", "", ""), nul l], 73 ["foo", null, document.implementation.createDocumentType("foo", "", ""), nul l],
63 ["foo", "bar", document.implementation.createDocumentType("foo", "", ""), nu ll], 74 ["foo", "bar", document.implementation.createDocumentType("foo", "", ""), nu ll],
64 [htmlNamespace, "", null, null], 75 [htmlNamespace, "", null, null],
65 [svgNamespace, "", null, null], 76 [svgNamespace, "", null, null],
66 [mathMLNamespace, "", null, null], 77 [mathMLNamespace, "", null, null],
67 [null, "html", null, null], 78 [null, "html", null, null],
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 assert_equals(element.namespaceURI, namespace === undefined ? null : n amespace) 120 assert_equals(element.namespaceURI, namespace === undefined ? null : n amespace)
110 } 121 }
111 if (!doctype) { 122 if (!doctype) {
112 assert_equals(doc.doctype, null) 123 assert_equals(doc.doctype, null)
113 } else { 124 } else {
114 assert_equals(doc.doctype, doctype) 125 assert_equals(doc.doctype, doctype)
115 assert_equals(doc.doctype.ownerDocument, doc) 126 assert_equals(doc.doctype.ownerDocument, doc)
116 } 127 }
117 assert_equals(doc.childNodes.length, !omitRootElement + !!doctype) 128 assert_equals(doc.childNodes.length, !omitRootElement + !!doctype)
118 } 129 }
119 }, "createDocument test " + i + ": " + t.map(function(el) { return format_va lue(el) })) 130 }, "createDocument test: " + t.map(my_format_value))
120 131
121 if (expected === null) { 132 if (expected === null) {
122 test(function() { 133 test(function() {
123 var doc = document.implementation.createDocument(namespace, qualifiedNam e, doctype) 134 var doc = document.implementation.createDocument(namespace, qualifiedNam e, doctype)
124 assert_equals(doc.compatMode, "CSS1Compat") 135 assert_equals(doc.compatMode, "CSS1Compat")
125 assert_equals(doc.characterSet, "UTF-8") 136 assert_equals(doc.characterSet, "UTF-8")
126 assert_equals(doc.contentType, namespace == htmlNamespace ? "application /xhtml+xml" 137 assert_equals(doc.contentType, namespace == htmlNamespace ? "application /xhtml+xml"
127 : namespace == svgNamespace ? "image/svg+xml" 138 : namespace == svgNamespace ? "image/svg+xml"
128 : "application/xml") 139 : "application/xml")
129 assert_equals(doc.URL, "about:blank") 140 assert_equals(doc.URL, "about:blank")
130 assert_equals(doc.documentURI, "about:blank") 141 assert_equals(doc.documentURI, "about:blank")
131 assert_equals(doc.createElement("DIV").localName, "DIV"); 142 assert_equals(doc.createElement("DIV").localName, "DIV");
132 }, "createDocument test " + i + ": metadata for " + 143 }, "createDocument test " + i + ": metadata for " +
133 [namespace, qualifiedName, doctype].map(function(el) { return format_value (el) })) 144 [namespace, qualifiedName, doctype].map(my_format_value))
134 145
135 test(function() { 146 test(function() {
136 var doc = document.implementation.createDocument(namespace, qualifiedNam e, doctype) 147 var doc = document.implementation.createDocument(namespace, qualifiedNam e, doctype)
137 assert_equals(doc.characterSet, "UTF-8", "characterSet"); 148 assert_equals(doc.characterSet, "UTF-8", "characterSet");
138 assert_equals(doc.charset, "UTF-8", "charset"); 149 assert_equals(doc.charset, "UTF-8", "charset");
139 assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding"); 150 assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding");
140 }, "createDocument test " + i + ": characterSet aliases for " + 151 }, "createDocument test " + i + ": characterSet aliases for " +
141 [namespace, qualifiedName, doctype].map(function(el) { return format_value (el) })) 152 [namespace, qualifiedName, doctype].map(my_format_value))
142 } 153 }
143 }) 154 })
144 }) 155 })
145 156
146 test(function() { 157 test(function() {
147 assert_throws(new TypeError(), function() { 158 assert_throws(new TypeError(), function() {
148 document.implementation.createDocument() 159 document.implementation.createDocument()
149 }, "createDocument() should throw") 160 }, "createDocument() should throw")
150 161
151 assert_throws(new TypeError(), function() { 162 assert_throws(new TypeError(), function() {
152 document.implementation.createDocument('') 163 document.implementation.createDocument('')
153 }, "createDocument('') should throw") 164 }, "createDocument('') should throw")
154 }, "createDocument with missing arguments"); 165 }, "createDocument with missing arguments");
155 </script> 166 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698