-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dpwa: Add Subapp integration testing to framework
Add a new app with a subapp to the desktop web app integration testing framework, and a function to install the subapp. The API under test requires user activation. For this, the app contains a button to press that will trigger the API-call and an input field in which to specify the specific sub-app to add. Bug: 1313112 Test: browser_tests --gtest_filter=*WebAppIntegration.CheckSubappInstallation Change-Id: I0100c16dde58e30a3332b6789403d1525bcffa21 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4142580 Reviewed-by: Daniel Murphy <dmurph@chromium.org> Commit-Queue: Philipp Weiß <phweiss@chromium.org> Cr-Commit-Position: refs/heads/main@{#1095538}
- Loading branch information
Philipp Weiß
authored and
Chromium LUCI CQ
committed
Jan 23, 2023
1 parent
24601f3
commit ed8d404
Showing
28 changed files
with
448 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+131 Bytes
chrome/test/data/webapps_integration/has_sub_apps/128x128-green.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+134 Bytes
chrome/test/data/webapps_integration/has_sub_apps/192x192-green.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+137 Bytes
chrome/test/data/webapps_integration/has_sub_apps/256x256-green.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
function doPromise(promise) { | ||
console.log('promise: ', promise); | ||
promise.then( | ||
value => { console.log('promise resolved: ', JSON.stringify(value)); }, | ||
err => { console.log('promise rejected: ', JSON.stringify(err)); }); | ||
} | ||
|
||
function callAdd() { | ||
var arg = {}; | ||
var app_id = document.getElementById('subAppUrl').value; | ||
arg[app_id] = {'install_url': app_id}; | ||
doPromise(navigator.subApps.add(arg)); | ||
} | ||
|
||
function callRemove() { | ||
arg = document.getElementById('subAppUrl').value; | ||
doPromise(navigator.subApps.remove(arg)); | ||
} | ||
|
||
function callList() { | ||
navigator.subApps.list().then( | ||
output => { | ||
document.getElementById('listOutput').value = | ||
JSON.stringify(output); | ||
}, | ||
err => { | ||
document.getElementById('listOutput').value = | ||
"Error: " + JSON.stringify(err); | ||
} | ||
) | ||
} |
44 changes: 44 additions & 0 deletions
44
chrome/test/data/webapps_integration/has_sub_apps/basic.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Site With Sub Apps</title> | ||
<script src="/web_apps/test_utils.js"></script> | ||
<script src="/webapps_integration/has_sub_apps/app.js"></script> | ||
<script> | ||
// If a "manifest=/path/to/manifest.json" query argument is provided to | ||
// the URL accessing this page, that path is injected as the manifest tag. | ||
// Otherwise, "basic.json" is used as the manifest tag. | ||
addManifestLinkTag(); | ||
</script> | ||
</head> | ||
<body onload="startWorker('/webapps_integration/has_sub_apps/service_worker.js', { scope: '/webapps_integration/has_sub_apps/' })"> | ||
<h1>Site With Sub Apps</h1> | ||
<div> | ||
<p> | ||
This site is used for dPWA integration tests, and is subject to modification to support that framework. See | ||
<a | ||
href="https://chromium.googlesource.com/chromium/src/+/main/docs/webapps/integration-testing-framework.md">https://chromium.googlesource.com/chromium/src/+/main/docs/webapps/integration-testing-framework.md</a> | ||
</p> | ||
<p> | ||
These buttons below are for manual debugging, the framework is | ||
calling the APIs-under-test directly. | ||
</p> | ||
<p> | ||
Subapp to add/remove: <input id="subAppUrl" value="/sub_app_url"></input> | ||
</p> | ||
<p> | ||
<button id="addButton" onclick="callAdd()">add()</button> | ||
</p> | ||
<p> | ||
<button id="removeButton" onclick="callRemove()">remove()</button> | ||
</p> | ||
<p> | ||
<button id="list" onclick="callList()">list()</button> | ||
</p> | ||
<p> | ||
list() output: | ||
<input id="listOutput" value="list wasn't called yet"></input> | ||
</p> | ||
</div> | ||
</body> | ||
</html> |
28 changes: 28 additions & 0 deletions
28
chrome/test/data/webapps_integration/has_sub_apps/basic.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "Site With Sub Apps", | ||
"icons": [ | ||
{ | ||
"src": "48x48-green.png", | ||
"sizes": "48x48", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "128x128-green.png", | ||
"sizes": "128x128", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "192x192-green.png", | ||
"sizes": "192x192", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "256x256-green.png", | ||
"sizes": "256x256", | ||
"type": "image/png" | ||
} | ||
], | ||
"start_url": "/webapps_integration/has_sub_apps/basic.html", | ||
"scope": "/webapps_integration/has_sub_apps/", | ||
"display": "standalone" | ||
} |
11 changes: 11 additions & 0 deletions
11
chrome/test/data/webapps_integration/has_sub_apps/service_worker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
'use strict'; | ||
|
||
self.addEventListener('fetch', event => { | ||
event.respondWith(fetch(event.request).catch(_ => { | ||
return new Response('Offline test.'); | ||
})); | ||
}); |
Binary file added
BIN
+253 Bytes
chrome/test/data/webapps_integration/has_sub_apps/sub_app1/128x128-blue.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+409 Bytes
chrome/test/data/webapps_integration/has_sub_apps/sub_app1/192x192-blue.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+564 Bytes
chrome/test/data/webapps_integration/has_sub_apps/sub_app1/256x256-blue.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+113 Bytes
chrome/test/data/webapps_integration/has_sub_apps/sub_app1/48x48-blue.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.