OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function() { | 5 (function() { |
6 | 6 |
7 'use strict'; | 7 'use strict'; |
8 | 8 |
9 var testUsername = 'testUsername@gmail.com'; | 9 var testUsername = 'testUsername@gmail.com'; |
10 var testToken = 'testToken'; | 10 var testToken = 'testToken'; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 expectNextState(remoting.SignalStrategy.State.CONNECTING).then(onConnecting); | 63 expectNextState(remoting.SignalStrategy.State.CONNECTING).then(onConnecting); |
64 connection.connect('xmpp.example.com:123', 'testUsername@gmail.com', | 64 connection.connect('xmpp.example.com:123', 'testUsername@gmail.com', |
65 'testToken'); | 65 'testToken'); |
66 | 66 |
67 function onConnecting() { | 67 function onConnecting() { |
68 expectNextState(remoting.SignalStrategy.State.FAILED).then(onFailed); | 68 expectNextState(remoting.SignalStrategy.State.FAILED).then(onFailed); |
69 } | 69 } |
70 | 70 |
71 function onFailed() { | 71 function onFailed() { |
72 sinon.assert.calledWith(socket.dispose); | 72 sinon.assert.calledWith(socket.dispose); |
73 QUnit.equal(connection.getError(), remoting.Error.NETWORK_FAILURE); | 73 QUnit.equal(connection.getError().tag, remoting.Error.Tag.NETWORK_FAILURE); |
74 | 74 |
75 QUnit.start(); | 75 QUnit.start(); |
76 } | 76 } |
77 }); | 77 }); |
78 | 78 |
79 QUnit.asyncTest('should use XmppLoginHandler for handshake', function() { | 79 QUnit.asyncTest('should use XmppLoginHandler for handshake', function() { |
80 $testStub(socket.connect).withArgs("xmpp.example.com", 123) | 80 $testStub(socket.connect).withArgs("xmpp.example.com", 123) |
81 .returns(new Promise(function(resolve, reject) { resolve(0) })); | 81 .returns(new Promise(function(resolve, reject) { resolve(0) })); |
82 | 82 |
83 var deferredSend = new base.Deferred(); | 83 var deferredSend = new base.Deferred(); |
(...skipping 29 matching lines...) Expand all Loading... |
113 var appendDataCalled = | 113 var appendDataCalled = |
114 parserMock.expects('appendData').once().withArgs(data); | 114 parserMock.expects('appendData').once().withArgs(data); |
115 $testStub(socket.startReceiving).getCall(0).args[0](data); | 115 $testStub(socket.startReceiving).getCall(0).args[0](data); |
116 appendDataCalled.verify(); | 116 appendDataCalled.verify(); |
117 | 117 |
118 QUnit.start(); | 118 QUnit.start(); |
119 } | 119 } |
120 }); | 120 }); |
121 | 121 |
122 })(); | 122 })(); |
OLD | NEW |