Skip to content

Commit 2e09157

Browse files
committed
Add the tests folder
1 parent 7310fb1 commit 2e09157

File tree

6 files changed

+55
-0
lines changed

6 files changed

+55
-0
lines changed

https-everywhere-tests/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Tests for HTTPS Everywhere
2+
3+
## Prerequisites
4+
* Latest release of the Firefox Add-On SDK: https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Installation
5+
6+
## Instructions
7+
1. Create a clean Firefox profile and install the HTTPS Everywhere XPI that you wish to test (TODO: script this).
8+
2. Copy the profile to `/tmp/test_profile` (TODO: make this configurable).
9+
3. Activate the Add-on SDK.
10+
4. cd to your HTTPS Everywhere repository root and run `./test.sh`.
11+
5. To add tests, put them in `./https-everywhere-tests/tests`.

https-everywhere-tests/doc/main.md

Whitespace-only changes.

https-everywhere-tests/lib/main.js

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "https-everywhere-tests",
3+
"title": "https-everywhere-tests",
4+
"id": "jid1-we5BQOfc6skSMg",
5+
"description": "a basic add-on",
6+
"author": "",
7+
"license": "MPL 2.0",
8+
"version": "0.1"
9+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Test that HTTPS Everywhere component is installed and accessible
2+
3+
const { Cc, Ci } = require("chrome");
4+
5+
let HTTPSEverywhere = Cc["@eff.org/https-everywhere;1"]
6+
.getService(Ci.nsISupports)
7+
.wrappedJSObject;
8+
9+
exports["test httpse installed"] = function(assert) {
10+
assert.equal(typeof HTTPSEverywhere, "object",
11+
"Test that HTTPSEverywhere is defined");
12+
assert.equal(typeof HTTPSEverywhere.observe, "function",
13+
"Test that HTTPSEverywhere.observe is a function");
14+
};
15+
16+
exports["test httpse potentiallyApplicableRulesets"] = function(assert) {
17+
let HTTPSRules = HTTPSEverywhere.https_rules;
18+
assert.deepEqual(HTTPSRules.potentiallyApplicableRulesets("www.eff.org").length,
19+
1,
20+
"Test that HTTPSE finds one applicable rule for www.eff.org");
21+
}
22+
23+
require("sdk/test").run(exports);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var main = require("./main");
2+
3+
exports["test main"] = function(assert) {
4+
assert.pass("Unit test running!");
5+
};
6+
7+
exports["test main async"] = function(assert, done) {
8+
assert.pass("async Unit test running!");
9+
done();
10+
};
11+
12+
require("sdk/test").run(exports);

0 commit comments

Comments
 (0)