forked from crossbario/autobahn-testsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tobias Oberstein
committed
Mar 12, 2012
1 parent
714d92c
commit 4bd182b
Showing
8 changed files
with
282 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
*.pyc | ||
*.pyo | ||
*.dat | ||
/lib/python/build/* | ||
/lib/python/dist/* | ||
/lib/python/autobahn.egg-info*/ | ||
testsuite/websockets/reports/* | ||
doc/python/_build/* | ||
/autobahn/build/* | ||
/autobahn/dist/* | ||
/autobahn/autobahn.egg-info*/ | ||
examples/fuzzing/reports/* | ||
doc/python/_build/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
include README | ||
include LICENSE | ||
include NOTICE | ||
recursive-include autobahn * | ||
recursive-include wstest/web * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style lang="css"> | ||
body { | ||
font-family: Segoe UI,Tahoma,Arial,Verdana,sans-serif; | ||
color: #333; | ||
} | ||
li { | ||
padding: 0.4em; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>Autobahn WebSockets Test Suite</h1> | ||
<ul> | ||
<li><a href="test_browser.html">Test your browser</a></li> | ||
</ul> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,247 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
|
||
<style lang="css"> | ||
body | ||
{ | ||
font-family: Segoe UI,Tahoma,Arial,Verdana,sans-serif; | ||
color: #333; | ||
} | ||
</style> | ||
|
||
<script type="text/javascript"> | ||
|
||
var hostname = null; | ||
var port = null; | ||
var agent = null; | ||
var ua = null; | ||
var webSocket = null; | ||
var currentCaseId = null; | ||
var caseCount = null; | ||
|
||
window.onload = | ||
function() | ||
{ | ||
setHostname(); | ||
setPort(); | ||
setAgent(); | ||
} | ||
|
||
function setHostname() | ||
{ | ||
var hn = window.location.hostname; | ||
if (hn == null || hn == "") { | ||
hn = "127.0.0.1"; | ||
} | ||
|
||
hostname = document.getElementById('hostname').value; | ||
if (hostname == null || hostname == "") | ||
{ | ||
hostname = hn; | ||
document.getElementById('hostname').value = hn; | ||
} | ||
} | ||
|
||
function setPort() | ||
{ | ||
port = document.getElementById('port').value; | ||
|
||
if (port == null || port == "") | ||
{ | ||
port = "9001"; | ||
document.getElementById('port').value = port; | ||
} | ||
} | ||
|
||
function setAgent() | ||
{ | ||
agent = document.getElementById('agent').value; | ||
ua = navigator.userAgent; | ||
document.getElementById('ua-detected').innerHTML = ua; | ||
|
||
if (agent == null || agent == "") | ||
{ | ||
console.log("user agent = " + ua); | ||
if (ua.indexOf("Chrome") > -1) | ||
{ | ||
i = ua.indexOf("Chrome"); | ||
j = ua.indexOf(" ", i); | ||
agent = ua.slice(i, j); | ||
updateStatus("Detected user agent " + agent + "."); | ||
} | ||
else if (ua.indexOf("Firefox") > -1) | ||
{ | ||
i = ua.indexOf("Firefox"); | ||
j = ua.indexOf(" ", i); | ||
if (j < i) j = ua.length; | ||
s1 = ua.slice(i, j); | ||
console.log(s1); | ||
i = ua.indexOf("Gecko/"); | ||
j = ua.indexOf(" ", i); | ||
s2 = ua.slice(i + "Gecko/".length, j).trim(); | ||
if (s2 != "") { | ||
agent = s1 + "-" + s2; | ||
} else { | ||
agent = s1; | ||
} | ||
updateStatus("Detected user agent " + agent + "."); | ||
} | ||
else if (ua.indexOf("Safari") > -1) | ||
{ | ||
i = ua.indexOf("Safari"); | ||
j = ua.indexOf(" ", i); | ||
if (j < 0) j = ua.length; | ||
agent = ua.slice(i, j); | ||
updateStatus("Detected user agent " + agent + "."); | ||
} | ||
else if (ua.indexOf("MSIE") > -1) | ||
{ | ||
i = ua.indexOf("MSIE"); | ||
j = ua.indexOf(";", i); | ||
if (j < 0) j = ua.length; | ||
agent = ua.slice(i, j); | ||
updateStatus("Detected user agent " + agent + "."); | ||
} | ||
else | ||
{ | ||
agent = "unknown"; | ||
updateStatus("Could not detect user agent .. will use '" + agent + "'."); | ||
} | ||
|
||
document.getElementById('agent').value = agent; | ||
} | ||
} | ||
|
||
function startTestRun() | ||
{ | ||
setHostname(); | ||
setPort(); | ||
setAgent(); | ||
updateStatus("Running test suite .."); | ||
document.getElementById('resultlink').innerHTML = ''; | ||
currentCaseId = 1; | ||
getCaseCount(runNextCase); | ||
} | ||
|
||
function updateStatus(msg) | ||
{ | ||
console.log(msg); | ||
document.getElementById('statusline').innerHTML = msg; | ||
} | ||
|
||
function openWebSocket(ws_uri) | ||
{ | ||
if ("WebSocket" in window) { | ||
// Chrome, IE10 | ||
webSocket = new WebSocket(ws_uri); | ||
} else if ("MozWebSocket" in window) { | ||
// Firefox 7-10 (currently vendor prefixed) | ||
webSocket = new MozWebSocket(ws_uri); | ||
} else { | ||
throw "neither WebSocket nor MozWebSocket available"; | ||
} | ||
return webSocket; | ||
} | ||
|
||
function getCaseCount(cont) | ||
{ | ||
var ws_uri = "ws://" + hostname + ":" + port + "/getCaseCount"; | ||
|
||
webSocket = openWebSocket(ws_uri); | ||
|
||
webSocket.onmessage = | ||
function(e) | ||
{ | ||
caseCount = JSON.parse(e.data); | ||
updateStatus("Will run " + caseCount + " cases .."); | ||
} | ||
|
||
webSocket.onclose = | ||
function(e) | ||
{ | ||
cont(); | ||
} | ||
} | ||
|
||
function updateReports() | ||
{ | ||
var ws_uri = "ws://" + hostname + ":" + port + "/updateReports?agent=" + agent; | ||
|
||
webSocket = openWebSocket(ws_uri); | ||
|
||
webSocket.onopen = | ||
function(e) | ||
{ | ||
updateStatus("Updating reports .."); | ||
} | ||
|
||
webSocket.onclose = | ||
function(e) | ||
{ | ||
webSocket = null; | ||
updateStatus("Reports updated."); | ||
updateStatus("Test suite finished!"); | ||
|
||
/*document.getElementById('resultlink').innerHTML = '<a href="../reports/clients/index.html">Check test report</a>';*/ | ||
} | ||
} | ||
|
||
function runNextCase() | ||
{ | ||
var ws_uri = "ws://" + hostname + ":" + port + "/runCase?case=" + currentCaseId + "&agent=" + agent; | ||
|
||
webSocket = openWebSocket(ws_uri); | ||
webSocket.binaryType = "arraybuffer"; | ||
|
||
webSocket.onopen = | ||
function(e) | ||
{ | ||
updateStatus("Executing test case " + currentCaseId + "/" + caseCount); | ||
} | ||
|
||
webSocket.onclose = | ||
function(e) | ||
{ | ||
webSocket = null; | ||
|
||
currentCaseId = currentCaseId + 1; | ||
if (currentCaseId <= caseCount) | ||
{ | ||
runNextCase(); | ||
} | ||
else | ||
{ | ||
updateStatus("All test cases executed."); | ||
updateReports(); | ||
} | ||
} | ||
|
||
//webSocket.onerror = webSocket.onclose; | ||
|
||
webSocket.onmessage = | ||
function(e) | ||
{ | ||
webSocket.send(e.data); | ||
} | ||
} | ||
|
||
</script> | ||
</head> | ||
|
||
<body> | ||
<h1>WebSockets Browser Testsuite</h1> | ||
<p>Provided by <a href="http://www.tavendo.de/autobahn">Autobahn</a> WebSockets.</p><br/> | ||
<form> | ||
<p>Fuzzing Server Hostname<br/><input id="hostname" type="text" size="20" maxlength="40"></p> | ||
<p>Fuzzing Server Port<br/><input id="port" type="text" size="5" maxlength="5"></p> | ||
<p>User Agent Identifier<br/><input id="agent" type="text" size="30" maxlength="30"><br/> | ||
<span style="font-size: 0.7em;" id="ua-detected"></span></p> | ||
</form> | ||
<br/> | ||
<p><button onclick='startTestRun();'>Start Tests</button> <i>Status:</i> <span id="statusline">Ready</span></p> | ||
<p><button onclick='updateReports();'>Update Reports (Manual)</button></p> | ||
<br/> | ||
<p id="resultlink"></p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.