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
5from marionette_driver.by import By
6
7from marionette_harness import MarionetteTestCase, WindowManagerMixin
8
9
10class TestElementSizeChrome(WindowManagerMixin, MarionetteTestCase):
11
12    def setUp(self):
13        super(TestElementSizeChrome, self).setUp()
14
15        self.marionette.set_context("chrome")
16
17        def open_window_with_js():
18            self.marionette.execute_script("""
19              window.open('chrome://marionette/content/test2.xul',
20                          'foo', 'chrome,centerscreen');
21            """)
22
23        new_window = self.open_window(trigger=open_window_with_js)
24        self.marionette.switch_to_window(new_window)
25
26    def tearDown(self):
27        self.close_all_windows()
28        super(TestElementSizeChrome, self).tearDown()
29
30    def testShouldReturnTheSizeOfAnInput(self):
31        shrinko = self.marionette.find_element(By.ID, 'textInput')
32        size = shrinko.rect
33        self.assertTrue(size['width'] > 0)
34        self.assertTrue(size['height'] > 0)
35