summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/browser/browser_timeline.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/server/tests/browser/browser_timeline.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/server/tests/browser/browser_timeline.js')
-rw-r--r--devtools/server/tests/browser/browser_timeline.js63
1 files changed, 63 insertions, 0 deletions
diff --git a/devtools/server/tests/browser/browser_timeline.js b/devtools/server/tests/browser/browser_timeline.js
new file mode 100644
index 000000000..1e5793447
--- /dev/null
+++ b/devtools/server/tests/browser/browser_timeline.js
@@ -0,0 +1,63 @@
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test that the timeline front's start/stop/isRecording methods work in a
+// simple use case, and that markers events are sent when operations occur.
+// Note that this test isn't concerned with which markers are actually recorded,
+// just that markers are recorded at all.
+// Trying to check marker types here may lead to intermittents, see bug 1066474.
+
+const {TimelineFront} = require("devtools/shared/fronts/timeline");
+
+add_task(function* () {
+ let browser = yield addTab("data:text/html;charset=utf-8,mop");
+ let doc = browser.contentDocument;
+
+ initDebuggerServer();
+ let client = new DebuggerClient(DebuggerServer.connectPipe());
+ let form = yield connectDebuggerClient(client);
+ let front = TimelineFront(client, form);
+
+ ok(front, "The TimelineFront was created");
+
+ let isActive = yield front.isRecording();
+ ok(!isActive, "The TimelineFront is not initially recording");
+
+ info("Flush any pending reflows");
+ let forceSyncReflow = doc.body.innerHeight;
+
+ info("Start recording");
+ yield front.start({ withMarkers: true });
+
+ isActive = yield front.isRecording();
+ ok(isActive, "The TimelineFront is now recording");
+
+ info("Change some style on the page to cause style/reflow/paint");
+ let onMarkers = once(front, "markers");
+ doc.body.style.padding = "10px";
+ let markers = yield onMarkers;
+
+ ok(true, "The markers event was fired");
+ ok(markers.length > 0, "Markers were returned");
+
+ info("Flush pending reflows again");
+ forceSyncReflow = doc.body.innerHeight;
+
+ info("Change some style on the page to cause style/paint");
+ onMarkers = once(front, "markers");
+ doc.body.style.backgroundColor = "red";
+ markers = yield onMarkers;
+
+ ok(markers.length > 0, "markers were returned");
+
+ yield front.stop();
+
+ isActive = yield front.isRecording();
+ ok(!isActive, "Not recording after stop()");
+
+ yield client.close();
+ gBrowser.removeCurrentTab();
+});