OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 onStateChange = null; | 9 var onStateChange = null; |
10 var onIncomingStanzaCallback = null; | 10 var onIncomingStanzaCallback = null; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 sinon.assert.calledWith(onStateChange, state); | 106 sinon.assert.calledWith(onStateChange, state); |
107 }); | 107 }); |
108 } | 108 } |
109 ); | 109 ); |
110 | 110 |
111 test('blocked', | 111 test('blocked', |
112 function() { | 112 function() { |
113 fakeXhrs[0].respond(400); | 113 fakeXhrs[0].respond(400); |
114 sinon.assert.calledWith(onStateChange, | 114 sinon.assert.calledWith(onStateChange, |
115 remoting.SignalStrategy.State.FAILED); | 115 remoting.SignalStrategy.State.FAILED); |
116 equal(checker.getError(), remoting.Error.NOT_AUTHORIZED); | 116 equal(checker.getError().tag, remoting.Error.Tag.NOT_AUTHORIZED); |
117 onStateChange.reset(); | 117 onStateChange.reset(); |
118 | 118 |
119 [ | 119 [ |
120 remoting.SignalStrategy.State.CONNECTING, | 120 remoting.SignalStrategy.State.CONNECTING, |
121 remoting.SignalStrategy.State.HANDSHAKE, | 121 remoting.SignalStrategy.State.HANDSHAKE, |
122 remoting.SignalStrategy.State.CONNECTED | 122 remoting.SignalStrategy.State.CONNECTED |
123 ].forEach(function(state) { | 123 ].forEach(function(state) { |
124 signalStrategy.setStateForTesting(state); | 124 signalStrategy.setStateForTesting(state); |
125 sinon.assert.notCalled(onStateChange); | 125 sinon.assert.notCalled(onStateChange); |
126 equal(checker.getState(), remoting.SignalStrategy.State.FAILED); | 126 equal(checker.getState(), remoting.SignalStrategy.State.FAILED); |
(...skipping 17 matching lines...) Expand all Loading... |
144 // signal strategy has connected. | 144 // signal strategy has connected. |
145 signalStrategy.setStateForTesting(remoting.SignalStrategy.State.CONNECTED); | 145 signalStrategy.setStateForTesting(remoting.SignalStrategy.State.CONNECTED); |
146 sinon.assert.notCalled(onStateChange); | 146 sinon.assert.notCalled(onStateChange); |
147 equal(checker.getState(), remoting.SignalStrategy.State.HANDSHAKE); | 147 equal(checker.getState(), remoting.SignalStrategy.State.HANDSHAKE); |
148 | 148 |
149 // Verify that DnsBlackholeChecker goes to FAILED state after it gets the | 149 // Verify that DnsBlackholeChecker goes to FAILED state after it gets the |
150 // blocked HTTP response. | 150 // blocked HTTP response. |
151 fakeXhrs[0].respond(400); | 151 fakeXhrs[0].respond(400); |
152 sinon.assert.calledWith(onStateChange, | 152 sinon.assert.calledWith(onStateChange, |
153 remoting.SignalStrategy.State.FAILED); | 153 remoting.SignalStrategy.State.FAILED); |
154 equal(checker.getError(), remoting.Error.NOT_AUTHORIZED); | 154 equal(checker.getError().tag, remoting.Error.Tag.NOT_AUTHORIZED); |
155 } | 155 } |
156 ); | 156 ); |
157 | 157 |
158 })(); | 158 })(); |
OLD | NEW |