From dd17250a80fe3e14d11ed4fa55f5ffa8427ce6a3 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Wed, 13 Jan 2021 22:49:35 +0100 Subject: [PATCH] revert: test use emittedUntil in PDF Viewer tests (#27273) This reverts commit 36f4ee87df6b57859ac30ac7128e538ebc50a229. --- spec-main/chromium-spec.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/spec-main/chromium-spec.ts b/spec-main/chromium-spec.ts index db883c299fc7..cfea0fe19c1b 100644 --- a/spec-main/chromium-spec.ts +++ b/spec-main/chromium-spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import { BrowserWindow, WebContents, session, ipcMain, app, protocol, webContents } from 'electron/main'; -import { emittedOnce, emittedUntil } from './events-helpers'; +import { emittedOnce } from './events-helpers'; import { closeAllWindows } from './window-helpers'; import * as https from 'https'; import * as http from 'http'; @@ -1283,17 +1283,15 @@ describe('chromium features', () => { it('opens when loading a pdf resource as top level navigation', async () => { const w = new BrowserWindow({ show: false }); w.loadURL(pdfSource); - await emittedUntil(app, 'web-contents-created', (event: Electron.Event, contents: WebContents) => { - return contents.getURL() === 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html'; - }); + const [, contents] = await emittedOnce(app, 'web-contents-created'); + expect(contents.getURL()).to.equal('chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html'); }); it('opens when loading a pdf resource in a iframe', async () => { const w = new BrowserWindow({ show: false }); w.loadFile(path.join(__dirname, 'fixtures', 'pages', 'pdf-in-iframe.html')); - await emittedUntil(app, 'web-contents-created', (event: Electron.Event, contents: WebContents) => { - return contents.getURL() === 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html'; - }); + const [, contents] = await emittedOnce(app, 'web-contents-created'); + expect(contents.getURL()).to.equal('chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html'); }); });