blob: a5ea78fa5daba9d35b358062ec98f01942821649 [file] [log] [blame]
Hitoshi Uchida7a59bac2014-06-11 22:36:551<!doctype html>
2<title>WebSockets : Boundary-value tests for the 'Extended payload length' field in RFC6455 section5.2 'Base Framing Protocol'</title>
3<meta name=timeout content=long>
4<script src=/resources/testharness.js></script>
5<script src=/resources/testharnessreport.js></script>
Ms2ger6057d832015-01-22 14:26:016<script src=constants.js?pipe=sub></script>
Simon Pieters78b80c52016-04-27 14:52:437<meta name="variant" content="">
8<meta name="variant" content="?wss">
Hitoshi Uchida7a59bac2014-06-11 22:36:559<div id=log></div>
10<script>
11async_test(function(t){
12 var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
13 var datasize = 125;
14 var data = null;
15 ws.onopen = t.step_func(function(e) {
16 data = new Array(datasize + 1).join('a');
17 ws.send(data);
18 });
19 ws.onmessage = t.step_func(function(e) {
20 assert_equals(e.data, data);
21 t.done();
22 });
qiuzhongaf5a0362018-11-16 05:54:1623}, "Application data is 125 byte which means any 'Extended payload length' field isn't used at all.");
Hitoshi Uchida7a59bac2014-06-11 22:36:5524
25async_test(function(t){
26 var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
27 var datasize = 126;
28 var data = null;
29 ws.onopen = t.step_func(function(e) {
30 data = new Array(datasize + 1).join('a');
31 ws.send(data);
32 });
33 ws.onmessage = t.step_func(function(e) {
34 assert_equals(e.data, data);
35 t.done();
36 });
qiuzhongaf5a0362018-11-16 05:54:1637}, "Application data is 126 byte which starts to use the 16 bit 'Extended payload length' field.");
Hitoshi Uchida7a59bac2014-06-11 22:36:5538
39async_test(function(t){
40 var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
41 var datasize = 0xFFFF;
42 var data = null;
43 ws.onopen = t.step_func(function(e) {
44 data = new Array(datasize + 1).join('a');
45 ws.send(data);
46 });
47 ws.onmessage = t.step_func(function(e) {
48 assert_equals(e.data, data);
49 t.done();
50 });
qiuzhongaf5a0362018-11-16 05:54:1651}, "Application data is 0xFFFF byte which means the upper bound of the 16 bit 'Extended payload length' field.");
Hitoshi Uchida7a59bac2014-06-11 22:36:5552
53async_test(function(t){
54 var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
55 var datasize = 0xFFFF + 1;
56 var data = null;
57 ws.onopen = t.step_func(function(e) {
58 data = new Array(datasize + 1).join('a');
59 ws.send(data);
60 });
61 ws.onmessage = t.step_func(function(e) {
62 assert_equals(e.data, data);
63 t.done();
64 });
qiuzhongaf5a0362018-11-16 05:54:1665}, "Application data is (0xFFFF + 1) byte which starts to use the 64 bit 'Extended payload length' field");
Hitoshi Uchida7a59bac2014-06-11 22:36:5566
67</script>