From 25e1c5d6e7de71c717c3ac24a27686affd09379d Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Mon, 26 Jun 2017 11:08:51 +0200 Subject: [PATCH] Skip "offscreen rendering" tests if OSR is not available --- spec/api-browser-window-spec.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index dad348599428..2e18ef25aac8 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -2555,9 +2555,8 @@ describe('BrowserWindow module', function () { }) describe('offscreen rendering', function () { - beforeEach(function () { - if (w != null) w.destroy() - w = new BrowserWindow({ + const createWindow = function() { + return new BrowserWindow({ width: 100, height: 100, show: false, @@ -2566,6 +2565,20 @@ 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) {