From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../shared/test/browser_flame-graph-utils-hash.js | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 devtools/client/shared/test/browser_flame-graph-utils-hash.js (limited to 'devtools/client/shared/test/browser_flame-graph-utils-hash.js') diff --git a/devtools/client/shared/test/browser_flame-graph-utils-hash.js b/devtools/client/shared/test/browser_flame-graph-utils-hash.js new file mode 100644 index 000000000..6b441bbf5 --- /dev/null +++ b/devtools/client/shared/test/browser_flame-graph-utils-hash.js @@ -0,0 +1,24 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Tests if (idle) nodes are added when necessary in the flame graph data. + +const {FlameGraphUtils} = require("devtools/client/shared/widgets/FlameGraph"); + +add_task(function* () { + let hash1 = FlameGraphUtils._getStringHash("abc"); + let hash2 = FlameGraphUtils._getStringHash("acb"); + let hash3 = FlameGraphUtils._getStringHash(Array.from(Array(100000)).join("a")); + let hash4 = FlameGraphUtils._getStringHash(Array.from(Array(100000)).join("b")); + + isnot(hash1, hash2, "The hashes should not be equal (1)."); + isnot(hash2, hash3, "The hashes should not be equal (2)."); + isnot(hash3, hash4, "The hashes should not be equal (3)."); + + ok(Number.isInteger(hash1), "The hashes should be integers, not Infinity or NaN (1)."); + ok(Number.isInteger(hash2), "The hashes should be integers, not Infinity or NaN (2)."); + ok(Number.isInteger(hash3), "The hashes should be integers, not Infinity or NaN (3)."); + ok(Number.isInteger(hash4), "The hashes should be integers, not Infinity or NaN (4)."); +}); -- cgit v1.2.3