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

Unified Diff: remoting/webapp/base/js/base_unittest.js

Issue 1065733004: Added partial unit tests for host_controller.js. More to come. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hdf-unittest
Patch Set: added licenses to satisfy presubmit Created 5 years, 8 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/base.js ('k') | remoting/webapp/crd/js/error.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/base/js/base_unittest.js
diff --git a/remoting/webapp/base/js/base_unittest.js b/remoting/webapp/base/js/base_unittest.js
index 34d00d7161ca0a4d9d97eb884dfc74fd2ff8f807..e5ec7dfddc0f6a32bc87f086e22d7e6c56c401e1 100644
--- a/remoting/webapp/base/js/base_unittest.js
+++ b/remoting/webapp/base/js/base_unittest.js
@@ -6,7 +6,16 @@
'use strict';
-QUnit.module('base');
+var getRandomValuesStub = null;
+
+QUnit.module('base', {
+ afterEach: function() {
+ if (getRandomValuesStub) {
+ getRandomValuesStub.restore();
+ getRandomValuesStub = null;
+ }
+ }
+});
QUnit.test('mix(dest, src) should copy properties from |src| to |dest|',
function(assert) {
@@ -200,6 +209,16 @@ QUnit.test('Promise.negate should fulfill iff the promise does not.',
});
});
+QUnit.test('generateUuid generates a UUID', function(assert) {
+ getRandomValuesStub = sinon.stub(
+ window.crypto, 'getRandomValues', function(/** Uint16Array*/ out) {
+ for (var i = 0; i < out.length; i++) {
+ out[i] = i;
+ }
+ });
+ assert.equal(base.generateUuid(), '00000001-0002-0003-0004-000500060007');
+});
+
QUnit.module('base.Deferred');
QUnit.test('resolve() should fulfill the underlying promise.', function(assert){
« no previous file with comments | « remoting/webapp/base/js/base.js ('k') | remoting/webapp/crd/js/error.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698