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

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

Issue 29755578: Issue 2148 - Rewrite the testpages test suite (Closed)
Patch Set: Addressed Dave's feedback Created June 4, 2018, 1:21 p.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
1 title = $ping - ABP Test Pages 1 title = $ping
2 template = testcase 2 template = testcase
3 3
4 {% set testcase_moreinfo = [ 4 {% set testcase_moreinfo = [
5 ("Filter Options", "https://adblockplus.org/filters#options"), 5 ("Filter Options", "https://adblockplus.org/filters#options"),
6 ] %} 6 ] %}
7 7
8 8
9 <script> 9 <script>
10 function pagelog(message) { 10 function pagelog(message) {
11 var log = document.getElementById("testcase-fo-ping"); 11 var log = document.getElementById("testcase-fo-ping");
12 log.innerText = log.innerText + message + "\n"; 12 log.innerText = log.innerText + message + "\n";
13 console.log(message); 13 console.log(message);
14 } 14 }
15 15
16 function do_ping() { 16 function do_ping() {
17 var button = document.getElementById("ping-button"); 17 var button = document.getElementById("ping-button");
18 button.parentNode.removeChild(button); 18 button.parentNode.removeChild(button);
19 19
20 pagelog( "Calling navigator.sendBeacon()" ); 20 pagelog("Calling navigator.sendBeacon()");
21 var res = navigator.sendBeacon("/en/filters/ping", "Testdata" ); 21 var res = navigator.sendBeacon("/en/filters/ping", "Testdata" );
22 pagelog("navigator.sendBeacon() called."); 22 pagelog("navigator.sendBeacon() called.");
23 23
24 (res ? pagelog("navigator.sendBeacon() returned true.") : pagelog("Beacon coul d not be queued.")); 24 if(res) {
kzar 2018/06/04 17:17:29 Nit: This looks better, but still a couple of mino
rossg 2018/06/07 10:30:25 Done.
25 pagelog("navigator.sendBeacon() returned true.")
26 }
27 else {
28 pagelog("Beacon could not be queued.")
29 }
30
25 } 31 }
26 </script> 32 </script>
27 33
28 <section class="site-panel"> 34 <section class="site-panel">
29 <h2>$ping</h2> 35 <h2>$ping</h2>
30 <p>Check that usage of the $ping filter option is working as expected.</p> 36 <p>Check that usage of the $ping filter option is working as expected.</p>
37 <p>With the filter displayed below each test case added to ABP (or with the te stcase subscription installed and active), the pings triggered in the test case panels below should be blocked.</p>
31 <p>Note: Browsers will always return true if the ping is successfully queued, not if sent. Check with the Adblock Plus DevTools panel to check if it was actua lly blocked.</p> 38 <p>Note: Browsers will always return true if the ping is successfully queued, not if sent. Check with the Adblock Plus DevTools panel to check if it was actua lly blocked.</p>
32 </section> 39 </section>
33 40
34 <section class="site-panel"> 41 <section class="site-panel">
35 <h2>Test case</h2> 42 <h2>Test case</h2>
36 <div class="testcase-container"> 43 <div class="testcase-container">
37 <div class="testcase-row"><h3>Ping</h3> 44 <div class="testcase-row"><h3>Ping</h3>
38 <a href="http://example.com" target="_blank" ping="/en/filters/ping">Link based ping</a> 45 <a href="http://example.com" target="_blank" ping="/en/filters/ping">Link based ping</a>
39 </div> 46 </div>
40 </div> 47 </div>
41 <h3>Filters</h3> 48 <h3>Filters</h3>
42 testpages.adblockplus.org/*^$ping 49 <pre>testpages.adblockplus.org/*^$ping</pre>
43 </section> 50 </section>
44 51
45 <section class="site-panel"> 52 <section class="site-panel">
46 <h2>navigator.sendBeacon()</h2> 53 <h2>navigator.sendBeacon()</h2>
47 <div class="testcase-container"> 54 <div class="testcase-container">
48 <div class="testcase-row"><h3>Ping</h3> 55 <div class="testcase-row"><h3>Ping</h3>
49 <div id="testcase-fo-ping"> 56 <div id="testcase-fo-ping">
50 <button id="ping-button" onclick="do_ping()">Send Ping</button> 57 <button id="ping-button" onclick="do_ping()">Send Ping</button>
51 </div> 58 </div>
52 </div> 59 </div>
53 </div> 60 </div>
54 <h3>Filters</h3> 61 <h3>Filters</h3>
55 testpages.adblockplus.org/*^$ping 62 <pre>testpages.adblockplus.org/*^$ping</pre>
56 </section> 63 </section>
OLDNEW

Powered by Google App Engine
This is Rietveld