diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations index 9b7ce3f51ce63..1f14d9683dc57 100644 --- a/LayoutTests/TestExpectations +++ b/LayoutTests/TestExpectations @@ -462,6 +462,8 @@ imported/w3c/web-platform-tests/html/webappapis/timers/negative-settimeout.any.w imported/w3c/web-platform-tests/html/webappapis/user-prompts/print-during-beforeunload.html [ DumpJSConsoleLogInStdErr ] imported/w3c/web-platform-tests/mixed-content/gen/top.http-rp/opt-in/xhr.https.html [ DumpJSConsoleLogInStdErr ] imported/w3c/web-platform-tests/notifications/instance.https.html [ DumpJSConsoleLogInStdErr ] +imported/w3c/web-platform-tests/screen-wake-lock/wakelock-disabled-by-feature-policy.https.sub.html [ DumpJSConsoleLogInStdErr ] +imported/w3c/web-platform-tests/screen-wake-lock/wakelock-enabled-on-self-origin-by-feature-policy.https.sub.html [ DumpJSConsoleLogInStdErr ] imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https.html [ DumpJSConsoleLogInStdErr ] imported/w3c/web-platform-tests/streams/readable-streams/patched-global.any.html [ DumpJSConsoleLogInStdErr ] imported/w3c/web-platform-tests/streams/transform-streams/terminate.any.html [ DumpJSConsoleLogInStdErr ] @@ -6026,13 +6028,6 @@ imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/js webkit.org/b/245164 css3/scroll-snap/scroll-snap-drag-scrollbar-thumb-with-relayouts.html [ Failure Pass ] -# Screen Wake Lock tests that are timing out since their import. -imported/w3c/web-platform-tests/screen-wake-lock/wakelock-disabled-by-feature-policy.https.sub.html [ Skip ] -imported/w3c/web-platform-tests/screen-wake-lock/wakelock-enabled-by-feature-policy-attribute-redirect-on-load.https.sub.html [ Skip ] -imported/w3c/web-platform-tests/screen-wake-lock/wakelock-enabled-by-feature-policy-attribute.https.sub.html [ Skip ] -imported/w3c/web-platform-tests/screen-wake-lock/wakelock-enabled-by-feature-policy.https.sub.html [ Skip ] -imported/w3c/web-platform-tests/screen-wake-lock/wakelock-enabled-on-self-origin-by-feature-policy.https.sub.html [ Skip ] - # Disable ShadowRealm (while running to ensure we do not crash) webkit.org/b/245680 http/tests/misc/iframe-shadow-realm.html [ Skip ] inspector/shadow-realm-console.html [ Pass Failure ] diff --git a/LayoutTests/imported/w3c/web-platform-tests/feature-policy/resources/feature-policy-screen-wakelock.html b/LayoutTests/imported/w3c/web-platform-tests/feature-policy/resources/feature-policy-screen-wakelock.html new file mode 100644 index 0000000000000..6feed51d49865 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/feature-policy/resources/feature-policy-screen-wakelock.html @@ -0,0 +1,18 @@ + + + diff --git a/LayoutTests/imported/w3c/web-platform-tests/feature-policy/resources/featurepolicy.js b/LayoutTests/imported/w3c/web-platform-tests/feature-policy/resources/featurepolicy.js index 9aba0ab8c6753..864c434c6633c 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/feature-policy/resources/featurepolicy.js +++ b/LayoutTests/imported/w3c/web-platform-tests/feature-policy/resources/featurepolicy.js @@ -13,9 +13,9 @@ function assert_feature_policy_supported() { // "/feature-policy/resources/feature-policy-payment.html", // "/feature-policy/resources/feature-policy-usb.html". // expect_feature_available: a callback(data, feature_description) to -// verify if a feature is avaiable or unavailable as expected. +// verify if a feature is available or unavailable as expected. // The file under the path "src" defines what "data" is sent back as a -// pistMessage. Inside the callback, some tests (e.g., EXPECT_EQ, +// postMessage. Inside the callback, some tests (e.g., EXPECT_EQ, // EXPECT_TRUE, etc) are run accordingly to test a feature's // availability. // Example: expect_feature_available_default(data, feature_description). @@ -24,8 +24,8 @@ function assert_feature_policy_supported() { // feature (https://wicg.github.io/feature-policy/#features). // See examples at: // https://github.com/WICG/feature-policy/blob/master/features.md -// allow_attribute: Optional argument, only used for testing fullscreen or -// payment: either "allowfullscreen" or "allowpaymentrequest" is passed. +// allow_attribute: Optional argument, only used for testing fullscreen: +// "allowfullscreen" function test_feature_availability( feature_description, test, src, expect_feature_available, feature_name, allow_attribute) { @@ -354,13 +354,9 @@ function test_subframe_header_policy( assert_feature_policy_supported() frame.src = src + '?pipe=sub|header(Feature-Policy,' + feature + ' ' + frame_header_policy + ';)'; - return new Promise(function(resolve, reject) { - let results = []; + return new Promise(function(resolve) { window.addEventListener('message', function handler(evt) { - results.push(evt.data); - if (results.length >= 6) { - resolve(results); - } + resolve(evt.data); }); document.body.appendChild(frame); }).then(function(results) { @@ -453,6 +449,6 @@ function expect_reports(report_count, policy_name, description) { if (num_received_reports >= report_count) { t.done(); } - }), {types: ['feature-policy-violation'], buffered: true}).observe(); + }), {types: ['permissions-policy-violation'], buffered: true}).observe(); }, description); } diff --git a/LayoutTests/imported/w3c/web-platform-tests/permissions/all-permissions-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/permissions/all-permissions-expected.txt index 638f014edd60e..9b1ad89ce3061 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/permissions/all-permissions-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/permissions/all-permissions-expected.txt @@ -12,7 +12,7 @@ FAIL Query "gyroscope" permission promise_test: Unhandled rejection with value: FAIL Query "magnetometer" permission promise_test: Unhandled rejection with value: object "NotSupportedError: Permissions::query does not support this API" FAIL Query "midi" permission promise_test: Unhandled rejection with value: object "NotSupportedError: Permissions::query does not support this API" FAIL Query "nfc" permission promise_test: Unhandled rejection with value: object "NotSupportedError: Permissions::query does not support this API" -FAIL Query "screen-wake-lock" permission promise_test: Unhandled rejection with value: object "TypeError: Type error" +PASS Query "screen-wake-lock" permission PASS Query "camera" permission FAIL Query "display-capture" permission promise_test: Unhandled rejection with value: object "NotSupportedError: Permissions::query does not support this API" PASS Query "microphone" permission diff --git a/LayoutTests/imported/w3c/web-platform-tests/resources/testdriver-vendor.js b/LayoutTests/imported/w3c/web-platform-tests/resources/testdriver-vendor.js index e51a1f90a645b..8e2307f84b98e 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/resources/testdriver-vendor.js +++ b/LayoutTests/imported/w3c/web-platform-tests/resources/testdriver-vendor.js @@ -305,6 +305,10 @@ window.test_driver_internal.set_permission = function(permission_params, context testRunner.setGeolocationPermission(permission_params.state == "granted"); return Promise.resolve(); } + if (window.testRunner && permission_params.descriptor.name == "screen-wake-lock") { + testRunner.setScreenWakeLockPermission(permission_params.state == "granted"); + return Promise.resolve(); + } return Promise.reject(new Error("unimplemented")); }; diff --git a/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/idlharness.https.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/idlharness.https.window-expected.txt index a9a870fe9c29c..d456894bc15c4 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/idlharness.https.window-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/idlharness.https.window-expected.txt @@ -1,5 +1,5 @@ -FAIL idl_test setup promise_test: Unhandled rejection with value: object "Error: unimplemented" +PASS idl_test setup PASS idl_test validation PASS Partial interface Navigator: original interface defined PASS Partial interface Navigator: member names are unique @@ -32,12 +32,12 @@ PASS WakeLockSentinel interface: attribute released PASS WakeLockSentinel interface: attribute type PASS WakeLockSentinel interface: operation release() PASS WakeLockSentinel interface: attribute onrelease -FAIL WakeLockSentinel must be primary interface of sentinel assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: sentinel" -FAIL Stringification of sentinel assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: sentinel" -FAIL WakeLockSentinel interface: sentinel must inherit property "released" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: sentinel" -FAIL WakeLockSentinel interface: sentinel must inherit property "type" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: sentinel" -FAIL WakeLockSentinel interface: sentinel must inherit property "release()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: sentinel" -FAIL WakeLockSentinel interface: sentinel must inherit property "onrelease" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: sentinel" +PASS WakeLockSentinel must be primary interface of sentinel +PASS Stringification of sentinel +PASS WakeLockSentinel interface: sentinel must inherit property "released" with the proper type +PASS WakeLockSentinel interface: sentinel must inherit property "type" with the proper type +PASS WakeLockSentinel interface: sentinel must inherit property "release()" with the proper type +PASS WakeLockSentinel interface: sentinel must inherit property "onrelease" with the proper type PASS Navigator interface: attribute wakeLock PASS Navigator interface: navigator must inherit property "wakeLock" with the proper type diff --git a/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-active-document.https.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-active-document.https.window-expected.txt index d74b0d05e3a92..526d7cf06ae46 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-active-document.https.window-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-active-document.https.window-expected.txt @@ -1,4 +1,4 @@ -FAIL navigator.wakeLock.request() aborts if the document is not active. promise_rejects_dom: Inactive document, so must throw NotAllowedError function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." that is not a DOMException NotAllowedError: property "code" is equal to 9, expected 0 -FAIL navigator.wakeLock.request() aborts if the document is active, but not fully active. promise_rejects_dom: Active, but not fully active, so must throw NotAllowedError function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." that is not a DOMException NotAllowedError: property "code" is equal to 9, expected 0 +PASS navigator.wakeLock.request() aborts if the document is not active. +PASS navigator.wakeLock.request() aborts if the document is active, but not fully active. diff --git a/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-disabled-by-feature-policy.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-disabled-by-feature-policy.https.sub-expected.txt index fc116b690c97d..d4ac3b1e3c460 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-disabled-by-feature-policy.https.sub-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-disabled-by-feature-policy.https.sub-expected.txt @@ -1,9 +1,6 @@ -Blocked access to external URL https://www.localhost:9443/feature-policy/resources/feature-policy-screen-wakelock.html -Harness Error (TIMEOUT), message = null - -FAIL Feature-Policy header {"screen-wake-lock" : []} disallows the top-level document. promise_rejects_dom: function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." that is not a DOMException NotAllowedError: property "code" is equal to 9, expected 0 -TIMEOUT Feature-Policy header {"screen-wake-lock" : []} disallows same-origin iframes. Test timed out -TIMEOUT Feature-Policy header {"screen-wake-lock" : []} disallows cross-origin iframes. Test timed out +PASS Feature-Policy header {"screen-wake-lock" : []} disallows the top-level document. +FAIL Feature-Policy header {"screen-wake-lock" : []} disallows same-origin iframes. assert_false: navigator.wakeLock.request("screen") expected false got true +PASS Feature-Policy header {"screen-wake-lock" : []} disallows cross-origin iframes. diff --git a/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-disabled-by-feature-policy.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-disabled-by-feature-policy.https.sub.html index 821ec62885d61..ba26028ca3514 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-disabled-by-feature-policy.https.sub.html +++ b/LayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-disabled-by-feature-policy.https.sub.html @@ -3,13 +3,14 @@ + + + + +