summaryrefslogtreecommitdiffstats
path: root/devtools/client/responsive/test/xpcshell/test_change_user_agent.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/responsive/test/xpcshell/test_change_user_agent.js')
-rw-r--r--devtools/client/responsive/test/xpcshell/test_change_user_agent.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/devtools/client/responsive/test/xpcshell/test_change_user_agent.js b/devtools/client/responsive/test/xpcshell/test_change_user_agent.js
new file mode 100644
index 0000000000..e92d3f110f
--- /dev/null
+++ b/devtools/client/responsive/test/xpcshell/test_change_user_agent.js
@@ -0,0 +1,28 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test changing the user agent.
+
+const {
+ changeUserAgent,
+} = require("resource://devtools/client/responsive/actions/ui.js");
+
+const NEW_USER_AGENT =
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) " +
+ "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36";
+
+add_task(async function () {
+ const store = Store();
+ const { getState, dispatch } = store;
+
+ equal(getState().ui.userAgent, "", "User agent is empty by default.");
+
+ dispatch(changeUserAgent(NEW_USER_AGENT));
+ equal(
+ getState().ui.userAgent,
+ NEW_USER_AGENT,
+ `User Agent changed to ${NEW_USER_AGENT}`
+ );
+});