gecko/browser/devtools/performance/test/browser_perf-data-samples.js
Victor Porof 8a3b02de53 Bug 1105014 - Part 3: Fix existing tests and add a few more, r=jsantell
--HG--
rename : browser/devtools/performance/test/browser_perf-details.js => browser/devtools/performance/test/browser_perf-details-01.js
rename : browser/devtools/performance/test/browser_perf-details-calltree-render-01.js => browser/devtools/performance/test/browser_perf-details-calltree-render.js
rename : browser/devtools/performance/test/browser_perf-details-flamegraph-render-01.js => browser/devtools/performance/test/browser_perf-details-flamegraph-render.js
rename : browser/devtools/performance/test/browser_perf-details-waterfall-render-01.js => browser/devtools/performance/test/browser_perf-details-waterfall-render.js
rename : browser/devtools/performance/test/browser_perf-details-calltree-render-02.js => browser/devtools/performance/test/browser_perf-range-changed-render.js
2015-01-22 12:20:55 -05:00

40 lines
1.1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests if the retrieved profiler data samples always have a (root) node.
* If this ever changes, the |ThreadNode.prototype.insert| function in
* browser/devtools/profiler/utils/tree-model.js will have to be changed.
*/
const WAIT_TIME = 1000; // ms
function spawnTest () {
let { panel } = yield initPerformance(SIMPLE_URL);
let front = panel.panelWin.gFront;
yield front.startRecording();
busyWait(WAIT_TIME); // allow the profiler module to sample some cpu activity
let { profile } = yield front.stopRecording();
let sampleCount = 0;
for (let thread of profile.threads) {
info("Checking thread: " + thread.name);
for (let sample of thread.samples) {
sampleCount++;
if (sample.frames[0].location != "(root)") {
ok(false, "The sample " + sample.toSource() + " doesn't have a root node.");
}
}
}
ok(sampleCount > 0,
"At least some samples have been iterated over, checking for root nodes.");
yield teardown(panel);
finish();
}