[Pkg-mozext-commits] [requestpolicy] 78/257: [tst][add] Marionette test: inline-redirections

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:19:59 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository requestpolicy.

commit 0efdd2fe17012b64c4dd618178d5a494e3f4851f
Author: Martin Kimmerle <dev at 256k.de>
Date:   Wed Oct 14 14:43:18 2015 +0200

    [tst][add] Marionette test: inline-redirections
    
    Convert Mozmill test
    "testRedirect/testInlineRedirect.js"
    to Marionette.
---
 tests/marionette/tests/redirections/manifest.ini   |  1 +
 .../tests/redirections/test_inline_redirect.py     | 46 ++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/tests/marionette/tests/redirections/manifest.ini b/tests/marionette/tests/redirections/manifest.ini
index 9c6b428..b3e145b 100644
--- a/tests/marionette/tests/redirections/manifest.ini
+++ b/tests/marionette/tests/redirections/manifest.ini
@@ -1 +1,2 @@
 [test_auto_redirect.py]
+[test_inline_redirect.py]
diff --git a/tests/marionette/tests/redirections/test_inline_redirect.py b/tests/marionette/tests/redirections/test_inline_redirect.py
new file mode 100644
index 0000000..c92f207
--- /dev/null
+++ b/tests/marionette/tests/redirections/test_inline_redirect.py
@@ -0,0 +1,46 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from rp_ui_harness.testcases import RequestPolicyTestCase
+import time
+
+
+PREF_DEFAULT_ALLOW = "extensions.requestpolicy.defaultPolicy.allow"
+
+
+class TestInlineRedirect(RequestPolicyTestCase):
+
+    def setUp(self):
+        super(TestInlineRedirect, self).setUp()
+
+        self.prefs.set_pref(PREF_DEFAULT_ALLOW, False)
+
+    def tearDown(self):
+        try:
+            self.prefs.reset_pref(PREF_DEFAULT_ALLOW)
+        finally:
+            super(TestInlineRedirect, self).tearDown()
+
+    def test_redirect_notification_doesnt_appear(self):
+        """This test ensures that the redirect notification is _not_ shown
+        when the URL of an inline element, such as <img>, causes a redirection.
+        """
+
+        def test_no_appear(path):
+            test_url = "http://www.maindomain.test/" + path
+
+            with self.marionette.using_context("content"):
+                self.marionette.navigate(test_url)
+
+            # Wait some time to be sure the test is not faster than the
+            # redirect notification.
+            # FIXME: Find a better solution than `sleep()`
+            time.sleep(0.1)
+
+            self.assertFalse(self.redir.is_shown(),
+                             "There's no redirect notification.")
+
+        test_no_appear("redirect-inline-image.html")
+        test_no_appear("redirect-iframe.html")
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git



More information about the Pkg-mozext-commits mailing list