Merge pull request #9918 from alexstrat/add-extensions-loading-api
Introduce Chrome extensions management APIs independent of Dev Tools Extensions
This commit is contained in:
commit
ccdff72ee4
3 changed files with 96 additions and 18 deletions
|
@ -2373,7 +2373,7 @@ describe('BrowserWindow module', function () {
|
|||
})
|
||||
})
|
||||
|
||||
describe('dev tool extensions', function () {
|
||||
describe('extensions and dev tools extensions', function () {
|
||||
let showPanelTimeoutId
|
||||
|
||||
const showLastDevToolsPanel = () => {
|
||||
|
@ -2506,6 +2506,33 @@ describe('BrowserWindow module', function () {
|
|||
app.emit('will-quit')
|
||||
assert.equal(fs.existsSync(serializedPath), false)
|
||||
})
|
||||
|
||||
describe('BrowserWindow.addExtension', function () {
|
||||
beforeEach(function () {
|
||||
BrowserWindow.removeExtension('foo')
|
||||
assert.equal(BrowserWindow.getExtensions().hasOwnProperty('foo'), false)
|
||||
|
||||
var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo')
|
||||
BrowserWindow.addExtension(extensionPath)
|
||||
assert.equal(BrowserWindow.getExtensions().hasOwnProperty('foo'), true)
|
||||
|
||||
showLastDevToolsPanel()
|
||||
|
||||
w.loadURL('about:blank')
|
||||
})
|
||||
|
||||
it('throws errors for missing manifest.json files', function () {
|
||||
assert.throws(function () {
|
||||
BrowserWindow.addExtension(path.join(__dirname, 'does-not-exist'))
|
||||
}, /ENOENT: no such file or directory/)
|
||||
})
|
||||
|
||||
it('throws errors for invalid manifest.json files', function () {
|
||||
assert.throws(function () {
|
||||
BrowserWindow.addExtension(path.join(__dirname, 'fixtures', 'devtools-extensions', 'bad-manifest'))
|
||||
}, /Unexpected token }/)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('window.webContents.executeJavaScript', function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue