Add spec for ipc.sendSync.

This commit is contained in:
Cheng Zhao 2013-09-22 12:06:41 +08:00
parent 761b9d22c8
commit 68bdad9a23
2 changed files with 10 additions and 1 deletions

View file

@ -49,7 +49,12 @@ describe 'ipc', ->
describe 'ipc.send', ->
it 'should work when sending an object containing id property', (done) ->
obj = id: 1, name: 'ly'
ipc.on 'message', (message) ->
ipc.once 'message', (message) ->
assert.deepEqual message, obj
done()
ipc.send obj
describe 'ipc.sendSync', ->
it 'can be replied by setting event.returnValue', ->
msg = ipc.sendChannelSync 'echo', 'test'
assert.equal msg, 'test'

View file

@ -26,6 +26,10 @@ ipc.on('eval', function(ev, pid, rid, script) {
ev.returnValue = eval(script);
});
ipc.on('echo', function(ev, pid, rid, msg) {
ev.returnValue = msg;
});
process.on('uncaughtException', function() {
window.openDevTools();
});