Add spec for undocked devtools

This commit is contained in:
Kevin Sawicki 2016-05-17 14:56:00 -07:00
Родитель 189380d4ea
Коммит 77b074fbad
1 изменённых файлов: 46 добавлений и 16 удалений

Просмотреть файл

@ -825,25 +825,55 @@ describe('browser-window module', function () {
describe('dev tool extensions', function () { describe('dev tool extensions', function () {
describe('BrowserWindow.addDevToolsExtension', function () { describe('BrowserWindow.addDevToolsExtension', function () {
it('creates the extension', function (done) { beforeEach(function () {
var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo') BrowserWindow.removeDevToolsExtension('foo')
BrowserWindow.addDevToolsExtension(extensionPath) })
w.webContents.on('devtools-opened', () => { describe('when the devtools is docked', function () {
var inputEventIntervalId = setInterval(function () { it('creates the extension', function (done) {
if (w && w.devToolsWebContents) { var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo')
w.devToolsWebContents.sendInputEvent({type: 'keyDown', keyCode:'[', modifiers: ['meta']}) BrowserWindow.addDevToolsExtension(extensionPath)
} else {
clearInterval(inputEventIntervalId) w.webContents.on('devtools-opened', () => {
} var inputEventIntervalId = setInterval(function () {
}, 250) if (w && w.devToolsWebContents) {
w.devToolsWebContents.sendInputEvent({type: 'keyDown', keyCode:'[', modifiers: ['meta']})
} else {
clearInterval(inputEventIntervalId)
}
}, 250)
})
w.loadURL('about:blank')
w.webContents.openDevTools({mode: 'bottom'})
ipcMain.once('answer', function (event, message) {
assert.equal(message, 'extension loaded')
done()
})
}) })
w.loadURL('about:blank') })
w.webContents.openDevTools({mode: 'bottom'})
ipcMain.once('answer', function (event, message) { describe('when the devtools is undocked', function () {
assert.equal(message, 'extension loaded') it('creates the extension', function (done) {
done() var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo')
BrowserWindow.addDevToolsExtension(extensionPath)
w.webContents.on('devtools-opened', () => {
var inputEventIntervalId = setInterval(function () {
if (w && w.devToolsWebContents) {
w.devToolsWebContents.sendInputEvent({type: 'keyDown', keyCode:'[', modifiers: ['meta']})
} else {
clearInterval(inputEventIntervalId)
}
}, 250)
})
w.loadURL('about:blank')
w.webContents.openDevTools({mode: 'undocked'})
ipcMain.once('answer', function (event, message) {
assert.equal(message, 'extension loaded')
done()
})
}) })
}) })
}) })