summaryrefslogtreecommitdiffstats
path: root/devtools/client/netmonitor/test/browser_net_reload-markers.js
blob: 26866830ff6521ab1e085f0b05dd91ebc8a66ad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

/**
 * Tests if the empty-requests reload button works.
 */

add_task(function* () {
  let { monitor } = yield initNetMonitor(SINGLE_GET_URL);
  info("Starting test... ");

  let { document, EVENTS } = monitor.panelWin;
  let button = document.querySelector("#requests-menu-reload-notice-button");
  button.click();

  let markers = [];

  monitor.panelWin.on(EVENTS.TIMELINE_EVENT, (_, marker) => {
    markers.push(marker);
  });

  yield waitForNetworkEvents(monitor, 2);
  yield waitUntil(() => markers.length == 2);

  ok(true, "Reloading finished");

  is(markers[0].name, "document::DOMContentLoaded",
    "The first received marker is correct.");
  is(markers[1].name, "document::Load",
    "The second received marker is correct.");

  return teardown(monitor);
});