Bug 1766010 [wpt PR 33754] - [Sub Apps] Change add() to take list and add SubAppInstallCommand, a=testonly

Automatic update from web-platform-tests
[Sub Apps] Change add() to take list and add SubAppInstallCommand

Bug: 1313108, 1171317
Change-Id: Ib0e4d54982a30b5a4d2c7406f113bd7da8fb7abc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3582589
Reviewed-by: Alex Gough <ajgo@chromium.org>
Reviewed-by: Daniel Murphy <dmurph@chromium.org>
Commit-Queue: Sam Thiesen <samicolon@google.com>
Cr-Commit-Position: refs/heads/main@{#1011466}

--

wpt-commits: 1df9d512650d18e9d07c04e529404cbe4ff136ff
wpt-pr: 33754
This commit is contained in:
samicolon 2022-06-09 16:23:51 +00:00 коммит произвёл moz-wptsync-bot
Родитель 43f63fbcc5
Коммит 9a0505493e
3 изменённых файлов: 23 добавлений и 27 удалений

Просмотреть файл

@ -20,9 +20,9 @@ self.SubAppsServiceTest = (() => {
this.receiver_.$.close();
}
add(install_path) {
add(sub_apps) {
return Promise.resolve({
result: testInternal.serviceResultCode
result: [],
});
}

Просмотреть файл

@ -18,9 +18,15 @@ promise_test(async t => {
// Detach the frame.
iframe.remove();
const same_origin_url = document.location.origin + '/sub-app';
let subapp = {};
let install_options = {};
install_options["install_url"] = same_origin_url;
subapp[same_origin_url] = install_options;
// At this point the iframe is detached and unloaded, and its execution
// context is gone.
await promise_rejects_dom(t, 'NotFoundError', iframeDOMException, iframeNavigator.subApps.add('app'));
await promise_rejects_dom(t, 'NotFoundError', iframeDOMException, iframeNavigator.subApps.add(subapp));
}, "The object is no longer associated to a document.");
promise_test(async t => {
@ -31,22 +37,13 @@ promise_test(async t => {
const iframeDOMException = iframe.contentWindow.DOMException;
t.add_cleanup(() => iframe.remove());
await promise_rejects_dom(t, 'InvalidStateError', iframeDOMException, iframeNavigator.subApps.add('app'));
const same_origin_url = document.location.origin + '/sub-app';
let subapp = {};
let install_options = {};
install_options["install_url"] = same_origin_url;
subapp[same_origin_url] = install_options;
await promise_rejects_dom(t, 'InvalidStateError', iframeDOMException, iframeNavigator.subApps.add(subapp));
}, "API is only supported in top-level browsing contexts.");
promise_test(t => {
return promise_rejects_dom(t, 'URLMismatchError', navigator.subApps.add(
'https://some.other.origin/'));
}, 'Wrong origin URL argument.');
promise_test(async t => {
t.add_cleanup(async () => {
await mockSubAppsService.reset();
mockSubAppsService = null;
});
await createMockSubAppsService(Status.FAILURE);
return promise_rejects_dom(t, 'OperationError', navigator.subApps.add(
'/sub-app'));
}, 'Service failed to add sub-app.');
</script>

Просмотреть файл

@ -7,15 +7,14 @@
subapps_test(async (t, mockSubAppsService) => {
const same_origin_url = document.location.origin + '/sub-app';
await navigator.subApps.add(same_origin_url);
}, 'Same origin fully qualified URL.');
subapps_test(async (t, mockSubAppsService) => {
await navigator.subApps.add('sub/app');
}, 'Relative path.');
let subapp = {};
let install_options = {};
install_options["install_url"] = same_origin_url;
subapp[same_origin_url] = install_options;
await navigator.subApps.add(subapp);
}, 'Add API call works.');
subapps_test(async (t, mockSubAppsService) => {
await navigator.subApps.add('/sub/app');
}, 'Absolute path.');
</script>