summaryrefslogtreecommitdiffstats
path: root/devtools/client/performance/test/unit/test_profiler-categories.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/performance/test/unit/test_profiler-categories.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/performance/test/unit/test_profiler-categories.js')
-rw-r--r--devtools/client/performance/test/unit/test_profiler-categories.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/devtools/client/performance/test/unit/test_profiler-categories.js b/devtools/client/performance/test/unit/test_profiler-categories.js
new file mode 100644
index 000000000..7ba288167
--- /dev/null
+++ b/devtools/client/performance/test/unit/test_profiler-categories.js
@@ -0,0 +1,38 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+
+/**
+ * Tests if the profiler categories are mapped correctly.
+ */
+
+function run_test() {
+ run_next_test();
+}
+
+add_task(function () {
+ let { CATEGORIES, CATEGORY_MAPPINGS } = require("devtools/client/performance/modules/categories");
+ let { L10N } = require("devtools/client/performance/modules/global");
+ let count = CATEGORIES.length;
+
+ ok(count,
+ "Should have a non-empty list of categories available.");
+
+ ok(CATEGORIES.some(e => e.color),
+ "All categories have an associated color.");
+
+ ok(CATEGORIES.every(e => e.label),
+ "All categories have an associated label.");
+
+ ok(CATEGORIES.every(e => e.label === L10N.getStr("category." + e.abbrev)),
+ "All categories have a correctly localized label.");
+
+ ok(Object.keys(CATEGORY_MAPPINGS).every(e => (Number(e) >= 9000 && Number(e) <= 9999) ||
+ Number.isInteger(Math.log2(e))),
+ "All bitmask mappings keys are powers of 2, or between 9000-9999 for special " +
+ "categories.");
+
+ ok(Object.keys(CATEGORY_MAPPINGS).every(e => CATEGORIES.indexOf(CATEGORY_MAPPINGS[e])
+ !== -1),
+ "All bitmask mappings point to a category.");
+});