tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_service_workers_at_startup.py (1041B)


      1 # This Source Code Form is subject to the terms of the Mozilla Public
      2 # License, v. 2.0. If a copy of the MPL was not distributed with this
      3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 
      5 import os
      6 import sys
      7 
      8 # Add this directory to the import path.
      9 sys.path.append(os.path.dirname(__file__))
     10 
     11 from marionette_driver import Wait
     12 from service_worker_utils import MarionetteServiceWorkerTestCase
     13 
     14 
     15 class ServiceWorkerAtStartupTestCase(MarionetteServiceWorkerTestCase):
     16    def setUp(self):
     17        super().setUp()
     18        self.install_service_worker("serviceworker/install_serviceworker.html")
     19 
     20    def tearDown(self):
     21        self.marionette.restart(in_app=False, clean=True)
     22        super().tearDown()
     23 
     24    def test_registered_service_worker_after_restart(self):
     25        self.marionette.restart()
     26 
     27        Wait(self.marionette).until(
     28            lambda _: self.is_service_worker_registered,
     29            message="Service worker not registered after restart",
     30        )
     31        self.assertTrue(self.is_service_worker_registered)