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

Unified Diff: pages/filters/xmlhttprequest.tmpl

Issue 29755578: Issue 2148 - Rewrite the testpages test suite (Closed)
Patch Set: Created April 18, 2018, 11:54 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pages/filters/xmlhttprequest.tmpl
===================================================================
new file mode 100644
--- /dev/null
+++ b/pages/filters/xmlhttprequest.tmpl
@@ -0,0 +1,57 @@
+title = $xmlhttprequest - ABP Test Pages
+template = testcase
+
+{% set testcase_moreinfo = [
+ ("Filter Options", "https://adblockplus.org/filters#options"),
+] %}
+
+<script>
+function pagelog(message) {
+ var log = document.getElementById("testcase-fo-xmlhttprequest");
+ log.innerText = log.innerText + message + "\n";
+ console.log(message);
+}
+
+function aborted(evt) {
+ pagelog("XMLHTTPRequest was aborted.");
+}
+
+function failed(evt) {
+ pagelog("XMLHTTPRequest failed.");
+}
+
+function makerequest() {
+ var req = new XMLHttpRequest();
+ req.addEventListener("error", failed);
+ req.addEventListener("abort", aborted);
+ req.open("GET", "https://testpages.adblockplus.org/testcasefiles/xmlhttprequest/text.txt", true);
+ req.onload = function(e) {
+ if (this.status == 200) {
+ pagelog(this.responseText);
+ }
+ };
+ req.send();
+}
+
+document.addEventListener('DOMContentLoaded', makerequest, false);
+</script>
+
+<section class="site-panel">
+ <h2>$xmlhttprequest</h2>
+ <p>Check that usage of the $xmlhttprequest filter option works as expected.</p>
+</section>
+
+<section class="site-panel">
+ <h2>Test case</h2>
+ <p>The XMLHTTPRequest should be blocked. The Image should not be blocked.</p>
+ <div class="testcase-container">
+ <div class="testcase-row">
+ <h3>XMLHTTPRequest</h3><div id="testcase-fo-xmlhttprequest"></div>
+ </div>
+ <div class="testcase-row">
+ <h3>Image</h3><img class="testcase-image" src="/testcasefiles/xmlhttprequest/image.jpg"/>
+ </div>
+ </div>
+ <h3>Filters</h3>
+ testpages.adblockplus.org/testcasefiles/xmlhttprequest/$xmlhttprequest
+</section>

Powered by Google App Engine
This is Rietveld