Commit f68571e3 authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

Fix two testharness.js tests with harness errors due to stray asserts

All asserts need to be in a step func. Unfortunately this makes the
tests more verbose.

Found in https://github.com/web-platform-tests/wpt/pull/8748#issuecomment-398954260.

Change-Id: Ib15270d6093ea094b0f8c387cc4370f5154cf5dd
Reviewed-on: https://chromium-review.googlesource.com/1109689
Commit-Queue: Robert Ma <robertma@chromium.org>
Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569401}
parent 6ef585df
CONSOLE ERROR: line 2748: Uncaught Error: assert_false: Should not call createdCallback in UA ShadowRoot. expected false got true
CONSOLE ERROR: line 2748: Uncaught Error: assert_false: Should not call attachedCallback in UA ShadowRoot. expected false got true
CONSOLE ERROR: line 2748: Uncaught Error: assert_false: Should not call createdCallback in UA ShadowRoot. expected false got true
CONSOLE ERROR: line 2748: Uncaught Error: assert_false: Should not call attachedCallback in UA ShadowRoot. expected false got true
This is a testharness.js-based test.
Harness Error. harness_status.status = 1 , harness_status.message = Uncaught Error: assert_false: Should not call attachedCallback in UA ShadowRoot. expected false got true
PASS SVG <use> shadow trees should not be exposed through custom elements.
FAIL SVG <use> shadow trees should not be exposed through custom elements. assert_false: Should not call createdCallback in UA ShadowRoot. expected false got true
Harness: the test ran to completion.
......@@ -23,6 +23,8 @@
<script>
"use strict";
var t = async_test("SVG <use> shadow trees should not be exposed through custom elements.");
var instances = [];
function createPrototype(superClass) {
......@@ -34,40 +36,48 @@ function createPrototype(superClass) {
return scope;
}
createdCallback() {
this.instanceId = instances.length;
instances[this.instanceId] = this;
assert_false(this.ownerScope instanceof ShadowRoot,
"Should not call createdCallback in UA ShadowRoot.");
t.step(() => {
this.instanceId = instances.length;
instances[this.instanceId] = this;
assert_false(this.ownerScope instanceof ShadowRoot,
"Should not call createdCallback in UA ShadowRoot.");
});
}
attachedCallback() {
assert_false(this.ownerScope instanceof ShadowRoot,
"Should not call attachedCallback in UA ShadowRoot.");
assert_equals(instances[this.instanceId], this);
t.step(() => {
assert_false(this.ownerScope instanceof ShadowRoot,
"Should not call attachedCallback in UA ShadowRoot.");
assert_equals(instances[this.instanceId], this);
});
}
detachedCallback() {
assert_false(this.ownerScope instanceof ShadowRoot,
"Should not call detachedCallback in UA ShadowRoot.");
assert_equals(instances[this.instanceId], this);
t.step(() => {
assert_false(this.ownerScope instanceof ShadowRoot,
"Should not call detachedCallback in UA ShadowRoot.");
assert_equals(instances[this.instanceId], this);
});
}
attributeChangedCallback() {
assert_unreached("attributeChangedCallback should never be called.");
t.step(() => {
assert_unreached("attributeChangedCallback should never be called.");
});
}
};
return ElementType.prototype;
}
// <rect is=x-rect>
var XRectElement = document.registerElement('x-rect', {
extends: 'rect',
prototype: createPrototype(SVGRectElement),
});
t.step(function () {
// <rect is=x-rect>
var XRectElement = document.registerElement('x-rect', {
extends: 'rect',
prototype: createPrototype(SVGRectElement),
});
// <x-test>
var XTestElement = document.registerElement('x-test', {
prototype: createPrototype(HTMLElement),
});
// <x-test>
var XTestElement = document.registerElement('x-test', {
prototype: createPrototype(HTMLElement),
});
test(function () {
var template = document.getElementById("template");
var svg = document.importNode(template.content, true).firstElementChild;
var usedGroup = svg.getElementById("used-group");
......@@ -97,5 +107,9 @@ test(function () {
assert_true(instances[i].ownerScope instanceof Document,
"No instances should be inside a ShadowRoot.");
}
}, "SVG <use> shadow trees should not be exposed through custom elements.");
// Any callbacks will have been scheduled and run in microtasks,
// so end test after that.
t.step_timeout(t.step_func_done());
});
</script>
CONSOLE WARNING: line 13: The AudioContext was not allowed to start. It must be resumed (or created) from a user gesture event handler.
CONSOLE WARNING: line 23: The AudioContext was not allowed to start. It must be resumed (or created) from a user gesture event handler.
CONSOLE WARNING: line 36: The AudioContext was not allowed to start. It must be resumed (or created) from a user gesture event handler.
CONSOLE ERROR: line 2684: Uncaught Error: assert_equals: stateAfterClick expected "running" but got "suspended"
CONSOLE WARNING: line 13: The AudioContext was not allowed to start. It must be resumed (or created) from a user gesture event handler. https://goo.gl/7K7WLu
CONSOLE WARNING: line 13: The Web Audio autoplay policy will be re-enabled in Chrome 70 (October 2018). Please check that your website is compatible with it. https://goo.gl/7K7WLu
CONSOLE WARNING: line 23: The AudioContext was not allowed to start. It must be resumed (or created) from a user gesture event handler. https://goo.gl/7K7WLu
CONSOLE WARNING: line 32: The AudioContext was not allowed to start. It must be resumed (or created) from a user gesture event handler. https://goo.gl/7K7WLu
CONSOLE WARNING: line 36: The AudioContext was not allowed to start. It must be resumed (or created) from a user gesture event handler. https://goo.gl/7K7WLu
CONSOLE WARNING: line 36: The Web Audio autoplay policy will be re-enabled in Chrome 70 (October 2018). Please check that your website is compatible with it. https://goo.gl/7K7WLu
This is a testharness.js-based test.
Harness Error. harness_status.status = 1 , harness_status.message = Uncaught Error: assert_equals: stateAfterClick expected "running" but got "suspended"
PASS Verify that autoplaying Web Audio from a cross origin iframe is blocked by mediaPlaybackRequiresUserGesture
FAIL Verify that autoplaying Web Audio from a cross origin iframe is blocked by mediaPlaybackRequiresUserGesture assert_equals: stateAfterClick expected "running" but got "suspended"
Harness: the test ran to completion.
......@@ -5,7 +5,7 @@
<body></body>
<script>
async_test(t => {
window.addEventListener('message', e => {
window.addEventListener('message', t.step_func(e => {
switch (e.data.msg) {
case 'clickme':
if (!('eventSender' in window))
......@@ -37,7 +37,7 @@ async_test(t => {
default:
assert_unreached();
}
});
}));
var f = document.createElement('iframe');
f.src = 'http://localhost:8000/webaudio/resources/autoplay-crossorigin-iframe.html';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment