Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: remoting/webapp/unittests/xmpp_connection_unittest.js

Issue 955283002: Converted remoting.Error from an enum to a class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 })();
OLDNEW
« no previous file with comments | « remoting/webapp/unittests/mock_signal_strategy.js ('k') | remoting/webapp/unittests/xmpp_login_handler_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698