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

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

Issue 959963002: [Chromoting] Enable jscompile for webapp unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename sinon.$testStub -> sinon.TestStub 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/apps_v2_migration_unittest.js
diff --git a/remoting/webapp/unittests/apps_v2_migration_unittest.js b/remoting/webapp/unittests/apps_v2_migration_unittest.js
index 6bc8db9a2ca0703e8b04859489a1baabc989b1d4..805995aab016dd196a35d0a700e923d518a5b9df 100644
--- a/remoting/webapp/unittests/apps_v2_migration_unittest.js
+++ b/remoting/webapp/unittests/apps_v2_migration_unittest.js
@@ -2,10 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+/**
+ * @fileoverview
+ * @suppress {checkTypes|checkVars|reportUnknownTypes|visibility}
+ */
+
(function() {
'use strict';
+/** @type {sinon.TestStub} */
var mockIsAppsV2 = null;
var mockChromeStorage = {};
@@ -22,10 +28,10 @@ function fail() {
/**
* @param {string} v1UserName
* @param {string} v1UserEmail
- * @param {string} currentEmail
- * @param {boolean} v1HasHost
+ * @param {boolean} v1HasHosts
*/
function setMigrationData_(v1UserName, v1UserEmail, v1HasHosts) {
+ /** @return {!Promise} */
remoting.identity.getUserInfo = function() {
if (base.isAppsV2()) {
return Promise.resolve(
@@ -35,10 +41,13 @@ function setMigrationData_(v1UserName, v1UserEmail, v1HasHosts) {
{email: v1UserEmail, name: v1UserName});
}
};
+ /** @return {!Promise} */
remoting.identity.getEmail = function() {
- return remoting.identity.getUserInfo().then(function(info) {
- return info.email;
- });
+ return remoting.identity.getUserInfo().then(
+ /** @param {{email:string, name:string}} info */
+ function(info) {
+ return info.email;
+ });
};
mockIsAppsV2.returns(false);
@@ -50,8 +59,8 @@ function setMigrationData_(v1UserName, v1UserEmail, v1HasHosts) {
module('AppsV2Migration', {
setup: function() {
chromeMocks.activate(['storage']);
- mockIsAppsV2 = sinon.stub(base, 'isAppsV2');
- remoting.identity = {};
+ mockIsAppsV2 = sinon.$setupStub(base, 'isAppsV2');
+ remoting.identity = new remoting.Identity();
},
teardown: function() {
chromeMocks.restore();
@@ -89,6 +98,7 @@ QUnit.asyncTest(
setMigrationData_('v1userName', 'v1user@gmail.com', true);
mockIsAppsV2.returns(true);
remoting.AppsV2Migration.hasHostsInV1App().then(
+ /** @param {{email:string, name:string}} result */
function(result) {
QUnit.equal(result.email, 'v1user@gmail.com');
QUnit.equal(result.fullName, 'v1userName');
@@ -100,10 +110,9 @@ QUnit.asyncTest(
QUnit.asyncTest(
'saveUserInfo() should clear the preferences on v2',
function() {
- setMigrationData_('v1userName', 'v1user@gmail.com', 'v2user@gmail.com',
- true);
+ setMigrationData_('v1userName', 'v1user@gmail.com', true);
mockIsAppsV2.returns(true);
- remoting.AppsV2Migration.saveUserInfo(true);
+ remoting.AppsV2Migration.saveUserInfo();
remoting.AppsV2Migration.hasHostsInV1App().then(fail, pass);
});

Powered by Google App Engine
This is Rietveld 408576698