Skip to content

Commit da8d7a4

Browse files
Anthony Vallee-Duboischromium-wpt-export-bot
authored andcommitted
Revert "[sub apps] enable wpt tests"
This reverts commit f56a10fc2ca726d6401a1c2232370faa8ce7d740. Reason for revert: New tests fail on some Linux bots Failure Link: https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/184324/overview Original change's description: > [sub apps] enable wpt tests > > Re-enable the tests in third_party/blink/web_tests/external/wpt/subapps. > > - Use virtual test suits to emulate isolated context with header overrides. > - Modernized tests to fit new sub apps API shape. > - Remove insecure context test because by definition isolated context cannot be insecure. > - Add a test that checks permission policy behavior. > > Fixed: 40928236 > Change-Id: Idc3d52c01a5a4cb4f4f588ea8c6011e1e13b4901 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8122238 > Reviewed-by: Andrew Rayskiy <greengrape@google.com> > Reviewed-by: Vladimir Levin <vmpstr@chromium.org> > Reviewed-by: Rick Byers <rbyers@chromium.org> > Commit-Queue: Vlad Krot <vkrot@google.com> > Cr-Commit-Position: refs/heads/main@{#1668571} Bug: 40928236 No-Presubmit: true No-Tree-Checks: true No-Try: true Change-Id: Icd7537fdea44945284b4f83325c6805ff8886727 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8157180 Owners-Override: Anthony Vallee-Dubois <anthonyvd@chromium.org> Reviewed-by: Anthony Vallee-Dubois <anthonyvd@chromium.org> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Anthony Vallee-Dubois <anthonyvd@chromium.org> Commit-Queue: Anthony Vallee-Dubois <anthonyvd@chromium.org> Cr-Commit-Position: refs/heads/main@{#1668824}
1 parent 8f6d21c commit da8d7a4

13 files changed

Lines changed: 131 additions & 208 deletions

interfaces/sub-apps.tentative.idl

Lines changed: 0 additions & 27 deletions
This file was deleted.

resources/chromium/mock-subapps.js

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,37 @@ self.SubAppsServiceTest = (() => {
2525
}
2626

2727
add(install_urls) {
28-
if (testInternal.serviceResultCode === -1) {
29-
return Promise.resolve(testInternal.addCallReturnValue);
30-
}
31-
throw testInternal.serviceResultCode;
28+
return Promise.resolve({
29+
resultList: {
30+
resultCode: testInternal.serviceResultCode,
31+
results: testInternal.addCallReturnValue,
32+
}
33+
});
3234
}
3335

3436
list() {
35-
if (testInternal.serviceResultCode === -1) {
36-
return Promise.resolve(testInternal.listCallReturnValue);
37-
}
38-
throw testInternal.serviceResultCode;
37+
return Promise.resolve({
38+
result: {
39+
resultCode: testInternal.serviceResultCode,
40+
subAppsList: testInternal.listCallReturnValue,
41+
}
42+
});
3943
}
4044

4145
remove(manifest_ids) {
42-
if (testInternal.serviceResultCode === -1) {
43-
return Promise.resolve(testInternal.removeCallReturnValue);
44-
}
45-
throw testInternal.serviceResultCode;
46+
return Promise.resolve({
47+
resultList: {
48+
resultCode: testInternal.serviceResultCode,
49+
results: testInternal.removeCallReturnValue,
50+
}
51+
});
4652
}
4753
}
4854

4955
let testInternal = {
5056
initialized: false,
5157
mockSubAppsService: null,
52-
serviceResultCode: -1,
58+
serviceResultCode: 0,
5359
addCallReturnValue: [],
5460
listCallReturnValue: [],
5561
removeCallReturnValue: [],
@@ -73,25 +79,13 @@ self.SubAppsServiceTest = (() => {
7379
};
7480
}
7581

76-
setAddCallReturnValue(value) {
77-
testInternal.addCallReturnValue = value;
78-
}
79-
80-
setListCallReturnValue(value) {
81-
testInternal.listCallReturnValue = value;
82-
}
83-
84-
setRemoveCallReturnValue(value) {
85-
testInternal.removeCallReturnValue = value;
86-
}
87-
8882
async reset() {
8983
if (testInternal.initialized) {
9084
testInternal.mockSubAppsService.reset();
9185
testInternal = {
9286
mockSubAppsService: null,
9387
initialized: false,
94-
serviceResultCode: -1,
88+
serviceResultCode: 0,
9589
addCallReturnValue: [],
9690
listCallReturnValue: [],
9791
removeCallReturnValue: [],

subapps/__dir__.headers

Lines changed: 0 additions & 4 deletions
This file was deleted.

subapps/add-error.tentative.https.html

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616

1717
const iframeDOMException = iframe.contentWindow.DOMException;
1818

19-
const subApps = iframe.contentWindow.subApps;
19+
// Detach the frame.
2020
iframe.remove();
21-
await promise_rejects_dom(t, 'OperationError', iframeDOMException, subApps.add([]));
21+
22+
// At this point the iframe is detached and unloaded, and its execution
23+
// context is gone.
24+
await promise_rejects_dom(t, 'NotFoundError', iframeDOMException, iframe.contentWindow.subApps.add([]));
2225
}, "The object is no longer associated to a document.");
2326

2427
promise_test(async t => {
@@ -28,22 +31,16 @@
2831
const iframeDOMException = iframe.contentWindow.DOMException;
2932
t.add_cleanup(() => iframe.remove());
3033

31-
await promise_rejects_dom(t, 'NotSupportedError', iframeDOMException, iframe.contentWindow.subApps.add([]));
34+
await promise_rejects_dom(t, 'InvalidStateError', iframeDOMException, iframe.contentWindow.subApps.add([]));
3235
}, "API is only supported in top-level browsing contexts.");
3336

3437
promise_test(async t => {
3538
const cross_origin_url = 'https://example.com/sub-app';
3639

3740
let add_call_params = [cross_origin_url];
3841

39-
t.add_cleanup(async () => {
40-
await mockSubAppsService.reset();
41-
mockSubAppsService = null;
42-
});
43-
44-
await createMockSubAppsService(Status.SUCCESS, [], [], []);
4542
await test_driver.bless("installing subapps", async function () {
46-
await promise_rejects_js(t, TypeError, window.subApps.add(add_call_params));
43+
await promise_rejects_dom(t, 'NotSupportedError', window.subApps.add(add_call_params));
4744
});
4845
}, 'API supports only same-origin URLs.');
4946

@@ -53,17 +50,17 @@
5350

5451
let add_call_params = [url_1, url_2];
5552

56-
let mocked_response = () => [
57-
{ "installPath": url_1, "manifestId": url_1, "resultType": SubAppsServiceAddResultType.kGenericError },
58-
{ "installPath": url_2, "manifestId": url_2, "resultType": SubAppsServiceAddResultType.kGenericError }
53+
let mocked_response = [
54+
{ "installUrlPath": url_1, "manifestIdPath": url_1, "resultType": SubAppsServiceAddResultType.kOperationError },
55+
{ "installUrlPath": url_2, "manifestIdPath": url_2, "resultType": SubAppsServiceAddResultType.kOperationError }
5956
];
6057

61-
let expected_results = () => ({
58+
let expected_results = {
6259
failedApps: {
6360
[url_1]: "OperationError",
6461
[url_2]: "OperationError"
6562
}
66-
});
63+
};
6764

6865
await test_driver.bless("installing a subapp", async function () {
6966
await subapps_add_expect_success_with_result(t, add_call_params, mocked_response, expected_results);
@@ -76,19 +73,19 @@
7673

7774
let add_call_params = [url_1, url_2];
7875

79-
let mocked_response = () => [
80-
{ "installPath": url_1, "manifestId": url_1, "resultType": SubAppsServiceAddResultType.kSuccess },
81-
{ "installPath": url_2, "manifestId": url_2, "resultType": SubAppsServiceAddResultType.kGenericError }
76+
let mocked_response = [
77+
{ "installUrlPath": url_1, "manifestIdPath": url_1, "resultType": SubAppsServiceAddResultType.kSuccess },
78+
{ "installUrlPath": url_2, "manifestIdPath": url_2, "resultType": SubAppsServiceAddResultType.kOperationError }
8279
];
8380

84-
let expected_results = () => ({
81+
let expected_results = {
8582
installedApps: {
8683
[url_1]: url_1
8784
},
8885
failedApps: {
8986
[url_2]: "OperationError"
9087
}
91-
});
88+
};
9289

9390
await test_driver.bless("installing a subapp", async function () {
9491
await subapps_add_expect_success_with_result(t, add_call_params, mocked_response, expected_results);
@@ -105,7 +102,8 @@
105102
mockSubAppsService = null;
106103
});
107104

108-
await createMockSubAppsService(Status.USER_DECLINED, [], [], []);
105+
// 2 corresponds to SubAppsServiceResultCode.kUserDenied
106+
await createMockSubAppsService(2, [], [], []);
109107
await test_driver.bless("installing a subapp", async function () {
110108
await window.subApps.add(add_call_params).then(
111109
result => {

subapps/add-success.tentative.https.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313

1414
let add_call_params = [install_url];
1515

16-
let mocked_response = () => [
17-
{ "installPath": install_url, "manifestId": install_url, "resultType": SubAppsServiceAddResultType.kSuccess }
16+
let mocked_response = [
17+
{ "installUrlPath": install_url, "manifestIdPath": install_url, "resultType": SubAppsServiceAddResultType.kSuccess }
1818
];
1919

20-
let expected_results = () => ({
20+
let expected_results = {
2121
installedApps: {
2222
[install_url]: install_url
2323
}
24-
});
24+
};
2525

2626
await test_driver.bless("installing a subapp", async function () {
2727
await subapps_add_expect_success_with_result(t, add_call_params, mocked_response, expected_results);
@@ -34,17 +34,17 @@
3434

3535
let add_call_params = [url_1, url_2];
3636

37-
let mocked_response = () => [
38-
{ "installPath": url_1, "manifestId": url_1, "resultType": SubAppsServiceAddResultType.kSuccess },
39-
{ "installPath": url_2, "manifestId": url_2, "resultType": SubAppsServiceAddResultType.kSuccess }
37+
let mocked_response = [
38+
{ "installUrlPath": url_1, "manifestIdPath": url_1, "resultType": SubAppsServiceAddResultType.kSuccess },
39+
{ "installUrlPath": url_2, "manifestIdPath": url_2, "resultType": SubAppsServiceAddResultType.kSuccess }
4040
];
4141

42-
let expected_results = () => ({
42+
let expected_results = {
4343
installedApps: {
4444
[url_1]: url_1,
4545
[url_2]: url_2
4646
}
47-
});
47+
};
4848

4949
await test_driver.bless("installing a subapp", async function () {
5050
await subapps_add_expect_success_with_result(t, add_call_params, mocked_response, expected_results);

subapps/disabled-by-permissions-policy.tentative.https.html

Lines changed: 0 additions & 20 deletions
This file was deleted.

subapps/disabled-by-permissions-policy.tentative.https.html.headers

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<title>Sub Apps: subApps is undefined in insecure context (non-https)</title>
3+
<script src="/resources/testharness.js"></script>
4+
<script src="/resources/testharnessreport.js"></script>
5+
<script>
6+
7+
test(() => {
8+
assert_equals(window.subApps, undefined);
9+
assert_equals(window.SubApps, undefined);
10+
}, 'subApps is not defined in insecure context.');
11+
12+
</script>

subapps/list-error.tentative.https.html

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
<title>Sub Apps: Error cases for list()</title>
33
<script src="/resources/testharness.js"></script>
44
<script src="/resources/testharnessreport.js"></script>
5-
<script src="/resources/testdriver.js"></script>
6-
<script src="/resources/testdriver-vendor.js"></script>
75
<script src="resources/subapps-helpers.js"></script>
86

97
<body></body>
@@ -14,13 +12,14 @@
1412
const iframe = document.createElement('iframe');
1513
document.body.appendChild(iframe);
1614

17-
const subApps = iframe.contentWindow.subApps;
18-
const DOMException_constructor = iframe.contentWindow.DOMException;
15+
const iframeDOMException = iframe.contentWindow.DOMException;
16+
17+
// Detach the frame.
1918
iframe.remove();
2019

2120
// At this point the iframe is detached and unloaded, and its execution
2221
// context is gone.
23-
await promise_rejects_dom(t, 'OperationError', DOMException_constructor, subApps.list());
22+
await promise_rejects_dom(t, 'NotFoundError', iframeDOMException, iframe.contentWindow.subApps.list());
2423
}, "The object is no longer associated to a document.");
2524

2625
promise_test(async t => {
@@ -30,7 +29,16 @@
3029
const iframeDOMException = iframe.contentWindow.DOMException;
3130
t.add_cleanup(() => iframe.remove());
3231

33-
await promise_rejects_dom(t, 'NotSupportedError', iframeDOMException, iframe.contentWindow.subApps.list());
32+
await promise_rejects_dom(t, 'InvalidStateError', iframeDOMException, iframe.contentWindow.subApps.list());
3433
}, "API is only supported in top-level browsing contexts.");
3534

35+
promise_test(async t => {
36+
t.add_cleanup(async () => {
37+
await mockSubAppsService.reset();
38+
mockSubAppsService = null;
39+
});
40+
await createMockSubAppsService(Status.FAILURE, [], []);
41+
return promise_rejects_dom(t, 'OperationError', window.subApps.list());
42+
}, 'List call failed.');
43+
3644
</script>

subapps/list-success.tentative.https.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
<title>Sub Apps: Valid calls for list()</title>
33
<script src="/resources/testharness.js"></script>
44
<script src="/resources/testharnessreport.js"></script>
5-
<script src="/resources/testdriver.js"></script>
6-
<script src="/resources/testdriver-vendor.js"></script>
75
<script src="resources/subapps-helpers.js"></script>
86
<script>
97

@@ -17,8 +15,8 @@
1715
const url_2 = '/sub-app-2';
1816

1917
const mocked_response = [
20-
{ "manifestId": url_1, "appName": "App 1" },
21-
{ "manifestId": url_2, "appName": "App 2" },
18+
{ "manifestIdPath": url_1, "appName": "App 1" },
19+
{ "manifestIdPath": url_2, "appName": "App 2" },
2220
];
2321

2422
let expected_results = {
@@ -57,4 +55,4 @@
5755
})
5856
}, 'List API call works with no sub apps.');
5957

60-
</script>
58+
</script>

0 commit comments

Comments
 (0)