summaryrefslogtreecommitdiffstats
path: root/devtools/client/responsive/test/xpcshell/test_change_network_throttling.js
blob: eb762682d8bcf0abf18b71e429fa3e49174f612e (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
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Test changing the network throttling state

const {
  changeNetworkThrottling,
} = require("resource://devtools/client/shared/components/throttling/actions.js");

add_task(async function () {
  const store = Store();
  const { getState, dispatch } = store;

  ok(
    !getState().networkThrottling.enabled,
    "Network throttling is disabled by default."
  );
  equal(
    getState().networkThrottling.profile,
    "",
    "Network throttling profile is empty by default."
  );

  dispatch(changeNetworkThrottling(true, "Bob"));

  ok(getState().networkThrottling.enabled, "Network throttling is enabled.");
  equal(
    getState().networkThrottling.profile,
    "Bob",
    "Network throttling profile is set."
  );
});