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

Unified Diff: remoting/webapp/unittests/dns_blackhole_checker_unittest.js

Issue 959963002: [Chromoting] Enable jscompile for webapp unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/unittests/dns_blackhole_checker_unittest.js
diff --git a/remoting/webapp/unittests/dns_blackhole_checker_unittest.js b/remoting/webapp/unittests/dns_blackhole_checker_unittest.js
index 53a76ad5294b50979c0e8db4648b3766e4119e4e..13884e6a262b9dd1fc0d4b0c7f90b2c80be98605 100644
--- a/remoting/webapp/unittests/dns_blackhole_checker_unittest.js
+++ b/remoting/webapp/unittests/dns_blackhole_checker_unittest.js
@@ -2,18 +2,31 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+/**
+ * @fileoverview
+ * TODO(garykac): Create interface for SignalStrategy.
+ * @suppress {checkTypes|checkVars|reportUnknownTypes|visibility}
+ */
+
(function() {
'use strict';
+/** @type {(sinon.$spy|function(remoting.SignalStrategy.State))} */
var onStateChange = null;
+
+/** @type {(sinon.$spy|function(Element):void)} */
var onIncomingStanzaCallback = null;
+
+/** @type {remoting.DnsBlackholeChecker} */
var checker = null;
+
+/** @type {remoting.MockSignalStrategy} */
var signalStrategy = null;
module('dns_blackhole_checker', {
setup: function() {
- sinon.stub(remoting.xhr, 'get');
+ sinon.$setupStub(remoting.xhr, 'get');
onStateChange = sinon.spy();
onIncomingStanzaCallback = sinon.spy();
@@ -41,13 +54,13 @@ module('dns_blackhole_checker', {
onIncomingStanzaCallback = null;
checker = null;
- remoting.xhr.get.restore();
+ remoting.xhr.get.$testStub.restore();
},
});
test('success',
function() {
- remoting.xhr.get.getCall(0).args[1]({status: 200});
+ remoting.xhr.get.$testStub.getCall(0).args[1]({status: 200});
sinon.assert.notCalled(onStateChange);
[
@@ -82,7 +95,7 @@ test('http response after connected',
// Verify that DnsBlackholeChecker goes to CONNECTED state after the
// the HTTP request has succeeded.
- remoting.xhr.get.getCall(0).args[1]({status: 200});
+ remoting.xhr.get.$testStub.getCall(0).args[1]({status: 200});
sinon.assert.calledWith(onStateChange,
remoting.SignalStrategy.State.CONNECTED);
}
@@ -90,7 +103,7 @@ test('http response after connected',
test('connect failed',
function() {
- remoting.xhr.get.getCall(0).args[1]({status: 200});
+ remoting.xhr.get.$testStub.getCall(0).args[1]({status: 200});
sinon.assert.notCalled(onStateChange);
[
@@ -105,7 +118,7 @@ test('connect failed',
test('blocked',
function() {
- remoting.xhr.get.getCall(0).args[1]({status: 400});
+ remoting.xhr.get.$testStub.getCall(0).args[1]({status: 400});
sinon.assert.calledWith(onStateChange,
remoting.SignalStrategy.State.FAILED);
equal(checker.getError(), remoting.Error.NOT_AUTHORIZED);
@@ -143,7 +156,7 @@ test('blocked after connected',
// Verify that DnsBlackholeChecker goes to FAILED state after it gets the
// blocked HTTP response.
- remoting.xhr.get.getCall(0).args[1]({status: 400});
+ remoting.xhr.get.$testStub.getCall(0).args[1]({status: 400});
sinon.assert.calledWith(onStateChange,
remoting.SignalStrategy.State.FAILED);
equal(checker.getError(), remoting.Error.NOT_AUTHORIZED);

Powered by Google App Engine
This is Rietveld 408576698