Skip to content

Commit

Permalink
Add test PWA for integration tests on tabbed mode
Browse files Browse the repository at this point in the history
Tabbed Mode explainer:
https://github.com/WICG/manifest-incubations/blob/gh-pages/tabbed-mode-explainer.md

Bug: 1406730
Change-Id: I22413751682467b4aef5f4aef9bec12d12171ce8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4199786
Reviewed-by: Eric Willigers <ericwilligers@chromium.org>
Reviewed-by: Louise Brett <loubrett@google.com>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1098421}
  • Loading branch information
Kasie Wang authored and Chromium LUCI CQ committed Jan 30, 2023
1 parent 52fee87 commit f99aff7
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "Site A",
"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/standalone/basic.html",
"scope": "/webapps_integration/standalone/",
"display": "standalone",
"display_override": [
"tabbed"
]
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
23 changes: 23 additions & 0 deletions chrome/test/data/webapps_integration/tabbed/basic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>Tabbed</title>
<script src="/webapps_integration/test_utils.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/tabbed/service_worker.js', { scope: '/webapps_integration/tabbed/' })">
<h1>Tabbed Home Page</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>
</div>
</body>
</html>
39 changes: 39 additions & 0 deletions chrome/test/data/webapps_integration/tabbed/basic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "Tabbed",
"icons": [
{
"src": "192x192-red.webp",
"sizes": "192x192",
"type": "image/webp"
},
{
"src": "256x256-red.webp",
"sizes": "256x256",
"type": "image/webp"
}
],
"start_url": "/webapps_integration/tabbed/basic.html",
"scope": "/webapps_integration/tabbed/",
"display": "standalone",
"display_override": ["tabbed"],
"tab_strip": {
"home_tab": {
"url": "/webapps_integration/tabbed/basic.html",
"icons": [
{
"src": "192x192-green.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "256x256-green.png",
"sizes": "256x256",
"type": "image/png"
}
]
},
"new_tab_button": {
"url": "/webapps_integration/tabbed/new_page.html"
}
}
}
23 changes: 23 additions & 0 deletions chrome/test/data/webapps_integration/tabbed/new_page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>Tabbed</title>
<script src="/webapps_integration/test_utils.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/tabbed/service_worker.js', { scope: '/webapps_integration/tabbed/' })">
<h1>Tabbed Page One</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>
</div>
</body>
</html>
11 changes: 11 additions & 0 deletions chrome/test/data/webapps_integration/tabbed/service_worker.js
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.');
}));
});

0 comments on commit f99aff7

Please sign in to comment.