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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
9 | 9 |
10 /** | 10 /** |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 /** @private */ | 59 /** @private */ |
60 this.state_ = remoting.XmppLoginHandler.State.INIT; | 60 this.state_ = remoting.XmppLoginHandler.State.INIT; |
61 /** @private */ | 61 /** @private */ |
62 this.jid_ = ''; | 62 this.jid_ = ''; |
63 | 63 |
64 /** @type {remoting.XmppStreamParser} @private */ | 64 /** @type {remoting.XmppStreamParser} @private */ |
65 this.streamParser_ = null; | 65 this.streamParser_ = null; |
66 } | 66 } |
67 | 67 |
| 68 /** @return {function(string, remoting.XmppStreamParser):void} */ |
| 69 remoting.XmppLoginHandler.prototype.getHandshakeDoneCallbackForTesting = |
| 70 function() { |
| 71 return this.onHandshakeDoneCallback_; |
| 72 }; |
| 73 |
68 /** | 74 /** |
69 * States the handshake goes through. States are iterated from INIT to DONE | 75 * States the handshake goes through. States are iterated from INIT to DONE |
70 * sequentially, except for ERROR state which may be accepted at any point. | 76 * sequentially, except for ERROR state which may be accepted at any point. |
71 * | 77 * |
72 * Following messages are sent/received in each state: | 78 * Following messages are sent/received in each state: |
73 * INIT | 79 * INIT |
74 * client -> server: Stream header | 80 * client -> server: Stream header |
75 * client -> server: <starttls> | 81 * client -> server: <starttls> |
76 * WAIT_STREAM_HEADER | 82 * WAIT_STREAM_HEADER |
77 * client <- server: Stream header with list of supported features which | 83 * client <- server: Stream header with list of supported features which |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 * @private | 286 * @private |
281 */ | 287 */ |
282 remoting.XmppLoginHandler.prototype.onError_ = function(error, text) { | 288 remoting.XmppLoginHandler.prototype.onError_ = function(error, text) { |
283 if (this.state_ != remoting.XmppLoginHandler.State.ERROR) { | 289 if (this.state_ != remoting.XmppLoginHandler.State.ERROR) { |
284 this.onErrorCallback_(error, text); | 290 this.onErrorCallback_(error, text); |
285 this.state_ = remoting.XmppLoginHandler.State.ERROR; | 291 this.state_ = remoting.XmppLoginHandler.State.ERROR; |
286 } else { | 292 } else { |
287 console.error(text); | 293 console.error(text); |
288 } | 294 } |
289 } | 295 } |
OLD | NEW |