test_chrome_title.py (1205B)
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 from marionette_harness import MarionetteTestCase, parameterized, WindowManagerMixin 9 10 # add this directory to the path 11 sys.path.append(os.path.dirname(__file__)) 12 13 from chrome_handler_mixin import ChromeHandlerMixin 14 15 16 PAGE_XHTML = "test.xhtml" 17 PAGE_XUL = "test_xul.xhtml" 18 19 20 class TestTitleChrome(ChromeHandlerMixin, WindowManagerMixin, MarionetteTestCase): 21 def tearDown(self): 22 try: 23 self.close_all_windows() 24 finally: 25 super(TestTitleChrome, self).tearDown() 26 27 @parameterized("XUL", PAGE_XUL) 28 @parameterized("XHTML", PAGE_XHTML) 29 def test_get_title(self, chrome_url): 30 win = self.open_chrome_window(self.chrome_base_url + chrome_url) 31 self.marionette.switch_to_window(win) 32 33 with self.marionette.using_context("chrome"): 34 expected_title = self.marionette.execute_script( 35 "return window.document.title;" 36 ) 37 self.assertEqual(self.marionette.title, expected_title)