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

Unified Diff: remoting/webapp/base/js/base.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: 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
Index: remoting/webapp/base/js/base.js
diff --git a/remoting/webapp/base/js/base.js b/remoting/webapp/base/js/base.js
index f34b2e24ec651557c427b65413744652acaf42f7..4f4a202daa2cdafbf0536ba7d1f99420ff3724a2 100644
--- a/remoting/webapp/base/js/base.js
+++ b/remoting/webapp/base/js/base.js
@@ -56,6 +56,15 @@ base.debug.callstack = function() {
};
/**
+ * @param {*} value
+ * @return T
+ * @template T
+ */
+base.reinterpret_cast = function(value) {
Jamie 2015/04/07 01:13:11 You don't seem to be using this.
John Williams 2015/04/07 20:10:25 Yeah, I thought this would make certain casts less
+ return value;
+};
+
+/**
* @interface
*/
base.Disposable = function() {};
@@ -734,3 +743,19 @@ base.resizeWindowToContent = function() {
// so restore it explicitly.
appWindow.moveTo(outerBounds.left, outerBounds.top);
};
+
+/**
+ * @return {string} A random UUID.
+ */
+base.generateUuid = function() {
Jamie 2015/04/07 01:13:12 Move this up below generateXsrfToken, since it's c
John Williams 2015/04/07 20:10:25 Done.
+ var random = new Uint16Array(8);
+ window.crypto.getRandomValues(random);
+ /** @type {Array<string>} */
+ var e = new Array();
+ for (var i = 0; i < 8; i++) {
+ e[i] = (/** @type {number} */ (random[i]) + 0x10000).
+ toString(16).substring(1);
+ }
+ return e[0] + e[1] + '-' + e[2] + '-' + e[3] + '-' +
+ e[4] + '-' + e[5] + e[6] + e[7];
+};

Powered by Google App Engine
This is Rietveld 408576698