1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/content/tests/chrome/test_about_networking.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=912103 1.8 +--> 1.9 +<head> 1.10 + <meta charset="utf-8"> 1.11 + <title>Test for Bug </title> 1.12 + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> 1.14 + <script type="application/javascript"> 1.15 + 1.16 + SimpleTest.waitForExplicitFinish(); 1.17 + 1.18 + function runTest() { 1.19 + const Cc = Components.classes; 1.20 + const Ci = Components.interfaces; 1.21 + 1.22 + var dashboard = Cc['@mozilla.org/network/dashboard;1'] 1.23 + .getService(Ci.nsIDashboard); 1.24 + dashboard.enableLogging = true; 1.25 + 1.26 + var wsURI = "ws://mochi.test:8888/chrome/toolkit/content/tests/chrome/file_about_networking"; 1.27 + var websocket = new WebSocket(wsURI); 1.28 + 1.29 + websocket.addEventListener("open", function() { 1.30 + dashboard.requestWebsocketConnections(function(data) { 1.31 + var found = false; 1.32 + for (var i = 0; i < data.websockets.length; i++) { 1.33 + if (data.websockets[i].hostport == "mochi.test:8888") { 1.34 + found = true; 1.35 + break; 1.36 + } 1.37 + } 1.38 + isnot(found, false, "tested websocket entry not found"); 1.39 + websocket.close(); 1.40 + SimpleTest.finish(); 1.41 + }); 1.42 + }); 1.43 + } 1.44 + 1.45 + window.addEventListener("DOMContentLoaded", function run() { 1.46 + window.removeEventListener("DOMContentLoaded", run); 1.47 + runTest(); 1.48 + }); 1.49 + 1.50 + </script> 1.51 +</head> 1.52 +<body> 1.53 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=912103">Mozilla Bug </a> 1.54 +<p id="display"></p> 1.55 +<div id="content" style="display: none"> 1.56 + 1.57 +</div> 1.58 +<pre id="test"> 1.59 +</pre> 1.60 +</body> 1.61 +</html>