diff options
Diffstat (limited to 'chrome/test/data/ssl/wss_close.html')
-rw-r--r-- | chrome/test/data/ssl/wss_close.html | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/chrome/test/data/ssl/wss_close.html b/chrome/test/data/ssl/wss_close.html index 69c8940..0df5431 100644 --- a/chrome/test/data/ssl/wss_close.html +++ b/chrome/test/data/ssl/wss_close.html @@ -9,37 +9,18 @@ var queryBegin = href.lastIndexOf('?') + 1; var port = href.slice(queryBegin); var url = 'wss://localhost:' + port; -function fail() -{ - // Set document title to 'FAIL'. The test observer catches this title changes +// Do connection test. +var ws = new WebSocket(url); +ws.onopen = function() { + // Set document title to 'FAIL'. The test observer catches this title change // to know the result. document.title = 'FAIL'; } -// Do connection test. -var ws = new WebSocket(url); - -ws.onopen = fail; -ws.onclose = fail; -ws.onerror = fail; - -// Use XHR to wait about two round trip time. -var xhr = new XMLHttpRequest(); -xhr.onreadystatechange = function(){ - if (this.readyState != this.DONE) - return; - var xhr2 = new XMLHttpRequest(); - xhr2.onreadystatechange = function(){ - if (this.readyState != this.DONE) - return; - document.title = 'PASS'; - }; - xhr2.open('GET', href); - xhr2.send(); -}; -xhr.open('GET', href); -xhr.send(); - -setTimeout(fail, 3000); +ws.onclose = function() { + // Set document title to 'PASS'. The test observer catches this title change + // to know the result. + document.title = 'PASS'; +} </script> </head> |