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

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

Issue 1017613002: Migrate Remoting Webapp Unittests to use QUnit 2.0 syntax. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Async test migration Created 5 years, 9 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/crd/js/apps_v2_migration_unittest.js
diff --git a/remoting/webapp/crd/js/apps_v2_migration_unittest.js b/remoting/webapp/crd/js/apps_v2_migration_unittest.js
index 097a80f598d3604e85f1dbcf63c0d3de49362953..0b83829e0baadf5abac61ee9ce2682b2ce02c075 100644
--- a/remoting/webapp/crd/js/apps_v2_migration_unittest.js
+++ b/remoting/webapp/crd/js/apps_v2_migration_unittest.js
@@ -15,16 +15,6 @@
var mockIsAppsV2 = null;
var mockChromeStorage = {};
-function pass() {
- ok(true);
- QUnit.start();
-}
-
-function fail() {
- ok(false);
- QUnit.start();
-}
-
/**
* @param {string} v1UserName
* @param {string} v1UserEmail
@@ -56,64 +46,65 @@ function setMigrationData_(v1UserName, v1UserEmail, v1HasHosts) {
}
}
-module('AppsV2Migration', {
- setup: function() {
+QUnit.module('AppsV2Migration', {
+ beforeEach: function() {
chromeMocks.activate(['storage']);
mockIsAppsV2 = sinon.stub(base, 'isAppsV2');
remoting.identity = new remoting.Identity();
},
- teardown: function() {
+ afterEach: function() {
chromeMocks.restore();
mockIsAppsV2.restore();
remoting.identity = null;
}
});
-QUnit.asyncTest(
+QUnit.test(
'hasHostsInV1App() should reject the promise if v1 user has same identity',
function() {
+ QUnit.expect(0);
setMigrationData_('v1userName', 'v2user@gmail.com', true);
mockIsAppsV2.returns(true);
- remoting.AppsV2Migration.hasHostsInV1App().then(fail, pass);
+ return base.Promise.negate(remoting.AppsV2Migration.hasHostsInV1App());
});
-QUnit.asyncTest(
+QUnit.test(
'hasHostsInV1App() should reject the promise if v1 user has no hosts',
function() {
+ QUnit.expect(0);
setMigrationData_('v1userName', 'v1user@gmail.com', false);
mockIsAppsV2.returns(true);
- remoting.AppsV2Migration.hasHostsInV1App().then(fail, pass);
+ return base.Promise.negate(remoting.AppsV2Migration.hasHostsInV1App());
});
-QUnit.asyncTest(
+QUnit.test(
'hasHostsInV1App() should reject the promise in v1', function() {
+ QUnit.expect(0);
setMigrationData_('v1userName', 'v1user@gmail.com', true);
mockIsAppsV2.returns(false);
- remoting.AppsV2Migration.hasHostsInV1App().then(fail, pass);
+ return base.Promise.negate(remoting.AppsV2Migration.hasHostsInV1App());
});
-QUnit.asyncTest(
+QUnit.test(
'hasHostsInV1App() should return v1 identity if v1 user has hosts',
function() {
setMigrationData_('v1userName', 'v1user@gmail.com', true);
mockIsAppsV2.returns(true);
- remoting.AppsV2Migration.hasHostsInV1App().then(
- /** @param {{email:string, name:string}} result */
- function(result) {
+ return remoting.AppsV2Migration.hasHostsInV1App().then(
+ function(/** {email:string, name:string} */ result) {
QUnit.equal(result.email, 'v1user@gmail.com');
QUnit.equal(result.fullName, 'v1userName');
- pass();
- }, fail
- );
+ });
});
-QUnit.asyncTest(
+QUnit.test(
'saveUserInfo() should clear the preferences on v2',
function() {
+ QUnit.expect(0);
setMigrationData_('v1userName', 'v1user@gmail.com', true);
mockIsAppsV2.returns(true);
remoting.AppsV2Migration.saveUserInfo();
- remoting.AppsV2Migration.hasHostsInV1App().then(fail, pass);
+ return base.Promise.negate(remoting.AppsV2Migration.hasHostsInV1App());
});
})();

Powered by Google App Engine
This is Rietveld 408576698