2009-12-08 Fumitoshi Ukai <ukai@chromium.org>
[WebKit-https.git] / LayoutTests / websocket / tests / script-tests / bad-sub-protocol.js
1 description("Test WebSocket bad sub-protocol names.");
2
3 // Fails if protocol is an empty string.
4 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "")');
5
6 // Fails if protocol contains an character less than U+0020.
7 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u0000")');
8 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u0009")');
9 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u000A")');
10 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u000D")');
11 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u001B")');
12
13 // Fails if protocol contains an character greater than U+007E.
14 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u007F")');
15 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u0080")');
16 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u3042")');
17 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\uFFFF")');
18 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\uFEFF")');
19 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\uFFFE")');
20 // Surrogate pairs
21 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\uD840\uDC0B")');
22
23 var successfullyParsed = true;