Merge pull request #8565 from electron/protocol-client-specs
Add protocol client specs on Windows
This commit is contained in:
commit
930a5c6de2
1 changed files with 36 additions and 0 deletions
|
@ -403,4 +403,40 @@ describe('app module', function () {
|
||||||
w.webContents.loadURL(secureUrl)
|
w.webContents.loadURL(secureUrl)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('setAsDefaultProtocolClient(protocol, path, args)', () => {
|
||||||
|
if (process.platform !== 'win32') return
|
||||||
|
|
||||||
|
const protocol = 'electron-test'
|
||||||
|
const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe')
|
||||||
|
const processStartArgs = [
|
||||||
|
'--processStart', `"${path.basename(process.execPath)}"`,
|
||||||
|
'--process-start-args', `"--hidden"`
|
||||||
|
]
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
app.removeAsDefaultProtocolClient(protocol)
|
||||||
|
app.removeAsDefaultProtocolClient(protocol, updateExe, processStartArgs)
|
||||||
|
})
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
app.removeAsDefaultProtocolClient(protocol)
|
||||||
|
assert.equal(app.isDefaultProtocolClient(protocol), false)
|
||||||
|
app.removeAsDefaultProtocolClient(protocol, updateExe, processStartArgs)
|
||||||
|
assert.equal(app.isDefaultProtocolClient(protocol, updateExe, processStartArgs), false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('sets the app as the default protocol client', () => {
|
||||||
|
assert.equal(app.isDefaultProtocolClient(protocol), false)
|
||||||
|
app.setAsDefaultProtocolClient(protocol)
|
||||||
|
assert.equal(app.isDefaultProtocolClient(protocol), true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('allows a custom path and args to be specified', () => {
|
||||||
|
assert.equal(app.isDefaultProtocolClient(protocol, updateExe, processStartArgs), false)
|
||||||
|
app.setAsDefaultProtocolClient(protocol, updateExe, processStartArgs)
|
||||||
|
assert.equal(app.isDefaultProtocolClient(protocol, updateExe, processStartArgs), true)
|
||||||
|
assert.equal(app.isDefaultProtocolClient(protocol), false)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue