| 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 8ee2a3a0b8ef3b1e347241b008f75bf54d85be46..b03cc5a7d0f089eac8d3a208735385cd748b3953 100644
|
| --- a/remoting/webapp/unittests/apps_v2_migration_unittest.js
|
| +++ b/remoting/webapp/unittests/apps_v2_migration_unittest.js
|
| @@ -6,6 +6,7 @@
|
|
|
| 'use strict';
|
|
|
| +/** @type {sinon.$testStub} */
|
| var mockIsAppsV2 = null;
|
| var mockChromeStorage = {};
|
|
|
| @@ -22,10 +23,13 @@ function fail() {
|
| /**
|
| * @param {string} v1UserName
|
| * @param {string} v1UserEmail
|
| - * @param {string} currentEmail
|
| - * @param {boolean} v1HasHost
|
| + * @param {boolean} v1HasHosts
|
| */
|
| function setMigrationData_(v1UserName, v1UserEmail, v1HasHosts) {
|
| + /**
|
| + * @param {function(string,string):void} onDone
|
| + * @param {function(remoting.Error):void} onError
|
| + */
|
| remoting.identity.getUserInfo = function(onDone, onError) {
|
| if (base.isAppsV2()) {
|
| onDone('v2user@gmail.com','v2userName');
|
| @@ -42,12 +46,10 @@ 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();
|
| mockIsAppsV2.restore();
|
| remoting.identity = null;
|
| }
|
| @@ -82,6 +84,7 @@ QUnit.asyncTest(
|
| setMigrationData_('v1userName', 'v1user@gmail.com', true);
|
| mockIsAppsV2.returns(true);
|
| remoting.AppsV2Migration.hasHostsInV1App().then(
|
| + /** @param {{email:string, fullName:string}} result */
|
| function(result) {
|
| QUnit.equal(result.email, 'v1user@gmail.com');
|
| QUnit.equal(result.fullName, 'v1userName');
|
| @@ -93,10 +96,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);
|
| });
|
|
|
|
|