Update web-platform-tests to revision 8119bc10583682676a3db9806c82ed4044e88e13

This commit is contained in:
WPT Sync Bot 2019-07-09 10:22:34 +00:00
parent 56f1e7cbc5
commit 3c256580fa
189 changed files with 4341 additions and 1030 deletions

View file

@ -669,11 +669,11 @@ class ActionSequenceAction(object):
for action in actionSequence["actions"]:
if (action["type"] == "pointerMove" and
isinstance(action["origin"], dict)):
action["origin"] = self.get_element(action["origin"]["selector"])
action["origin"] = self.get_element(action["origin"]["selector"], action["frame"]["frame"])
self.protocol.action_sequence.send_actions({"actions": actions})
def get_element(self, selector):
element = self.protocol.select.element_by_selector(selector)
def get_element(self, element_selector, frame):
element = self.protocol.select.element_by_selector(element_selector, frame)
return element
class GenerateTestReportAction(object):

View file

@ -386,6 +386,9 @@ class MarionetteSelectorProtocolPart(SelectorProtocolPart):
def elements_by_selector(self, selector):
return self.marionette.find_elements("css selector", selector)
def elements_by_selector_and_frame(self, element_selector, frame):
return self.marionette.find_elements("css selector", element_selector)
class MarionetteClickProtocolPart(ClickProtocolPart):
def setup(self):

View file

@ -149,6 +149,9 @@ class SeleniumSelectorProtocolPart(SelectorProtocolPart):
def elements_by_selector(self, selector):
return self.webdriver.find_elements_by_css_selector(selector)
def elements_by_selector_and_frame(self, element_selector, frame):
return self.webdriver.find_elements_by_css_selector(element_selector)
class SeleniumClickProtocolPart(ClickProtocolPart):
def setup(self):

View file

@ -142,6 +142,9 @@ class WebDriverSelectorProtocolPart(SelectorProtocolPart):
def elements_by_selector(self, selector):
return self.webdriver.find.css(selector)
def elements_by_selector_and_frame(self, element_selector, frame):
return self.webdriver.find.css(element_selector, frame)
class WebDriverClickProtocolPart(ClickProtocolPart):
def setup(self):

View file

@ -235,12 +235,15 @@ class SelectorProtocolPart(ProtocolPart):
name = "select"
def element_by_selector(self, selector):
elements = self.elements_by_selector(selector)
def element_by_selector(self, element_selector, frame="window"):
elements = self.elements_by_selector_and_frame(element_selector, frame)
frame_name = "window"
if (frame != "window"):
frame_name = frame.id
if len(elements) == 0:
raise ValueError("Selector '%s' matches no elements" % selector)
raise ValueError("Selector '%s' in frame '%s' matches no elements" % (element_selector, frame_name))
elif len(elements) > 1:
raise ValueError("Selector '%s' matches multiple elements" % selector)
raise ValueError("Selector '%s' in frame '%s' matches multiple elements" % (element_selector, frame_name))
return elements[0]
@abstractmethod
@ -251,6 +254,13 @@ class SelectorProtocolPart(ProtocolPart):
:returns: A list of protocol-specific handles to elements"""
pass
@abstractmethod
def elements_by_selector_and_frame(self, element_selector, frame):
"""Select elements matching a CSS selector
:param str selector: The CSS selector
:returns: A list of protocol-specific handles to elements"""
pass
class ClickProtocolPart(ProtocolPart):
"""Protocol part for performing trusted clicks"""

View file

@ -21,10 +21,26 @@
}
});
const get_frame = function(element, frame) {
let foundFrame = frame;
let frameDocument = frame == window ? window.document : frame.contentDocument;
if (!frameDocument.contains(element)) {
foundFrame = null;
let frames = document.getElementsByTagName("iframe");
for (let i = 0; i < frames.length; i++) {
if (get_frame(element, frames[i])) {
foundFrame = frames[i];
break;
}
}
}
return foundFrame;
};
const get_selector = function(element) {
let selector;
if (element.id && document.getElementById(element.id) === element) {
if (element.id) {
const id = element.id;
selector = "#";
@ -81,8 +97,16 @@
for (let actionSequence of actions) {
if (actionSequence.type == "pointer") {
for (let action of actionSequence.actions) {
if (action.type == "pointerMove" && action.origin instanceof Element) {
action.origin = {selector: get_selector(action.origin)};
// The origin of each action can only be an element or a string of a value "viewport" or "pointer".
if (action.type == "pointerMove" && typeof(action.origin) != 'string') {
let frame = get_frame(action.origin, window);
if (frame != null) {
if (frame == window)
action.frame = {frame: "window"};
else
action.frame = {frame: frame};
action.origin = {selector: get_selector(action.origin)};
}
}
}
}

View file

@ -13,6 +13,17 @@ from mozlog import structuredlog, capture
Stop = object()
def release_mozlog_lock():
try:
from mozlog.structuredlog import StructuredLogger
try:
StructuredLogger._lock.release()
except threading.ThreadError:
pass
except ImportError:
pass
class MessageLogger(object):
def __init__(self, message_func):
self.send_message = message_func
@ -138,6 +149,10 @@ def start_runner(runner_command_queue, runner_result_queue,
logger.critical(traceback.format_exc())
stop_flag.set()
# Ensure that when we start this in a new process we have the global lock
# in the logging module unlocked
release_mozlog_lock()
logger = MessageLogger(send_message)
with capture.CaptureIO(logger, capture_stdio):