Index: remoting/webapp/unittests/xmpp_connection_unittest.js |
diff --git a/remoting/webapp/unittests/xmpp_connection_unittest.js b/remoting/webapp/unittests/xmpp_connection_unittest.js |
index f99f94c008295e7e678797bc0ba09c8090c42f4b..fe635c1da2a1c6e2da0650da439f8c0e79670c28 100644 |
--- a/remoting/webapp/unittests/xmpp_connection_unittest.js |
+++ b/remoting/webapp/unittests/xmpp_connection_unittest.js |
@@ -27,12 +27,12 @@ module('XmppConnection', { |
onStanzaStr(new XMLSerializer().serializeToString(stanza)); |
} |
- sinon.$setupStub(chrome.socket, 'create'); |
- sinon.$setupStub(chrome.socket, 'connect'); |
- sinon.$setupStub(chrome.socket, 'write'); |
- sinon.$setupStub(chrome.socket, 'read'); |
- sinon.$setupStub(chrome.socket, 'destroy'); |
- sinon.$setupStub(chrome.socket, 'secure'); |
+ sinon.stub(chrome.socket, 'create'); |
+ sinon.stub(chrome.socket, 'connect'); |
+ sinon.stub(chrome.socket, 'write'); |
+ sinon.stub(chrome.socket, 'read'); |
+ sinon.stub(chrome.socket, 'destroy'); |
+ sinon.stub(chrome.socket, 'secure'); |
connection = new remoting.XmppConnection(); |
connection.setStateChangedCallback( |
@@ -42,12 +42,12 @@ module('XmppConnection', { |
}, |
teardown: function() { |
- chrome.socket.create.$testStub.restore(); |
- chrome.socket.connect.$testStub.restore(); |
- chrome.socket.write.$testStub.restore(); |
- chrome.socket.read.$testStub.restore(); |
- chrome.socket.destroy.$testStub.restore(); |
- chrome.socket.secure.$testStub.restore(); |
+ $testStub(chrome.socket.create).restore(); |
+ $testStub(chrome.socket.connect).restore(); |
+ $testStub(chrome.socket.write).restore(); |
+ $testStub(chrome.socket.read).restore(); |
+ $testStub(chrome.socket.destroy).restore(); |
+ $testStub(chrome.socket.secure).restore(); |
} |
}); |
@@ -57,11 +57,11 @@ test('should go to FAILED state when failed to connect', function() { |
sinon.assert.calledWith(onStateChange, |
remoting.SignalStrategy.State.CONNECTING); |
sinon.assert.calledWith(chrome.socket.create, "tcp", {}); |
- chrome.socket.create.$testStub.getCall(0).args[2]({socketId: socketId}); |
+ $testStub(chrome.socket.create).getCall(0).args[2]({socketId: socketId}); |
sinon.assert.calledWith( |
chrome.socket.connect, socketId, "xmpp.example.com", 123); |
- chrome.socket.connect.$testStub.getCall(0).args[3](-1); |
+ $testStub(chrome.socket.connect).getCall(0).args[3](-1); |
QUnit.equal(connection.getError().tag, remoting.Error.Tag.NETWORK_FAILURE); |
}); |
@@ -73,11 +73,11 @@ test('should use XmppLoginHandler to complete handshake and read data', |
sinon.assert.calledWith(onStateChange, |
remoting.SignalStrategy.State.CONNECTING); |
sinon.assert.calledWith(chrome.socket.create, "tcp", {}); |
- chrome.socket.create.$testStub.getCall(0).args[2]({socketId: socketId}); |
+ $testStub(chrome.socket.create).getCall(0).args[2]({socketId: socketId}); |
sinon.assert.calledWith( |
chrome.socket.connect, socketId, "xmpp.example.com", 123); |
- chrome.socket.connect.$testStub.getCall(0).args[3](0); |
+ $testStub(chrome.socket.connect).getCall(0).args[3](0); |
sinon.assert.calledWith(onStateChange, |
remoting.SignalStrategy.State.HANDSHAKE); |
@@ -96,7 +96,7 @@ test('should use XmppLoginHandler to complete handshake and read data', |
var data = base.encodeUtf8('<iq id="1">hello</iq>'); |
sinon.assert.calledWith(chrome.socket.read, socketId); |
var appendDataCalled = parserMock.expects('appendData').once().withArgs(data); |
- chrome.socket.read.$testStub.getCall(0).args[1]({resultCode: 0, data: data}); |
+ $testStub(chrome.socket.read).getCall(0).args[1]({resultCode: 0, data: data}); |
appendDataCalled.verify(); |
}); |