summaryrefslogtreecommitdiffstats
path: root/devtools/shared/heapsnapshot/tests/unit/test_DominatorTree_05.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-22 17:32:39 -0500
committerMatt A. Tobin <email@mattatobin.com>2020-02-22 17:32:39 -0500
commit4e2e9be6abed3225406b466099e397acc0f914d2 (patch)
tree023551018892b8e76ae80e63a08d9d6a27c21a77 /devtools/shared/heapsnapshot/tests/unit/test_DominatorTree_05.js
parenta7888b8cf20691a4090715ab9b055ec3cb75f5e8 (diff)
downloadUXP-4e2e9be6abed3225406b466099e397acc0f914d2.tar
UXP-4e2e9be6abed3225406b466099e397acc0f914d2.tar.gz
UXP-4e2e9be6abed3225406b466099e397acc0f914d2.tar.lz
UXP-4e2e9be6abed3225406b466099e397acc0f914d2.tar.xz
UXP-4e2e9be6abed3225406b466099e397acc0f914d2.zip
Reclassify heapsnapshot and nsJSInspector as not part of devtools
This resolves Issue #316
Diffstat (limited to 'devtools/shared/heapsnapshot/tests/unit/test_DominatorTree_05.js')
-rw-r--r--devtools/shared/heapsnapshot/tests/unit/test_DominatorTree_05.js75
1 files changed, 0 insertions, 75 deletions
diff --git a/devtools/shared/heapsnapshot/tests/unit/test_DominatorTree_05.js b/devtools/shared/heapsnapshot/tests/unit/test_DominatorTree_05.js
deleted file mode 100644
index c07cee994..000000000
--- a/devtools/shared/heapsnapshot/tests/unit/test_DominatorTree_05.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test that we can get the set of immediately dominated nodes for any given
-// node and that this forms a tree.
-
-function run_test() {
- var dominatorTree = saveHeapSnapshotAndComputeDominatorTree();
- equal(typeof dominatorTree.getImmediatelyDominated, "function",
- "getImmediatelyDominated should be a function");
-
- // Do a traversal of the dominator tree.
- //
- // Note that we don't assert directly, only if we get an unexpected
- // value. There are just way too many nodes in the heap graph to assert for
- // every one. This test would constantly time out and assertion messages would
- // overflow the log size.
-
- var root = dominatorTree.root;
- equal(dominatorTree.getImmediateDominator(root), null,
- "The root should not have a parent");
-
- var seen = new Set();
- var stack = [root];
- while (stack.length > 0) {
- var top = stack.pop();
-
- if (seen.has(top)) {
- ok(false,
- "This is a tree, not a graph: we shouldn't have multiple edges to the same node");
- }
- seen.add(top);
- if (seen.size % 1000 === 0) {
- dumpn("Progress update: seen size = " + seen.size);
- }
-
- var newNodes = dominatorTree.getImmediatelyDominated(top);
- if (Object.prototype.toString.call(newNodes) !== "[object Array]") {
- ok(false, "getImmediatelyDominated should return an array for known node ids");
- }
-
- var topSize = dominatorTree.getRetainedSize(top);
-
- var lastSize = Infinity;
- for (var i = 0; i < newNodes.length; i++) {
- if (typeof newNodes[i] !== "number") {
- ok(false, "Every dominated id should be a number");
- }
-
- if (dominatorTree.getImmediateDominator(newNodes[i]) !== top) {
- ok(false, "child's parent should be the expected parent");
- }
-
- var thisSize = dominatorTree.getRetainedSize(newNodes[i]);
-
- if (thisSize >= topSize) {
- ok(false, "the size of children in the dominator tree should always be less than that of their parent");
- }
-
- if (thisSize > lastSize) {
- ok(false,
- "children should be sorted by greatest to least retained size, "
- + "lastSize = " + lastSize + ", thisSize = " + thisSize);
- }
-
- lastSize = thisSize;
- stack.push(newNodes[i]);
- }
- }
-
- ok(true, "Successfully walked the tree");
- dumpn("Walked " + seen.size + " nodes");
-
- do_test_finished();
-}