2015-02-06 18:20:19 +00:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests that view states and lazy component intialization works.
|
|
|
|
*/
|
2015-05-25 12:42:51 +00:00
|
|
|
function* spawnTest() {
|
2015-02-06 18:20:19 +00:00
|
|
|
let { panel } = yield initPerformance(SIMPLE_URL);
|
|
|
|
let { EVENTS, PerformanceView, OverviewView, DetailsView } = panel.panelWin;
|
|
|
|
|
|
|
|
is(PerformanceView.getState(), "empty",
|
|
|
|
"The intial state of the performance panel view is correct.");
|
|
|
|
|
2015-04-25 04:04:02 +00:00
|
|
|
ok(!(OverviewView.graphs.get("timeline")),
|
2015-02-06 18:20:19 +00:00
|
|
|
"The markers graph should not have been created yet.");
|
2015-04-25 04:04:02 +00:00
|
|
|
ok(!(OverviewView.graphs.get("memory")),
|
2015-02-06 18:20:19 +00:00
|
|
|
"The memory graph should not have been created yet.");
|
2015-04-25 04:04:02 +00:00
|
|
|
ok(!(OverviewView.graphs.get("framerate")),
|
2015-02-06 18:20:19 +00:00
|
|
|
"The framerate graph should not have been created yet.");
|
|
|
|
|
2015-04-25 04:04:02 +00:00
|
|
|
ok(!DetailsView.components["waterfall"].initialized,
|
|
|
|
"The waterfall detail view should not have been created yet.");
|
2015-02-06 18:20:19 +00:00
|
|
|
ok(!DetailsView.components["js-calltree"].initialized,
|
|
|
|
"The js-calltree detail view should not have been created yet.");
|
|
|
|
ok(!DetailsView.components["js-flamegraph"].initialized,
|
|
|
|
"The js-flamegraph detail view should not have been created yet.");
|
|
|
|
ok(!DetailsView.components["memory-calltree"].initialized,
|
|
|
|
"The memory-calltree detail view should not have been created yet.");
|
|
|
|
ok(!DetailsView.components["memory-flamegraph"].initialized,
|
|
|
|
"The memory-flamegraph detail view should not have been created yet.");
|
|
|
|
|
|
|
|
Services.prefs.setBoolPref(MEMORY_PREF, true);
|
2015-06-09 18:06:49 +00:00
|
|
|
Services.prefs.setBoolPref(ALLOCATIONS_PREF, true);
|
2015-02-06 18:20:19 +00:00
|
|
|
|
2015-04-25 04:04:02 +00:00
|
|
|
ok(!(OverviewView.graphs.get("timeline")),
|
2015-02-06 18:20:19 +00:00
|
|
|
"The markers graph should still not have been created yet.");
|
2015-04-25 04:04:02 +00:00
|
|
|
ok(!(OverviewView.graphs.get("memory")),
|
2015-02-06 18:20:19 +00:00
|
|
|
"The memory graph should still not have been created yet.");
|
2015-04-25 04:04:02 +00:00
|
|
|
ok(!(OverviewView.graphs.get("framerate")),
|
2015-02-06 18:20:19 +00:00
|
|
|
"The framerate graph should still not have been created yet.");
|
|
|
|
|
|
|
|
let stateChanged = once(PerformanceView, EVENTS.UI_STATE_CHANGED);
|
|
|
|
yield startRecording(panel);
|
|
|
|
yield stateChanged;
|
|
|
|
|
|
|
|
is(PerformanceView.getState(), "recording",
|
|
|
|
"The current state of the performance panel view is 'recording'.");
|
2015-04-25 04:04:02 +00:00
|
|
|
ok(OverviewView.graphs.get("memory"),
|
2015-02-06 18:20:19 +00:00
|
|
|
"The memory graph should have been created now.");
|
2015-04-25 04:04:02 +00:00
|
|
|
ok(OverviewView.graphs.get("framerate"),
|
2015-02-06 18:20:19 +00:00
|
|
|
"The framerate graph should have been created now.");
|
|
|
|
|
|
|
|
stateChanged = once(PerformanceView, EVENTS.UI_STATE_CHANGED);
|
|
|
|
yield stopRecording(panel);
|
|
|
|
yield stateChanged;
|
|
|
|
|
|
|
|
is(PerformanceView.getState(), "recorded",
|
|
|
|
"The current state of the performance panel view is 'recorded'.");
|
|
|
|
ok(!DetailsView.components["js-calltree"].initialized,
|
|
|
|
"The js-calltree detail view should still not have been created yet.");
|
|
|
|
ok(!DetailsView.components["js-flamegraph"].initialized,
|
|
|
|
"The js-flamegraph detail view should still not have been created yet.");
|
|
|
|
ok(!DetailsView.components["memory-calltree"].initialized,
|
|
|
|
"The memory-calltree detail view should still not have been created yet.");
|
|
|
|
ok(!DetailsView.components["memory-flamegraph"].initialized,
|
|
|
|
"The memory-flamegraph detail view should still not have been created yet.");
|
|
|
|
|
|
|
|
yield DetailsView.selectView("js-calltree");
|
|
|
|
|
|
|
|
is(PerformanceView.getState(), "recorded",
|
|
|
|
"The current state of the performance panel view is still 'recorded'.");
|
|
|
|
ok(DetailsView.components["js-calltree"].initialized,
|
|
|
|
"The js-calltree detail view should still have been created now.");
|
|
|
|
ok(!DetailsView.components["js-flamegraph"].initialized,
|
|
|
|
"The js-flamegraph detail view should still not have been created yet.");
|
|
|
|
ok(!DetailsView.components["memory-calltree"].initialized,
|
|
|
|
"The memory-calltree detail view should still not have been created yet.");
|
|
|
|
ok(!DetailsView.components["memory-flamegraph"].initialized,
|
|
|
|
"The memory-flamegraph detail view should still not have been created yet.");
|
|
|
|
|
|
|
|
yield DetailsView.selectView("memory-calltree");
|
|
|
|
|
|
|
|
is(PerformanceView.getState(), "recorded",
|
|
|
|
"The current state of the performance panel view is still 'recorded'.");
|
|
|
|
ok(DetailsView.components["js-calltree"].initialized,
|
|
|
|
"The js-calltree detail view should still register as being created.");
|
|
|
|
ok(!DetailsView.components["js-flamegraph"].initialized,
|
|
|
|
"The js-flamegraph detail view should still not have been created yet.");
|
|
|
|
ok(DetailsView.components["memory-calltree"].initialized,
|
|
|
|
"The memory-calltree detail view should still have been created now.");
|
|
|
|
ok(!DetailsView.components["memory-flamegraph"].initialized,
|
|
|
|
"The memory-flamegraph detail view should still not have been created yet.");
|
|
|
|
|
|
|
|
yield teardown(panel);
|
|
|
|
finish();
|
|
|
|
}
|