Update web-platform-tests to revision fcc7ecef8ee95ba3776cfa3b1de30101c30432aa

This commit is contained in:
WPT Sync Bot 2018-01-31 20:09:06 -05:00
parent 3e27459ad3
commit ba118104e4
41 changed files with 370 additions and 71 deletions

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.js></script>
<script src=/feature-policy/resources/featurepolicy.js></script>
<script src=/feature-policy/resources/picture-in-picture.js></script>
<script>
'use strict';
const relative_path = '/feature-policy/resources/feature-policy-picture-in-picture.html';
const base_src = '/feature-policy/resources/redirect-on-load.html#';
const same_origin_src = base_src + relative_path;
const cross_origin_src = base_src + 'https://{{domains[www]}}:{{ports[https][0]}}' +
relative_path;
const header = 'Feature-Policy allow="picture-in-picture"';
async_test(t => {
test_feature_availability(
'picture-in-picture', t, same_origin_src,
expect_feature_available_default, 'picture-in-picture');
}, header + ' allows same-origin navigation in an iframe.');
async_test(t => {
test_feature_availability(
'picture-in-picture', t, cross_origin_src,
expect_feature_unavailable_default, 'picture-in-picture');
}, header + ' disallows cross-origin navigation in an iframe.');
</script>
</body>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.js></script>
<script src=/feature-policy/resources/featurepolicy.js></script>
<script src=/feature-policy/resources/picture-in-picture.js></script>
<script>
'use strict';
const same_origin_src = '/feature-policy/resources/feature-policy-picture-in-picture.html';
const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
same_origin_src;
const feature_name = 'Feature policy "picture-in-picture"';
const header = 'allow="picture-in-picture" attribute';
async_test(t => {
test_feature_availability(
'picture-in-picture', t, same_origin_src,
expect_feature_available_default, 'picture-in-picture');
}, feature_name + ' can be enabled in same-origin iframe using ' + header);
async_test(t => {
test_feature_availability(
'picture-in-picture', t, cross_origin_src,
expect_feature_available_default, 'picture-in-picture');
}, feature_name + ' can be enabled in cross-origin iframe using ' + header);
</script>
</body>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.js></script>
<script src=/feature-policy/resources/featurepolicy.js></script>
<script src=/feature-policy/resources/picture-in-picture.js></script>
<script>
'use strict';
const same_origin_src = '/feature-policy/resources/feature-policy-picture-in-picture.html';
const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
same_origin_src;
const header = 'Feature-Policy header: picture-in-picture *';
async_test(t => {
isPictureInPictureAllowed().then(t.step_func_done((result) => {
assert_true(result);
}));
}, header + ' allows the top-level document.');
async_test(t => {
test_feature_availability('picture-in-picture', t, same_origin_src,
expect_feature_available_default);
}, header + ' allows same-origin iframes.');
async_test(t => {
test_feature_availability('picture-in-picture', t, cross_origin_src,
expect_feature_available_default);
}, header + ' allows cross-origin iframes.');
</script>
</body>

View file

@ -0,0 +1 @@
Feature-Policy: picture-in-picture *

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.js></script>
<script src=/feature-policy/resources/featurepolicy.js></script>
<script src=/feature-policy/resources/picture-in-picture.js></script>
<script>
'use strict';
const same_origin_src = '/feature-policy/resources/feature-policy-picture-in-picture.html';
const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
same_origin_src;
const header = 'Default "picture-in-picture" feature policy ["self"]';
async_test(t => {
isPictureInPictureAllowed().then(t.step_func_done((result) => {
assert_true(result);
}));
}, header + ' allows the top-level document.');
async_test(t => {
test_feature_availability('picture-in-picture', t, same_origin_src,
expect_feature_available_default);
}, header + ' allows same-origin iframes.');
async_test(t => {
test_feature_availability('picture-in-picture', t, cross_origin_src,
expect_feature_unavailable_default,);
}, header + ' disallows cross-origin iframes.');
</script>
</body>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.js></script>
<script src=/feature-policy/resources/featurepolicy.js></script>
<script src=/feature-policy/resources/picture-in-picture.js></script>
<script>
'use strict';
const same_origin_src = '/feature-policy/resources/feature-policy-picture-in-picture.html';
const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
same_origin_src;
const header = 'Feature-Policy header: picture-in-picture "none"';
async_test(t => {
isPictureInPictureAllowed().then(t.step_func_done((result) => {
assert_false(result);
}));
}, header + ' disallows the top-level document.');
async_test(t => {
test_feature_availability('picture-in-picture', t, same_origin_src,
expect_feature_unavailable_default);
}, header + ' disallows same-origin iframes.');
async_test(t => {
test_feature_availability('picture-in-picture', t, cross_origin_src,
expect_feature_unavailable_default,);
}, header + ' disallows cross-origin iframes.');
</script>
</body>

View file

@ -0,0 +1 @@
Feature-Policy: picture-in-picture 'none'

View file

@ -0,0 +1,10 @@
<script src=/feature-policy/resources/picture-in-picture.js></script>
<script>
'use strict';
window.addEventListener('load', () => {
isPictureInPictureAllowed().then(result => {
window.parent.postMessage({ enabled: result }, '*');
});
}, { once: true });
</script>

View file

@ -0,0 +1,13 @@
function isPictureInPictureAllowed() {
return new Promise((resolve, reject) => {
const video = document.createElement('video');
video.requestPictureInPicture()
.then(() => resolve(document.pictureInPictureEnabled))
.catch(e => {
if (e.name == 'NotAllowedError')
resolve(document.pictureInPictureEnabled);
else
resolve(false);
});
});
}