testing/marionette/harness/marionette/tests/unit/test_execute_isolate.py
author Andreas Tolfsen <ato@mozilla.com>
Sat, 06 Feb 2016 17:34:10 +0000
changeset 285593 29caf02c0eb04ae7703b6dc18a6949ab74fae102
parent 231821 testing/marionette/client/marionette/tests/unit/test_execute_isolate.py@8add60e27b0a9210a092058a1afe20f36cf21f43
child 317078 cada890e8220de534eaa185bcb4f486ceb9f8883
permissions -rw-r--r--
Bug 1246407 - Rename parent directories for Marionette client and test harness; r=automatedtester This change moves testing/marionette/client to testing/marionette/harness, and testing/marionette/driver to testing/marionette/client. This parent directory name change reflects the true purpose of these Python packages. MozReview-Commit-ID: B0KrGzDTLlQ

# 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 marionette import MarionetteTestCase
from marionette_driver.errors import (MarionetteException,
                                      ScriptTimeoutException)

class TestExecuteIsolationContent(MarionetteTestCase):
    def setUp(self):
        super(TestExecuteIsolationContent, self).setUp()
        self.content = True

    def test_execute_async_isolate(self):
        # Results from one execute call that has timed out should not
        # contaminate a future call.
        multiplier = "*3" if self.content else "*1"
        self.marionette.set_script_timeout(500)
        self.assertRaises(ScriptTimeoutException,
                          self.marionette.execute_async_script,
                          ("setTimeout(function() { marionetteScriptFinished(5%s); }, 3000);"
                               % multiplier))

        self.marionette.set_script_timeout(6000)
        result = self.marionette.execute_async_script("""
setTimeout(function() { marionetteScriptFinished(10%s); }, 5000);
""" % multiplier)
        self.assertEqual(result, 30 if self.content else 10)

class TestExecuteIsolationChrome(TestExecuteIsolationContent):
    def setUp(self):
        super(TestExecuteIsolationChrome, self).setUp()
        self.marionette.set_context("chrome")
        self.content = False