Add spec for undocked devtools
This commit is contained in:
parent
189380d4ea
commit
77b074fbad
1 changed files with 46 additions and 16 deletions
|
@ -825,6 +825,11 @@ describe('browser-window module', function () {
|
||||||
|
|
||||||
describe('dev tool extensions', function () {
|
describe('dev tool extensions', function () {
|
||||||
describe('BrowserWindow.addDevToolsExtension', function () {
|
describe('BrowserWindow.addDevToolsExtension', function () {
|
||||||
|
beforeEach(function () {
|
||||||
|
BrowserWindow.removeDevToolsExtension('foo')
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('when the devtools is docked', function () {
|
||||||
it('creates the extension', function (done) {
|
it('creates the extension', function (done) {
|
||||||
var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo')
|
var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo')
|
||||||
BrowserWindow.addDevToolsExtension(extensionPath)
|
BrowserWindow.addDevToolsExtension(extensionPath)
|
||||||
|
@ -848,6 +853,31 @@ describe('browser-window module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('when the devtools is undocked', function () {
|
||||||
|
it('creates the extension', function (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()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it('serializes the registered extensions on quit', function () {
|
it('serializes the registered extensions on quit', function () {
|
||||||
var extensionName = 'foo'
|
var extensionName = 'foo'
|
||||||
var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', extensionName)
|
var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', extensionName)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue