From 051e133ce33e3c1f6be625f65b7a4774182cc394 Mon Sep 17 00:00:00 2001 From: Ryohei Ikegami Date: Tue, 4 Apr 2017 19:05:13 +0900 Subject: [PATCH] Add test for opeing HTML file --- spec/api-browser-window-spec.js | 23 +++++++++++++------ .../api/native-window-open-child.html | 1 + spec/fixtures/api/native-window-open.html | 23 +++++++++++++++---- 3 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 spec/fixtures/api/native-window-open-child.html diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index c5c1bb2859..04c3be453c 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -1071,19 +1071,28 @@ describe('BrowserWindow module', function () { }) describe('nativeWindowOpen option', () => { - it('allows synchronous access to window opened by window.open()', (done) => { - ipcMain.once('answer', function (event, content) { - assert.equal(content, 'Hello') - done() - }) + beforeEach(() => { w.destroy() w = new BrowserWindow({ - show: false, + show: true, webPreferences: { nativeWindowOpen: true } }) - w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open.html')) + }) + it('opens window of about:blank with cross-scripting enabled', (done) => { + ipcMain.once('answer', function (event, content) { + assert.equal(content, 'Hello') + done() + }) + w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open.html#blank')) + }) + it('opens window of same domain with cross-scripting enabled', (done) => { + ipcMain.once('answer', function (event, content) { + assert.equal(content, 'Hello') + done() + }) + w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open.html#file')) }) }) }) diff --git a/spec/fixtures/api/native-window-open-child.html b/spec/fixtures/api/native-window-open-child.html new file mode 100644 index 0000000000..986a4a1a25 --- /dev/null +++ b/spec/fixtures/api/native-window-open-child.html @@ -0,0 +1 @@ +

Hello

diff --git a/spec/fixtures/api/native-window-open.html b/spec/fixtures/api/native-window-open.html index 630c4faa41..49c9352265 100644 --- a/spec/fixtures/api/native-window-open.html +++ b/spec/fixtures/api/native-window-open.html @@ -2,10 +2,25 @@