Bug 1344160 - Fix mochitest failures r=Honza

MozReview-Commit-ID: JkF1WCdLmt8

--HG--
extra : rebase_source : d6c1e0bf147023c177ac098ecbfce7bb86738a5f
This commit is contained in:
Ricky Chien 2017-04-29 23:20:49 +08:00
Родитель ffb7c92d26
Коммит da1823f076
86 изменённых файлов: 428 добавлений и 589 удалений

Просмотреть файл

@ -23,9 +23,9 @@ add_task(function* () {
is(panel.UI.editors.length, 1, "correct number of editors opened");
let monitor = yield toolbox.selectTool("netmonitor");
let { gStore, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
is(gStore.getState().requests.requests.size, 0, "No network requests appear in the network panel");
is(store.getState().requests.requests.size, 0, "No network requests appear in the network panel");
yield gDevTools.closeToolbox(target);
tab = target = toolbox = panel = null;

Просмотреть файл

@ -11,11 +11,12 @@ add_task(function* () {
info("Starting test... ");
let { actions, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let RequestListContextMenu = windowRequire(
"devtools/client/netmonitor/src/request-list-context-menu");
actions.batchEnable(false);
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.reload();

Просмотреть файл

@ -12,11 +12,12 @@ add_task(function* () {
info("Starting test... ");
let { actions, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let RequestListContextMenu = windowRequire(
"devtools/client/netmonitor/src/request-list-context-menu");
actions.batchEnable(false);
store.dispatch(Actions.batchEnable(false));
// Execute one POST request on the page and wait till its done.
let wait = waitForNetworkEvents(monitor, 0, 1);

Просмотреть файл

@ -16,13 +16,14 @@ function* throttleUploadTest(actuallyThrottle) {
info("Starting test... (actuallyThrottle = " + actuallyThrottle + ")");
let { actions, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { setPreferences } =
windowRequire("devtools/client/netmonitor/src/connector/index");
let RequestListContextMenu = windowRequire(
"devtools/client/netmonitor/src/request-list-context-menu");
actions.batchEnable(false);
store.dispatch(Actions.batchEnable(false));
const size = 4096;
const uploadSize = actuallyThrottle ? size / 3 : 0;

Просмотреть файл

@ -121,7 +121,6 @@ skip-if = (os == 'linux' && debug && bits == 32) # Bug 1303439
[browser_net_large-response.js]
[browser_net_leak_on_tab_close.js]
[browser_net_open_request_in_tab.js]
[browser_net_page-nav.js]
[browser_net_pane-collapse.js]
[browser_net_pane-toggle.js]
[browser_net_post-data-01.js]
@ -147,7 +146,6 @@ skip-if = (os == 'linux' && debug && bits == 32) # Bug 1303439
[browser_net_security-warnings.js]
[browser_net_send-beacon.js]
[browser_net_send-beacon-other-tab.js]
[browser_net_simple-init.js]
[browser_net_simple-request-data.js]
[browser_net_simple-request-details.js]
skip-if = true # Bug 1258809

Просмотреть файл

@ -14,10 +14,10 @@ add_task(function* () {
// It seems that this test may be slow on Ubuntu builds running on ec2.
requestLongerTimeout(2);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let count = 0;
function check(selectedIndex, panelVisibility) {
@ -38,19 +38,19 @@ add_task(function* () {
check(-1, false);
gStore.dispatch(Actions.selectDelta(+Infinity));
store.dispatch(Actions.selectDelta(+Infinity));
check(1, true);
gStore.dispatch(Actions.selectDelta(-Infinity));
store.dispatch(Actions.selectDelta(-Infinity));
check(0, true);
gStore.dispatch(Actions.selectDelta(+1));
store.dispatch(Actions.selectDelta(+1));
check(1, true);
gStore.dispatch(Actions.selectDelta(-1));
store.dispatch(Actions.selectDelta(-1));
check(0, true);
gStore.dispatch(Actions.selectDelta(+10));
store.dispatch(Actions.selectDelta(+10));
check(1, true);
gStore.dispatch(Actions.selectDelta(-10));
store.dispatch(Actions.selectDelta(-10));
check(0, true);
wait = waitForNetworkEvents(monitor, 18);
@ -59,24 +59,24 @@ add_task(function* () {
});
yield wait;
gStore.dispatch(Actions.selectDelta(+Infinity));
store.dispatch(Actions.selectDelta(+Infinity));
check(19, true);
gStore.dispatch(Actions.selectDelta(-Infinity));
store.dispatch(Actions.selectDelta(-Infinity));
check(0, true);
gStore.dispatch(Actions.selectDelta(+1));
store.dispatch(Actions.selectDelta(+1));
check(1, true);
gStore.dispatch(Actions.selectDelta(-1));
store.dispatch(Actions.selectDelta(-1));
check(0, true);
gStore.dispatch(Actions.selectDelta(+10));
store.dispatch(Actions.selectDelta(+10));
check(10, true);
gStore.dispatch(Actions.selectDelta(-10));
store.dispatch(Actions.selectDelta(-10));
check(0, true);
gStore.dispatch(Actions.selectDelta(+100));
store.dispatch(Actions.selectDelta(+100));
check(19, true);
gStore.dispatch(Actions.selectDelta(-100));
store.dispatch(Actions.selectDelta(-100));
check(0, true);
return teardown(monitor);

Просмотреть файл

@ -14,10 +14,10 @@ add_task(function* () {
// It seems that this test may be slow on Ubuntu builds running on ec2.
requestLongerTimeout(2);
let { window, document, gStore, windowRequire } = monitor.panelWin;
let { window, document, windowRequire, store } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let count = 0;
function check(selectedIndex, panelVisibility) {

Просмотреть файл

@ -12,14 +12,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(API_CALLS_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
const REQUEST_URIS = [
"http://example.com/api/fileName.xml",
@ -38,8 +38,8 @@ add_task(function* () {
REQUEST_URIS.forEach(function (uri, index) {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(index),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(index),
"GET",
uri
);

Просмотреть файл

@ -10,9 +10,11 @@ add_task(function* () {
requestLongerTimeout(4);
let { monitor } = yield initNetMonitor(INFINITE_GET_URL, true);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, windowRequire, store } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
store.dispatch(Actions.batchEnable(false));
// Wait until the first request makes the empty notice disappear
yield waitForRequestListToAppear();
@ -47,7 +49,7 @@ add_task(function* () {
// (4) Now select an item in the list and check that additional requests
// do not change the scroll position.
gStore.dispatch(Actions.selectRequestByIndex(0));
store.dispatch(Actions.selectRequestByIndex(0));
yield waitForNetworkEvents(monitor, 8);
yield waitSomeTime();
is(requestsContainer.scrollTop, 0, "Did not scroll.");

Просмотреть файл

@ -16,14 +16,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(BROTLI_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, BROTLI_REQUESTS);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -33,8 +33,8 @@ add_task(function* () {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(0),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(0),
"GET", HTTPS_CONTENT_TYPE_SJS + "?fmt=br", {
status: 200,
statusText: "Connected",

Просмотреть файл

@ -11,14 +11,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(STATUS_CODES_URL, true);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
const REQUEST_DATA = [
{
@ -96,8 +96,8 @@ add_task(function* () {
info("Verifying request #" + index);
yield verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(index),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(index),
request.method,
request.uri,
request.details

Просмотреть файл

@ -89,28 +89,29 @@ add_task(function* () {
// page has actually made at least one request.
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, EXPECTED_REQUESTS.length);
tab.linkedBrowser.loadURI(CAUSE_URL);
yield wait;
is(gStore.getState().requests.requests.size, EXPECTED_REQUESTS.length,
is(store.getState().requests.requests.size, EXPECTED_REQUESTS.length,
"All the page events should be recorded.");
EXPECTED_REQUESTS.forEach((spec, i) => {
let { method, url, causeType, causeUri, stack } = spec;
let requestItem = getSortedRequests(gStore.getState()).get(i);
let requestItem = getSortedRequests(store.getState()).get(i);
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
requestItem,
method,
url,
@ -148,7 +149,7 @@ add_task(function* () {
document.querySelector("#requests-list-cause-button"));
let expectedOrder = EXPECTED_REQUESTS.map(r => r.causeType).sort();
expectedOrder.forEach((expectedCause, i) => {
const cause = getSortedRequests(gStore.getState()).get(i).cause.type;
const cause = getSortedRequests(store.getState()).get(i).cause.type;
is(cause, expectedCause, `The request #${i} has the expected cause after sorting`);
});

Просмотреть файл

@ -19,20 +19,20 @@ add_task(function* () {
];
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
let { gStore, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, EXPECTED_REQUESTS.length);
yield performRequests(2, HSTS_SJS);
yield wait;
EXPECTED_REQUESTS.forEach(({status, hasStack}, i) => {
let item = getSortedRequests(gStore.getState()).get(i);
let item = getSortedRequests(store.getState()).get(i);
is(item.status, status, `Request #${i} has the expected status`);

Просмотреть файл

@ -11,13 +11,13 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
let detailsPanelToggleButton = document.querySelector(".network-details-panel-toggle");
let clearButton = document.querySelector(".requests-list-clear-button");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
// Make sure we start in a sane state
assertNoRequestState();
@ -60,7 +60,7 @@ add_task(function* () {
* Asserts the state of the network monitor when one request has loaded
*/
function assertSingleRequestState() {
is(gStore.getState().requests.requests.size, 1,
is(store.getState().requests.requests.size, 1,
"The request menu should have one item at this point.");
is(detailsPanelToggleButton.hasAttribute("disabled"), false,
"The pane toggle button should be enabled after a request is made.");
@ -70,7 +70,7 @@ add_task(function* () {
* Asserts the state of the network monitor when no requests have loaded
*/
function assertNoRequestState() {
is(gStore.getState().requests.requests.size, 0,
is(store.getState().requests.requests.size, 0,
"The request menu should be empty at this point.");
is(detailsPanelToggleButton.hasAttribute("disabled"), true,
"The pane toggle button should be disabled when the request menu is cleared.");

Просмотреть файл

@ -11,10 +11,10 @@ add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, gStore, parent } = monitor.panelWin;
let { document, store, parent } = monitor.panelWin;
for (let [column, shown] of gStore.getState().ui.columns) {
let visibleColumns = [...gStore.getState().ui.columns]
for (let [column, shown] of store.getState().ui.columns) {
let visibleColumns = [...store.getState().ui.columns]
.filter(([_, visible]) => visible);
if (visibleColumns.length === 1) {

Просмотреть файл

@ -11,9 +11,9 @@ add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, gStore, parent } = monitor.panelWin;
let { document, store, parent } = monitor.panelWin;
for (let [column, shown] of gStore.getState().ui.columns) {
for (let [column, shown] of store.getState().ui.columns) {
if (shown) {
yield testVisibleColumnContextMenuItem(column, document, parent);
yield testHiddenColumnContextMenuItem(column, document, parent);

Просмотреть файл

@ -12,11 +12,11 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(PARAMS_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { L10N } = windowRequire("devtools/client/netmonitor/src/utils/l10n");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1, 6);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {

Просмотреть файл

@ -11,7 +11,7 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { L10N } = windowRequire("devtools/client/netmonitor/src/utils/l10n");
let {
@ -19,7 +19,7 @@ add_task(function* () {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -29,8 +29,8 @@ add_task(function* () {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(0),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=xml",
{
@ -44,8 +44,8 @@ add_task(function* () {
);
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(1),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(1),
"GET",
CONTENT_TYPE_SJS + "?fmt=css",
{
@ -59,8 +59,8 @@ add_task(function* () {
);
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(2),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(2),
"GET",
CONTENT_TYPE_SJS + "?fmt=js",
{
@ -74,8 +74,8 @@ add_task(function* () {
);
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(3),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(3),
"GET",
CONTENT_TYPE_SJS + "?fmt=json",
{
@ -89,8 +89,8 @@ add_task(function* () {
);
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(4),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(4),
"GET",
CONTENT_TYPE_SJS + "?fmt=bogus",
{
@ -104,8 +104,8 @@ add_task(function* () {
);
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(5),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(5),
"GET",
TEST_IMAGE,
{
@ -120,8 +120,8 @@ add_task(function* () {
);
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(6),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(6),
"GET",
CONTENT_TYPE_SJS + "?fmt=gzip",
{
@ -280,14 +280,14 @@ add_task(function* () {
function* selectIndexAndWaitForJSONView(index) {
let tabpanel = document.querySelector("#response-panel");
let waitDOM = waitForDOM(tabpanel, ".treeTable");
gStore.dispatch(Actions.selectRequestByIndex(index));
store.dispatch(Actions.selectRequestByIndex(index));
yield waitDOM;
}
function* selectIndexAndWaitForImageView(index) {
let tabpanel = document.querySelector("#response-panel");
let waitDOM = waitForDOM(tabpanel, ".response-image");
gStore.dispatch(Actions.selectRequestByIndex(index));
store.dispatch(Actions.selectRequestByIndex(index));
let [imageNode] = yield waitDOM;
yield once(imageNode, "load");
}

Просмотреть файл

@ -11,7 +11,7 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
@ -23,7 +23,7 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[0]);
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
let { method, httpVersion, status, statusText } = requestItem;
EventUtils.sendMouseEvent({ type: "contextmenu" },

Просмотреть файл

@ -11,10 +11,10 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(PARAMS_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1, 6);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -97,7 +97,7 @@ add_task(function* () {
// Wait for formDataSections and requestPostData state are ready in redux store
// since copyPostData API needs to read these state.
yield waitUntil(() => {
let { requests } = gStore.getState().requests;
let { requests } = store.getState().requests;
let actIDs = Object.keys(requests.toJS());
let { formDataSections, requestPostData } = requests.get(actIDs[index]).toJS();
return formDataSections && requestPostData;

Просмотреть файл

@ -11,7 +11,7 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
@ -27,7 +27,7 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "contextmenu" },
document.querySelectorAll(".request-list-item")[0]);
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
yield waitForClipboardPromise(function setup() {
monitor.panelWin.parent.document

Просмотреть файл

@ -10,14 +10,14 @@
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CORS_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1, 1);
@ -34,8 +34,8 @@ add_task(function* () {
["OPTIONS", "POST"].forEach((method, index) => {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(index),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(index),
method,
requestUrl
);

Просмотреть файл

@ -13,14 +13,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CURL_UTILS_URL);
info("Starting test... ");
let { gStore, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
let { getLongString } = windowRequire("devtools/client/netmonitor/src/utils/client");
let { getLongString } = windowRequire("devtools/client/netmonitor/src/connector/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1, 3);
yield ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, function* (url) {
@ -29,10 +29,10 @@ add_task(function* () {
yield wait;
let requests = {
get: getSortedRequests(gStore.getState()).get(0),
post: getSortedRequests(gStore.getState()).get(1),
multipart: getSortedRequests(gStore.getState()).get(2),
multipartForm: getSortedRequests(gStore.getState()).get(3),
get: getSortedRequests(store.getState()).get(0),
post: getSortedRequests(store.getState()).get(1),
multipart: getSortedRequests(store.getState()).get(2),
multipartForm: getSortedRequests(store.getState()).get(3),
};
let data = yield createCurlData(requests.get, getLongString);

Просмотреть файл

@ -11,14 +11,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CYRILLIC_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -28,8 +28,8 @@ add_task(function* () {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(0),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=txt",
{

Просмотреть файл

@ -12,7 +12,7 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CYRILLIC_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let {
getDisplayedRequests,
getSortedRequests,
@ -24,8 +24,8 @@ add_task(function* () {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(0),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(0),
"GET",
CYRILLIC_URL,
{

Просмотреть файл

@ -130,7 +130,7 @@ const EXPECTED_REQUESTS = [
add_task(function* () {
let { monitor } = yield initNetMonitor(FILTERING_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
@ -138,10 +138,10 @@ add_task(function* () {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
function setFreetextFilter(value) {
gStore.dispatch(Actions.setRequestFilterText(value));
store.dispatch(Actions.setRequestFilterText(value));
}
info("Starting test... ");
@ -154,9 +154,9 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[0]);
isnot(getSelectedRequest(gStore.getState()), null,
isnot(getSelectedRequest(store.getState()), null,
"There should be a selected item in the requests menu.");
is(getSelectedIndex(gStore.getState()), 0,
is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should render correctly.");
@ -316,13 +316,13 @@ add_task(function* () {
}
function testContents(visibility) {
isnot(getSelectedRequest(gStore.getState()), undefined,
isnot(getSelectedRequest(store.getState()), undefined,
"There should still be a selected item after filtering.");
is(getSelectedIndex(gStore.getState()), 0,
is(getSelectedIndex(store.getState()), 0,
"The first item should be still selected after filtering.");
const items = getSortedRequests(gStore.getState());
const visibleItems = getDisplayedRequests(gStore.getState());
const items = getSortedRequests(store.getState());
const visibleItems = getDisplayedRequests(store.getState());
is(items.size, visibility.length,
"There should be a specific amount of items in the requests menu.");
@ -341,8 +341,8 @@ add_task(function* () {
let { method, url, data } = EXPECTED_REQUESTS[i];
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(i),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(i),
method,
url,
data

Просмотреть файл

@ -136,7 +136,7 @@ add_task(function* () {
// It seems that this test may be slow on Ubuntu builds running on ec2.
requestLongerTimeout(2);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
@ -144,7 +144,7 @@ add_task(function* () {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 9);
loadCommonFrameScript();
@ -154,9 +154,9 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[0]);
isnot(getSelectedRequest(gStore.getState()), null,
isnot(getSelectedRequest(store.getState()), null,
"There should be a selected item in the requests menu.");
is(getSelectedIndex(gStore.getState()), 0,
is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should be visible after toggle button was pressed.");
@ -206,15 +206,15 @@ add_task(function* () {
}
function testContents(visibility) {
isnot(getSelectedRequest(gStore.getState()), null,
isnot(getSelectedRequest(store.getState()), null,
"There should still be a selected item after filtering.");
is(getSelectedIndex(gStore.getState()), 0,
is(getSelectedIndex(store.getState()), 0,
"The first item should be still selected after filtering.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should still be visible after filtering.");
const items = getSortedRequests(gStore.getState());
const visibleItems = getDisplayedRequests(gStore.getState());
const items = getSortedRequests(store.getState());
const visibleItems = getDisplayedRequests(store.getState());
is(items.size, visibility.length,
"There should be a specific amount of items in the requests menu.");
@ -235,8 +235,8 @@ add_task(function* () {
if (visibility[j]) {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(i),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(i),
method,
url,
data

Просмотреть файл

@ -27,7 +27,7 @@ add_task(function* () {
// It seems that this test may be slow on Ubuntu builds running on ec2.
requestLongerTimeout(2);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
@ -35,7 +35,7 @@ add_task(function* () {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
// The test assumes that the first HTML request here has a longer response
// body than the other HTML requests performed later during the test.
@ -52,9 +52,9 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[0]);
isnot(getSelectedRequest(gStore.getState()), null,
isnot(getSelectedRequest(store.getState()), null,
"There should be a selected item in the requests menu.");
is(getSelectedIndex(gStore.getState()), 0,
is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should be visible after toggle button was pressed.");
@ -111,16 +111,16 @@ add_task(function* () {
}
function testContents(order, visible, selection) {
isnot(getSelectedRequest(gStore.getState()), null,
isnot(getSelectedRequest(store.getState()), null,
"There should still be a selected item after filtering.");
is(getSelectedIndex(gStore.getState()), selection,
is(getSelectedIndex(store.getState()), selection,
"The first item should be still selected after filtering.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should still be visible after filtering.");
is(getSortedRequests(gStore.getState()).length, order.length,
is(getSortedRequests(store.getState()).length, order.length,
"There should be a specific amount of items in the requests menu.");
is(getDisplayedRequests(gStore.getState()).length, visible,
is(getDisplayedRequests(store.getState()).length, visible,
"There should be a specific amount of visible items in the requests menu.");
}
});

Просмотреть файл

@ -36,11 +36,11 @@ add_task(function* () {
let { monitor } = yield initNetMonitor(FILTERING_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { Prefs } = windowRequire("devtools/client/netmonitor/src/utils/prefs");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
is(Prefs.filters.length, 3,
"All the filter types should be loaded.");

Просмотреть файл

@ -110,17 +110,17 @@ const EXPECTED_REQUESTS = [
add_task(function* () {
let { monitor } = yield initNetMonitor(FILTERING_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
function setFreetextFilter(value) {
gStore.dispatch(Actions.setRequestFilterText(value));
store.dispatch(Actions.setRequestFilterText(value));
}
info("Starting test... ");
@ -190,8 +190,8 @@ add_task(function* () {
yield teardown(monitor);
function testContents(visibility) {
const items = getSortedRequests(gStore.getState());
const visibleItems = getDisplayedRequests(gStore.getState());
const items = getSortedRequests(store.getState());
const visibleItems = getDisplayedRequests(store.getState());
is(items.size, visibility.length,
"There should be a specific amount of items in the requests menu.");
@ -209,8 +209,8 @@ add_task(function* () {
let { method, url, data } = EXPECTED_REQUESTS[i];
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(i),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(i),
method,
url,
data

Просмотреть файл

@ -18,14 +18,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(FILTERING_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { getDisplayedRequestsSummary } =
windowRequire("devtools/client/netmonitor/src/selectors/index");
let { L10N } = windowRequire("devtools/client/netmonitor/src/utils/l10n");
let { PluralForm } = windowRequire("devtools/shared/plural-form");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
testStatus();
for (let i = 0; i < 2; i++) {
@ -49,7 +49,7 @@ add_task(function* () {
yield teardown(monitor);
function testStatus() {
let state = gStore.getState();
let state = store.getState();
let totalRequestsCount = state.requests.requests.size;
let requestsSummary = getDisplayedRequestsSummary(state);
info(`Current requests: ${requestsSummary.count} of ${totalRequestsCount}.`);

Просмотреть файл

@ -158,20 +158,20 @@ add_task(function* () {
// page has actually made at least one request.
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
tab.linkedBrowser.loadURI(TOP_URL, null, null);
yield waitForNetworkEvents(monitor, REQUEST_COUNT);
is(gStore.getState().requests.requests.size, REQUEST_COUNT,
is(store.getState().requests.requests.size, REQUEST_COUNT,
"All the page events should be recorded.");
// While there is a defined order for requests in each document separately, the requests
@ -180,7 +180,7 @@ add_task(function* () {
let currentTop = 0;
let currentSub = 0;
for (let i = 0; i < REQUEST_COUNT; i++) {
let requestItem = getSortedRequests(gStore.getState()).get(i);
let requestItem = getSortedRequests(store.getState()).get(i);
let itemUrl = requestItem.url;
let itemCauseUri = requestItem.cause.loadingDocumentUri;
@ -194,7 +194,7 @@ add_task(function* () {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
requestItem,
method,
url,

Просмотреть файл

@ -11,14 +11,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
let { getHeadersURL } = require("devtools/client/netmonitor/src/utils/mdn-utils");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 2);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -29,7 +29,7 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "click" },
document.querySelectorAll(".request-list-item")[0]);
testShowLearnMore(getSortedRequests(gStore.getState()).get(0));
testShowLearnMore(getSortedRequests(store.getState()).get(0));
return teardown(monitor);

Просмотреть файл

@ -12,13 +12,13 @@ add_task(function* () {
const SELECTOR = ".requests-list-icon[src]";
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
let { triggerActivity } =
windowRequire("devtools/client/netmonitor/src/connector/index");
let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/src/constants");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
yield performRequests();
@ -28,11 +28,11 @@ add_task(function* () {
info("Checking the image thumbnail when all items are shown.");
checkImageThumbnail();
gStore.dispatch(Actions.sortBy("contentSize"));
store.dispatch(Actions.sortBy("contentSize"));
info("Checking the image thumbnail when all items are sorted.");
checkImageThumbnail();
gStore.dispatch(Actions.toggleRequestFilterType("images"));
store.dispatch(Actions.toggleRequestFilterType("images"));
info("Checking the image thumbnail when only images are shown.");
checkImageThumbnail();
@ -54,7 +54,7 @@ add_task(function* () {
}
function* reloadAndPerformRequests() {
yield NetMonitorController.triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
yield triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
yield performRequests();
}

Просмотреть файл

@ -14,14 +14,14 @@ add_task(function* test() {
const SELECTOR = ".requests-list-icon[src]";
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
let { triggerActivity } =
windowRequire("devtools/client/netmonitor/src/connector/index");
let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/src/constants");
let toolboxDoc = monitor.panelWin.parent.document;
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let onEvents = waitForNetworkEvents(monitor, IMAGE_TOOLTIP_REQUESTS);
yield performRequests();
@ -40,7 +40,7 @@ add_task(function* test() {
onEvents = waitForNetworkEvents(monitor, IMAGE_TOOLTIP_REQUESTS + 1);
info("Reloading the debuggee and performing all requests again...");
yield NetMonitorController.triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
yield triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
yield performRequests();
yield onEvents;
yield waitUntil(() => !!document.querySelector(SELECTOR));

Просмотреть файл

@ -12,10 +12,10 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(JSON_B64_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {

Просмотреть файл

@ -17,14 +17,14 @@ add_task(function* () {
// in a variables view instance. Debug builds are slow.
requestLongerTimeout(4);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -34,8 +34,8 @@ add_task(function* () {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(0),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=json-long",
{

Просмотреть файл

@ -12,14 +12,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(JSON_MALFORMED_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -29,8 +29,8 @@ add_task(function* () {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(0),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=json-malformed",
{

Просмотреть файл

@ -11,11 +11,11 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(JSON_BASIC_URL + "?name=null");
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let { L10N } = windowRequire("devtools/client/netmonitor/src/utils/l10n");
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {

Просмотреть файл

@ -11,7 +11,7 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(JSON_CUSTOM_MIME_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { L10N } = windowRequire("devtools/client/netmonitor/src/utils/l10n");
let {
@ -19,7 +19,7 @@ add_task(function* () {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -29,8 +29,8 @@ add_task(function* () {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(0),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=json-custom-mime",
{

Просмотреть файл

@ -13,14 +13,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(JSON_TEXT_MIME_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -30,8 +30,8 @@ add_task(function* () {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(0),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=json-text-mime",
{

Просмотреть файл

@ -13,14 +13,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(JSONP_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 2);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -30,8 +30,8 @@ add_task(function* () {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(0),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=jsonp&jsonp=$_0123Fun",
{
@ -44,8 +44,8 @@ add_task(function* () {
});
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(1),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(1),
"GET",
CONTENT_TYPE_SJS + "?fmt=jsonp2&jsonp=$_4567Sad",
{

Просмотреть файл

@ -17,14 +17,14 @@ add_task(function* () {
// is going to be requested and displayed in the source editor.
requestLongerTimeout(2);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, HTML_LONG_URL, function* (url) {
@ -34,8 +34,8 @@ add_task(function* () {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(0),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=html-long",
{

Просмотреть файл

@ -11,10 +11,10 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test...");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {

Просмотреть файл

@ -1,72 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Tests if page navigation ("close", "navigate", etc.) triggers an appropriate
* action in the network monitor.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { windowRequire } = monitor.panelWin;
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
yield testNavigate();
yield testNavigateBack();
yield testClose();
function* testNavigate() {
info("Navigating forward...");
let onWillNav = monitor.panelWin.once(EVENTS.TARGET_WILL_NAVIGATE);
let onDidNav = monitor.panelWin.once(EVENTS.TARGET_DID_NAVIGATE);
tab.linkedBrowser.loadURI(NAVIGATE_URL);
yield onWillNav;
is(tab.linkedBrowser.currentURI.spec, SIMPLE_URL,
"Target started navigating to the correct location.");
yield onDidNav;
is(tab.linkedBrowser.currentURI.spec, NAVIGATE_URL,
"Target finished navigating to the correct location.");
}
function* testNavigateBack() {
info("Navigating backward...");
let onWillNav = monitor.panelWin.once(EVENTS.TARGET_WILL_NAVIGATE);
let onDidNav = monitor.panelWin.once(EVENTS.TARGET_DID_NAVIGATE);
tab.linkedBrowser.loadURI(SIMPLE_URL);
yield onWillNav;
is(tab.linkedBrowser.currentURI.spec, NAVIGATE_URL,
"Target started navigating back to the previous location.");
yield onDidNav;
is(tab.linkedBrowser.currentURI.spec, SIMPLE_URL,
"Target finished navigating back to the previous location.");
}
function* testClose() {
info("Closing...");
let onDestroyed = monitor.once("destroyed");
removeTab(tab);
yield onDestroyed;
ok(!NetMonitorController.client,
"There shouldn't be a client available after destruction.");
ok(!NetMonitorController.tabClient,
"There shouldn't be a tabClient available after destruction.");
ok(!NetMonitorController.webConsoleClient,
"There shouldn't be a webConsoleClient available after destruction.");
}
});

Просмотреть файл

@ -11,7 +11,7 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
let {
@ -19,7 +19,7 @@ add_task(function* () {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let toggleButton = document.querySelector(".network-details-panel-toggle");
@ -30,7 +30,7 @@ add_task(function* () {
"collapsed when the frontend is opened.");
is(!!document.querySelector(".network-details-panel"), false,
"The details pane should be hidden when the frontend is opened.");
is(getSelectedRequest(gStore.getState()), null,
is(getSelectedRequest(store.getState()), null,
"There should be no selected item in the requests menu.");
let networkEvent = monitor.panelWin.once(EVENTS.NETWORK_EVENT);
@ -44,7 +44,7 @@ add_task(function* () {
"collapsed after the first request.");
is(!!document.querySelector(".network-details-panel"), false,
"The details pane should still be hidden after the first request.");
is(getSelectedRequest(gStore.getState()), null,
is(getSelectedRequest(store.getState()), null,
"There should still be no selected item in the requests menu.");
EventUtils.sendMouseEvent({ type: "click" }, toggleButton);
@ -56,9 +56,9 @@ add_task(function* () {
"not collapsed anymore after being pressed.");
is(!!document.querySelector(".network-details-panel"), true,
"The details pane should not be hidden after toggle button was pressed.");
isnot(getSelectedRequest(gStore.getState()), null,
isnot(getSelectedRequest(store.getState()), null,
"There should be a selected item in the requests menu.");
is(getSelectedIndex(gStore.getState()), 0,
is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
EventUtils.sendMouseEvent({ type: "click" }, toggleButton);
@ -70,7 +70,7 @@ add_task(function* () {
"collapsed after being pressed again.");
is(!!document.querySelector(".network-details-panel"), false,
"The details pane should now be hidden after the toggle button was pressed again.");
is(getSelectedRequest(gStore.getState()), null,
is(getSelectedRequest(store.getState()), null,
"There should now be no selected item in the requests menu.");
yield teardown(monitor);

Просмотреть файл

@ -16,14 +16,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 2);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -33,8 +33,8 @@ add_task(function* () {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(0),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(0),
"POST",
SIMPLE_SJS + "?foo=bar&baz=42&type=urlencoded",
{
@ -48,8 +48,8 @@ add_task(function* () {
);
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(1),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(1),
"POST",
SIMPLE_SJS + "?foo=bar&baz=42&type=multipart",
{

Просмотреть файл

@ -14,10 +14,10 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(POST_RAW_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {

Просмотреть файл

@ -14,10 +14,10 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(POST_RAW_WITH_HEADERS_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {

Просмотреть файл

@ -14,10 +14,10 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(POST_JSON_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {

Просмотреть файл

@ -25,7 +25,7 @@ add_task(function* () {
let getDoc = () => monitor.panelWin.document;
let getPrefs = () => monitor.panelWin
.windowRequire("devtools/client/netmonitor/src/utils/prefs").Prefs;
let getStore = () => monitor.panelWin.gStore;
let getStore = () => monitor.panelWin.store;
let getState = () => getStore().getState();
let prefsToCheck = {

Просмотреть файл

@ -11,13 +11,13 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 2);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -35,7 +35,7 @@ add_task(function* () {
document.querySelectorAll(".headers-summary .devtools-button")[1]);
yield wait;
testShowRawHeaders(getSortedRequests(gStore.getState()).get(0));
testShowRawHeaders(getSortedRequests(store.getState()).get(0));
EventUtils.sendMouseEvent({ type: "click" },
document.querySelectorAll(".headers-summary .devtools-button")[1]);

Просмотреть файл

@ -13,14 +13,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(JSON_LONG_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
// Perform first batch of requests.
let wait = waitForNetworkEvents(monitor, 1);
@ -60,8 +60,8 @@ add_task(function* () {
function verifyRequest(index) {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(index),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(index),
"GET",
CONTENT_TYPE_SJS + "?fmt=json-long",
{

Просмотреть файл

@ -16,14 +16,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 2);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -31,30 +31,30 @@ add_task(function* () {
});
yield wait;
let origItem = getSortedRequests(gStore.getState()).get(0);
let origItem = getSortedRequests(store.getState()).get(0);
gStore.dispatch(Actions.selectRequest(origItem.id));
store.dispatch(Actions.selectRequest(origItem.id));
// add a new custom request cloned from selected request
gStore.dispatch(Actions.cloneSelectedRequest());
store.dispatch(Actions.cloneSelectedRequest());
testCustomForm(origItem);
let customItem = getSelectedRequest(gStore.getState());
let customItem = getSelectedRequest(store.getState());
testCustomItem(customItem, origItem);
// edit the custom request
yield editCustomForm();
// FIXME: reread the customItem, it's been replaced by a new object (immutable!)
customItem = getSelectedRequest(gStore.getState());
customItem = getSelectedRequest(store.getState());
testCustomItemChanged(customItem, origItem);
// send the new request
wait = waitForNetworkEvents(monitor, 0, 1);
gStore.dispatch(Actions.sendCustomRequest());
store.dispatch(Actions.sendCustomRequest());
yield wait;
let sentItem = getSelectedRequest(gStore.getState());
let sentItem = getSelectedRequest(store.getState());
testSentRequest(sentItem, origItem);
return teardown(monitor);

Просмотреть файл

@ -12,13 +12,13 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CORS_URL);
info("Starting test... ");
let { gStore, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let requestUrl = "http://test1.example.com" + CORS_SJS_PATH;
@ -30,7 +30,7 @@ add_task(function* () {
yield wait;
const METHODS = ["OPTIONS", "POST"];
const ITEMS = METHODS.map((val, i) => getSortedRequests(gStore.getState()).get(i));
const ITEMS = METHODS.map((val, i) => getSortedRequests(store.getState()).get(i));
// Check the requests that were sent
ITEMS.forEach((item, i) => {
@ -43,13 +43,13 @@ add_task(function* () {
let onRequests = waitForNetworkEvents(monitor, 1, 0);
ITEMS.forEach((item) => {
info(`Selecting the ${item.method} request`);
gStore.dispatch(Actions.selectRequest(item.id));
store.dispatch(Actions.selectRequest(item.id));
info("Cloning the selected request into a custom clone");
gStore.dispatch(Actions.cloneSelectedRequest());
store.dispatch(Actions.cloneSelectedRequest());
info("Sending the cloned request (without change)");
gStore.dispatch(Actions.sendCustomRequest());
store.dispatch(Actions.sendCustomRequest());
});
info("Waiting for both resent requests");

Просмотреть файл

@ -11,15 +11,15 @@ add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_SJS);
info("Starting test... ");
let { gStore, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
let { sendHTTPRequest } =
windowRequire("devtools/client/netmonitor/src/connector/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let requestUrl = SIMPLE_SJS;
let requestHeaders = [
@ -32,7 +32,7 @@ add_task(function* () {
];
let wait = waitForNetworkEvents(monitor, 0, 1);
NetMonitorController.webConsoleClient.sendHTTPRequest({
sendHTTPRequest({
url: requestUrl,
method: "POST",
headers: requestHeaders,
@ -40,7 +40,7 @@ add_task(function* () {
});
yield wait;
let item = getSortedRequests(gStore.getState()).get(0);
let item = getSortedRequests(store.getState()).get(0);
is(item.method, "POST", "The request has the right method");
is(item.url, requestUrl, "The request has the right URL");

Просмотреть файл

@ -9,10 +9,10 @@
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
info("Performing a secure request.");
const REQUESTS_URL = "https://example.com" + CORS_SJS_PATH;

Просмотреть файл

@ -9,11 +9,11 @@
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
info("Requesting a resource that has a certificate problem.");

Просмотреть файл

@ -9,16 +9,16 @@
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
info("Requesting a resource over HTTPS.");
yield performRequestAndWait("https://example.com" + CORS_SJS_PATH + "?request_2");
yield performRequestAndWait("https://example.com" + CORS_SJS_PATH + "?request_1");
is(gStore.getState().requests.requests.size, 2, "Two events event logged.");
is(store.getState().requests.requests.size, 2, "Two events event logged.");
yield clickAndTestSecurityIcon();

Просмотреть файл

@ -10,10 +10,10 @@
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 2);
yield ContentTask.spawn(tab.linkedBrowser, HTTPS_REDIRECT_SJS, function* (url) {
@ -21,7 +21,7 @@ add_task(function* () {
});
yield wait;
is(gStore.getState().requests.requests.size, 2,
is(store.getState().requests.requests.size, 2,
"There were two requests due to redirect.");
let [

Просмотреть файл

@ -17,10 +17,10 @@ add_task(function* () {
};
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
yield performRequests();
@ -86,7 +86,7 @@ add_task(function* () {
yield done;
const expectedCount = Object.keys(EXPECTED_SECURITY_STATES).length;
is(gStore.getState().requests.requests.size,
is(store.getState().requests.requests.size,
expectedCount,
expectedCount + " events logged.");
}

Просмотреть файл

@ -10,10 +10,10 @@
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
info("Performing requests.");
let wait = waitForNetworkEvents(monitor, 2);

Просмотреть файл

@ -32,12 +32,12 @@ add_task(function* () {
];
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { getSelectedRequest } =
windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
for (let testcase of TEST_DATA) {
info("Testing Security tab visibility for " + testcase.desc);
@ -59,7 +59,7 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[0]);
is(getSelectedRequest(gStore.getState()).securityState, undefined,
is(getSelectedRequest(store.getState()).securityState, undefined,
"Security state has not yet arrived.");
is(!!document.querySelector("#security-tab"), testcase.visibleOnNewEvent,
"Security tab is " + (testcase.visibleOnNewEvent ? "visible" : "hidden") +
@ -68,8 +68,8 @@ add_task(function* () {
info("Waiting for security information to arrive.");
yield onSecurityInfo;
yield waitUntil(() => !!getSelectedRequest(gStore.getState()).securityState);
ok(getSelectedRequest(gStore.getState()).securityState,
yield waitUntil(() => !!getSelectedRequest(store.getState()).securityState);
ok(getSelectedRequest(store.getState()).securityState,
"Security state arrived.");
is(!!document.querySelector("#security-tab"), testcase.visibleOnSecurityInfo,
"Security tab is " + (testcase.visibleOnSecurityInfo ? "visible" : "hidden") +
@ -83,7 +83,7 @@ add_task(function* () {
" after request has been completed.");
info("Clearing requests.");
gStore.dispatch(Actions.clearRequests());
store.dispatch(Actions.clearRequests());
}
return teardown(monitor);

Просмотреть файл

@ -17,10 +17,10 @@ const TEST_CASES = [
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
for (let test of TEST_CASES) {
info("Testing site with " + test.desc);
@ -50,7 +50,7 @@ add_task(function* () {
test.warnCipher,
"Cipher suite warning is hidden.");
gStore.dispatch(Actions.clearRequests());
store.dispatch(Actions.clearRequests());
}
return teardown(monitor);

Просмотреть файл

@ -9,18 +9,18 @@
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
let { gStore, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let beaconTab = yield addTab(SEND_BEACON_URL);
info("Beacon tab added successfully.");
is(gStore.getState().requests.requests.size, 0, "The requests menu should be empty.");
is(store.getState().requests.requests.size, 0, "The requests menu should be empty.");
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(beaconTab.linkedBrowser, {}, function* () {
@ -29,8 +29,8 @@ add_task(function* () {
tab.linkedBrowser.reload();
yield wait;
is(gStore.getState().requests.requests.size, 1, "Only the reload should be recorded.");
let request = getSortedRequests(gStore.getState()).get(0);
is(store.getState().requests.requests.size, 1, "Only the reload should be recorded.");
let request = getSortedRequests(store.getState()).get(0);
is(request.method, "GET", "The method is correct.");
is(request.status, "200", "The status is correct.");

Просмотреть файл

@ -9,14 +9,14 @@
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SEND_BEACON_URL);
let { gStore, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { getSortedRequests } =
windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
is(gStore.getState().requests.requests.size, 0, "The requests menu should be empty.");
is(store.getState().requests.requests.size, 0, "The requests menu should be empty.");
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
@ -24,8 +24,8 @@ add_task(function* () {
});
yield wait;
is(gStore.getState().requests.requests.size, 1, "The beacon should be recorded.");
let request = getSortedRequests(gStore.getState()).get(0);
is(store.getState().requests.requests.size, 1, "The beacon should be recorded.");
let request = getSortedRequests(store.getState()).get(0);
is(request.method, "POST", "The method is correct.");
ok(request.url.endsWith("beacon_request"), "The URL is correct.");
is(request.status, "404", "The status is correct.");

Просмотреть файл

@ -16,14 +16,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(TEST_URL, true);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
const REQUEST_DATA = [
{
@ -54,12 +54,12 @@ add_task(function* () {
let index = 0;
for (let request of REQUEST_DATA) {
let item = getSortedRequests(gStore.getState()).get(index);
let item = getSortedRequests(store.getState()).get(index);
info(`Verifying request #${index}`);
yield verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
item,
request.method,
request.uri,

Просмотреть файл

@ -1,93 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Simple check if the network monitor starts up and shuts down properly.
*/
function test() {
// These test suite functions are removed from the global scope inside a
// cleanup function. However, we still need them.
let gInfo = info;
let gOk = ok;
initNetMonitor(SIMPLE_URL).then(({ tab, monitor }) => {
info("Starting test... ");
let { windowRequire } = monitor.panelWin;
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
is(tab.linkedBrowser.currentURI.spec, SIMPLE_URL,
"The current tab's location is the correct one.");
function checkIfInitialized(tag) {
info(`Checking if initialization is ok (${tag}).`);
ok(NetMonitorController,
`The network monitor controller object exists (${tag}).`);
ok(NetMonitorController._startup,
`The network monitor controller object exists and is initialized (${tag}).`);
ok(monitor.isReady,
`The network monitor panel appears to be ready (${tag}).`);
ok(NetMonitorController.tabClient,
`There should be a tabClient available at this point (${tag}).`);
ok(NetMonitorController.webConsoleClient,
`There should be a webConsoleClient available at this point (${tag}).`);
ok(NetMonitorController.timelineFront,
`There should be a timelineFront available at this point (${tag}).`);
}
function checkIfDestroyed(tag) {
gInfo("Checking if destruction is ok.");
gOk(NetMonitorController,
`The network monitor controller object still exists (${tag}).`);
gOk(NetMonitorController._shutdown,
`The network monitor controller object still exists and is destroyed (${tag}).`);
gOk(!NetMonitorController.tabClient,
`There shouldn't be a tabClient available after destruction (${tag}).`);
gOk(!NetMonitorController.webConsoleClient,
`There shouldn't be a webConsoleClient available after destruction (${tag}).`);
gOk(!NetMonitorController.timelineFront,
`There shouldn't be a timelineFront available after destruction (${tag}).`);
}
executeSoon(() => {
checkIfInitialized(1);
NetMonitorController.startupNetMonitor()
.then(() => {
info("Starting up again shouldn't do anything special.");
checkIfInitialized(2);
return NetMonitorController.connect();
})
.then(() => {
info("Connecting again shouldn't do anything special.");
checkIfInitialized(3);
return teardown(monitor);
})
.then(finish);
});
registerCleanupFunction(() => {
checkIfDestroyed(1);
NetMonitorController.shutdownNetMonitor()
.then(() => {
gInfo("Shutting down again shouldn't do anything special.");
checkIfDestroyed(2);
return NetMonitorController.disconnect();
})
.then(() => {
gInfo("Disconnecting again shouldn't do anything special.");
checkIfDestroyed(3);
});
});
});
}

Просмотреть файл

@ -13,7 +13,7 @@ function test() {
initNetMonitor(SIMPLE_SJS).then(({ tab, monitor }) => {
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
let {
@ -22,21 +22,21 @@ function test() {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
waitForNetworkEvents(monitor, 1)
.then(() => teardown(monitor))
.then(finish);
monitor.panelWin.once(EVENTS.NETWORK_EVENT, () => {
is(getSelectedRequest(gStore.getState()), null,
is(getSelectedRequest(store.getState()), null,
"There shouldn't be any selected item in the requests menu.");
is(gStore.getState().requests.requests.size, 1,
is(store.getState().requests.requests.size, 1,
"The requests menu should not be empty after the first request.");
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should still be hidden after first request.");
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
is(typeof requestItem.id, "string",
"The attached request id is incorrect.");
@ -84,7 +84,7 @@ function test() {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS
@ -93,11 +93,11 @@ function test() {
monitor.panelWin.once(EVENTS.RECEIVED_REQUEST_HEADERS, async () => {
await waitUntil(() => {
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.requestHeaders;
});
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
ok(requestItem.requestHeaders,
"There should be a requestHeaders data available.");
@ -110,7 +110,7 @@ function test() {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS
@ -119,11 +119,11 @@ function test() {
monitor.panelWin.once(EVENTS.RECEIVED_REQUEST_COOKIES, async () => {
await waitUntil(() => {
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.requestCookies;
});
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
ok(requestItem.requestCookies,
"There should be a requestCookies data available.");
@ -132,7 +132,7 @@ function test() {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS
@ -145,11 +145,11 @@ function test() {
monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_HEADERS, async () => {
await waitUntil(() => {
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.responseHeaders;
});
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
ok(requestItem.responseHeaders,
"There should be a responseHeaders data available.");
@ -160,7 +160,7 @@ function test() {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS
@ -169,11 +169,11 @@ function test() {
monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_COOKIES, async () => {
await waitUntil(() => {
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.responseCookies;
});
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
ok(requestItem.responseCookies,
"There should be a responseCookies data available.");
@ -182,7 +182,7 @@ function test() {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS
@ -191,14 +191,14 @@ function test() {
monitor.panelWin.once(EVENTS.STARTED_RECEIVING_RESPONSE, async () => {
await waitUntil(() => {
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.httpVersion &&
requestItem.status &&
requestItem.statusText &&
requestItem.headersSize;
});
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
is(requestItem.httpVersion, "HTTP/1.1",
"The httpVersion data has an incorrect value.");
@ -211,7 +211,7 @@ function test() {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS,
@ -224,14 +224,14 @@ function test() {
monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_CONTENT, async () => {
await waitUntil(() => {
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.transferredSize &&
requestItem.contentSize &&
requestItem.mimeType &&
requestItem.responseContent;
});
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
is(requestItem.transferredSize, "12",
"The transferredSize data has an incorrect value.");
@ -257,7 +257,7 @@ function test() {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS,
@ -272,11 +272,11 @@ function test() {
monitor.panelWin.once(EVENTS.UPDATING_EVENT_TIMINGS, async () => {
await waitUntil(() => {
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.eventTimings;
});
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
is(typeof requestItem.totalTime, "number",
"The attached totalTime is incorrect.");
@ -285,7 +285,7 @@ function test() {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS,
@ -296,7 +296,7 @@ function test() {
});
monitor.panelWin.once(EVENTS.RECEIVED_EVENT_TIMINGS, () => {
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
ok(requestItem.eventTimings,
"There should be a eventTimings data available.");
@ -317,7 +317,7 @@ function test() {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS,

Просмотреть файл

@ -13,7 +13,7 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_SJS);
info("Starting test... ");
let { document, gStore, windowRequire, NetMonitorView } = monitor.panelWin;
let { document, store, windowRequire, NetMonitorView } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
let {
@ -22,15 +22,15 @@ add_task(function* () {
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
let Editor = require("devtools/client/sourceeditor/editor");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.reload();
yield wait;
is(getSelectedRequest(gStore.getState()), undefined,
is(getSelectedRequest(store.getState()), undefined,
"There shouldn't be any selected item in the requests menu.");
is(gStore.getState().requests.requests.size, 1,
is(store.getState().requests.requests.size, 1,
"The requests menu should not be empty after the first request.");
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should still be hidden after first request.");
@ -38,9 +38,9 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
isnot(getSelectedRequest(gStore.getState()), undefined,
isnot(getSelectedRequest(store.getState()), undefined,
"There should be a selected item in the requests menu.");
is(getSelectedIndex(gStore.getState()), 0,
is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should not be hidden after toggle button was pressed.");

Просмотреть файл

@ -16,17 +16,17 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
true,
"The pane toggle button should be disabled when the frontend is opened.");
ok(document.querySelector(".request-list-empty-notice"),
"An empty notice should be displayed when the frontend is opened.");
is(gStore.getState().requests.requests.size, 0,
is(store.getState().requests.requests.size, 0,
"The requests menu should be empty when the frontend is opened.");
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should be hidden when the frontend is opened.");
@ -38,7 +38,7 @@ add_task(function* () {
"The pane toggle button should be enabled after the first request.");
ok(!document.querySelector(".request-list-empty-notice"),
"The empty notice should be hidden after the first request.");
is(gStore.getState().requests.requests.size, 1,
is(store.getState().requests.requests.size, 1,
"The requests menu should not be empty after the first request.");
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should still be hidden after the first request.");
@ -50,19 +50,19 @@ add_task(function* () {
"The pane toggle button should be still be enabled after a reload.");
ok(!document.querySelector(".request-list-empty-notice"),
"The empty notice should be still hidden after a reload.");
is(gStore.getState().requests.requests.size, 1,
is(store.getState().requests.requests.size, 1,
"The requests menu should not be empty after a reload.");
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should still be hidden after a reload.");
gStore.dispatch(Actions.clearRequests());
store.dispatch(Actions.clearRequests());
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
true,
"The pane toggle button should be disabled when after clear.");
ok(document.querySelector(".request-list-empty-notice"),
"An empty notice should be displayed again after clear.");
is(gStore.getState().requests.requests.size, 0,
is(store.getState().requests.requests.size, 0,
"The requests menu should be empty after clear.");
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should still be hidden after clear.");

Просмотреть файл

@ -17,7 +17,7 @@ add_task(function* () {
// of the heavy dom manipulation associated with sorting.
requestLongerTimeout(2);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
@ -25,7 +25,7 @@ add_task(function* () {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
// Loading the frame script and preparing the xhr request URLs so we can
// generate some requests later.
@ -54,9 +54,9 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
isnot(getSelectedRequest(gStore.getState()), undefined,
isnot(getSelectedRequest(store.getState()), undefined,
"There should be a selected item in the requests menu.");
is(getSelectedIndex(gStore.getState()), 0,
is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should be visible after toggle button was pressed.");
@ -138,16 +138,16 @@ add_task(function* () {
}
function testContents(order, selection) {
isnot(getSelectedRequest(gStore.getState()), undefined,
isnot(getSelectedRequest(store.getState()), undefined,
"There should still be a selected item after sorting.");
is(getSelectedIndex(gStore.getState()), selection,
is(getSelectedIndex(store.getState()), selection,
"The first item should be still selected after sorting.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should still be visible after sorting.");
is(getSortedRequests(gStore.getState()).length, order.length,
is(getSortedRequests(store.getState()).length, order.length,
"There should be a specific number of items in the requests menu.");
is(getDisplayedRequests(gStore.getState()).length, order.length,
is(getDisplayedRequests(store.getState()).length, order.length,
"There should be a specific number of visbile items in the requests menu.");
is(document.querySelectorAll(".request-list-item").length, order.length,
"The visible items in the requests menu are, in fact, visible!");
@ -155,8 +155,8 @@ add_task(function* () {
for (let i = 0, len = order.length / 5; i < len; i++) {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(order[i]),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(order[i]),
"GET1", SORTING_SJS + "?index=1", {
fuzzyUrl: true,
status: 101,
@ -171,8 +171,8 @@ add_task(function* () {
for (let i = 0, len = order.length / 5; i < len; i++) {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(order[i + len]),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(order[i + len]),
"GET2", SORTING_SJS + "?index=2", {
fuzzyUrl: true,
status: 200,
@ -187,8 +187,8 @@ add_task(function* () {
for (let i = 0, len = order.length / 5; i < len; i++) {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(order[i + len * 2]),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(order[i + len * 2]),
"GET3", SORTING_SJS + "?index=3", {
fuzzyUrl: true,
status: 300,
@ -203,8 +203,8 @@ add_task(function* () {
for (let i = 0, len = order.length / 5; i < len; i++) {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(order[i + len * 3]),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(order[i + len * 3]),
"GET4", SORTING_SJS + "?index=4", {
fuzzyUrl: true,
status: 400,
@ -219,8 +219,8 @@ add_task(function* () {
for (let i = 0, len = order.length / 5; i < len; i++) {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(order[i + len * 4]),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(order[i + len * 4]),
"GET5", SORTING_SJS + "?index=5", {
fuzzyUrl: true,
status: 500,

Просмотреть файл

@ -17,7 +17,7 @@ add_task(function* () {
// of the heavy dom manipulation associated with sorting.
requestLongerTimeout(2);
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
@ -25,7 +25,7 @@ add_task(function* () {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
// Loading the frame script and preparing the xhr request URLs so we can
// generate some requests later.
@ -54,9 +54,9 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
isnot(getSelectedRequest(gStore.getState()), undefined,
isnot(getSelectedRequest(store.getState()), undefined,
"There should be a selected item in the requests menu.");
is(getSelectedIndex(gStore.getState()), 0,
is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should be visible after toggle button was pressed.");
@ -222,24 +222,24 @@ add_task(function* () {
}
function testContents([a, b, c, d, e]) {
isnot(getSelectedRequest(gStore.getState()), undefined,
isnot(getSelectedRequest(store.getState()), undefined,
"There should still be a selected item after sorting.");
is(getSelectedIndex(gStore.getState()), a,
is(getSelectedIndex(store.getState()), a,
"The first item should be still selected after sorting.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should still be visible after sorting.");
is(getSortedRequests(gStore.getState()).length, 5,
is(getSortedRequests(store.getState()).length, 5,
"There should be a total of 5 items in the requests menu.");
is(getDisplayedRequests(gStore.getState()).length, 5,
is(getDisplayedRequests(store.getState()).length, 5,
"There should be a total of 5 visible items in the requests menu.");
is(document.querySelectorAll(".request-list-item").length, 5,
"The visible items in the requests menu are, in fact, visible!");
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(a),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(a),
"GET1", SORTING_SJS + "?index=1", {
fuzzyUrl: true,
status: 101,
@ -252,8 +252,8 @@ add_task(function* () {
});
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(b),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(b),
"GET2", SORTING_SJS + "?index=2", {
fuzzyUrl: true,
status: 200,
@ -266,8 +266,8 @@ add_task(function* () {
});
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(c),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(c),
"GET3", SORTING_SJS + "?index=3", {
fuzzyUrl: true,
status: 300,
@ -280,8 +280,8 @@ add_task(function* () {
});
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(d),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(d),
"GET4", SORTING_SJS + "?index=4", {
fuzzyUrl: true,
status: 400,
@ -294,8 +294,8 @@ add_task(function* () {
});
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(e),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(e),
"GET5", SORTING_SJS + "?index=5", {
fuzzyUrl: true,
status: 500,

Просмотреть файл

@ -12,14 +12,14 @@ add_task(function* () {
info("Starting test... ");
let panel = monitor.panelWin;
let { document, gStore, windowRequire } = panel;
let { document, store, windowRequire } = panel;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
ok(document.querySelector(".monitor-panel"),
"The current main panel is correct.");
info("Displaying statistics panel");
gStore.dispatch(Actions.openStatistics(true));
store.dispatch(Actions.openStatistics(true));
ok(document.querySelector(".statistics-panel"),
"The current main panel is correct.");

Просмотреть файл

@ -13,7 +13,7 @@ add_task(function* () {
info("Starting test... ");
let panel = monitor.panelWin;
let { document, gStore, windowRequire } = panel;
let { document, store, windowRequire } = panel;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
EventUtils.sendMouseEvent({ type: "click" },
@ -29,7 +29,7 @@ add_task(function* () {
testFilterButtonsCustom(monitor, [0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1]);
info("The correct filtering predicates are used before entering perf. analysis mode.");
gStore.dispatch(Actions.openStatistics(true));
store.dispatch(Actions.openStatistics(true));
ok(document.querySelector(".statistics-panel"),
"The main panel is switched to the statistics panel.");

Просмотреть файл

@ -14,14 +14,14 @@ add_task(function* () {
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let requestItems = [];
@ -114,13 +114,13 @@ add_task(function* () {
info("Verifying requests contain correct information.");
let index = 0;
for (let request of REQUEST_DATA) {
let item = getSortedRequests(gStore.getState()).get(index);
let item = getSortedRequests(store.getState()).get(index);
requestItems[index] = item;
info("Verifying request #" + index);
yield verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getDisplayedRequests(store.getState()),
item,
request.method,
request.uri,

Просмотреть файл

@ -12,14 +12,14 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
const REQUESTS = [
[ "hls-m3u8", /^#EXTM3U/ ],
@ -38,8 +38,8 @@ add_task(function* () {
REQUESTS.forEach(([ fmt ], i) => {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(i),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(i),
"GET",
CONTENT_TYPE_SJS + "?fmt=" + fmt,
{
@ -55,7 +55,7 @@ add_task(function* () {
document.querySelector("#response-tab"));
yield wait;
gStore.dispatch(Actions.selectRequest(null));
store.dispatch(Actions.selectRequest(null));
yield selectIndexAndWaitForSourceEditor(0);
// the hls-m3u8 part

Просмотреть файл

@ -14,11 +14,11 @@ function* throttleTest(actuallyThrottle) {
requestLongerTimeout(2);
let { monitor } = yield initNetMonitor(SIMPLE_URL);
let { gStore, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/src/constants");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
let { setPreferences, triggerActivity } =
windowRequire("devtools/client/netmonitor/src/connector/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
@ -39,20 +39,19 @@ function* throttleTest(actuallyThrottle) {
uploadBPSMax: 10000,
},
};
let client = NetMonitorController.webConsoleClient;
info("sending throttle request");
yield new Promise((resolve) => {
client.setPreferences(request, response => {
setPreferences(request, response => {
resolve(response);
});
});
let eventPromise = monitor.panelWin.once(EVENTS.RECEIVED_EVENT_TIMINGS);
yield NetMonitorController.triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_DISABLED);
yield triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_DISABLED);
yield eventPromise;
let requestItem = getSortedRequests(gStore.getState()).get(0);
let requestItem = getSortedRequests(store.getState()).get(0);
const reportedOneSecond = requestItem.eventTimings.timings.receive > 1000;
if (actuallyThrottle) {
ok(reportedOneSecond, "download reported as taking more than one second");

Просмотреть файл

@ -18,13 +18,13 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 2);
// Timeout needed for having enough divisions on the time scale.
@ -48,11 +48,11 @@ add_task(function* () {
secDivs.forEach(div => info(`Second division: ${div.textContent}`));
minDivs.forEach(div => info(`Minute division: ${div.textContent}`));
is(gStore.getState().requests.requests.size, 2,
is(store.getState().requests.requests.size, 2,
"There should be only two requests made.");
let firstRequest = getSortedRequests(gStore.getState()).get(0);
let lastRequest = getSortedRequests(gStore.getState()).get(1);
let firstRequest = getSortedRequests(store.getState()).get(0);
let lastRequest = getSortedRequests(store.getState()).get(1);
info("First request happened at: " +
firstRequest.responseHeaders.headers.find(e => e.name == "date").value);

Просмотреть файл

@ -19,7 +19,7 @@ function test() {
initNetMonitor(URL).then(({ tab, monitor }) => {
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
let {
@ -27,7 +27,7 @@ function test() {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
waitForNetworkEvents(monitor, 1)
.then(() => teardown(monitor))
@ -36,8 +36,8 @@ function test() {
monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_CONTENT, () => {
verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(0),
getDisplayedRequests(store.getState()),
getSortedRequests(store.getState()).get(0),
"GET", URL,
{
type: "plain",

Просмотреть файл

@ -167,22 +167,22 @@ function waitForTimelineMarkers(monitor) {
function waitForAllRequestsFinished(monitor) {
let window = monitor.panelWin;
let { windowRequire } = window;
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
let { getNetworkRequest } =
windowRequire("devtools/client/netmonitor/src/connector/index");
return new Promise(resolve => {
// Key is the request id, value is a boolean - is request finished or not?
let requests = new Map();
function onRequest(_, id) {
let networkInfo = NetMonitorController.webConsoleClient.getNetworkRequest(id);
let networkInfo = getNetworkRequest(id);
let { url } = networkInfo.request;
info(`Request ${id} for ${url} not yet done, keep waiting...`);
requests.set(id, false);
}
function onTimings(_, id) {
let networkInfo = NetMonitorController.webConsoleClient.getNetworkRequest(id);
let networkInfo = getNetworkRequest(id);
let { url } = networkInfo.request;
info(`Request ${id} for ${url} done`);
requests.set(id, true);
@ -226,7 +226,9 @@ function initNetMonitor(url, enableCache) {
if (!enableCache) {
let panel = monitor.panelWin;
let { gStore, windowRequire } = panel;
let { store, windowRequire } = panel;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
info("Disabling cache and reloading page.");
let requestsDone = waitForAllRequestsFinished(monitor);
let markersDone = waitForTimelineMarkers(monitor);
@ -240,8 +242,8 @@ function initNetMonitor(url, enableCache) {
info("Clearing requests in the console client.");
target.activeConsole.clearNetworkRequests();
info("Clearing requests in the UI.");
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
gStore.dispatch(Actions.clearRequests());
store.dispatch(Actions.clearRequests());
}
return {tab, monitor};
@ -279,8 +281,8 @@ function waitForNetworkEvents(monitor, getRequests, postRequests = 0) {
return new Promise((resolve) => {
let panel = monitor.panelWin;
let { windowRequire } = panel;
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
let { getNetworkRequest } =
windowRequire("devtools/client/netmonitor/src/connector/index");
let progress = {};
let genericEvents = 0;
let postEvents = 0;
@ -318,7 +320,7 @@ function waitForNetworkEvents(monitor, getRequests, postRequests = 0) {
}
function onGenericEvent(event, actor) {
let networkInfo = NetMonitorController.webConsoleClient.getNetworkRequest(actor);
let networkInfo = getNetworkRequest(actor);
if (!networkInfo) {
// Must have been related to reloading document to disable cache.
// Ignore the event.
@ -329,7 +331,7 @@ function waitForNetworkEvents(monitor, getRequests, postRequests = 0) {
}
function onPostEvent(event, actor) {
let networkInfo = NetMonitorController.webConsoleClient.getNetworkRequest(actor);
let networkInfo = getNetworkRequest(actor);
if (!networkInfo) {
// Must have been related to reloading document to disable cache.
// Ignore the event.

Просмотреть файл

@ -14,13 +14,13 @@ add_task(function* () {
let target = TargetFactory.forTab(tab);
let toolbox = yield gDevTools.showToolbox(target, "netmonitor");
let monitor = toolbox.getPanel("netmonitor");
let { gStore, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
info("Navigating to test page");
yield navigateTo(TEST_URL);
@ -33,7 +33,7 @@ add_task(function* () {
info("Checking Netmonitor contents.");
let items = [];
for (let item of getSortedRequests(gStore.getState())) {
for (let item of getSortedRequests(store.getState())) {
if (item.url.endsWith("doc_uncached.css")) {
items.push(item);
}

Просмотреть файл

@ -46,7 +46,7 @@ add_task(function* () {
let toolbox = yield gDevTools.showToolbox(target, "netmonitor");
info("Network panel is open.");
testNetmonitor(toolbox);
yield testNetmonitor(toolbox);
});
function loadDocument(browser) {
@ -60,18 +60,20 @@ function loadDocument(browser) {
return deferred.promise;
}
function testNetmonitor(toolbox) {
function* testNetmonitor(toolbox) {
let monitor = toolbox.getCurrentPanel();
let { gStore, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { getSortedRequests } = windowRequire("devtools/client/netmonitor/src/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
store.dispatch(Actions.batchEnable(false));
is(gStore.getState().requests.requests.size, 1, "Network request appears in the network panel");
yield waitUntil(() => store.getState().requests.requests.size > 0);
let item = getSortedRequests(gStore.getState()).get(0);
is(store.getState().requests.requests.size, 1, "Network request appears in the network panel");
let item = getSortedRequests(store.getState()).get(0);
is(item.method, "GET", "The attached method is correct.");
is(item.url, TEST_PATH, "The attached url is correct.");
}

Просмотреть файл

@ -23,13 +23,10 @@ add_task(function* () {
is(toolbox.currentToolId, "netmonitor", "Network panel was opened");
let panel = toolbox.getCurrentPanel();
let { gStore, windowRequire } = panel.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
let { store, windowRequire } = panel.panelWin;
let { getSelectedRequest } = windowRequire("devtools/client/netmonitor/src/selectors/index");
let selected = getSelectedRequest(gStore.getState());
let selected = getSelectedRequest(store.getState());
is(selected.method, request.request.method,
"The correct request is selected");
is(selected.url, request.request.url,

Просмотреть файл

@ -38,24 +38,24 @@ add_task(function* () {
is(toolbox.currentToolId, "netmonitor", "Network panel was opened");
let panel = toolbox.getCurrentPanel();
let { gStore, windowRequire } = panel.panelWin;
let { store, windowRequire } = panel.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { getSelectedRequest } = windowRequire("devtools/client/netmonitor/src/selectors/index");
let selected = getSelectedRequest(gStore.getState());
let selected = getSelectedRequest(store.getState());
is(selected.method, htmlRequest.request.method,
"The correct request is selected");
is(selected.url, htmlRequest.request.url,
"The correct request is definitely selected");
// Filter out the HTML request.
gStore.dispatch(Actions.toggleRequestFilterType("js"));
store.dispatch(Actions.toggleRequestFilterType("js"));
yield toolbox.selectTool("webconsole");
is(toolbox.currentToolId, "webconsole", "Web console was selected");
yield hud.ui.openNetworkPanel(htmlRequest.actor);
selected = getSelectedRequest(gStore.getState());
selected = getSelectedRequest(store.getState());
is(selected.method, htmlRequest.request.method,
"The correct request is selected");
is(selected.url, htmlRequest.request.url,

Просмотреть файл

@ -62,14 +62,14 @@ function loadDocument(browser) {
function* testNetmonitor(toolbox) {
let monitor = toolbox.getCurrentPanel();
let { gStore, windowRequire } = monitor.panelWin;
let { store, windowRequire } = monitor.panelWin;
let { getSortedRequests } = windowRequire("devtools/client/netmonitor/src/selectors/index");
yield waitUntil(() => gStore.getState().requests.requests.size > 0);
yield waitUntil(() => store.getState().requests.requests.size > 0);
is(gStore.getState().requests.requests.size, 1, "Network request appears in the network panel");
is(store.getState().requests.requests.size, 1, "Network request appears in the network panel");
let item = getSortedRequests(gStore.getState()).get(0);
let item = getSortedRequests(store.getState()).get(0);
is(item.method, "GET", "The request method is correct.");
is(item.url, TEST_PATH, "The request url is correct.");
}