Assert on tab id as well

This commit is contained in:
Kevin Sawicki 2016-06-07 10:38:01 -07:00
parent bf47056561
commit 4f7bde38a9
3 changed files with 5 additions and 1 deletions

View file

@ -864,6 +864,7 @@ describe('browser-window module', function () {
ipcMain.once('answer', function (event, message) { ipcMain.once('answer', function (event, message) {
assert.equal(message.runtimeId, 'foo') assert.equal(message.runtimeId, 'foo')
assert.equal(message.tabId, w.webContents.id)
done() done()
}) })
}) })
@ -875,6 +876,7 @@ describe('browser-window module', function () {
ipcMain.once('answer', function (event, message, extensionId) { ipcMain.once('answer', function (event, message, extensionId) {
assert.equal(message.runtimeId, 'foo') assert.equal(message.runtimeId, 'foo')
assert.equal(message.tabId, w.webContents.id)
done() done()
}) })
}) })

View file

@ -5,7 +5,8 @@
<title></title> <title></title>
<script> <script>
var message = JSON.stringify({ var message = JSON.stringify({
runtimeId: chrome.runtime.id runtimeId: chrome.runtime.id,
tabId: chrome.devtools.inspectedWindow.tabId
}) })
var sendMessage = `require('electron').ipcRenderer.send('answer', ${message})` var sendMessage = `require('electron').ipcRenderer.send('answer', ${message})`
window.chrome.devtools.inspectedWindow.eval(sendMessage, function () {}) window.chrome.devtools.inspectedWindow.eval(sendMessage, function () {})

View file

@ -929,6 +929,7 @@ describe('<webview> tag', function () {
ipcMain.once('answer', function (event, message) { ipcMain.once('answer', function (event, message) {
assert.equal(message.runtimeId, 'foo') assert.equal(message.runtimeId, 'foo')
assert.notEqual(message.tabId, w.webContents.id)
done() done()
}) })
}) })