-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-tests.html
38 lines (38 loc) · 1.94 KB
/
run-tests.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="cache-control" content="no-cache">
</head>
<body>
<h1>Test runner</h1>
<h2 style="background-color: palevioletred">Important note</h2>
<p>For this test extension to run properly, you need a 'static' web-server running, to represent a 'remote' website. To do this, run
<ul>
<li>cd location-of-this-extension-on-disc</li>
<li>ruby -run -ehttpd . -p8000</li>
</ul>
We're using ruby to run a static web-server on port 8000, returning files from the extension folder. If you don't have ruby,
try another <a href="https://gist.github.com/willurd/5720255">one-liner</a>.
<h2>What's going on</h2>
<p>We're testing web-request interception for ajax-calls made from extension content-scripts.
Specifically, we're checking that the reported tabId and frameId (of the ajax-call) match that of the web-page running the content script.
</p>
<p>
Opening this web-page triggers the tests. An iframe is created, either on the extension's background page, or on a visible tab. The iframe loads a web-page, along with
a content script. The content script makes an ajax call. All web-requests are intercepted using a chrome.webRequest.onBeforeRequest listener.
</p>
<p>For all web-requests, we expect the tabId and frameId to match. To see if this happened:
<ul>
<li>From the Chrome extensions page, view the extension console log using: 'Inspect views: background page'. Web-request details are output there</li>
<li>Or, look at the 'Outcome' and 'Status' and sections below. They should be updated once the tests has run.</li>
</ul>
</p>
<p>Chrome 50 behaves as expected: tabId and frameId match for all requests.</p>
<h2>Outcome</h2>
<div id="outcome"></div>
<h2>Status</h2>
<div id="status"></div>
<script src="js/test-runner.js"></script>
</body>
</html>