From 85c9f7f56a981f5820199c61b8f9a9f950633d3b Mon Sep 17 00:00:00 2001 From: Wanming Lin Date: Thu, 13 Jun 2019 14:09:15 +0000 Subject: [PATCH] Bug 1554569 [wpt PR 17019] - Adapt the rest wake lock tests to latest spec, a=testonly Automatic update from web-platform-tests Adapt the rest wake lock tests to latest spec (#17019) - Remove some tests since `state`, `type` and `onactivechange` had been removed from latest spec - Enable insecure context and invalid type tests on Worker -- wp5At-commits: 7cb8a811bbba84c4da802dbd9cce3247104dca77 wpt-pr: 17019 --- .../wakelock-insecure-context.any.js | 5 ++ .../wake-lock/wakelock-insecure-context.html | 13 ---- .../wakelock-state-is-global.https.html | 75 ------------------- .../wake-lock/wakelock-type.https.any.js | 19 +++++ .../tests/wake-lock/wakelock-type.https.html | 38 ---------- 5 files changed, 24 insertions(+), 126 deletions(-) create mode 100644 testing/web-platform/tests/wake-lock/wakelock-insecure-context.any.js delete mode 100644 testing/web-platform/tests/wake-lock/wakelock-insecure-context.html delete mode 100644 testing/web-platform/tests/wake-lock/wakelock-state-is-global.https.html create mode 100644 testing/web-platform/tests/wake-lock/wakelock-type.https.any.js delete mode 100644 testing/web-platform/tests/wake-lock/wakelock-type.https.html diff --git a/testing/web-platform/tests/wake-lock/wakelock-insecure-context.any.js b/testing/web-platform/tests/wake-lock/wakelock-insecure-context.any.js new file mode 100644 index 000000000000..f32cc3c35435 --- /dev/null +++ b/testing/web-platform/tests/wake-lock/wakelock-insecure-context.any.js @@ -0,0 +1,5 @@ +//META: title=Wake Lock API is not exposed in an insecure context + +test(() => { + assert_false("WakeLock" in self, "'WakeLock' must not be exposed"); +}, "Wake Lock API is not exposed in an insecure context"); diff --git a/testing/web-platform/tests/wake-lock/wakelock-insecure-context.html b/testing/web-platform/tests/wake-lock/wakelock-insecure-context.html deleted file mode 100644 index 2c61f41311db..000000000000 --- a/testing/web-platform/tests/wake-lock/wakelock-insecure-context.html +++ /dev/null @@ -1,13 +0,0 @@ - - -Wake Lock API is not exposed in an insecure context - - - - diff --git a/testing/web-platform/tests/wake-lock/wakelock-state-is-global.https.html b/testing/web-platform/tests/wake-lock/wakelock-state-is-global.https.html deleted file mode 100644 index 2eee31982498..000000000000 --- a/testing/web-platform/tests/wake-lock/wakelock-state-is-global.https.html +++ /dev/null @@ -1,75 +0,0 @@ - - -wake lock state should be global - - - - - - - - - diff --git a/testing/web-platform/tests/wake-lock/wakelock-type.https.any.js b/testing/web-platform/tests/wake-lock/wakelock-type.https.any.js new file mode 100644 index 000000000000..26ebcbef5570 --- /dev/null +++ b/testing/web-platform/tests/wake-lock/wakelock-type.https.any.js @@ -0,0 +1,19 @@ +//META: title=WakeLock.request() with invaild type + +promise_test(async t => { + await promise_rejects(t, new TypeError(), WakeLock.request()); +}, "'TypeError' is thrown when set an empty wake lock type"); + +promise_test(t => { + const invalidTypes = [ + "invalid", + null, + 123, + {}, + "", + true + ]; + invalidTypes.map(async invalidType => { + await promise_rejects(t, new TypeError(), WakeLock.request(invalidType)); + }); +}, "'TypeError' is thrown when set an invalid wake lock type"); diff --git a/testing/web-platform/tests/wake-lock/wakelock-type.https.html b/testing/web-platform/tests/wake-lock/wakelock-type.https.html deleted file mode 100644 index df7a68a040be..000000000000 --- a/testing/web-platform/tests/wake-lock/wakelock-type.https.html +++ /dev/null @@ -1,38 +0,0 @@ - - -WakeLockType Test - - - - -