Update web-platform-tests to revision e29e596073468910d8655a8ec23262f17543e147

This commit is contained in:
WPT Sync Bot 2018-10-03 21:30:54 -04:00
parent e56db1f322
commit 5e2118728a
67 changed files with 1403 additions and 821 deletions

View file

@ -5,7 +5,6 @@ async function send_message_to_iframe(iframe, message, reply) {
return new Promise((resolve, reject) => {
let messageHandler = e => {
if (e.data.command !== message.command) {
return;
}
@ -131,4 +130,31 @@ function run_generic_sensor_iframe_tests(sensorName) {
iframe.parentNode.removeChild(iframe);
}, `${sensorName}: sensor is not suspended when focus traverses from\
to same-origin frame`);
sensor_test(async t => {
assert_true(sensorName in self);
const iframe = document.createElement('iframe');
iframe.allow = featurePolicies.join(';') + ';';
iframe.src = 'https://{{host}}:{{ports[https][0]}}/generic-sensor/resources/iframe_sensor_handler.html';
// Create sensor in the iframe (we do not care whether this is a
// cross-origin nested context in this test).
const iframeLoadWatcher = new EventWatcher(t, iframe, 'load');
document.body.appendChild(iframe);
await iframeLoadWatcher.wait_for('load');
await send_message_to_iframe(iframe, {command: 'create_sensor',
type: sensorName});
iframe.contentWindow.focus();
await send_message_to_iframe(iframe, {command: 'start_sensor'});
// Remove iframe from main document and change focus. When focus changes,
// we need to determine whether a sensor must have its execution suspended
// or resumed (section 4.2.3, "Focused Area" of the Generic Sensor API
// spec). In Blink, this involves querying a frame, which might no longer
// exist at the time of the check.
// Note that we cannot send the "reset_sensor_backend" command because the
// iframe is discarded with the removeChild call.
iframe.parentNode.removeChild(iframe);
window.focus();
}, `${sensorName}: losing a document's frame with an active sensor does not crash`);
}