toolkit/content/tests/chrome/test_about_networking.html

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:ad5373bcc19d
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=912103
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug </title>
9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
11 <script type="application/javascript">
12
13 SimpleTest.waitForExplicitFinish();
14
15 function runTest() {
16 const Cc = Components.classes;
17 const Ci = Components.interfaces;
18
19 var dashboard = Cc['@mozilla.org/network/dashboard;1']
20 .getService(Ci.nsIDashboard);
21 dashboard.enableLogging = true;
22
23 var wsURI = "ws://mochi.test:8888/chrome/toolkit/content/tests/chrome/file_about_networking";
24 var websocket = new WebSocket(wsURI);
25
26 websocket.addEventListener("open", function() {
27 dashboard.requestWebsocketConnections(function(data) {
28 var found = false;
29 for (var i = 0; i < data.websockets.length; i++) {
30 if (data.websockets[i].hostport == "mochi.test:8888") {
31 found = true;
32 break;
33 }
34 }
35 isnot(found, false, "tested websocket entry not found");
36 websocket.close();
37 SimpleTest.finish();
38 });
39 });
40 }
41
42 window.addEventListener("DOMContentLoaded", function run() {
43 window.removeEventListener("DOMContentLoaded", run);
44 runTest();
45 });
46
47 </script>
48 </head>
49 <body>
50 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=912103">Mozilla Bug </a>
51 <p id="display"></p>
52 <div id="content" style="display: none">
53
54 </div>
55 <pre id="test">
56 </pre>
57 </body>
58 </html>

mercurial