GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 3f07e512 authored by Alex Catarineu's avatar Alex Catarineu

Bug 30431: Fix the https-everywhere test

Temptatively fixing this flaky test by waiting until HTTPS Everywhere
has loaded some rulesets.

Also fix https-everywhere tests for builtin addon.
parent cd6aa441
......@@ -272,27 +272,12 @@ our @tests = (
type => 'marionette',
descr => 'Check that https everywhere is not doing anything when disabled',
use_net => 1,
pre => sub {
my ($tbbinfos, $t) = @_;
my $hdir = "$tbbinfos->{tmpdir}/https-everywhere";
mkdir "$hdir";
move($tbbinfos->{ffprofiledir} . '/extensions/https-everywhere-eff@eff.org.xpi',
$hdir . '/https-everywhere-eff@eff.org.xpi');
},
post => sub {
my ($tbbinfos, $t) = @_;
my $hdir = "$tbbinfos->{tmpdir}/https-everywhere";
move($hdir . '/https-everywhere-eff@eff.org.xpi',
$tbbinfos->{ffprofiledir} . '/extensions/https-everywhere-eff@eff.org.xpi');
},
},
{
name => 'https-everywhere',
type => 'marionette',
use_net => 1,
descr => 'Check that https everywhere is working',
# Bug 30431: temporarily disable test
enable => sub { undef },
},
{
name => 'settings',
......
from marionette_driver import By
from marionette_driver.errors import MarionetteException
from marionette_harness import MarionetteTestCase
from marionette_driver import Wait
import testsuite
class Test(MarionetteTestCase):
def setUp(self):
......@@ -17,13 +13,47 @@ class Test(MarionetteTestCase):
self.HTTP_URL = "http://httpbin.org/"
self.HTTPS_URL = "https://httpbin.org/"
self.is_disabled = self.ts.t['test']['name'] == 'https-everywhere-disabled'
if self.is_disabled:
with self.marionette.using_context('chrome'):
self.marionette.execute_async_script("""
let [resolve] = arguments;
const { AddonManager } = ChromeUtils.import(
"resource://gre/modules/AddonManager.jsm"
);
AddonManager.getAddonByID("https-everywhere-eff@eff.org")
.then(addon => addon.disable())
.then(resolve);
""")
def tearDown(self):
super(Test, self).tearDown()
if self.is_disabled:
with self.marionette.using_context('chrome'):
self.marionette.execute_async_script("""
let [resolve] = arguments;
const { AddonManager } = ChromeUtils.import(
"resource://gre/modules/AddonManager.jsm"
);
AddonManager.getAddonByID("https-everywhere-eff@eff.org")
.then(addon => addon.enable())
.then(resolve);
""")
def test_https_everywhere(self):
# Wait until .tor.onion rules have been loaded, to make sure HTTPS Everywhere
# has loaded correctly.
m = self.marionette
if not self.is_disabled:
with m.using_context('chrome'):
Wait(m, timeout=m.timeout.page_load).until(
lambda _: m.execute_script("return OnionAliasStore._onionMap.size;") > 0)
with self.marionette.using_context('content'):
self.marionette.navigate(self.HTTP_URL)
if self.ts.t['test']['name'] == 'https-everywhere':
if not self.is_disabled:
self.assertEqual(self.marionette.get_url(), self.HTTPS_URL)
else:
self.assertEqual(self.marionette.get_url(), self.HTTP_URL)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment