diff options
Diffstat (limited to 'testing/web-platform/tests/service-workers/service-worker/tentative/static-router/resources')
2 files changed, 27 insertions, 4 deletions
diff --git a/testing/web-platform/tests/service-workers/service-worker/tentative/static-router/resources/router-rules.js b/testing/web-platform/tests/service-workers/service-worker/tentative/static-router/resources/router-rules.js index c3aef4272f..014cd2ec95 100644 --- a/testing/web-platform/tests/service-workers/service-worker/tentative/static-router/resources/router-rules.js +++ b/testing/web-platform/tests/service-workers/service-worker/tentative/static-router/resources/router-rules.js @@ -1,9 +1,14 @@ +const TEST_CACHE_NAME = 'v1'; + const routerRules = { 'condition-urlpattern-constructed-source-network': [{ condition: {urlPattern: new URLPattern({pathname: '/**/direct.txt'})}, source: 'network' }], - 'condition-urlpattern-urlpatterninit-source-network': [ + 'condition-urlpattern-constructed-match-all-source-cache': [ + {condition: {urlPattern: new URLPattern({})}, source: 'cache'}, + ], + 'condition-urlpattern-urlpatterncompatible-source-network': [ {condition: {urlPattern: {pathname: '/**/direct.txt'}}, source: 'network'}, ], 'condition-urlpattern-string-source-network': [ @@ -12,6 +17,9 @@ const routerRules = { 'condition-urlpattern-string-source-cache': [ {condition: {urlPattern: '/**/cache.txt'}, source: 'cache'}, ], + 'condition-urlpattern-string-source-cache-with-name': [ + {condition: {urlPattern: '/**/cache.txt'}, source: {cacheName: TEST_CACHE_NAME}}, + ], 'condition-urlpattern-constructed-ignore-case-source-network': [{ condition: { urlPattern: @@ -90,6 +98,21 @@ const routerRules = { source: 'race-network-and-fetch-handler' }, ], + 'multiple-conditions-network': { + condition: { + urlPattern: new URLPattern({search: 'test'}), + requestMode: 'cors', + requestMethod: 'post', + }, + source: 'network' + }, + 'multiple-conditions-with-destination-network' : { + condition: { + urlPattern: new URLPattern({search: 'test'}), + requestDestination: 'style' + }, + source: 'network' + } }; -export {routerRules}; +export {routerRules, TEST_CACHE_NAME as cacheName}; diff --git a/testing/web-platform/tests/service-workers/service-worker/tentative/static-router/resources/static-router-sw.js b/testing/web-platform/tests/service-workers/service-worker/tentative/static-router/resources/static-router-sw.js index 07409ec42c..c0bd683f91 100644 --- a/testing/web-platform/tests/service-workers/service-worker/tentative/static-router/resources/static-router-sw.js +++ b/testing/web-platform/tests/service-workers/service-worker/tentative/static-router/resources/static-router-sw.js @@ -1,6 +1,6 @@ 'use strict'; -import {routerRules} from './router-rules.js'; +import {routerRules, cacheName} from './router-rules.js'; import { recordRequest, recordError, @@ -10,7 +10,7 @@ import { import './imported-sw.js'; self.addEventListener('install', async e => { - e.waitUntil(caches.open('v1').then( + e.waitUntil(caches.open(cacheName).then( cache => {cache.put('cache.txt', new Response('From cache'))})); const params = new URLSearchParams(location.search); |