Index: remoting/webapp/unittests/base_unittest.js |
diff --git a/remoting/webapp/unittests/base_unittest.js b/remoting/webapp/unittests/base_unittest.js |
index 6ffc8c90b4b3b811b3620807a776c1f1cee9f8ed..c2213c1558d726d0d33449828c5215957759f54b 100644 |
--- a/remoting/webapp/unittests/base_unittest.js |
+++ b/remoting/webapp/unittests/base_unittest.js |
@@ -2,6 +2,12 @@ |
// 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 base.Disposable. |
kelvinp
2015/02/26 00:31:30
base.Disposable is already an interface. Am I mis
garykac
2015/02/28 02:33:33
Nope. I missed it. Enabling jscompile for this fil
|
+ * @suppress {checkTypes|checkVars|reportUnknownTypes|visibility} |
+ */ |
+ |
(function() { |
'use strict'; |
@@ -22,14 +28,14 @@ test('mix(dest, src) should assert if properties are overwritten', |
var src = { a: 'a', b: 'b'}; |
var dest = { a: 'a'}; |
- sinon.spy(base.debug, 'assert'); |
+ sinon.$setupStub(base.debug, 'assert'); |
try { |
base.mix(dest, src); |
} catch (e) { |
} finally { |
sinon.assert.called(base.debug.assert); |
- base.debug.assert.restore(); |
+ base.debug.assert.$testStub.restore(); |
} |
}); |
@@ -110,10 +116,11 @@ test('escapeHTML(str) should escape special characters', function() { |
'<script>alert("hello")</script>'); |
}); |
+/** @this {QUnit.$test} */ |
QUnit.asyncTest('Promise.sleep(delay) should fulfill the promise after |delay|', |
function() { |
var isCalled = false; |
- var clock = this.clock; |
+ var clock = /** @type {QUnit.$clock} */ (this.clock); |
base.Promise.sleep(100).then(function(){ |
isCalled = true; |
@@ -155,12 +162,14 @@ QUnit.asyncTest('resolve() should fulfill the underlying promise.', function() { |
return deferred.promise(); |
} |
- async().then(function(value){ |
- QUnit.equal(value, 'bar'); |
- QUnit.start(); |
- }, function() { |
- QUnit.ok(false, 'The reject handler should not be invoked.'); |
- }); |
+ async().then( |
+ /** @param {string} value */ |
+ function(value){ |
+ QUnit.equal(value, 'bar'); |
+ QUnit.start(); |
+ }, function() { |
+ QUnit.ok(false, 'The reject handler should not be invoked.'); |
+ }); |
}); |
QUnit.asyncTest('reject() should fail the underlying promise.', function() { |
@@ -170,15 +179,19 @@ QUnit.asyncTest('reject() should fail the underlying promise.', function() { |
return deferred.promise(); |
} |
- async().then(function(){ |
- QUnit.ok(false, 'The then handler should not be invoked.'); |
- }, function(value) { |
- QUnit.equal(value, 'bar'); |
- QUnit.start(); |
- }); |
+ async().then( |
+ function(){ |
+ QUnit.ok(false, 'The then handler should not be invoked.'); |
+ }, |
+ /** @param {string} value */ |
+ function(value) { |
+ QUnit.equal(value, 'bar'); |
+ QUnit.start(); |
+ }); |
}); |
+/** @type {base.EventSourceImpl} */ |
var source = null; |
var listener = null; |
@@ -229,13 +242,13 @@ test('raiseEvent() should not invoke listeners of a different event', |
test('raiseEvent() should assert when undeclared events are raised', |
function() { |
- sinon.spy(base.debug, 'assert'); |
+ sinon.$setupStub(base.debug, 'assert'); |
try { |
source.raiseEvent('undefined'); |
} catch (e) { |
} finally { |
sinon.assert.called(base.debug.assert); |
- base.debug.assert.restore(); |
+ base.debug.assert.$testStub.restore(); |
} |
}); |
@@ -268,6 +281,7 @@ test('removeEventListener() should work even if the listener ' + |
}); |
test('encodeUtf8() can encode UTF8 strings', function() { |
+ /** @type {function(ArrayBuffer):Array} */ |
function toJsArray(arrayBuffer) { |
var result = []; |
var array = new Uint8Array(arrayBuffer); |