Index: remoting/webapp/unittests/ipc_unittest.js |
diff --git a/remoting/webapp/unittests/ipc_unittest.js b/remoting/webapp/unittests/ipc_unittest.js |
index 9434cabe97c3adcc2aa5dfaf37aac2c54f6b9173..a0685978a2326591e90b2605167d1794c12d65c6 100644 |
--- a/remoting/webapp/unittests/ipc_unittest.js |
+++ b/remoting/webapp/unittests/ipc_unittest.js |
@@ -6,6 +6,7 @@ |
'use strict'; |
+/** @type {base.Ipc} */ |
var ipc_; |
function pass() { |
@@ -20,20 +21,20 @@ function fail() { |
module('base.Ipc', { |
setup: function() { |
- chromeMocks.activate(['runtime']); |
ipc_ = base.Ipc.getInstance(); |
}, |
teardown: function() { |
base.Ipc.deleteInstance(); |
ipc_ = null; |
- chromeMocks.restore(); |
} |
}); |
QUnit.test( |
'register() should return false if the request type was already registered', |
function() { |
+ /** @type {function(...?)} */ |
var handler1 = function() {}; |
+ /** @type {function(...?)} */ |
var handler2 = function() {}; |
QUnit.equal(true, ipc_.register('foo', handler1)); |
QUnit.equal(false, ipc_.register('foo', handler2)); |
@@ -42,7 +43,7 @@ QUnit.test( |
QUnit.asyncTest( |
'send() should invoke a registered handler with the correct arguments', |
function() { |
- var handler = sinon.spy(); |
+ var handler = /** @type {function(...?)} */ (sinon.spy()); |
kelvinp
2015/02/26 00:31:30
You can simply change the definition ipc.js to be
garykac
2015/02/28 02:33:33
Done.
|
var argArray = [1, 2, 3]; |
var argDict = { |
key1: 'value1', |
@@ -60,9 +61,9 @@ QUnit.asyncTest( |
QUnit.asyncTest( |
'send() should not invoke a handler that is unregistered', |
function() { |
- var handler = sinon.spy(); |
+ var handler = /** @type {function(...?)} */ (sinon.spy()); |
ipc_.register('foo', handler); |
- ipc_.unregister('foo', handler); |
+ ipc_.unregister('foo'); |
base.Ipc.invoke('foo', 'hello', 'world').then(fail, function(error) { |
sinon.assert.notCalled(handler); |
QUnit.equal(error, base.Ipc.Error.UNSUPPORTED_REQUEST_TYPE); |
@@ -73,7 +74,7 @@ QUnit.asyncTest( |
QUnit.asyncTest( |
'send() should raise exceptions on unknown request types', |
function() { |
- var handler = sinon.spy(); |
+ var handler = /** @type {function(...?)} */ (sinon.spy()); |
ipc_.register('foo', handler); |
base.Ipc.invoke('bar', 'hello', 'world').then(fail, function(error) { |
QUnit.equal(error, base.Ipc.Error.UNSUPPORTED_REQUEST_TYPE); |
@@ -84,7 +85,7 @@ QUnit.asyncTest( |
QUnit.asyncTest( |
'send() should raise exceptions on request from another extension', |
function() { |
- var handler = sinon.spy(); |
+ var handler = /** @type {function(...?)} */ (sinon.spy()); |
var oldId = chrome.runtime.id; |
ipc_.register('foo', handler); |
chrome.runtime.id = 'foreign-extension'; |