summaryrefslogtreecommitdiffstats
path: root/devtools/client/performance/test/browser_perf-theme-toggle.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-theme-toggle.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-theme-toggle.js')
-rw-r--r--devtools/client/performance/test/browser_perf-theme-toggle.js78
1 files changed, 78 insertions, 0 deletions
diff --git a/devtools/client/performance/test/browser_perf-theme-toggle.js b/devtools/client/performance/test/browser_perf-theme-toggle.js
new file mode 100644
index 000000000..f8dbe9767
--- /dev/null
+++ b/devtools/client/performance/test/browser_perf-theme-toggle.js
@@ -0,0 +1,78 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+/* eslint-disable */
+/**
+ * Tests if the markers and memory overviews render with the correct
+ * theme on load, and rerenders when changed.
+ */
+
+const { setTheme } = require("devtools/client/shared/theme");
+
+const LIGHT_BG = "white";
+const DARK_BG = "#14171a";
+
+setTheme("dark");
+Services.prefs.setBoolPref(MEMORY_PREF, false);
+
+requestLongerTimeout(2);
+
+function* spawnTest() {
+ let { panel } = yield initPerformance(SIMPLE_URL);
+ let { EVENTS, $, OverviewView, document: doc } = panel.panelWin;
+
+ yield startRecording(panel);
+ let markers = OverviewView.graphs.get("timeline");
+ is(markers.backgroundColor, DARK_BG,
+ "correct theme on load for markers.");
+ yield stopRecording(panel);
+
+ let refreshed = once(markers, "refresh");
+ setTheme("light");
+ yield refreshed;
+
+ ok(true, "markers were rerendered after theme change.");
+ is(markers.backgroundColor, LIGHT_BG,
+ "correct theme on after toggle for markers.");
+
+ // reset back to dark
+ refreshed = once(markers, "refresh");
+ setTheme("dark");
+ yield refreshed;
+
+ info("Testing with memory overview");
+
+ Services.prefs.setBoolPref(MEMORY_PREF, true);
+
+ yield startRecording(panel);
+ let memory = OverviewView.graphs.get("memory");
+ is(memory.backgroundColor, DARK_BG,
+ "correct theme on load for memory.");
+ yield stopRecording(panel);
+
+ refreshed = Promise.all([
+ once(markers, "refresh"),
+ once(memory, "refresh"),
+ ]);
+ setTheme("light");
+ yield refreshed;
+
+ ok(true, "Both memory and markers were rerendered after theme change.");
+ is(markers.backgroundColor, LIGHT_BG,
+ "correct theme on after toggle for markers.");
+ is(memory.backgroundColor, LIGHT_BG,
+ "correct theme on after toggle for memory.");
+
+ refreshed = Promise.all([
+ once(markers, "refresh"),
+ once(memory, "refresh"),
+ ]);
+
+ // Set theme back to light
+ setTheme("light");
+ yield refreshed;
+
+ yield teardown(panel);
+ finish();
+}
+/* eslint-enable */