From 449776f22824ad88faf2bffdf04a30a6840b0db6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 29 Jun 2017 12:26:45 -0700 Subject: [PATCH] Don't run it statements when OSR is disabled --- spec/api-browser-window-spec.js | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index 2e18ef25a..fba606f3a 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -2555,8 +2555,19 @@ describe('BrowserWindow module', function () { }) describe('offscreen rendering', function () { - const createWindow = function() { - return new BrowserWindow({ + const isOffscreenRenderingDisabled = () => { + const contents = webContents.create({}) + const disabled = typeof contents.isOffscreen !== 'function' + contents.destroy() + return disabled + } + + // Offscreen rendering can be disabled in the build + if (isOffscreenRenderingDisabled()) return + + beforeEach(function () { + if (w != null) w.destroy() + w = new BrowserWindow({ width: 100, height: 100, show: false, @@ -2565,20 +2576,6 @@ describe('BrowserWindow module', function () { offscreen: true } }) - } - - before(function() { - const w = createWindow() - this.osrIsAvailable = ('isOffscreen' in w.webContents) - }) - - beforeEach(function () { - if (!this.osrIsAvailable) { - this.skip() - } - - if (w != null) w.destroy() - w = createWindow() }) it('creates offscreen window with correct size', function (done) {