gecko-dev/browser/devtools/performance/test/browser_profiler_tree-view-07.js

71 lines
2.3 KiB
JavaScript
Raw Normal View History

2014-08-06 15:25:18 +00:00
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests if the profiler's tree view implementation works properly and
* has the correct 'root', 'parent', 'level' etc. accessors on child nodes.
*/
Bug 1101235 - Move tree utilities out of profiler, r=vp --HG-- rename : browser/devtools/profiler/test/browser_profiler_categories.js => browser/devtools/performance/test/browser_profiler_categories.js rename : browser/devtools/profiler/test/browser_profiler_content-check.js => browser/devtools/performance/test/browser_profiler_content-check.js rename : browser/devtools/profiler/test/browser_profiler_tree-abstract-01.js => browser/devtools/performance/test/browser_profiler_tree-abstract-01.js rename : browser/devtools/profiler/test/browser_profiler_tree-abstract-02.js => browser/devtools/performance/test/browser_profiler_tree-abstract-02.js rename : browser/devtools/profiler/test/browser_profiler_tree-abstract-03.js => browser/devtools/performance/test/browser_profiler_tree-abstract-03.js rename : browser/devtools/profiler/test/browser_profiler_tree-abstract-04.js => browser/devtools/performance/test/browser_profiler_tree-abstract-04.js rename : browser/devtools/profiler/test/browser_profiler_tree-frame-node.js => browser/devtools/performance/test/browser_profiler_tree-frame-node.js rename : browser/devtools/profiler/test/browser_profiler_tree-model-01.js => browser/devtools/performance/test/browser_profiler_tree-model-01.js rename : browser/devtools/profiler/test/browser_profiler_tree-model-02.js => browser/devtools/performance/test/browser_profiler_tree-model-02.js rename : browser/devtools/profiler/test/browser_profiler_tree-model-03.js => browser/devtools/performance/test/browser_profiler_tree-model-03.js rename : browser/devtools/profiler/test/browser_profiler_tree-model-04.js => browser/devtools/performance/test/browser_profiler_tree-model-04.js rename : browser/devtools/profiler/test/browser_profiler_tree-model-05.js => browser/devtools/performance/test/browser_profiler_tree-model-05.js rename : browser/devtools/profiler/test/browser_profiler_tree-view-01.js => browser/devtools/performance/test/browser_profiler_tree-view-01.js rename : browser/devtools/profiler/test/browser_profiler_tree-view-02.js => browser/devtools/performance/test/browser_profiler_tree-view-02.js rename : browser/devtools/profiler/test/browser_profiler_tree-view-03.js => browser/devtools/performance/test/browser_profiler_tree-view-03.js rename : browser/devtools/profiler/test/browser_profiler_tree-view-04.js => browser/devtools/performance/test/browser_profiler_tree-view-04.js rename : browser/devtools/profiler/test/browser_profiler_tree-view-05.js => browser/devtools/performance/test/browser_profiler_tree-view-05.js rename : browser/devtools/profiler/test/browser_profiler_tree-view-06.js => browser/devtools/performance/test/browser_profiler_tree-view-06.js rename : browser/devtools/profiler/test/browser_profiler_tree-view-07.js => browser/devtools/performance/test/browser_profiler_tree-view-07.js rename : browser/devtools/timeline/test/browser_timeline_blueprint.js => browser/devtools/performance/test/browser_timeline_blueprint.js rename : browser/devtools/profiler/utils/global.js => browser/devtools/shared/profiler/global.js rename : browser/devtools/profiler/utils/tree-model.js => browser/devtools/shared/profiler/tree-model.js rename : browser/devtools/profiler/utils/tree-view.js => browser/devtools/shared/profiler/tree-view.js rename : browser/devtools/timeline/widgets/global.js => browser/devtools/shared/timeline/global.js rename : browser/devtools/timeline/widgets/marker-details.js => browser/devtools/shared/timeline/marker-details.js rename : browser/devtools/timeline/widgets/markers-overview.js => browser/devtools/shared/timeline/markers-overview.js rename : browser/devtools/timeline/widgets/memory-overview.js => browser/devtools/shared/timeline/memory-overview.js rename : browser/devtools/timeline/widgets/waterfall.js => browser/devtools/shared/timeline/waterfall.js
2015-02-11 20:23:32 +00:00
function spawnTest () {
let { ThreadNode } = devtools.require("devtools/shared/profiler/tree-model");
let { CallView } = devtools.require("devtools/shared/profiler/tree-view");
2014-08-06 15:25:18 +00:00
let threadNode = new ThreadNode(gThread);
// Don't display the synthesized (root) and the real (root) node twice.
threadNode.calls = threadNode.calls[0].calls;
2014-08-06 15:25:18 +00:00
let treeRoot = new CallView({ frame: threadNode });
let container = document.createElement("vbox");
container.id = "call-tree-container";
treeRoot.attachTo(container);
let A = treeRoot.getChild();
let B = A.getChild();
let D = B.getChild();
is(D.root, treeRoot,
"The .A.B.D node has the correct root.");
is(D.parent, B,
"The .A.B.D node has the correct parent.");
is(D.level, 3,
"The .A.B.D node has the correct level.");
is(D.target.className, "call-tree-item",
"The .A.B.D node has the correct target node.");
is(D.container.id, "call-tree-container",
"The .A.B.D node has the correct container node.");
2014-08-06 15:25:18 +00:00
}
let gThread = synthesizeProfileForTest([{
2014-08-06 15:25:18 +00:00
time: 5,
frames: [
{ category: 8, location: "(root)" },
{ category: 8, location: "A (http://foo/bar/baz:12)" },
{ category: 16, location: "B (http://foo/bar/baz:34)" },
{ category: 32, location: "C (http://foo/bar/baz:56)" }
]
}, {
time: 5 + 1,
frames: [
{ category: 8, location: "(root)" },
{ category: 8, location: "A (http://foo/bar/baz:12)" },
{ category: 16, location: "B (http://foo/bar/baz:34)" },
{ category: 64, location: "D (http://foo/bar/baz:78)" }
]
}, {
time: 5 + 1 + 2,
2014-08-06 15:25:18 +00:00
frames: [
{ category: 8, location: "(root)" },
{ category: 8, location: "A (http://foo/bar/baz:12)" },
{ category: 16, location: "B (http://foo/bar/baz:34)" },
{ category: 64, location: "D (http://foo/bar/baz:78)" }
]
}, {
time: 5 + 1 + 2 + 7,
2014-08-06 15:25:18 +00:00
frames: [
{ category: 8, location: "(root)" },
{ category: 8, location: "A (http://foo/bar/baz:12)" },
{ category: 128, location: "E (http://foo/bar/baz:90)" },
{ category: 256, location: "F (http://foo/bar/baz:99)" }
]
}]);