def setUp(self):
        FirefoxTestCase.setUp(self)

        self.url = 'https://ssl-dv.mozqa.com/data/firefox/security/unencryptedsearch.html'
        self.test_string = 'mozilla'

        self.prefs.set_pref('security.warn_submit_insecure', True)
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.locationbar = self.browser.navbar.locationbar
        self.identity_popup = self.locationbar.identity_popup

        self.url = 'https://ssl-ev.mozqa.com/'
 def tearDown(self):
     try:
         self.browser.switch_to()
         self.identity_popup.close(force=True)
         self.windows.close_all([self.browser])
     finally:
         FirefoxTestCase.tearDown(self)
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.test_data = [
            # Phishing URL info
            {
                'button_property': 'safebrowsing.notAForgeryButton.label',
                'report_page': 'www.google.com/safebrowsing/report_error',
                'unsafe_page': 'https://www.itisatrap.org/firefox/its-a-trap.html'
            },
            # Malware URL object
            {
                'button_property': 'safebrowsing.notAnAttackButton.label',
                'report_page': 'www.stopbadware.org',
                'unsafe_page': 'https://www.itisatrap.org/firefox/its-an-attack.html'
            }
        ]

        self.prefs.set_pref('browser.safebrowsing.enabled', True)
        self.prefs.set_pref('browser.safebrowsing.malware.enabled', True)

        # Give the browser a little time, because SafeBrowsing.jsm takes a while
        # between start up and adding the example urls to the db.
        # hg.mozilla.org/mozilla-central/file/46aebcd9481e/browser/base/content/browser.js#l1194
        time.sleep(3)

        # TODO: Bug 1139544: While we don't have a reliable way to close the safe browsing
        # notification bar when a test fails, run this test in a new tab.
        self.browser.tabbar.open_tab()
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.locationbar = self.browser.navbar.locationbar
        self.identity_popup = self.locationbar.identity_popup

        self.url = self.marionette.absolute_url('layout/mozilla.html')
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.test_data = (
            {
                'url': 'https://ssl-dv.mozqa.com',
                'identity': '',
                'type': 'verifiedDomain'
            },
            {
                'url': 'https://ssl-ev.mozqa.com/',
                'identity': 'Mozilla Corporation',
                'type': 'verifiedIdentity'
            },
            {
                'url': 'https://ssl-ov.mozqa.com/',
                'identity': '',
                'type': 'verifiedDomain'
            }
        )

        # Set browser to restore previous session
        self.prefs.set_pref('browser.startup.page', 3)

        self.identity_popup = self.browser.navbar.locationbar.identity_popup
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.locationbar = self.browser.navbar.locationbar
        self.identity_popup = self.locationbar.identity_popup

        self.url = 'https://mozqa.com/data/firefox/security/mixedcontent.html'
 def tearDown(self):
     # Close the autocomplete results
     try:
         self.browser.navbar.locationbar.autocomplete_results.close()
         self.places.restore_default_bookmarks()
     finally:
         FirefoxTestCase.tearDown(self)
    def setUp(self):
        FirefoxTestCase.setUp(self)

        # Use a fake local support URL
        support_url = 'about:blank?'
        self.prefs.set_pref('app.support.baseURL', support_url)

        self.pb_url = support_url + 'private-browsing'
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.new_pref = 'marionette.unittest.set_pref'
        self.unknown_pref = 'marionette.unittest.unknown'

        self.bool_pref = 'browser.tabs.loadBookmarksInBackground'
        self.int_pref = 'browser.tabs.maxOpenBeforeWarn'
        self.string_pref = 'browser.newtab.url'
 def tearDown(self):
     try:
         self.autocomplete_results.close(force=True)
     except NoSuchElementException:
         # TODO: A NoSuchElementException is thrown here when tests accessing the
         # autocomplete_results element are skipped.
         pass
     finally:
         FirefoxTestCase.tearDown(self)
 def tearDown(self):
     try:
         self.identity_popup.close(force=True)
     except NoSuchElementException:
         # TODO: A NoSuchElementException may be thrown here when tests accessing the
         # identity_popup.popup element are skipped.
         pass
     finally:
         FirefoxTestCase.tearDown(self)
 def setUp(self):
     FirefoxTestCase.setUp(self)
     self.url = 'https://mozqa.com/data/firefox/security/mixed_content_blocked/index.html'
     self.test_elements = [
         ('result1', 'Insecure script one'),
         ('result2', 'Insecure script from iFrame'),
         ('result3', 'Insecure plugin'),
         ('result4', 'Insecure stylesheet'),
     ]
     self.locationbar = self.browser.navbar.locationbar
 def tearDown(self):
     try:
         self.identity_popup.close(force=True)
         self.windows.close_all([self.browser])
     except NoSuchElementException:
         # TODO: A NoSuchElementException may be thrown here when the test is skipped
         # as under xvfb.
         pass
     finally:
         FirefoxTestCase.tearDown(self)
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.locationbar = self.browser.navbar.locationbar
        self.identity_popup = self.locationbar.identity_popup

        self.url = 'https://ssl-ev.mozqa.com'

        with self.marionette.using_context('content'):
            self.marionette.navigate(self.url)
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.test_urls = [self.marionette.absolute_url("layout/mozilla_grants.html")]

        # Disable search suggestions to only get results for history and bookmarks
        self.prefs.set_pref(self.PREF_SUGGEST_SEARCHES, False)

        with self.marionette.using_context("content"):
            self.marionette.navigate("about:blank")

        self.places.remove_all_history()
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.url = 'https://tlsv1-0.mozqa.com'

        self.utils.sanitize({"sessions": True})

        # Disable SSL 3.0, TLS 1.0 and TLS 1.1 for secure connections
        # by forcing the use of TLS 1.2
        # see: http://kb.mozillazine.org/Security.tls.version.*#Possible_values_and_their_effects
        self.prefs.set_pref('security.tls.version.min', 3)
        self.prefs.set_pref('security.tls.version.max', 3)
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.test_urls = [self.marionette.absolute_url('layout/mozilla_grants.html')]

        # Location bar suggests 'History and Bookmarks'
        self.prefs.set_pref(self.PREF_LOCATION_BAR_SUGGEST, 0)

        with self.marionette.using_context('content'):
            self.marionette.navigate('about:blank')

        self.places.remove_all_history()
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.urls = [
            # Invalid cert page
            'https://ssl-expired.mozqa.com',
            # Secure page
            'https://ssl-ev.mozqa.com/',
            # Insecure page
            'http://www.mozqa.com'
        ]

        self.identity_box = self.browser.navbar.locationbar.identity_popup.box
    def setUp(self):
        FirefoxTestCase.setUp(self)

        # Clear complete history so there's no interference from previous entries.
        self.places.remove_all_history()

        self.test_urls = ["layout/mozilla.html", "layout/mozilla_community.html"]
        self.test_urls = [self.marionette.absolute_url(t) for t in self.test_urls]

        self.test_string = "mozilla"

        self.locationbar = self.browser.navbar.locationbar
        self.autocomplete_results = self.locationbar.autocomplete_results
    def setUp(self):
        FirefoxTestCase.setUp(self)

        def opener(win):
            self.marionette.execute_script("""
              let updatePrompt = Components.classes["@mozilla.org/updates/update-prompt;1"]
                                 .createInstance(Components.interfaces.nsIUpdatePrompt);
              updatePrompt.checkForUpdates();
            """)

        self.dialog = self.browser.open_window(callback=opener,
                                               expected_window_class=UpdateWizardDialog)
        self.wizard = self.dialog.wizard
    def setUp(self):
        FirefoxTestCase.setUp(self)

        # Disable search suggestions to get results only for history and bookmarks
        self.prefs.set_pref(self.PREF_SUGGEST_SEARCHES, False)

        self.places.remove_all_history()

        self.test_urls = [self.marionette.absolute_url('layout/mozilla.html')]

        self.test_string = 'mozilla'
        self.test_favicon = 'mozilla_favicon.ico'

        self.autocomplete_results = self.browser.navbar.locationbar.autocomplete_results
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.navbar = self.browser.navbar
        self.url = self.marionette.absolute_url('layout/mozilla.html')

        with self.marionette.using_context('content'):
            self.marionette.navigate('about:blank')

        # TODO: check why self.places.remove_all_history() does not work here
        self.marionette.execute_script("""
            let count = gBrowser.sessionHistory.count;
            gBrowser.sessionHistory.PurgeHistory(count);
        """)
    def setUp(self):
        FirefoxTestCase.setUp(self)

        # Clear complete history so there's no interference from previous entries.
        self.places.remove_all_history()

        self.test_urls = [
            'layout/mozilla_projects.html',
            'layout/mozilla.html',
            'layout/mozilla_mission.html'
        ]
        self.test_urls = [self.marionette.absolute_url(t)
                          for t in self.test_urls]

        self.locationbar = self.browser.navbar.locationbar
        self.autocomplete_results = self.locationbar.autocomplete_results
        self.urlbar = self.locationbar.urlbar
    def setUp(self):
        FirefoxTestCase.setUp(self)

        with self.marionette.using_context("content"):
            self.marionette.navigate("about:blank")

        self.marionette.execute_script("""
            let count = gBrowser.sessionHistory.count;
            gBrowser.sessionHistory.PurgeHistory(count);
        """)

        self.test_urls = [
            'layout/mozilla.html',
            'layout/mozilla_mission.html',
            'layout/mozilla_grants.html',
        ]
        self.test_urls = [self.marionette.absolute_url(t)
                          for t in self.test_urls]
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.urls = [
            # Phishing URL
            'https://www.itisatrap.org/firefox/its-a-trap.html',
            # Malware URL
            'https://www.itisatrap.org/firefox/its-an-attack.html'
        ]

        self.prefs.set_pref('browser.safebrowsing.enabled', True)
        self.prefs.set_pref('browser.safebrowsing.malware.enabled', True)

        # Give the browser a little time, because SafeBrowsing.jsm takes a
        # while between start up and adding the example urls to the db.
        # hg.mozilla.org/mozilla-central/file/46aebcd9481e/browser/base/content/browser.js#l1194
        time.sleep(3)

        # TODO: Bug 1139544: While we don't have a reliable way to close the safe browsing
        # notification bar when a test fails, run this test in a new tab.
        self.browser.tabbar.open_tab()
    def setUp(self):
        FirefoxTestCase.setUp(self)

        self.test_data = [
            # Unwanted software URL
            {
                # First two properties are not needed,
                # since these errors are not reported
                "button_property": None,
                "report_page": None,
                "unsafe_page": "https://www.itisatrap.org/firefox/unwanted.html",
            },
            # Phishing URL info
            {
                "button_property": "safebrowsing.notAForgeryButton.label",
                "report_page": "www.google.com/safebrowsing/report_error",
                "unsafe_page": "https://www.itisatrap.org/firefox/its-a-trap.html",
            },
            # Malware URL object
            {
                "button_property": "safebrowsing.notAnAttackButton.label",
                "report_page": "www.stopbadware.org",
                "unsafe_page": "https://www.itisatrap.org/firefox/its-an-attack.html",
            },
        ]

        self.prefs.set_pref("browser.safebrowsing.enabled", True)
        self.prefs.set_pref("browser.safebrowsing.malware.enabled", True)

        # Give the browser a little time, because SafeBrowsing.jsm takes a while
        # between start up and adding the example urls to the db.
        # hg.mozilla.org/mozilla-central/file/46aebcd9481e/browser/base/content/browser.js#l1194
        time.sleep(3)

        # TODO: Bug 1139544: While we don't have a reliable way to close the safe browsing
        # notification bar when a test fails, run this test in a new tab.
        self.browser.tabbar.open_tab()
 def tearDown(self):
     FirefoxTestCase.tearDown(self)
 def setUp(self):
     FirefoxTestCase.setUp(self)
     self.l10n = L10n(lambda: self.marionette)
 def tearDown(self):
     try:
         self.utils.remove_perms('www.itisatrap.org', 'safe-browsing')
         self.browser.tabbar.close_all_tabs([self.browser.tabbar.tabs[0]])
     finally:
         FirefoxTestCase.tearDown(self)