Skip to content

Commit

Permalink
Moved Web Sockets IDL tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
sideshowbarker committed May 26, 2014
1 parent e37ef9f commit dcb704b
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 45 deletions.
45 changes: 0 additions & 45 deletions html/dom/interfaces.html
Expand Up @@ -2553,49 +2553,6 @@ <h1>HTML IDL tests</h1>
boolean withCredentials = false;
};

enum BinaryType { "blob", "arraybuffer" };
[Constructor(DOMString url, optional (DOMString or DOMString[]) protocols)]
interface WebSocket : EventTarget {
readonly attribute DOMString url;

// ready state
const unsigned short CONNECTING = 0;
const unsigned short OPEN = 1;
const unsigned short CLOSING = 2;
const unsigned short CLOSED = 3;
readonly attribute unsigned short readyState;
readonly attribute unsigned long bufferedAmount;

// networking
attribute EventHandler onopen;
attribute EventHandler onerror;
attribute EventHandler onclose;
readonly attribute DOMString extensions;
readonly attribute DOMString protocol;
void close([Clamp] optional unsigned short code, optional DOMString reason);

// messaging
attribute EventHandler onmessage;
attribute BinaryType binaryType;
void send(DOMString data);
void send(Blob data);
void send(ArrayBuffer data);
void send(ArrayBufferView data);
};

[Constructor(DOMString type, optional CloseEventInit eventInitDict)]
interface CloseEvent : Event {
readonly attribute boolean wasClean;
readonly attribute unsigned short code;
readonly attribute DOMString reason;
};

dictionary CloseEventInit : EventInit {
boolean wasClean;
unsigned short code;
DOMString reason;
};

[Constructor]
interface MessageChannel {
readonly attribute MessagePort port1;
Expand Down Expand Up @@ -3194,8 +3151,6 @@ <h1>HTML IDL tests</h1>
SharedWorker: [],
MessageEvent: [],
EventSource: [],
WebSocket: [],
CloseEvent: [],
MessageChannel: [],
MessagePort: [],
Storage: [],
Expand Down
75 changes: 75 additions & 0 deletions websockets/interfaces.html
@@ -0,0 +1,75 @@
<!doctype html>
<title>Web Sockets IDL tests</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>

<h1>Web Sockets IDL tests</h1>
<div id=log></div>

<script type=text/plain>
enum BinaryType { "blob", "arraybuffer" };
[Constructor(DOMString url, optional (DOMString or DOMString[]) protocols), Exposed=Window,Worker]
interface WebSocket : EventTarget {
readonly attribute DOMString url;

// ready state
const unsigned short CONNECTING = 0;
const unsigned short OPEN = 1;
const unsigned short CLOSING = 2;
const unsigned short CLOSED = 3;
readonly attribute unsigned short readyState;
readonly attribute unsigned long bufferedAmount;

// networking
attribute EventHandler onopen;
attribute EventHandler onerror;
attribute EventHandler onclose;
readonly attribute DOMString extensions;
readonly attribute DOMString protocol;
void close([Clamp] optional unsigned short code, optional DOMString reason);

// messaging
attribute EventHandler onmessage;
attribute BinaryType binaryType;
void send(DOMString data);
void send(Blob data);
void send(ArrayBuffer data);
void send(ArrayBufferView data);
};

[Constructor(DOMString type, optional CloseEventInit eventInitDict), Exposed=Window,Worker]
interface CloseEvent : Event {
readonly attribute boolean wasClean;
readonly attribute unsigned short code;
readonly attribute DOMString reason;
};

dictionary CloseEventInit : EventInit {
boolean wasClean;
unsigned short code;
DOMString reason;
};
</script>
<script>
"use strict";
var idlArray;
setup(function() {
idlArray = new IdlArray();
[].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
if (node.className == "untested") {
idlArray.add_untested_idls(node.textContent);
} else {
idlArray.add_idls(node.textContent);
}
});
}, {explicit_done:true});
window.onload = function() {
idlArray.add_objects({
WebSocket: ['new WebSocket("ws://foo")'],
});
idlArray.test();
done();
};
</script>

0 comments on commit dcb704b

Please sign in to comment.