| Michael[tm] Smith | 1f66bf6 | 2014-05-26 07:50:19 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <title>EventSource IDL tests</title> |
| 3 | <script src=/resources/testharness.js></script> |
| 4 | <script src=/resources/testharnessreport.js></script> |
| 5 | <script src=/resources/WebIDLParser.js></script> |
| 6 | <script src=/resources/idlharness.js></script> |
| 7 | |
| 8 | <h1>EventSource IDL tests</h1> |
| 9 | <div id=log></div> |
| 10 | |
| 11 | <script type=text/plain> |
| 12 | [Constructor(DOMString url, optional EventSourceInit eventSourceInitDict)] |
| 13 | interface EventSource : EventTarget { |
| 14 | readonly attribute DOMString url; |
| 15 | readonly attribute boolean withCredentials; |
| 16 | |
| 17 | // ready state |
| 18 | const unsigned short CONNECTING = 0; |
| 19 | const unsigned short OPEN = 1; |
| 20 | const unsigned short CLOSED = 2; |
| 21 | readonly attribute unsigned short readyState; |
| 22 | |
| 23 | // networking |
| 24 | attribute EventHandler onopen; |
| 25 | attribute EventHandler onmessage; |
| 26 | attribute EventHandler onerror; |
| 27 | void close(); |
| 28 | }; |
| 29 | |
| 30 | dictionary EventSourceInit { |
| 31 | boolean withCredentials = false; |
| 32 | }; |
| 33 | |
| 34 | [TreatNonCallableAsNull] |
| 35 | callback EventHandlerNonNull = any (Event event); |
| 36 | typedef EventHandlerNonNull? EventHandler; |
| 37 | </script> |
| 38 | <script> |
| 39 | "use strict"; |
| 40 | var idlArray; |
| 41 | setup(function() { |
| Ms2ger | 53321dc | 2015-05-18 08:31:44 | [diff] [blame^] | 42 | idlArray = new IdlArray(); |
| 43 | [].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) { |
| 44 | if (node.className == "untested") { |
| 45 | idlArray.add_untested_idls(node.textContent); |
| 46 | } else { |
| 47 | idlArray.add_idls(node.textContent); |
| 48 | } |
| 49 | }); |
| Michael[tm] Smith | 1f66bf6 | 2014-05-26 07:50:19 | [diff] [blame] | 50 | }, {explicit_done:true}); |
| 51 | window.onload = function() { |
| Ms2ger | 53321dc | 2015-05-18 08:31:44 | [diff] [blame^] | 52 | idlArray.add_objects({ |
| 53 | EventSource: ['new EventSource("http://foo")'], |
| 54 | }); |
| 55 | idlArray.test(); |
| 56 | done(); |
| Michael[tm] Smith | 1f66bf6 | 2014-05-26 07:50:19 | [diff] [blame] | 57 | }; |
| 58 | </script> |