gecko-dev/browser/devtools/performance/test/browser_perf-details-01.js
Victor Porof 8799c47957 Bug 1077461 - Build call tree for memory allocations view, r=jsantell
--HG--
rename : browser/devtools/performance/test/browser_perf-options-invert-call-tree.js => browser/devtools/performance/test/browser_perf-options-invert-call-tree-01.js
rename : browser/devtools/performance/views/details-call-tree.js => browser/devtools/performance/views/details-js-call-tree.js
rename : browser/devtools/performance/views/details-flamegraph.js => browser/devtools/performance/views/details-js-flamegraph.js
2015-01-28 14:30:32 -05:00

52 lines
1.9 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that the details view toggles subviews.
*/
function spawnTest () {
let { panel } = yield initPerformance(SIMPLE_URL);
let { EVENTS, $, DetailsView, document: doc } = panel.panelWin;
info("views on startup");
checkViews(DetailsView, doc, "waterfall");
// Select calltree view
let viewChanged = onceSpread(DetailsView, EVENTS.DETAILS_VIEW_SELECTED);
command($("toolbarbutton[data-view='js-calltree']"));
let [_, viewName] = yield viewChanged;
is(viewName, "js-calltree", "DETAILS_VIEW_SELECTED fired with view name");
checkViews(DetailsView, doc, "js-calltree");
// Select flamegraph view
viewChanged = onceSpread(DetailsView, EVENTS.DETAILS_VIEW_SELECTED);
command($("toolbarbutton[data-view='js-flamegraph']"));
[_, viewName] = yield viewChanged;
is(viewName, "js-flamegraph", "DETAILS_VIEW_SELECTED fired with view name");
checkViews(DetailsView, doc, "js-flamegraph");
// Select waterfall view
viewChanged = onceSpread(DetailsView, EVENTS.DETAILS_VIEW_SELECTED);
command($("toolbarbutton[data-view='waterfall']"));
[_, viewName] = yield viewChanged;
is(viewName, "waterfall", "DETAILS_VIEW_SELECTED fired with view name");
checkViews(DetailsView, doc, "waterfall");
yield teardown(panel);
finish();
}
function checkViews (DetailsView, doc, currentView) {
for (let viewName in DetailsView.components) {
let button = doc.querySelector(`toolbarbutton[data-view="${viewName}"]`);
is(DetailsView.el.selectedPanel.id, DetailsView.components[currentView].id,
`DetailsView correctly has ${currentView} selected.`);
if (viewName === currentView) {
ok(button.getAttribute("checked"), `${viewName} button checked`);
} else {
ok(!button.getAttribute("checked"), `${viewName} button not checked`);
}
}
}