summaryrefslogtreecommitdiffstats
path: root/devtools/client/responsive/test/xpcshell/test_change_network_throttling.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/responsive/test/xpcshell/test_change_network_throttling.js')
-rw-r--r--devtools/client/responsive/test/xpcshell/test_change_network_throttling.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/devtools/client/responsive/test/xpcshell/test_change_network_throttling.js b/devtools/client/responsive/test/xpcshell/test_change_network_throttling.js
new file mode 100644
index 0000000000..eb762682d8
--- /dev/null
+++ b/devtools/client/responsive/test/xpcshell/test_change_network_throttling.js
@@ -0,0 +1,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."
+ );
+});