summaryrefslogtreecommitdiffstats
path: root/devtools/client/performance/test/browser_perf-states.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/performance/test/browser_perf-states.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-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/browser_perf-states.js')
-rw-r--r--devtools/client/performance/test/browser_perf-states.js102
1 files changed, 102 insertions, 0 deletions
diff --git a/devtools/client/performance/test/browser_perf-states.js b/devtools/client/performance/test/browser_perf-states.js
new file mode 100644
index 000000000..c01fb3121
--- /dev/null
+++ b/devtools/client/performance/test/browser_perf-states.js
@@ -0,0 +1,102 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+
+/**
+ * Tests that view states and lazy component intialization works.
+ */
+
+const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
+const { UI_ENABLE_MEMORY_PREF, UI_ENABLE_ALLOCATIONS_PREF } = require("devtools/client/performance/test/helpers/prefs");
+const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
+const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
+
+add_task(function* () {
+ let { panel } = yield initPerformanceInNewTab({
+ url: SIMPLE_URL,
+ win: window
+ });
+
+ let { PerformanceView, OverviewView, DetailsView } = panel.panelWin;
+
+ is(PerformanceView.getState(), "empty",
+ "The intial state of the performance panel view is correct.");
+
+ ok(!(OverviewView.graphs.get("timeline")),
+ "The markers graph should not have been created yet.");
+ ok(!(OverviewView.graphs.get("memory")),
+ "The memory graph should not have been created yet.");
+ ok(!(OverviewView.graphs.get("framerate")),
+ "The framerate graph should not have been created yet.");
+
+ ok(!DetailsView.components.waterfall.initialized,
+ "The waterfall detail view should not have been created yet.");
+ 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(UI_ENABLE_MEMORY_PREF, true);
+ Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, true);
+
+ ok(!(OverviewView.graphs.get("timeline")),
+ "The markers graph should still not have been created yet.");
+ ok(!(OverviewView.graphs.get("memory")),
+ "The memory graph should still not have been created yet.");
+ ok(!(OverviewView.graphs.get("framerate")),
+ "The framerate graph should still not have been created yet.");
+
+ yield startRecording(panel);
+
+ is(PerformanceView.getState(), "recording",
+ "The current state of the performance panel view is 'recording'.");
+ ok(OverviewView.graphs.get("memory"),
+ "The memory graph should have been created now.");
+ ok(OverviewView.graphs.get("framerate"),
+ "The framerate graph should have been created now.");
+
+ yield stopRecording(panel);
+
+ 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 teardownToolboxAndRemoveTab(panel);
+});