author | Barbara Miller <galgeek@me.com> |
Fri, 06 Mar 2015 13:45:00 -0800 | |
changeset 232344 | efa7c6cf88fce711716619cb1b37035fa48387bc |
parent 232343 | 39488bb38d8da22a1aed3888ffb4a1d9a1328add |
child 232345 | 56083b5a4473a5f4f8715c9d1a07b105abba04f6 |
push id | 28377 |
push user | philringnalda@gmail.com |
push date | Sun, 08 Mar 2015 03:12:31 +0000 |
treeherder | mozilla-central@eeaf226575f2 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dburns |
bugs | 1134872 |
milestone | 39.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
new file mode 100644 --- /dev/null +++ b/testing/marionette/client/marionette/tests/unit/test_chrome_element_css.py @@ -0,0 +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/. + +from marionette import MarionetteTestCase + + +class TestChromeElementCSS(MarionetteTestCase): + + def test_we_can_get_css_value_on_chrome_element(self): + self.marionette.navigate("about:blank") + with self.marionette.using_context("chrome"): + element = self.marionette.find_element("id", "page-proxy-favicon") + favicon_image = element.value_of_css_property("list-style-image") + + self.assertIn("identity-icons-generic.png", favicon_image) + + element = self.marionette.find_element("id", "identity-box") + background_colour = element.value_of_css_property("background-color") + + self.assertEqual("transparent", background_colour)
--- a/testing/marionette/client/marionette/tests/unit/unit-tests.ini +++ b/testing/marionette/client/marionette/tests/unit/unit-tests.ini @@ -32,16 +32,18 @@ b2g = false [test_selected_chrome.py] b2g = false [test_getattr.py] [test_getattr_chrome.py] b2g = false [test_elementsize.py] [test_position.py] [test_rendered_element.py] +[test_chrome_element_css.py] +b2g = false [test_elementState.py] [test_elementState_chrome.py] b2g = false [test_text.py] [test_text_chrome.py] disabled = "Bug 896046" [test_clearing.py]
--- a/testing/marionette/marionette-server.js +++ b/testing/marionette/marionette-server.js @@ -2174,19 +2174,31 @@ MarionetteServerConnection.prototype = { * * @param object aRequest * 'id' member holds the reference id to * the element that will be checked * 'propertyName' is the CSS rule that is being requested */ getElementValueOfCssProperty: function MDA_getElementValueOfCssProperty(aRequest){ let command_id = this.command_id = this.getCommandId(); - this.sendAsync("getElementValueOfCssProperty", - {id: aRequest.parameters.id, propertyName: aRequest.parameters.propertyName}, - command_id); + let curWin = this.getCurrentWindow(); + if (this.context == "chrome") { + try { + let el = this.curBrowser.elementManager.getKnownElement(aRequest.parameters.id, curWin); + this.sendResponse(curWin.document.defaultView.getComputedStyle(el, null).getPropertyValue( + aRequest.parameters.propertyName), command_id); + } catch (e) { + this.sendError(e.message, e.code, e.stack, command_id); + } + } + else { + this.sendAsync("getElementValueOfCssProperty", + {id: aRequest.parameters.id, propertyName: aRequest.parameters.propertyName}, + command_id); + } }, /** * Submit a form on a content page by either using form or element in a form * @param object aRequest * 'id' member holds the reference id to * the element that will be checked */