Bug 1107336: Update marionette unit tests to use new marionette driver; r=jgriffin a=test-only
authorDavid Burns <dburns@mozilla.com>
Mon, 23 Feb 2015 14:46:40 +0000
changeset 257718 5c0363ee9a8552a1a3bb71d0132d6bf4b3304866
parent 257717 d5123c4a18ccaeb9009c9f3e8d6a77395599709c
child 257719 b4de64871d158173dda862d93e0125bb9827dded
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin, test-only
bugs1107336
milestone38.0a2
Bug 1107336: Update marionette unit tests to use new marionette driver; r=jgriffin a=test-only
testing/marionette/client/marionette/tests/unit/single_finger_functions.py
testing/marionette/client/marionette/tests/unit/test_accessibility.py
testing/marionette/client/marionette/tests/unit/test_anonymous_content.py
testing/marionette/client/marionette/tests/unit/test_appcache.py
testing/marionette/client/marionette/tests/unit/test_capabilities.py
testing/marionette/client/marionette/tests/unit/test_clearing.py
testing/marionette/client/marionette/tests/unit/test_click.py
testing/marionette/client/marionette/tests/unit/test_click_chrome.py
testing/marionette/client/marionette/tests/unit/test_click_scrolling.py
testing/marionette/client/marionette/tests/unit/test_date_time_value.py
testing/marionette/client/marionette/tests/unit/test_element_touch.py
testing/marionette/client/marionette/tests/unit/test_emulator.py
testing/marionette/client/marionette/tests/unit/test_errors.py
testing/marionette/client/marionette/tests/unit/test_execute_async_script.py
testing/marionette/client/marionette/tests/unit/test_execute_isolate.py
testing/marionette/client/marionette/tests/unit/test_execute_script.py
testing/marionette/client/marionette/tests/unit/test_expected.py
testing/marionette/client/marionette/tests/unit/test_findelement.py
testing/marionette/client/marionette/tests/unit/test_findelement_chrome.py
testing/marionette/client/marionette/tests/unit/test_implicit_waits.py
testing/marionette/client/marionette/tests/unit/test_import_script.py
testing/marionette/client/marionette/tests/unit/test_key_actions.py
testing/marionette/client/marionette/tests/unit/test_marionette.py
testing/marionette/client/marionette/tests/unit/test_modal_dialogs.py
testing/marionette/client/marionette/tests/unit/test_navigation.py
testing/marionette/client/marionette/tests/unit/test_profile_management.py
testing/marionette/client/marionette/tests/unit/test_screen_orientation.py
testing/marionette/client/marionette/tests/unit/test_set_window_size.py
testing/marionette/client/marionette/tests/unit/test_simpletest_sanity.py
testing/marionette/client/marionette/tests/unit/test_single_finger.py
testing/marionette/client/marionette/tests/unit/test_single_finger_desktop.py
testing/marionette/client/marionette/tests/unit/test_specialpowers.py
testing/marionette/client/marionette/tests/unit/test_submit.py
testing/marionette/client/marionette/tests/unit/test_switch_frame.py
testing/marionette/client/marionette/tests/unit/test_switch_frame_chrome.py
testing/marionette/client/marionette/tests/unit/test_text.py
testing/marionette/client/marionette/tests/unit/test_timeouts.py
testing/marionette/client/marionette/tests/unit/test_typing.py
testing/marionette/client/marionette/tests/unit/test_wait.py
testing/marionette/client/marionette/tests/unit/test_window_handles.py
testing/marionette/client/marionette/tests/unit/test_window_position.py
testing/marionette/client/marionette/tests/unit/test_window_switching.py
testing/marionette/client/marionette/tests/unit/test_with_using_context.py
--- a/testing/marionette/client/marionette/tests/unit/single_finger_functions.py
+++ b/testing/marionette/client/marionette/tests/unit/single_finger_functions.py
@@ -1,10 +1,10 @@
-from marionette import Actions
-from errors import TimeoutException
+from marionette_driver.marionette import Actions
+from marionette_driver.errors import TimeoutException
 
 def wait_for_condition_else_raise(marionette, wait_for_condition, expected, script):
     try:
         wait_for_condition(lambda m: expected in m.execute_script(script))
     except TimeoutException as e:
         raise TimeoutException(e.msg + " got %s instead of %s" % (marionette.execute_script(script), expected))
 
 def press_release(marionette, times, wait_for_condition, expected):
--- a/testing/marionette/client/marionette/tests/unit/test_accessibility.py
+++ b/testing/marionette/client/marionette/tests/unit/test_accessibility.py
@@ -1,15 +1,15 @@
 # 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_test import MarionetteTestCase
-from errors import ElementNotAccessibleException
-from errors import ElementNotVisibleException
+from marionette_driver.errors import (ElementNotAccessibleException,
+                                     ElementNotVisibleException)
 
 
 class TestAccessibility(MarionetteTestCase):
 
     # Elements that are accessible with and without the accessibliity API
     valid_elementIDs = [
         # Button1 is an accessible button with a valid accessible name
         # computed from subtree
--- a/testing/marionette/client/marionette/tests/unit/test_anonymous_content.py
+++ b/testing/marionette/client/marionette/tests/unit/test_anonymous_content.py
@@ -1,17 +1,18 @@
 # 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 HTMLElement
 from marionette_test import MarionetteTestCase
-from errors import NoSuchElementException
-from expected import element_present
-from wait import Wait
+
+from marionette_driver.errors import NoSuchElementException
+from marionette_driver.expected import element_present
+from marionette_driver.marionette import HTMLElement
+from marionette_driver.wait import Wait
 
 class TestAnonymousContent(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.current_window_handle
         self.marionette.execute_script("window.open('chrome://marionette/content/test_anonymous_content.xul', 'foo', 'chrome,centerscreen');")
         self.marionette.switch_to_window('foo')
--- a/testing/marionette/client/marionette/tests/unit/test_appcache.py
+++ b/testing/marionette/client/marionette/tests/unit/test_appcache.py
@@ -8,24 +8,24 @@
 #     http://www.apache.org/licenses/LICENSE-2.0
 #
 #Unless required by applicable law or agreed to in writing, software
 #distributed under the License is distributed on an "AS IS" BASIS,
 #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #See the License for the specific language governing permissions and
 #limitations under the License.
 
-from application_cache import ApplicationCache
+from marionette_driver.application_cache import ApplicationCache
 from marionette_test import MarionetteTestCase
 
 
 class AppCacheTests(MarionetteTestCase):
 
     def testWeCanGetTheStatusOfTheAppCache(self):
         test_url = self.marionette.absolute_url('html5Page')
         self.marionette.navigate(test_url)
         app_cache = self.marionette.application_cache
 
-        status = app_cache.status 
+        status = app_cache.status
         while status == ApplicationCache.DOWNLOADING:
             status = app_cache.status
 
         self.assertEquals(ApplicationCache.UNCACHED, app_cache.status)
--- a/testing/marionette/client/marionette/tests/unit/test_capabilities.py
+++ b/testing/marionette/client/marionette/tests/unit/test_capabilities.py
@@ -1,14 +1,14 @@
 # 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_test import MarionetteTestCase
-from errors import SessionNotCreatedException
+from marionette_driver.errors import SessionNotCreatedException
 
 class TestCapabilities(MarionetteTestCase):
     def setUp(self):
         super(TestCapabilities, self).setUp()
         self.caps = self.marionette.session_capabilities
         self.marionette.set_context("chrome")
         self.appinfo = self.marionette.execute_script(
             "return Services.appinfo")
--- a/testing/marionette/client/marionette/tests/unit/test_clearing.py
+++ b/testing/marionette/client/marionette/tests/unit/test_clearing.py
@@ -1,14 +1,14 @@
 # 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_test import MarionetteTestCase
-from errors import InvalidElementStateException
+from marionette_driver.errors import InvalidElementStateException
 
 class TestClear(MarionetteTestCase):
     def testWriteableTextInputShouldClear(self):
         test_html = self.marionette.absolute_url("test_clearing.html")
         self.marionette.navigate(test_html)
         element = self.marionette.find_element("id", "writableTextInput")
         element.clear()
         self.assertEqual("", element.get_attribute("value"))
@@ -51,17 +51,17 @@ class TestClear(MarionetteTestCase):
             pass
 
     def testContentEditableAreaShouldClear(self):
         test_html = self.marionette.absolute_url("test_clearing.html")
         self.marionette.navigate(test_html)
         element = self.marionette.find_element("id","content-editable")
         element.clear()
         self.assertEqual("", element.text)
-        
+
     def testTextInputShouldNotClearWhenDisabled(self):
         test_html = self.marionette.absolute_url("test_clearing.html")
         self.marionette.navigate(test_html)
         try:
             element = self.marionette.find_element("id","textInputnotenabled")
             self.assertFalse(element.is_enabled())
             element.clear()
             self.fail("Should not have been able to clear")
--- a/testing/marionette/client/marionette/tests/unit/test_click.py
+++ b/testing/marionette/client/marionette/tests/unit/test_click.py
@@ -1,16 +1,16 @@
 # 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 by import By
-from errors import NoSuchElementException, ElementNotVisibleException
+from marionette_driver.by import By
+from marionette_driver.errors import NoSuchElementException, ElementNotVisibleException
 from marionette_test import MarionetteTestCase
-from wait import Wait
+from marionette_driver.wait import Wait
 
 
 class TestClick(MarionetteTestCase):
     def test_click(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         link = self.marionette.find_element(By.ID, "mozLink")
         link.click()
--- a/testing/marionette/client/marionette/tests/unit/test_click_chrome.py
+++ b/testing/marionette/client/marionette/tests/unit/test_click_chrome.py
@@ -1,14 +1,14 @@
 # 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_test import MarionetteTestCase
-from by import By
+from marionette_driver.by import By
 
 
 class TestClickChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.current_window_handle
         self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', 'foo', 'chrome,centerscreen');")
--- a/testing/marionette/client/marionette/tests/unit/test_click_scrolling.py
+++ b/testing/marionette/client/marionette/tests/unit/test_click_scrolling.py
@@ -1,14 +1,14 @@
 # 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 by import By
-from errors import MoveTargetOutOfBoundsException
+from marionette_driver.by import By
+from marionette_driver.errors import MoveTargetOutOfBoundsException
 from marionette_test import MarionetteTestCase, skip
 
 
 class TestClickScrolling(MarionetteTestCase):
 
     def test_clicking_on_anchor_scrolls_page(self):
         scrollScript = """
             var pageY;
--- a/testing/marionette/client/marionette/tests/unit/test_date_time_value.py
+++ b/testing/marionette/client/marionette/tests/unit/test_date_time_value.py
@@ -1,15 +1,15 @@
 # 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_test import MarionetteTestCase
 from datetime import datetime
-from date_time_value import DateTimeValue
+from marionette_driver.date_time_value import DateTimeValue
 
 class TestDateTime(MarionetteTestCase):
 
     def test_set_date(self):
         test_html = self.marionette.absolute_url("datetimePage.html")
         self.marionette.navigate(test_html)
 
         element = self.marionette.find_element("id", "date-test")
--- a/testing/marionette/client/marionette/tests/unit/test_element_touch.py
+++ b/testing/marionette/client/marionette/tests/unit/test_element_touch.py
@@ -1,14 +1,14 @@
 # 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_test import MarionetteTestCase
-from errors import MarionetteException
+from marionette_driver.errors import MarionetteException
 
 class testElementTouch(MarionetteTestCase):
     def test_touch(self):
       testAction = self.marionette.absolute_url("testAction.html")
       self.marionette.navigate(testAction)
       button = self.marionette.find_element("id", "button1")
       button.tap()
       expected = "button1-touchstart-touchend-mousemove-mousedown-mouseup-click"
--- a/testing/marionette/client/marionette/tests/unit/test_emulator.py
+++ b/testing/marionette/client/marionette/tests/unit/test_emulator.py
@@ -1,14 +1,15 @@
 # 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_test import MarionetteTestCase
-from errors import JavascriptException, MarionetteException
+from marionette_driver.errors import (JavascriptException,
+                                      MarionetteException)
 
 
 class TestEmulatorContent(MarionetteTestCase):
 
     def test_emulator_cmd(self):
         self.marionette.set_script_timeout(10000)
         expected = ["<build>",
                     "OK"]
--- a/testing/marionette/client/marionette/tests/unit/test_errors.py
+++ b/testing/marionette/client/marionette/tests/unit/test_errors.py
@@ -1,18 +1,17 @@
 # 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/.
 
 import sys
 
-import errors
 import marionette_test
-
-from errors import ErrorCodes
+from marionette_driver import errors
+from marionette_driver.errors import ErrorCodes
 
 def fake_cause():
     try:
         raise ValueError("bar")
     except ValueError as e:
         return sys.exc_info()
 
 message = "foo"
--- a/testing/marionette/client/marionette/tests/unit/test_execute_async_script.py
+++ b/testing/marionette/client/marionette/tests/unit/test_execute_async_script.py
@@ -1,14 +1,16 @@
 # 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_test import MarionetteTestCase
-from errors import JavascriptException, MarionetteException, ScriptTimeoutException
+from marionette_driver.errors import ( JavascriptException,
+                                       MarionetteException,
+                                       ScriptTimeoutException )
 import time
 
 
 class TestExecuteAsyncContent(MarionetteTestCase):
     def setUp(self):
         super(TestExecuteAsyncContent, self).setUp()
         self.marionette.set_script_timeout(1000)
 
--- a/testing/marionette/client/marionette/tests/unit/test_execute_isolate.py
+++ b/testing/marionette/client/marionette/tests/unit/test_execute_isolate.py
@@ -1,14 +1,16 @@
 # 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_test import MarionetteTestCase, skip_if_b2g
-from errors import JavascriptException, MarionetteException, ScriptTimeoutException
+from marionette_driver.errors import (JavascriptException,
+                                      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
--- a/testing/marionette/client/marionette/tests/unit/test_execute_script.py
+++ b/testing/marionette/client/marionette/tests/unit/test_execute_script.py
@@ -1,16 +1,16 @@
 # 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/.
 
 import urllib
 
-from by import By
-from errors import JavascriptException, MarionetteException
+from marionette_driver.by import By
+from marionette_driver.errors import JavascriptException, MarionetteException
 from marionette_test import MarionetteTestCase
 
 def inline(doc):
     return "data:text/html;charset=utf-8,%s" % urllib.quote(doc)
 
 elements = inline("<p>foo</p> <p>bar</p>")
 
 class TestExecuteContent(MarionetteTestCase):
--- a/testing/marionette/client/marionette/tests/unit/test_expected.py
+++ b/testing/marionette/client/marionette/tests/unit/test_expected.py
@@ -1,18 +1,19 @@
 # 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/.
 
 import urllib
 
-import expected
+from marionette_driver import expected
+from marionette_driver.by import By
+
 import marionette_test
 
-from by import By
 
 def inline(doc):
     return "data:text/html;charset=utf-8,%s" % urllib.quote(doc)
 
 static_element = inline("""<p>foo</p>""")
 static_elements = static_element + static_element
 
 remove_element_by_tag_name = \
--- a/testing/marionette/client/marionette/tests/unit/test_findelement.py
+++ b/testing/marionette/client/marionette/tests/unit/test_findelement.py
@@ -1,16 +1,16 @@
 # 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_test import MarionetteTestCase
-from marionette import HTMLElement
-from by import By
-from errors import NoSuchElementException, InvalidSelectorException
+from marionette_driver.marionette import HTMLElement
+from marionette_driver.by import By
+from marionette_driver.errors import NoSuchElementException, InvalidSelectorException
 
 
 class TestElements(MarionetteTestCase):
     def test_id(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         el = self.marionette.execute_script("return window.document.getElementById('mozLink');")
         found_el = self.marionette.find_element(By.ID, "mozLink")
--- a/testing/marionette/client/marionette/tests/unit/test_findelement_chrome.py
+++ b/testing/marionette/client/marionette/tests/unit/test_findelement_chrome.py
@@ -1,16 +1,16 @@
 # 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_test import MarionetteTestCase
-from marionette import HTMLElement
-from by import By
-from errors import NoSuchElementException
+from marionette_driver.marionette import HTMLElement
+from marionette_driver.by import By
+from marionette_driver.errors import NoSuchElementException
 
 
 class TestElementsChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.current_window_handle
         self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', 'foo', 'chrome,centerscreen');")
--- a/testing/marionette/client/marionette/tests/unit/test_implicit_waits.py
+++ b/testing/marionette/client/marionette/tests/unit/test_implicit_waits.py
@@ -1,14 +1,14 @@
 # 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_test import MarionetteTestCase
-from errors import NoSuchElementException
+from marionette_driver.errors import NoSuchElementException
 
 class TestImplicitWaits(MarionetteTestCase):
     def testShouldImplicitlyWaitForASingleElement(self):
         test_html = self.marionette.absolute_url("test_dynamic.html")
         self.marionette.navigate(test_html)
         add = self.marionette.find_element("id", "adder")
         self.marionette.set_search_timeout("30000")
         add.click()
--- a/testing/marionette/client/marionette/tests/unit/test_import_script.py
+++ b/testing/marionette/client/marionette/tests/unit/test_import_script.py
@@ -1,36 +1,36 @@
 # 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/.
 
 import os
 from marionette_test import MarionetteTestCase
-from errors import JavascriptException
+from marionette_driver.errors import JavascriptException
 
 class TestImportScript(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
 
     def clear_other_context(self):
         self.marionette.set_context("chrome")
         self.marionette.clear_imported_scripts()
         self.marionette.set_context("content")
 
     def check_file_exists(self):
         return self.marionette.execute_script("""
           let FileUtils = SpecialPowers.Cu.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
-          let importedScripts = FileUtils.getFile('TmpD', ['marionetteContentScripts']); 
+          let importedScripts = FileUtils.getFile('TmpD', ['marionetteContentScripts']);
           return importedScripts.exists();
         """, special_powers=True)
 
     def get_file_size(self):
         return self.marionette.execute_script("""
           let FileUtils = SpecialPowers.Cu.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
-          let importedScripts = FileUtils.getFile('TmpD', ['marionetteContentScripts']); 
+          let importedScripts = FileUtils.getFile('TmpD', ['marionetteContentScripts']);
           return importedScripts.fileSize;
         """, special_powers=True)
 
     def test_import_script(self):
         js = os.path.abspath(os.path.join(__file__, os.path.pardir, "importscript.js"))
         self.marionette.import_script(js)
         self.assertEqual("i'm a test function!", self.marionette.execute_script("return testFunc();"))
         self.assertEqual("i'm a test function!", self.marionette.execute_async_script("marionetteScriptFinished(testFunc());"))
@@ -104,17 +104,17 @@ class TestImportScript(MarionetteTestCas
         firstjs = os.path.abspath(
                 os.path.join(__file__, os.path.pardir, "importscript.js"))
         secondjs = os.path.abspath(
                 os.path.join(__file__, os.path.pardir, "importanotherscript.js"))
 
         self.marionette.import_script(firstjs)
         self.marionette.import_script(secondjs)
 
-        self.assertEqual("i'm a test function!", 
+        self.assertEqual("i'm a test function!",
                 self.marionette.execute_script("return testFunc();"))
 
         self.assertEqual("i'm yet another test function!",
                     self.marionette.execute_script("return testAnotherFunc();"))
 
 class TestImportScriptChrome(TestImportScript):
     def setUp(self):
         MarionetteTestCase.setUp(self)
@@ -124,19 +124,19 @@ class TestImportScriptChrome(TestImportS
     def clear_other_context(self):
         self.marionette.set_context("content")
         self.marionette.clear_imported_scripts()
         self.marionette.set_context("chrome")
 
     def check_file_exists(self):
         return self.marionette.execute_async_script("""
           let FileUtils = Components.utils.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
-          let importedScripts = FileUtils.getFile('TmpD', ['marionetteChromeScripts']); 
+          let importedScripts = FileUtils.getFile('TmpD', ['marionetteChromeScripts']);
           marionetteScriptFinished(importedScripts.exists());
         """)
 
     def get_file_size(self):
         return self.marionette.execute_async_script("""
           let FileUtils = Components.utils.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
-          let importedScripts = FileUtils.getFile('TmpD', ['marionetteChromeScripts']); 
+          let importedScripts = FileUtils.getFile('TmpD', ['marionetteChromeScripts']);
           marionetteScriptFinished(importedScripts.fileSize);
         """)
 
--- a/testing/marionette/client/marionette/tests/unit/test_key_actions.py
+++ b/testing/marionette/client/marionette/tests/unit/test_key_actions.py
@@ -1,17 +1,17 @@
 # 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_test import (MarionetteTestCase,
                              skip_if_b2g,
                              skip_if_e10s)
-from keys import Keys
-from marionette import Actions
+from marionette_driver.keys import Keys
+from marionette_driver.marionette import Actions
 
 class TestKeyActions(MarionetteTestCase):
 
     def setUp(self):
         MarionetteTestCase.setUp(self)
         if self.marionette.session_capabilities['platformName'] == 'DARWIN':
             self.mod_key = Keys.META
         else:
--- a/testing/marionette/client/marionette/tests/unit/test_marionette.py
+++ b/testing/marionette/client/marionette/tests/unit/test_marionette.py
@@ -1,13 +1,13 @@
 # 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/.
 
-import errors
+from marionette_driver import errors
 import marionette_test
 
 
 class TestHandleError(marionette_test.MarionetteTestCase):
     def test_malformed_packet(self):
         for t in [{}, {"error": None}]:
             with self.assertRaisesRegexp(errors.MarionetteException, "Malformed packet"):
                 self.marionette._handle_error(t)
--- a/testing/marionette/client/marionette/tests/unit/test_modal_dialogs.py
+++ b/testing/marionette/client/marionette/tests/unit/test_modal_dialogs.py
@@ -1,16 +1,16 @@
 # 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_test import MarionetteTestCase, skip_if_e10s
-from errors import NoAlertPresentException, ElementNotVisibleException
-from marionette import Alert
-from wait import Wait
+from marionette_driver.errors import NoAlertPresentException, ElementNotVisibleException
+from marionette_driver.marionette import Alert
+from marionette_driver.wait import Wait
 
 class TestTabModals(MarionetteTestCase):
 
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.enforce_gecko_prefs({"prompts.tab_modal.enabled": True})
         self.marionette.navigate(self.marionette.absolute_url('modal_dialogs.html'))
 
--- a/testing/marionette/client/marionette/tests/unit/test_navigation.py
+++ b/testing/marionette/client/marionette/tests/unit/test_navigation.py
@@ -1,14 +1,14 @@
 # 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_test import MarionetteTestCase, skip_if_b2g, skip_if_e10s
-from errors import MarionetteException, TimeoutException
+from marionette_driver.errors import MarionetteException, TimeoutException
 
 class TestNavigate(MarionetteTestCase):
     def test_navigate(self):
         self.assertTrue(self.marionette.execute_script("window.location.href = 'about:blank'; return true;"))
         self.assertEqual("about:blank", self.marionette.execute_script("return window.location.href;"))
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         self.assertNotEqual("about:blank", self.marionette.execute_script("return window.location.href;"))
--- a/testing/marionette/client/marionette/tests/unit/test_profile_management.py
+++ b/testing/marionette/client/marionette/tests/unit/test_profile_management.py
@@ -1,14 +1,14 @@
 # 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/.
 
 import os
-from errors import JavascriptException
+from marionette_driver.errors import JavascriptException
 from marionette_test import MarionetteTestCase
 
 class TestLog(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.enforce_gecko_prefs({"marionette.test.bool": True, "marionette.test.string": "testing", "marionette.test.int": 3})
 
     def test_preferences_are_set(self):
--- a/testing/marionette/client/marionette/tests/unit/test_screen_orientation.py
+++ b/testing/marionette/client/marionette/tests/unit/test_screen_orientation.py
@@ -1,15 +1,15 @@
 # -*- fill-column: 100; comment-column: 100; -*-
 
 # 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 errors import MarionetteException
+from marionette_driver.errors import MarionetteException
 from marionette_test import MarionetteTestCase
 from mozrunner.devices.emulator_screen import EmulatorScreen
 
 default_orientation = "portrait-primary"
 unknown_orientation = "Unknown screen orientation: %s"
 
 class TestScreenOrientation(MarionetteTestCase):
     def tearDown(self):
--- a/testing/marionette/client/marionette/tests/unit/test_set_window_size.py
+++ b/testing/marionette/client/marionette/tests/unit/test_set_window_size.py
@@ -1,13 +1,13 @@
 # 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 errors import MarionetteException
+from marionette_driver.errors import MarionetteException
 from marionette_test import MarionetteTestCase
 
 class TestSetWindowSize(MarionetteTestCase):
     def setUp(self):
         super(MarionetteTestCase, self).setUp()
         self.start_size = self.marionette.window_size
         self.max_width = self.marionette.execute_script("return window.screen.availWidth;")
         self.max_height = self.marionette.execute_script("return window.screen.availHeight;")
--- a/testing/marionette/client/marionette/tests/unit/test_simpletest_sanity.py
+++ b/testing/marionette/client/marionette/tests/unit/test_simpletest_sanity.py
@@ -1,14 +1,16 @@
 # 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_test import MarionetteTestCase
-from errors import JavascriptException, MarionetteException, ScriptTimeoutException
+from marionette_driver.errors import (JavascriptException,
+                                      MarionetteException,
+                                      ScriptTimeoutException)
 
 class SimpletestSanityTest(MarionetteTestCase):
 
     callFinish = "return finish();"
 
     def test_is(self):
         def runtests():
             sentFail1 = "is(true, false, 'isTest1', TEST_UNEXPECTED_FAIL, TEST_PASS);" + self.callFinish
--- a/testing/marionette/client/marionette/tests/unit/test_single_finger.py
+++ b/testing/marionette/client/marionette/tests/unit/test_single_finger.py
@@ -1,15 +1,15 @@
 # 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_test import MarionetteTestCase
-from marionette import Actions
-from errors import MarionetteException
+from marionette_driver.marionette import Actions
+from marionette_driver.errors import MarionetteException
 #add this directory to the path
 import os
 import sys
 sys.path.append(os.path.dirname(__file__))
 from single_finger_functions import (
         chain, chain_flick, context_menu, double_tap,
         long_press_action, long_press_on_xy_action,
         move_element, move_element_offset, press_release, single_tap, wait,
--- a/testing/marionette/client/marionette/tests/unit/test_single_finger_desktop.py
+++ b/testing/marionette/client/marionette/tests/unit/test_single_finger_desktop.py
@@ -1,11 +1,11 @@
 from marionette_test import MarionetteTestCase
-from marionette import Actions
-from errors import MarionetteException
+from marionette_driver.marionette import Actions
+from marionette_driver.errors import MarionetteException
 #add this directory to the path
 import os
 import sys
 sys.path.append(os.path.dirname(__file__))
 from single_finger_functions import (
         chain, chain_flick, context_menu, double_tap,
         long_press_action, long_press_on_xy_action,
         move_element, move_element_offset, press_release, single_tap, wait,
--- a/testing/marionette/client/marionette/tests/unit/test_specialpowers.py
+++ b/testing/marionette/client/marionette/tests/unit/test_specialpowers.py
@@ -1,26 +1,26 @@
 # 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_test import MarionetteTestCase
-from errors import JavascriptException, MarionetteException
+from marionette_driver.errors import JavascriptException, MarionetteException
 
 class TestSpecialPowersContent(MarionetteTestCase):
 
     testpref = "testing.marionette.contentcharpref"
     testvalue = "blabla"
 
     def test_prefs(self):
         result = self.marionette.execute_script("""
         SpecialPowers.setCharPref("%(pref)s", "%(value)s");
         return SpecialPowers.getCharPref("%(pref)s")
         """ % {'pref': self.testpref, 'value': self.testvalue}, special_powers=True);
-        self.assertEqual(result, self.testvalue) 
+        self.assertEqual(result, self.testvalue)
 
     def test_prefs_after_navigate(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         self.test_prefs()
 
 class TestSpecialPowersChrome(TestSpecialPowersContent):
 
--- a/testing/marionette/client/marionette/tests/unit/test_submit.py
+++ b/testing/marionette/client/marionette/tests/unit/test_submit.py
@@ -1,19 +1,18 @@
 # 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/.
 
 import time
 
-from by import By
-from errors import NoSuchElementException
+from marionette_driver.by import By
+from marionette_driver.errors import NoSuchElementException
+from marionette_driver.wait import Wait
 from marionette_test import MarionetteTestCase
-from wait import Wait
-
 
 class TestSubmit(MarionetteTestCase):
 
     def test_should_be_able_to_submit_forms(self):
         test_html = self.marionette.absolute_url("formPage.html")
         self.marionette.navigate(test_html)
         self.marionette.find_element(By.NAME, "login").submit()
         for x in xrange(1, 10):
--- a/testing/marionette/client/marionette/tests/unit/test_switch_frame.py
+++ b/testing/marionette/client/marionette/tests/unit/test_switch_frame.py
@@ -1,15 +1,15 @@
 # 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_test import MarionetteTestCase
-from errors import JavascriptException
-from errors import NoSuchFrameException
+from marionette_driver.errors import (JavascriptException,
+                                      NoSuchFrameException)
 
 
 class TestSwitchFrame(MarionetteTestCase):
     def test_switch_simple(self):
         start_url = "test_iframe.html"
         verify_title = "Marionette IFrame Test"
         test_html = self.marionette.absolute_url(start_url)
         self.marionette.navigate(test_html)
--- a/testing/marionette/client/marionette/tests/unit/test_switch_frame_chrome.py
+++ b/testing/marionette/client/marionette/tests/unit/test_switch_frame_chrome.py
@@ -1,15 +1,15 @@
 # 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_test import MarionetteTestCase
-from errors import JavascriptException
-from by import By
+from marionette_driver.errors import JavascriptException
+from marionette_driver.by import By
 
 class TestSwitchFrameChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.current_window_handle
         self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', 'foo', 'chrome,centerscreen');")
         self.marionette.switch_to_window('foo')
@@ -43,14 +43,8 @@ class TestSwitchFrameChrome(MarionetteTe
     def test_stack_trace(self):
         self.assertIn("test.xul", self.marionette.get_url(), "Initial navigation has failed")
         self.marionette.switch_to_frame(0)
         self.assertRaises(JavascriptException, self.marionette.execute_async_script, "foo();")
         try:
             self.marionette.execute_async_script("foo();")
         except JavascriptException as e:
             self.assertIn("foo", e.msg)
-
-    def test_we_can_switch_to_a_browser_frame(self):
-        self.assertIn("test.xul", self.marionette.get_url(), "Initial navigation has failed")
-        browser = self.marionette.find_element(By.ID, 'aBrowser')
-        self.marionette.switch_to_frame(browser)
-        self.assertIn("test2.xul", self.marionette.get_url(), "Switching by element failed")
--- a/testing/marionette/client/marionette/tests/unit/test_text.py
+++ b/testing/marionette/client/marionette/tests/unit/test_text.py
@@ -1,14 +1,14 @@
 # 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_test import MarionetteTestCase
-from keys import Keys
+from marionette_driver.keys import Keys
 
 
 class TestText(MarionetteTestCase):
     def test_getText(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         l = self.marionette.find_element("id", "mozLink")
         self.assertEqual("Click me!", l.text)
--- a/testing/marionette/client/marionette/tests/unit/test_timeouts.py
+++ b/testing/marionette/client/marionette/tests/unit/test_timeouts.py
@@ -1,16 +1,19 @@
 # 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/.
 
 import os
 from marionette_test import MarionetteTestCase
-from marionette import HTMLElement
-from errors import NoSuchElementException, JavascriptException, MarionetteException, ScriptTimeoutException
+from marionette_driver.marionette import HTMLElement
+from marionette_driver.errors import (NoSuchElementException,
+                                      JavascriptException,
+                                      MarionetteException,
+                                      ScriptTimeoutException)
 
 class TestTimeouts(MarionetteTestCase):
     def test_pagetimeout_notdefinetimeout_pass(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
 
     def test_pagetimeout_fail(self):
         self.marionette.timeouts("page load", 0)
--- a/testing/marionette/client/marionette/tests/unit/test_typing.py
+++ b/testing/marionette/client/marionette/tests/unit/test_typing.py
@@ -1,15 +1,15 @@
 # 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_test import MarionetteTestCase, skip_if_b2g
-from keys import Keys
-from errors import ElementNotVisibleException
+from marionette_driver.keys import Keys
+from marionette_driver.errors import ElementNotVisibleException
 
 
 class TestTyping(MarionetteTestCase):
 
     def testShouldFireKeyPressEvents(self):
         test_html = self.marionette.absolute_url("javascriptPage.html")
         self.marionette.navigate(test_html)
         keyReporter = self.marionette.find_element("id", "keyReporter")
--- a/testing/marionette/client/marionette/tests/unit/test_wait.py
+++ b/testing/marionette/client/marionette/tests/unit/test_wait.py
@@ -1,20 +1,21 @@
 # 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/.
 
 import sys
 import time
 
-import errors
-import wait
+from marionette_driver import errors
+from marionette_driver import wait
+from marionette_driver.wait import Wait
 
 from marionette_test import MarionetteTestCase
-from wait import Wait
+
 
 class TickingClock(object):
     def __init__(self, incr=1):
         self.ticks = 0
         self.increment = incr
 
     def sleep(self, dur):
         self.ticks += self.increment
--- a/testing/marionette/client/marionette/tests/unit/test_window_handles.py
+++ b/testing/marionette/client/marionette/tests/unit/test_window_handles.py
@@ -1,14 +1,14 @@
 # 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_test import MarionetteTestCase, skip_if_e10s
-from marionette import Keys
+from marionette_driver.keys import Keys
 
 
 class TestWindowHandles(MarionetteTestCase):
 
     @skip_if_e10s # Interactions with about: pages need e10s support (bug 1096488).
     def test_new_tab_window_handles(self):
         keys = [Keys.SHIFT]
         if self.marionette.session_capabilities['platformName'] == 'DARWIN':
@@ -87,16 +87,18 @@ class TestWindowHandles(MarionetteTestCa
             self.wait_for_condition(lambda mn: len(mn.window_handles) == i + 3)
             self.assertEqual(len(self.marionette.chrome_window_handles), 2)
 
         self.marionette.close_chrome_window()
         self.assertEqual(len(self.marionette.chrome_window_handles), 1)
         self.assertEqual(len(self.marionette.window_handles), 1)
         self.marionette.switch_to_window(start_tab)
 
+    # This sequence triggers an exception in Marionette:register with e10s on (bug 1120809).
+    @skip_if_e10s
     def test_tab_and_window_handles(self):
         start_tab = self.marionette.current_window_handle
         start_chrome_window = self.marionette.current_chrome_window_handle
         tab_open_page = self.marionette.absolute_url("windowHandles.html")
         window_open_page = self.marionette.absolute_url("test_windows.html")
 
         # Open a new tab and switch to it.
         self.marionette.navigate(tab_open_page)
--- a/testing/marionette/client/marionette/tests/unit/test_window_position.py
+++ b/testing/marionette/client/marionette/tests/unit/test_window_position.py
@@ -8,17 +8,17 @@
 #
 #Unless required by applicable law or agreed to in writing, software
 #distributed under the License is distributed on an "AS IS" BASIS,
 #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #See the License for the specific language governing permissions and
 #limitations under the License.
 
 from marionette_test import MarionetteTestCase
-from errors import MarionetteException
+from marionette_driver.errors import MarionetteException
 
 class TestWindowPosition(MarionetteTestCase):
 
     def test_that_we_return_the_window_position(self):
         position = self.marionette.get_window_position()
         self.assertTrue(isinstance(position['x'], int))
         self.assertTrue(isinstance(position['y'], int))
 
--- a/testing/marionette/client/marionette/tests/unit/test_window_switching.py
+++ b/testing/marionette/client/marionette/tests/unit/test_window_switching.py
@@ -1,16 +1,17 @@
 # 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 by import By
-from errors import NoSuchElementException
 from marionette_test import MarionetteTestCase
-from wait import Wait
+
+from marionette_driver.by import By
+from marionette_driver.errors import NoSuchElementException
+from marionette_driver.wait import Wait
 
 
 class TestWindowSwitching(MarionetteTestCase):
     def testJSWindowCreationAndSwitching(self):
         test_html = self.marionette.absolute_url("test_windows.html")
         self.marionette.navigate(test_html)
 
         self.current_window = self.marionette.current_window_handle
--- a/testing/marionette/client/marionette/tests/unit/test_with_using_context.py
+++ b/testing/marionette/client/marionette/tests/unit/test_with_using_context.py
@@ -1,14 +1,14 @@
 # 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_test import MarionetteTestCase
-from errors import MarionetteException
+from marionette_driver.errors import MarionetteException
 
 
 class TestSetContext(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
 
         # shortcuts to improve readability of these tests
         self.chrome = self.marionette.CONTEXT_CHROME