forked from EFForg/https-everywhere
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-httpse-installed.js
More file actions
38 lines (32 loc) · 1.26 KB
/
test-httpse-installed.js
File metadata and controls
38 lines (32 loc) · 1.26 KB
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
// Test that HTTPS Everywhere component is installed and accessible
const { Cc, Ci } = require("chrome");
var tabs = require("sdk/tabs");
let HTTPSEverywhere = Cc["@eff.org/https-everywhere;1"]
.getService(Ci.nsISupports)
.wrappedJSObject;
exports["test httpse installed"] = function(assert) {
assert.equal(typeof HTTPSEverywhere, "object",
"Test that HTTPSEverywhere is defined");
assert.equal(typeof HTTPSEverywhere.observe, "function",
"Test that HTTPSEverywhere.observe is a function");
};
exports["test httpse potentiallyApplicableRulesets"] = function(assert) {
let HTTPSRules = HTTPSEverywhere.https_rules;
assert.deepEqual(HTTPSRules.potentiallyApplicableRulesets("www.eff.org").length,
1,
"Test that HTTPSE finds one applicable rule for www.eff.org");
}
exports["test sample ruleset"] = function(assert, done) {
tabs.open({
url: "http://www.reddit.com/robots.txt",
onOpen: function(tab) {
tab.on('load', function(tab) {
assert.equal(tab.url, "https://www.reddit.com/robots.txt",
"Test that Reddit URLs are rewritten to HTTPS.");
tab.close();
done();
});
}
});
}
require("sdk/test").run(exports);