import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1,6 @@
"use strict";
module.exports = {
// Extend from the shared list of defined globals for xpcshell.
"extends": "../../../../.eslintrc.xpcshell.js"
};

View file

@ -0,0 +1,21 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint no-unused-vars: [2, {"vars": "local"}] */
const { utils: Cu } = Components;
const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
const promise = require("promise");
const { Task } = require("devtools/shared/task");
const Store = require("devtools/client/responsive.html/store");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const flags = require("devtools/shared/flags");
flags.testing = true;
do_register_cleanup(() => {
flags.testing = false;
});

View file

@ -0,0 +1,35 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test adding a new device.
const {
addDevice,
addDeviceType,
} = require("devtools/client/responsive.html/actions/devices");
add_task(function* () {
let store = Store();
const { getState, dispatch } = store;
let device = {
"name": "Firefox OS Flame",
"width": 320,
"height": 570,
"pixelRatio": 1.5,
"userAgent": "Mozilla/5.0 (Mobile; rv:39.0) Gecko/39.0 Firefox/39.0",
"touch": true,
"firefoxOS": true,
"os": "fxos"
};
dispatch(addDeviceType("phones"));
dispatch(addDevice(device, "phones"));
equal(getState().devices.phones.length, 1,
"Correct number of phones");
ok(getState().devices.phones.includes(device),
"Device phone list contains Firefox OS Flame");
});

View file

@ -0,0 +1,22 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test adding a new device type.
const { addDeviceType } =
require("devtools/client/responsive.html/actions/devices");
add_task(function* () {
let store = Store();
const { getState, dispatch } = store;
dispatch(addDeviceType("phones"));
equal(getState().devices.types.length, 1, "Correct number of device types");
equal(getState().devices.phones.length, 0,
"Defaults to an empty array of phones");
ok(getState().devices.types.includes("phones"),
"Device types contain phones");
});

View file

@ -0,0 +1,23 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test adding viewports to the page.
const { addViewport } =
require("devtools/client/responsive.html/actions/viewports");
add_task(function* () {
let store = Store();
const { getState, dispatch } = store;
equal(getState().viewports.length, 0, "Defaults to no viewpots at startup");
dispatch(addViewport());
equal(getState().viewports.length, 1, "One viewport total");
// For the moment, there can be at most one viewport.
dispatch(addViewport());
equal(getState().viewports.length, 1, "One viewport total, again");
});

View file

@ -0,0 +1,42 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test changing the viewport device.
const {
addDevice,
addDeviceType,
} = require("devtools/client/responsive.html/actions/devices");
const {
addViewport,
changeDevice,
} = require("devtools/client/responsive.html/actions/viewports");
add_task(function* () {
let store = Store();
const { getState, dispatch } = store;
dispatch(addDeviceType("phones"));
dispatch(addDevice({
"name": "Firefox OS Flame",
"width": 320,
"height": 570,
"pixelRatio": 1.5,
"userAgent": "Mozilla/5.0 (Mobile; rv:39.0) Gecko/39.0 Firefox/39.0",
"touch": true,
"firefoxOS": true,
"os": "fxos"
}, "phones"));
dispatch(addViewport());
let viewport = getState().viewports[0];
equal(viewport.device, "", "Default device is unselected");
dispatch(changeDevice(0, "Firefox OS Flame"));
viewport = getState().viewports[0];
equal(viewport.device, "Firefox OS Flame",
"Changed to Firefox OS Flame device");
});

View file

@ -0,0 +1,22 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test changing the display pixel ratio.
const { changeDisplayPixelRatio } =
require("devtools/client/responsive.html/actions/display-pixel-ratio");
const NEW_PIXEL_RATIO = 5.5;
add_task(function* () {
let store = Store();
const { getState, dispatch } = store;
equal(getState().displayPixelRatio, 0,
"Defaults to 0 at startup");
dispatch(changeDisplayPixelRatio(NEW_PIXEL_RATIO));
equal(getState().displayPixelRatio, NEW_PIXEL_RATIO,
`Display Pixel Ratio changed to ${NEW_PIXEL_RATIO}`);
});

View file

@ -0,0 +1,22 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test changing the location of the displayed page.
const { changeLocation } =
require("devtools/client/responsive.html/actions/location");
const TEST_URL = "http://example.com";
add_task(function* () {
let store = Store();
const { getState, dispatch } = store;
equal(getState().location, "about:blank",
"Defaults to about:blank at startup");
dispatch(changeLocation(TEST_URL));
equal(getState().location, TEST_URL, "Location changed to TEST_URL");
});

View file

@ -0,0 +1,27 @@
/* 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("devtools/client/responsive.html/actions/network-throttling");
add_task(function* () {
let 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.");
});

View file

@ -0,0 +1,22 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test changing the viewport pixel ratio.
const { addViewport, changePixelRatio } =
require("devtools/client/responsive.html/actions/viewports");
const NEW_PIXEL_RATIO = 5.5;
add_task(function* () {
let store = Store();
const { getState, dispatch } = store;
dispatch(addViewport());
dispatch(changePixelRatio(0, NEW_PIXEL_RATIO));
let viewport = getState().viewports[0];
equal(viewport.pixelRatio.value, NEW_PIXEL_RATIO,
`Viewport's pixel ratio changed to ${NEW_PIXEL_RATIO}`);
});

View file

@ -0,0 +1,21 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test resizing the viewport.
const { addViewport, resizeViewport } =
require("devtools/client/responsive.html/actions/viewports");
add_task(function* () {
let store = Store();
const { getState, dispatch } = store;
dispatch(addViewport());
dispatch(resizeViewport(0, 500, 500));
let viewport = getState().viewports[0];
equal(viewport.width, 500, "Resized width of 500");
equal(viewport.height, 500, "Resized height of 500");
});

View file

@ -0,0 +1,25 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test rotating the viewport.
const { addViewport, rotateViewport } =
require("devtools/client/responsive.html/actions/viewports");
add_task(function* () {
let store = Store();
const { getState, dispatch } = store;
dispatch(addViewport());
let viewport = getState().viewports[0];
equal(viewport.width, 320, "Default width of 320");
equal(viewport.height, 480, "Default height of 480");
dispatch(rotateViewport(0));
viewport = getState().viewports[0];
equal(viewport.width, 480, "Rotated width of 480");
equal(viewport.height, 320, "Rotated height of 320");
});

View file

@ -0,0 +1,37 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test updating the device `displayed` property
const {
addDevice,
addDeviceType,
updateDeviceDisplayed,
} = require("devtools/client/responsive.html/actions/devices");
add_task(function* () {
let store = Store();
const { getState, dispatch } = store;
let device = {
"name": "Firefox OS Flame",
"width": 320,
"height": 570,
"pixelRatio": 1.5,
"userAgent": "Mozilla/5.0 (Mobile; rv:39.0) Gecko/39.0 Firefox/39.0",
"touch": true,
"firefoxOS": true,
"os": "fxos"
};
dispatch(addDeviceType("phones"));
dispatch(addDevice(device, "phones"));
dispatch(updateDeviceDisplayed(device, "phones", true));
equal(getState().devices.phones.length, 1,
"Correct number of phones");
ok(getState().devices.phones[0].displayed,
"Device phone list contains enabled Firefox OS Flame");
});

View file

@ -0,0 +1,23 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test updating the touch simulation `enabled` property
const {
changeTouchSimulation,
} = require("devtools/client/responsive.html/actions/touch-simulation");
add_task(function* () {
let store = Store();
const { getState, dispatch } = store;
ok(!getState().touchSimulation.enabled,
"Touch simulation is disabled by default.");
dispatch(changeTouchSimulation(true));
ok(getState().touchSimulation.enabled,
"Touch simulation is enabled.");
});

View file

@ -0,0 +1,18 @@
[DEFAULT]
tags = devtools
head = head.js ../../../framework/test/shared-redux-head.js
tail =
firefox-appdir = browser
[test_add_device.js]
[test_add_device_type.js]
[test_add_viewport.js]
[test_change_device.js]
[test_change_display_pixel_ratio.js]
[test_change_location.js]
[test_change_network_throttling.js]
[test_change_pixel_ratio.js]
[test_resize_viewport.js]
[test_rotate_viewport.js]
[test_update_device_displayed.js]
[test_update_touch_simulation_enabled.js]