diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/performance/test/unit/test_tree-model-02.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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_tree-model-02.js')
-rw-r--r-- | devtools/client/performance/test/unit/test_tree-model-02.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/devtools/client/performance/test/unit/test_tree-model-02.js b/devtools/client/performance/test/unit/test_tree-model-02.js new file mode 100644 index 000000000..2cbff11be --- /dev/null +++ b/devtools/client/performance/test/unit/test_tree-model-02.js @@ -0,0 +1,62 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +/** + * Tests if a call tree model ignores samples with no timing information. + */ + +function run_test() { + run_next_test(); +} + +add_task(function test() { + let { ThreadNode } = require("devtools/client/performance/modules/logic/tree-model"); + + // Create a root node from a given samples array. + + let thread = new ThreadNode(gThread, { startTime: 0, endTime: 10 }); + let root = getFrameNodePath(thread, "(root)"); + + // Test the ThreadNode, only node with a duration. + equal(thread.duration, 10, + "The correct duration was calculated for the ThreadNode."); + + equal(root.calls.length, 1, + "The correct number of child calls were calculated for the root node."); + ok(getFrameNodePath(root, "A"), + "The root node's only child call is correct."); + + // Test all the descendant nodes. + + equal(getFrameNodePath(root, "A").calls.length, 1, + "The correct number of child calls were calculated for the 'A' node."); + ok(getFrameNodePath(root, "A > B"), + "The 'A' node's only child call is correct."); + + equal(getFrameNodePath(root, "A > B").calls.length, 1, + "The correct number of child calls were calculated for the 'A > B' node."); + ok(getFrameNodePath(root, "A > B > C"), + "The 'A > B' node's only child call is correct."); + + equal(getFrameNodePath(root, "A > B > C").calls.length, 0, + "The correct number of child calls were calculated for the 'A > B > C' node."); +}); + +var gThread = synthesizeProfileForTest([{ + time: 5, + frames: [ + { location: "(root)" }, + { location: "A" }, + { location: "B" }, + { location: "C" } + ] +}, { + time: null, + frames: [ + { location: "(root)" }, + { location: "A" }, + { location: "B" }, + { location: "D" } + ] +}]); |