[Pkg-mozext-commits] [requestpolicy] 122/257: [tst][ref] auto-redirect: factor out navigate()

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:20:04 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 f1113be3aced1d0c47a7637cf703b2fe12d0ed23
Author: Martin Kimmerle <dev at 256k.de>
Date:   Thu Oct 29 23:20:08 2015 +0100

    [tst][ref] auto-redirect: factor out navigate()
---
 .../tests/redirections/test_auto_redirect.py       | 46 ++++++++++++++--------
 1 file changed, 29 insertions(+), 17 deletions(-)

diff --git a/tests/marionette/tests/redirections/test_auto_redirect.py b/tests/marionette/tests/redirections/test_auto_redirect.py
index 272f947..940a281 100644
--- a/tests/marionette/tests/redirections/test_auto_redirect.py
+++ b/tests/marionette/tests/redirections/test_auto_redirect.py
@@ -22,6 +22,10 @@ class TestAutoRedirect(RequestPolicyTestCase):
         finally:
             super(TestAutoRedirect, self).tearDown()
 
+    ################
+    # Test Methods #
+    ################
+
     def test_redirect_notification_appears_or_not(self):
         """Using some pages which cause redirections, this test ensures
         that the redirect notification appears when it's expected and stays
@@ -44,23 +48,7 @@ class TestAutoRedirect(RequestPolicyTestCase):
 
             initial_uri = self.marionette.get_url()
 
-            # Load the page, expecting a TimeoutException, because when
-            # RequestPolicy blocks a redirection, the page never loads.
-            with self.marionette.using_context("content"):
-                if self.browser_info.e10s_enabled:
-                    # Looks like with E10s enabled the TimeoutException
-                    # is not thrown.
-                    self.marionette.navigate(test_url)
-                else:
-                    # Set the timeout to a low value in order to speed up the
-                    # test.
-                    self.marionette.timeouts("page load", 100)
-
-                    self.assertRaises(TimeoutException,
-                                      self.marionette.navigate,
-                                      test_url)
-
-                    self.marionette.timeouts("page load", 20000)
+            self._navigate_expecting_r21n(test_url)
 
             self.assertTrue(self.redir.is_shown(),
                             "The redirect notification has been displayed.")
@@ -86,3 +74,27 @@ class TestAutoRedirect(RequestPolicyTestCase):
         test_no_appear("redirect-meta-tag-06-different-formatting.html")
         test_no_appear("redirect-meta-tag-07-different-formatting-delayed.html")
         test_no_appear("redirect-meta-tag-09-relative.html")
+
+    ##########################
+    # Private Helper Methods #
+    ##########################
+
+    def _navigate_expecting_r21n(self, url):
+        """Navigate to a URL, catching all expected exceptions."""
+
+        with self.marionette.using_context("content"):
+            if self.browser_info.e10s_enabled:
+                # On E10s there's no TimeoutException raised.
+                self.marionette.navigate(url)
+            else:
+                # On non-E10s, expect a TimeoutException, because when
+                # RequestPolicy blocks a redirection, the page never loads.
+
+                # Set the timeout to a low value in order to speed up the
+                # test.
+                self.marionette.timeouts("page load", 100)
+
+                self.assertRaises(TimeoutException, self.marionette.navigate,
+                                  url)
+
+                self.marionette.timeouts("page load", 20000)

-- 
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