summaryrefslogtreecommitdiffstats
path: root/devtools/client/responsive/test/xpcshell/test_change_user_agent.js
blob: e92d3f110fb0dab977948198f8fee8c5b6c30604 (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
/* 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}`
  );
});