Bug 1567379 [wpt PR 17922] - [sms] Expose manual cancellations/aborts to developers, a=testonly

Automatic update from web-platform-tests
[sms] Expose manual cancellations/aborts to developers

Bug: 979265
Change-Id: I8b080fe35fc44c16af5b149bb23c9a5e7e57af06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1707827
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Sam Goto <goto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#679667}

--

wpt-commits: deef122fe48037c93c145509eff9f3735b6f64e3
wpt-pr: 17922
This commit is contained in:
Sam Goto 2019-07-30 17:40:32 +00:00 committed by moz-wptsync-bot
parent 9a7733f5f3
commit 6b4aba1533
2 changed files with 18 additions and 0 deletions

View File

@ -165,4 +165,21 @@ promise_test(async t => {
let sms = await navigator.sms.receive({timeout: undefined});
assert_equals(sms.content, "hello");
}, 'Should use default value for timeout (undefined)');
promise_test(async t => {
await expect(receive).andReturn((timeout) => {
return Promise.resolve({
status: Status.kCancelled,
});
});
try {
await navigator.sms.receive();
assert_unreached('Expected CancelledError to be thrown.');
} catch (error) {
assert_equals(error.name, "AbortError");
assert_equals(error.message, "SMSReceiver was aborted.");
}
}, 'Deal with cancelled requests');
</script>

View File

@ -73,6 +73,7 @@ function intercept() {
Status.kSuccess = blink.mojom.SmsStatus.kSuccess;
Status.kTimeout = blink.mojom.SmsStatus.kTimeout;
Status.kCancelled = blink.mojom.SmsStatus.kCancelled;
return smsReceiverImpl;
}