Commit e3b44520 authored by Becca Hughes's avatar Becca Hughes Committed by Commit Bot

Autoplay: Harden and switch layout tests back on

Harden feature policy layout tests and switch them back on.

These tests are still disabled with site isolation until
HasBeenActivated is replicated.

BUG=794631,790549

Change-Id: I8fd2be1f9222c71288d5e39e1639c4d990df995b
Reviewed-on: https://chromium-review.googlesource.com/966069Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Commit-Queue: Becca Hughes <beccahughes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545804}
parent f0bc2ea5
...@@ -154,3 +154,13 @@ crbug.com/711468 virtual/gpu/fast/canvas/canvas-scale-strokePath-shadow.html [ P ...@@ -154,3 +154,13 @@ crbug.com/711468 virtual/gpu/fast/canvas/canvas-scale-strokePath-shadow.html [ P
crbug.com/711468 http/tests/intersection-observer/cross-origin-iframe-with-nesting.html [ Failure ] crbug.com/711468 http/tests/intersection-observer/cross-origin-iframe-with-nesting.html [ Failure ]
crbug.com/807675 http/tests/images/image-decode-in-frame.html [ Crash Failure ] crbug.com/807675 http/tests/images/image-decode-in-frame.html [ Crash Failure ]
# These tests have issues with —site-per-process. https://crbug.com/794631
crbug.com/794631 http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-delegation.html [ Failure Pass Timeout ]
crbug.com/794631 http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-disabled.html [ Failure Pass Timeout ]
crbug.com/794631 http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-gesture.html [ Failure Pass Timeout ]
crbug.com/794631 http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-header.html [ Failure Pass Timeout ]
crbug.com/794631 http/tests/media/autoplay/document-user-activation-feature-policy-alternating.html [ Failure Pass Timeout ]
crbug.com/794631 http/tests/media/autoplay/document-user-activation-feature-policy-iframe-no-gesture.html [ Failure Pass Timeout ]
crbug.com/794631 http/tests/media/autoplay/document-user-activation-feature-policy-same-origin.html [ Failure Pass Timeout ]
crbug.com/794631 http/tests/media/autoplay/document-user-activation-iframe-delegation.html [ Failure Pass Timeout ]
...@@ -3198,16 +3198,6 @@ crbug.com/791941 [ Mac ] virtual/gpu-rasterization/images/color-profile-clip.htm ...@@ -3198,16 +3198,6 @@ crbug.com/791941 [ Mac ] virtual/gpu-rasterization/images/color-profile-clip.htm
crbug.com/791941 [ Mac ] virtual/gpu-rasterization/images/color-profile-munsell-adobe-to-srgb.html [ Pass Failure ] crbug.com/791941 [ Mac ] virtual/gpu-rasterization/images/color-profile-munsell-adobe-to-srgb.html [ Pass Failure ]
crbug.com/791941 [ Mac ] virtual/gpu-rasterization/images/color-profile-munsell-srgb-to-srgb.html [ Pass Failure ] crbug.com/791941 [ Mac ] virtual/gpu-rasterization/images/color-profile-munsell-srgb-to-srgb.html [ Pass Failure ]
# These tests fail often on Linux and Mac and Windows. https://crbug.com/790549
crbug.com/788390 [ Linux Win ] http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-delegation.html [ Failure Pass Timeout ]
crbug.com/788390 [ Linux Win ] http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-disabled.html [ Failure Pass Timeout ]
crbug.com/788390 [ Linux Mac Win ] http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-gesture.html [ Failure Pass Timeout ]
crbug.com/788390 [ Linux Win ] http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-header.html [ Failure Pass Timeout ]
crbug.com/788390 [ Linux ] http/tests/media/autoplay/document-user-activation-feature-policy-alternating.html [ Failure Pass Timeout ]
crbug.com/788390 [ Linux ] http/tests/media/autoplay/document-user-activation-feature-policy-iframe-no-gesture.html [ Failure Pass Timeout ]
crbug.com/788390 [ Linux ] http/tests/media/autoplay/document-user-activation-feature-policy-same-origin.html [ Failure Pass Timeout ]
crbug.com/788390 [ Linux ] http/tests/media/autoplay/document-user-activation-iframe-delegation.html [ Failure Pass Timeout ]
# Double tap on modern media controls is a bit more complicated on Mac but # Double tap on modern media controls is a bit more complicated on Mac but
# since we are not targeting Mac yet we can come back and fix this later. # since we are not targeting Mac yet we can come back and fix this later.
crbug.com/783154 [ Mac ] virtual/modern-media-controls/media/controls/modern/doubletap-to-jump-backwards.html [ Skip ] crbug.com/783154 [ Mac ] virtual/modern-media-controls/media/controls/modern/doubletap-to-jump-backwards.html [ Skip ]
......
...@@ -5,13 +5,12 @@ ...@@ -5,13 +5,12 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="resources/autoplay-test.js"></script> <script src="resources/autoplay-test.js"></script>
<!-- This is a cross origin iframe with a same origin child with allow="autoplay" --> <!-- This is a cross origin iframe with a same origin child with allow="autoplay" -->
<iframe allow="autoplay" src="http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html"></iframe> <iframe allow="autoplay"></iframe>
<script> <script>
simulateViewportClick(); runTest(simulateViewportClick, [
runTest({ ['http://127.0.0.1:8000/media/autoplay/document-user-activation-cross-origin-feature-policy-delegation.html', true],
'http://127.0.0.1:8000/media/autoplay/document-user-activation-cross-origin-feature-policy-delegation.html': true, ['http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html', true],
'http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html': true, ['http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html', true]
'http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html': true ]);
});
</script> </script>
</html> </html>
...@@ -5,13 +5,12 @@ ...@@ -5,13 +5,12 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="resources/autoplay-test.js"></script> <script src="resources/autoplay-test.js"></script>
<!-- This is a cross origin iframe with a same origin child with allow="autoplay" --> <!-- This is a cross origin iframe with a same origin child with allow="autoplay" -->
<iframe src="http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html"></iframe> <iframe></iframe>
<script> <script>
simulateViewportClick(); runTest(simulateViewportClick, [
runTest({ ['http://127.0.0.1:8000/media/autoplay/document-user-activation-cross-origin-feature-policy-disabled.html', true],
'http://127.0.0.1:8000/media/autoplay/document-user-activation-cross-origin-feature-policy-disabled.html': true, ['http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html', false],
'http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html': false, ['http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html', false]
'http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html': false ]);
});
</script> </script>
</html> </html>
...@@ -5,13 +5,12 @@ ...@@ -5,13 +5,12 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="resources/autoplay-test.js"></script> <script src="resources/autoplay-test.js"></script>
<!-- This is a cross origin iframe with a same origin child with allow="autoplay" --> <!-- This is a cross origin iframe with a same origin child with allow="autoplay" -->
<iframe allow="autoplay" src="http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html"></iframe> <iframe allow="autoplay"></iframe>
<script> <script>
simulateFrameClick(); runTest(simulateFrameClick, [
runTest({ ['http://127.0.0.1:8000/media/autoplay/document-user-activation-cross-origin-feature-policy-gesture.html', true],
'http://127.0.0.1:8000/media/autoplay/document-user-activation-cross-origin-feature-policy-gesture.html': true, ['http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html', true],
'http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html': true, ['http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html', true]
'http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html': true ]);
});
</script> </script>
</html> </html>
...@@ -5,12 +5,11 @@ ...@@ -5,12 +5,11 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="resources/autoplay-test.js"></script> <script src="resources/autoplay-test.js"></script>
<!-- This is a cross origin iframe that disables autoplay with a HTTP header --> <!-- This is a cross origin iframe that disables autoplay with a HTTP header -->
<iframe allow="autoplay" src="http://localhost:8000/media/autoplay/resources/nested-frame-with-header.php"></iframe> <iframe allow="autoplay"></iframe>
<script> <script>
simulateViewportClick(); runTest(simulateViewportClick, [
runTest({ ['http://127.0.0.1:8000/media/autoplay/document-user-activation-cross-origin-feature-policy-header.html', true],
'http://127.0.0.1:8000/media/autoplay/document-user-activation-cross-origin-feature-policy-header.html': true, ['http://localhost:8000/media/autoplay/resources/nested-frame-with-header.php', false]
'http://localhost:8000/media/autoplay/resources/nested-frame-with-header.php': false ]);
});
</script> </script>
</html> </html>
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="resources/autoplay-test.js"></script> <script src="resources/autoplay-test.js"></script>
<!-- This is a cross origin iframe with a same origin child with no allow attribute --> <!-- This is a cross origin iframe with a same origin child with no allow attribute -->
<iframe allow="autoplay" src="http://localhost:8000/media/autoplay/resources/nested-iframe-1b.html"></iframe> <iframe allow="autoplay"></iframe>
<script> <script>
simulateViewportClick(); simulateViewportClick();
runTest({ runTest(simulateViewportClick, [
'http://127.0.0.1:8000/media/autoplay/document-user-activation-feature-policy-alternating.html': true, ['http://127.0.0.1:8000/media/autoplay/document-user-activation-feature-policy-alternating.html', true],
'http://localhost:8000/media/autoplay/resources/nested-iframe-1b.html': true, ['http://localhost:8000/media/autoplay/resources/nested-iframe-1b.html', true],
'http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html': false ['http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html', false]
}); ]);
</script> </script>
</html> </html>
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="resources/autoplay-test.js"></script> <script src="resources/autoplay-test.js"></script>
<!-- This is a cross origin iframe with a same origin child with allow="autoplay" --> <!-- This is a cross origin iframe with a same origin child with allow="autoplay" -->
<iframe allow="autoplay" src="http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html"></iframe> <iframe allow="autoplay"></iframe>
<script> <script>
runTest({ runTest(simulateNoGesture, [
'http://127.0.0.1:8000/media/autoplay/document-user-activation-cross-origin-feature-policy-delegation.html': true, ['http://127.0.0.1:8000/media/autoplay/document-user-activation-feature-policy-iframe-no-gesture.html', false],
'http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html': false, ['http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html', false],
'http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html': false ['http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html', false]
}); ]);
</script> </script>
</html> </html>
...@@ -5,13 +5,12 @@ ...@@ -5,13 +5,12 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="resources/autoplay-test.js"></script> <script src="resources/autoplay-test.js"></script>
<!-- This is a same origin frame with a sub origin child frame with no allow attributes --> <!-- This is a same origin frame with a sub origin child frame with no allow attributes -->
<iframe src="/media/autoplay/resources/nested-iframe-1b.html"></iframe> <iframe></iframe>
<script> <script>
simulateViewportClick(); runTest(simulateViewportClick, [
runTest({ ['http://127.0.0.1:8000/media/autoplay/document-user-activation-feature-policy-same-origin.html', true],
'http://127.0.0.1:8000/media/autoplay/document-user-activation-feature-policy-same-origin.html': true, ['http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-1b.html', true],
'http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-1b.html': true, ['http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html', true]
'http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html': true ]);
});
</script> </script>
</html> </html>
<!DOCTYPE html> <!DOCTYPE html>
<title>Test user gesture is delegated to iframes after navigation.</title> <title>Test user gesture is delegated to iframes after navigation.</title>
<script> <script>
chrome.gpuBenchmarking.pointerActionSequence([
{"source": "mouse",
"actions": [
{ "name": "pointerDown", "x": 0, "y": 0 },
{ "name": "pointerUp" } ]}]);
if (window.testRunner) { if (window.testRunner) {
testRunner.waitUntilDone(); testRunner.waitUntilDone();
testRunner.dumpAsText(); testRunner.dumpAsText();
} }
document.location.href = 'resources/test-autoplay-post-navigation.html'; chrome.gpuBenchmarking.pointerActionSequence([
{"source": "mouse",
"actions": [
{ "name": "pointerDown", "x": 0, "y": 0 },
{ "name": "pointerUp" } ]}], () => {
document.location.href = 'resources/test-autoplay-post-navigation.html';
});
</script> </script>
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
*/ */
// Tracks the results and how many active tests we have running. // Tracks the results and how many active tests we have running.
let activeTests;
let testExpectations = {}; let testExpectations = {};
let callback; let callback;
let resultCallback = (data) => { top.postMessage(data, '*') };
let completedTestResults = [];
function tearDown(result) { function tearDown(result) {
// Reset the flag state. // Reset the flag state.
...@@ -31,11 +32,20 @@ function receivedResult(data) { ...@@ -31,11 +32,20 @@ function receivedResult(data) {
return; return;
} }
activeTests--; completedTestResults.push(data);
assert_equals(testExpectations[data.url], data.message); processTestResults();
}
function processTestResults() {
// Check if we have completed all the tests.
if (Object.keys(testExpectations).length != completedTestResults.length)
return;
completedTestResults.forEach((data) => {
assert_equals(testExpectations[data.url], data.message);
});
if (!activeTests) callback();
callback();
} }
function runVideoTest() { function runVideoTest() {
...@@ -44,15 +54,15 @@ function runVideoTest() { ...@@ -44,15 +54,15 @@ function runVideoTest() {
video.play().then(tearDown, tearDown); video.play().then(tearDown, tearDown);
} }
function simulateViewportClick() { function simulateViewportClick(callback) {
chrome.gpuBenchmarking.pointerActionSequence([ chrome.gpuBenchmarking.pointerActionSequence([
{"source": "mouse", {"source": "mouse",
"actions": [ "actions": [
{ "name": "pointerDown", "x": 0, "y": 0 }, { "name": "pointerDown", "x": 0, "y": 0 },
{ "name": "pointerUp" } ]}]); { "name": "pointerUp" } ]}], callback);
} }
function simulateFrameClick() { function simulateFrameClick(callback) {
const frame = document.getElementsByTagName('iframe')[0]; const frame = document.getElementsByTagName('iframe')[0];
const rect = frame.getBoundingClientRect(); const rect = frame.getBoundingClientRect();
...@@ -64,32 +74,42 @@ function simulateFrameClick() { ...@@ -64,32 +74,42 @@ function simulateFrameClick() {
"x": rect.left + (rect.width / 2), "x": rect.left + (rect.width / 2),
"y": rect.top + (rect.height / 2) "y": rect.top + (rect.height / 2)
}, },
{ "name": "pointerUp" } ]}]); { "name": "pointerUp" } ]}], callback);
}
function simulateNoGesture(callback) {
callback();
} }
function runTest(expectations) { function runTest(pointerSequence, expectations) {
// Setup the global variables.
expectations.forEach((expectation) => {
testExpectations[expectation[0]] = expectation[1];
});
// Run the test.
async_test((t) => { async_test((t) => {
testExpectations = expectations;
activeTests = Object.keys(expectations).length;
callback = t.step_func_done(); callback = t.step_func_done();
});
}
window.addEventListener('load', () => { // Fire the pointer sequence and then run the video test.
if (!window.testRunner) pointerSequence(t.step_func(() => {
return; runVideoTest();
// Setup the flags before the test is run. // Navigate the iframe now we have the gesture.
window.internals.settings.setAutoplayPolicy('document-user-activation-required'); document.getElementsByTagName('iframe')[0].src =
expectations[1][0];
}));
// Setup the event listener to forward messages. resultCallback = t.step_func(receivedResult);
window.addEventListener('message', (e) => {
if (callback) {
receivedResult(e.data);
} else {
top.postMessage(e.data, '*');
}
}); });
}
// Setup the flags before the test is run.
window.internals.settings.setAutoplayPolicy('document-user-activation-required');
// Setup the event listener to forward messages.
window.addEventListener('message', (e) => { resultCallback(e.data); });
// If we are on an iframe then run the video test automatically.
if (window.self !== window.top)
runVideoTest(); runVideoTest();
}, { once: true });
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="autoplay-test.js"></script> <script src="autoplay-test.js"></script>
<!-- This is a cross origin iframe with a same origin child with allow="autoplay" --> <!-- This is a cross origin iframe with a same origin child with allow="autoplay" -->
<iframe allow="autoplay" src="http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html"></iframe> <iframe allow="autoplay"></iframe>
<script> <script>
runTest({ runTest(simulateNoGesture, [
'http://127.0.0.1:8000/media/autoplay/resources/test-autoplay-post-navigation.html': true, ['http://127.0.0.1:8000/media/autoplay/resources/test-autoplay-post-navigation.html', true],
'http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html': true, ['http://localhost:8000/media/autoplay/resources/nested-iframe-1a.html', true],
'http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html': true ['http://127.0.0.1:8000/media/autoplay/resources/nested-iframe-2.html', true]
}); ]);
</script> </script>
</html> </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