How to use backgroundFetchTest method in wpt

Best JavaScript code snippet using wpt

mixed-content-and-allowed-schemes.https.window.js

Source:mixed-content-and-allowed-schemes.https.window.js Github

copy

Full Screen

...9// requests are allowed. Hence the wss:, file:, data:, etc schemes are blocked.10// https://github.com/WICG/background-fetch/issues/4411// This is not a comprehensive test of mixed content blocking - it is just12// intended to check that blocking is enabled.13backgroundFetchTest((t, bgFetch) => {14 return bgFetch.fetch(uniqueTag(), 'https://example.com');15}, 'https: fetch should register ok');16backgroundFetchTest((t, bgFetch) => {17 return bgFetch.fetch(uniqueTag(), 'http://127.0.0.1');18}, 'loopback IPv4 http: fetch should register ok');19backgroundFetchTest((t, bgFetch) => {20 return bgFetch.fetch(uniqueTag(), 'http://[::1]');21}, 'loopback IPv6 http: fetch should register ok');22backgroundFetchTest((t, bgFetch) => {23 return bgFetch.fetch(uniqueTag(), 'http://localhost');24}, 'localhost http: fetch should register ok');25backgroundFetchTest((t, bgFetch) => {26 return promise_rejects(t, new TypeError(),27 bgFetch.fetch(uniqueTag(), 'http://example.com'));28}, 'non-loopback http: fetch should reject');29backgroundFetchTest((t, bgFetch) => {30 return promise_rejects(t, new TypeError(),31 bgFetch.fetch(uniqueTag(), 'http://192.0.2.0'));32}, 'non-loopback IPv4 http: fetch should reject');33backgroundFetchTest((t, bgFetch) => {34 return promise_rejects(t, new TypeError(),35 bgFetch.fetch(uniqueTag(), 'http://[2001:db8::1]'));36}, 'non-loopback IPv6 http: fetch should reject');37backgroundFetchTest((t, bgFetch) => {38 return promise_rejects(t, new TypeError(),39 bgFetch.fetch(uniqueTag(), ['https://example.com',40 'http://example.com']));41}, 'https: and non-loopback http: fetch should reject');42backgroundFetchTest((t, bgFetch) => {43 return promise_rejects(t, new TypeError(),44 bgFetch.fetch(uniqueTag(), ['http://example.com',45 'https://example.com']));46}, 'non-loopback http: and https: fetch should reject');47backgroundFetchTest((t, bgFetch) => {48 return promise_rejects(t, new TypeError(),49 bgFetch.fetch(uniqueTag(), 'wss:127.0.0.1'));50}, 'wss: fetch should reject');51backgroundFetchTest((t, bgFetch) => {52 return promise_rejects(t, new TypeError(),53 bgFetch.fetch(uniqueTag(), 'file:///'));54}, 'file: fetch should reject');55backgroundFetchTest((t, bgFetch) => {56 return promise_rejects(t, new TypeError(),57 bgFetch.fetch(uniqueTag(), 'data:text/plain,foo'));58}, 'data: fetch should reject');59backgroundFetchTest((t, bgFetch) => {60 return promise_rejects(t, new TypeError(),61 bgFetch.fetch(uniqueTag(), 'foobar:bazqux'));...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful