| Index: remoting/webapp/crd/js/identity_unittest.js
|
| diff --git a/remoting/webapp/crd/js/identity_unittest.js b/remoting/webapp/crd/js/identity_unittest.js
|
| index 5bd9452c87974379b0495682306effcfd6574be8..a9b335efac5f4abe3713c1f3d4ade064145f6c6f 100644
|
| --- a/remoting/webapp/crd/js/identity_unittest.js
|
| +++ b/remoting/webapp/crd/js/identity_unittest.js
|
| @@ -30,8 +30,8 @@ MockConsent.prototype.show = function() {
|
| // The consent dialog should only be shown if a previous call to getAuthToken
|
| // with {interactive: false} failed, and it should occur before any call with
|
| // {interactive: true}.
|
| - ok(getAuthToken.calledOnce);
|
| - ok(getAuthToken.calledWith({'interactive': false}));
|
| + QUnit.ok(getAuthToken.calledOnce);
|
| + QUnit.ok(getAuthToken.calledWith({'interactive': false}));
|
| getAuthToken.reset();
|
|
|
| if (this.grantConsent) {
|
| @@ -40,8 +40,8 @@ MockConsent.prototype.show = function() {
|
| return Promise.resolve();
|
| };
|
|
|
| -module('Identity', {
|
| - setup: function() {
|
| +QUnit.module('Identity', {
|
| + beforeEach: function() {
|
| chromeMocks.identity.mock$clearToken();
|
| chromeMocks.activate(['identity', 'runtime']);
|
| consentDialog = new MockConsent();
|
| @@ -49,19 +49,19 @@ module('Identity', {
|
| identity = new remoting.Identity(consentDialog);
|
| getAuthToken = sinon.spy(chromeMocks.identity, 'getAuthToken');
|
| },
|
| - teardown: function() {
|
| + afterEach: function() {
|
| chromeMocks.restore();
|
| getAuthToken.restore();
|
| }
|
| });
|
|
|
| -test('consent is requested only on first invocation', function() {
|
| - ok(!promptForConsent.called);
|
| +QUnit.test('consent is requested only on first invocation', function() {
|
| + QUnit.ok(!promptForConsent.called);
|
| return identity.getToken().then(
|
| function(/** string */ token) {
|
| - ok(promptForConsent.called);
|
| - ok(getAuthToken.calledOnce);
|
| - ok(getAuthToken.calledWith({'interactive': true}));
|
| + QUnit.ok(promptForConsent.called);
|
| + QUnit.ok(getAuthToken.calledOnce);
|
| + QUnit.ok(getAuthToken.calledWith({'interactive': true}));
|
|
|
| // Request another token.
|
| promptForConsent.reset();
|
| @@ -69,33 +69,33 @@ test('consent is requested only on first invocation', function() {
|
| return identity.getToken();
|
|
|
| }).then(function(/** string */ token) {
|
| - ok(!promptForConsent.called);
|
| - ok(getAuthToken.calledOnce);
|
| - ok(getAuthToken.calledWith({'interactive': true}));
|
| - equal(token, 'token');
|
| + QUnit.ok(!promptForConsent.called);
|
| + QUnit.ok(getAuthToken.calledOnce);
|
| + QUnit.ok(getAuthToken.calledWith({'interactive': true}));
|
| + QUnit.equal(token, 'token');
|
| });
|
| });
|
|
|
| -test('cancellations are reported correctly', function() {
|
| +QUnit.test('cancellations are reported correctly', function() {
|
| consentDialog.grantConsent = false;
|
| chromeMocks.runtime.lastError.message = 'The user did not approve access.';
|
| return identity.getToken().then(
|
| function(/** string */ token) {
|
| - ok(false, 'expected getToken() to fail');
|
| + QUnit.ok(false, 'expected getToken() to fail');
|
| }).catch(function(/** remoting.Error */ error) {
|
| - equal(error.getTag(), remoting.Error.Tag.CANCELLED);
|
| + QUnit.equal(error.getTag(), remoting.Error.Tag.CANCELLED);
|
| });
|
| });
|
|
|
|
|
| -test('other errors are reported correctly', function() {
|
| +QUnit.test('other errors are reported correctly', function() {
|
| consentDialog.grantConsent = false;
|
| chromeMocks.runtime.lastError.message = '<some other error message>';
|
| return identity.getToken().then(
|
| function(/** string */ token) {
|
| - ok(false, 'expected getToken() to fail');
|
| + QUnit.ok(false, 'expected getToken() to fail');
|
| }).catch(function(/** remoting.Error */ error) {
|
| - equal(error.getTag(), remoting.Error.Tag.NOT_AUTHENTICATED);
|
| + QUnit.equal(error.getTag(), remoting.Error.Tag.NOT_AUTHENTICATED);
|
| });
|
| });
|
|
|
|
|