- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / ssl / wss_close.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>test to close hanging wss connection</title>
5 <script type="text/javascript">
6
7 var href = window.location.href;
8 var hostBegin = href.indexOf('/') + 2;
9 var hostEnd = href.lastIndexOf(':');
10 var host = href.slice(hostBegin, hostEnd);
11 var queryBegin = href.lastIndexOf('?') + 1;
12 var port = href.slice(queryBegin);
13 var url = 'wss://' + host + ':' + port;
14
15 // Do connection test.
16 var ws = new WebSocket(url);
17 ws.onopen = function() {
18   // Set document title to 'FAIL'. The test observer catches this title change
19   // to know the result.
20   document.title = 'FAIL';
21 }
22 ws.onclose = function() {
23   // Set document title to 'PASS'. The test observer catches this title change
24   // to know the result.
25   document.title = 'PASS';
26 }
27
28 </script>
29 </head>
30 </html>