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

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: Migrate to assert 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
« no previous file with comments | « remoting/webapp/base/js/ipc_unittest.js ('k') | remoting/webapp/crd/js/desktop_viewport_unittest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..456cc47d0d00325585311461f5adc40f0c5910f7 100644
--- a/remoting/webapp/crd/js/apps_v2_migration_unittest.js
+++ b/remoting/webapp/crd/js/apps_v2_migration_unittest.js
@@ -4,7 +4,6 @@
/**
* @fileoverview
- * @suppress {checkTypes|checkVars|reportUnknownTypes|visibility}
*/
(function() {
@@ -15,16 +14,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 +45,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() {
+ function(assert) {
+ assert.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() {
+ function(assert) {
+ assert.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(
- 'hasHostsInV1App() should reject the promise in v1', function() {
- setMigrationData_('v1userName', 'v1user@gmail.com', true);
- mockIsAppsV2.returns(false);
- remoting.AppsV2Migration.hasHostsInV1App().then(fail, pass);
+QUnit.test('hasHostsInV1App() should reject the promise in v1',
+ function(assert) {
+ assert.expect(0);
+ setMigrationData_('v1userName', 'v1user@gmail.com', true);
+ mockIsAppsV2.returns(false);
+ return base.Promise.negate(remoting.AppsV2Migration.hasHostsInV1App());
});
-QUnit.asyncTest(
+QUnit.test(
'hasHostsInV1App() should return v1 identity if v1 user has hosts',
- function() {
+ function(assert) {
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');
- pass();
- }, fail
- );
+ return remoting.AppsV2Migration.hasHostsInV1App().then(
+ function(/** {email:string, fullName:string} */ result) {
+ assert.equal(result.email, 'v1user@gmail.com');
+ assert.equal(result.fullName, 'v1userName');
+ });
});
-QUnit.asyncTest(
+QUnit.test(
'saveUserInfo() should clear the preferences on v2',
- function() {
+ function(assert) {
+ assert.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());
});
})();
« no previous file with comments | « remoting/webapp/base/js/ipc_unittest.js ('k') | remoting/webapp/crd/js/desktop_viewport_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698