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

Side by Side Diff: LayoutTests/imported/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio_constructor.html

Issue 1144143009: W3C Test: Import web-platform-tests/html/semantics (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!doctype html>
2 <meta charset=utf-8>
3 <title>Audio constructor</title>
4 <script src="../../../../../../resources/testharness.js"></script>
5 <script src="../../../../../../resources/testharnessreport.js"></script>
6 <div id=log></div>
7 <script>
8 test(function() {
9 var throwingObject = {
10 toString: function() { throw Error() },
11 valueOf: function() { throw Error() }
12 };
13 var tests = [
14 [function() { return Audio() }, null, "No arguments, without new"],
15 [function() { return new Audio() }, null, "No arguments, with new"],
16 [function() { return Audio("") }, "", "Empty string argument, without new"],
17 [function() { return new Audio("") }, "", "Empty string argument, with new"] ,
18 [function() { return Audio("src") }, "src", "Non-empty string argument, with out new"],
19 [function() { return new Audio("src") }, "src", "Non-empty string argument, with new"],
20 [function() { return Audio(null) }, "null", "Null argument, without new"],
21 [function() { return new Audio(null) }, "null", "Null argument, with new"],
22 [function() { return Audio(undefined) }, null, "Undefined argument, without new"],
23 [function() { return new Audio(undefined) }, null, "Undefined argument, with new"],
24 [function() { return Audio("", throwingObject) }, "", "Extra argument, witho ut new"],
25 [function() { return new Audio("", throwingObject) }, "", "Extra argument, w ith new"],
26 ];
27 tests.forEach(function(t) {
28 var fn = t[0], expectedSrc = t[1], description = t[2];
29 test(function() {
30 var element = fn();
31 assert_equals(element.localName, "audio");
32 assert_equals(element.tagName, "AUDIO");
33 assert_equals(element.namespaceURI, "http://www.w3.org/1999/xhtml");
34 assert_equals(element.nodeType, Node.ELEMENT_NODE);
35 assert_equals(element.getAttribute("preload"), "auto");
36 assert_equals(element.getAttribute("src"), expectedSrc);
37 assert_equals(element.ownerDocument, document);
38 }, description);
39 });
40 });
41 test(function() {
42 assert_throws(new TypeError(), function() {
43 HTMLAudioElement();
44 });
45 }, "Calling HTMLAudioElement should throw");
46 test(function() {
47 assert_throws(new TypeError(), function() {
48 new HTMLAudioElement();
49 });
50 }, "Constructing HTMLAudioElement should throw");
51 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698