From 904d2ff4cc2fc427d699d7301ab5be0e78f12e80 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Thu, 7 Jan 2021 23:17:53 +0100 Subject: [PATCH] test: skip PictureInPicture video when media not supported (#27218) --- spec-main/api-web-contents-spec.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec-main/api-web-contents-spec.ts b/spec-main/api-web-contents-spec.ts index c1348af72e39..6033269a132d 100644 --- a/spec-main/api-web-contents-spec.ts +++ b/spec-main/api-web-contents-spec.ts @@ -1787,9 +1787,14 @@ describe('webContents module', () => { describe('PictureInPicture video', () => { afterEach(closeAllWindows); - it('works as expected', async () => { + it('works as expected', async function () { const w = new BrowserWindow({ show: false, webPreferences: { sandbox: true } }); await w.loadFile(path.join(fixturesPath, 'api', 'picture-in-picture.html')); + + if (!await w.webContents.executeJavaScript('document.createElement(\'video\').canPlayType(\'video/webm; codecs="vp8.0"\')')) { + this.skip(); + } + const result = await w.webContents.executeJavaScript( `runTest(${features.isPictureInPictureEnabled()})`, true); expect(result).to.be.true();