})
describe('dev tool extensions', function () {
+ describe('BrowserWindow.addDevToolsExtension', 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: 'bottom'})
+
+ ipcMain.once('answer', function (event, message) {
+ assert.equal(message, 'extension loaded')
+ done()
+ })
+ })
+ })
+
it('serializes the registered extensions on quit', function () {
var extensionName = 'foo'
var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', extensionName)
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title></title>
+ <script>
+ var sendMessage = `require('electron').ipcRenderer.send('answer', 'extension loaded')`
+ window.chrome.devtools.inspectedWindow.eval(sendMessage, function () {})
+ </script>
+ </head>
+ <body>
+ a custom devtools extension
+ </body>
+</html>