Commit 348175b0 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

Add basic PWA to test suite

Tests like WebAppPictureInPictureWindowControllerBrowserTest
now have a trivial standalone PWA to reference.

Requested in
https://chromium-review.googlesource.com/c/chromium/src/+/2062123/1/chrome/browser/picture_in_picture/picture_in_picture_window_controller_browsertest.cc#2534

Bug: 2062123
Change-Id: I65451ef09523c669c4e53634d9bcac2a3face288
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2066408
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarFrançois Beaufort <beaufort.francois@gmail.com>
Cr-Commit-Position: refs/heads/master@{#743501}
parent 8bbf15de
......@@ -2579,8 +2579,8 @@ IN_PROC_BROWSER_TEST_P(
AutoPictureInPictureNotTriggeredIfDocumentNotInWebAppScope) {
// We open a web app with a different scope
// Then go to our usual test page.
Browser* app_browser = InstallAndLaunchPWA(https_server()->GetURL(
"www.foobar.com", "/banners/manifest_test_page.html"));
Browser* app_browser = InstallAndLaunchPWA(
https_server()->GetURL("www.foobar.com", "/web_apps/basic.html"));
web_app::NavigateToURLAndWait(app_browser, main_url());
EXPECT_TRUE(app_browser->app_controller()->ShouldShowCustomTabBar());
......
<!DOCTYPE html>
<html>
<head>
<link rel="manifest" href="basic.json">
<link rel="icon" href="basic-48.png">
</head>
<body>
<h1>Basic web app</h1>
<script>
navigator.serviceWorker.register('/web_apps/service_worker.js');
</script>
</body>
</html>
{
"name": "Basic web app",
"icons": [
{
"src": "basic-48.png",
"sizes": "48x48",
"type": "image/png"
},
{
"src": "basic-192.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "basic.html",
"display": "standalone"
}
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
'use strict';
const urlsToCache = [
'basic-192.png',
'basic-48.png',
'basic.html',
'basic.json',
];
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open('basic-cache').then((cache) => {
return cache.addAll(urlsToCache);
})
);
});
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request).then((response) => {
if (response) {
return response;
}
return fetch(event.request);
})
);
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment