Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: pages/filters/websocket.tmpl

Issue 29755578: Issue 2148 - Rewrite the testpages test suite (Closed)
Patch Set: Created April 18, 2018, 11:54 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 title = $websocket - ABP Test Pages
2 template = testcase
3
4 {% set testcase_moreinfo = [
5 ("Filter Options", "https://adblockplus.org/filters#options"),
6 ] %}
7
8
9 <script>
10 function pagelog(message) {
11 var log = document.getElementById("testcase-fo-websocket");
12 log.innerText = log.innerText + message + "\n";
13 console.log(message);
14 }
15
16 function ws_open(evt) {
17 pagelog("Connected");
18 websocket.send("Test message was echoed back");
19 }
20 function ws_close(evt) {
21 pagelog("Disconnected");
22 }
23 function ws_message(evt) {
24 pagelog("Received message: ");
25 pagelog(evt.data);
26 }
27 function ws_error(evt) {
28 pagelog("WebSocket error / Blocked");
29 }
30
31 function ws_disconnect()
32 {
33 websocket.close();
34 }
35
36 function ws_connect() {
37 var url ="wss://echo.websocket.org";
38 websocket = new WebSocket(url);
39 websocket.onopen = function(evt) { ws_open(evt) };
40 websocket.onclose = function(evt) { ws_disconnect(evt) };
41 websocket.onmessage = function(evt) { ws_message(evt) };
42 websocket.onerror = function(evt) { ws_error(evt) };
43 }
44
45 document.addEventListener('DOMContentLoaded', ws_connect, false);
46 </script>
47
48 <section class="site-panel">
49 <h2>$websocket</h2>
50 <p>Check that usage of the $websocket filter option works as expected.</p>
51 </section>
52
53 <section class="site-panel">
54 <h2>Test case</h2>
55 <div class="testcase-container">
56 <div class="testcase-row"><h3>WebSocket Request</h3><div id="testcase-fo-webs ocket"></div></div>
57 </div>
58 <h3>Filters</h3>
59 $websocket,domain=testpages.adblockplus.org
60 </section>
OLDNEW

Powered by Google App Engine
This is Rietveld