Bug 1352699 - Fix mochitest failures r=Honza

MozReview-Commit-ID: 8rhAQw5oflC

--HG--
extra : rebase_source : 493e558a566548ca713c952b87c00575b5332e0d
This commit is contained in:
Ricky Chien 2017-04-05 22:59:57 +08:00
Родитель 83be5c2660
Коммит 50848b589c
9 изменённых файлов: 55 добавлений и 36 удалений

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

@ -14,25 +14,25 @@ add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, windowRequire, parent } = monitor.panelWin;
let { document, parent } = monitor.panelWin;
ok(!document.querySelector("#requests-list-status-button"),
"Status column should be hidden");
ok(!document.querySelector("#requests-list-contentSize-button"),
"Content size column should be hidden");
let { Prefs } = windowRequire("devtools/client/netmonitor/src/utils/prefs");
yield showColumn("status");
yield showColumn("contentSize");
ok(!Prefs.hiddenColumns.includes("status"), "Pref should be synced for status");
ok(!Prefs.hiddenColumns.includes("contentSize"),
"Pref should be synced for contentSize");
ok(!Services.prefs.getCharPref("devtools.netmonitor.hiddenColumns").includes("status"),
"Pref should be synced for status");
ok(!Services.prefs.getCharPref("devtools.netmonitor.hiddenColumns")
.includes("contentSize"), "Pref should be synced for contentSize");
yield hideColumn("status");
ok(Prefs.hiddenColumns.includes("status"), "Pref should be synced for status");
ok(Services.prefs.getCharPref("devtools.netmonitor.hiddenColumns").includes("status"),
"Pref should be synced for status");
yield showColumn("status");

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

@ -11,9 +11,10 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
info("Starting test... ");
let { document, gStore, windowRequire, NetMonitorController } =
monitor.panelWin;
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
let {
ACTIVITY_TYPE,
EVENTS,

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

@ -13,8 +13,10 @@ add_task(function* test() {
let { tab, monitor } = yield initNetMonitor(IMAGE_TOOLTIP_URL);
info("Starting test... ");
let { document, gStore, windowRequire, NetMonitorController } = monitor.panelWin;
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
let {
ACTIVITY_TYPE,
EVENTS,

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

@ -13,6 +13,8 @@ add_task(function* () {
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();
@ -60,11 +62,11 @@ add_task(function* () {
removeTab(tab);
yield onDestroyed;
ok(!monitor.panelWin.NetMonitorController.client,
ok(!NetMonitorController.client,
"There shouldn't be a client available after destruction.");
ok(!monitor.panelWin.NetMonitorController.tabClient,
ok(!NetMonitorController.tabClient,
"There shouldn't be a tabClient available after destruction.");
ok(!monitor.panelWin.NetMonitorController.webConsoleClient,
ok(!NetMonitorController.webConsoleClient,
"There shouldn't be a webConsoleClient available after destruction.");
}
});

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

@ -11,8 +11,10 @@ add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_SJS);
info("Starting test... ");
let { gStore, windowRequire, NetMonitorController } = monitor.panelWin;
let { gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");

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

@ -16,52 +16,56 @@ function test() {
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(monitor.panelWin.NetMonitorController,
ok(NetMonitorController,
`The network monitor controller object exists (${tag}).`);
ok(monitor.panelWin.NetMonitorController._startup,
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(monitor.panelWin.NetMonitorController.tabClient,
ok(NetMonitorController.tabClient,
`There should be a tabClient available at this point (${tag}).`);
ok(monitor.panelWin.NetMonitorController.webConsoleClient,
ok(NetMonitorController.webConsoleClient,
`There should be a webConsoleClient available at this point (${tag}).`);
ok(monitor.panelWin.NetMonitorController.timelineFront,
ok(NetMonitorController.timelineFront,
`There should be a timelineFront available at this point (${tag}).`);
}
function checkIfDestroyed(tag) {
gInfo("Checking if destruction is ok.");
gOk(monitor.panelWin.NetMonitorController,
gOk(NetMonitorController,
`The network monitor controller object still exists (${tag}).`);
gOk(monitor.panelWin.NetMonitorController._shutdown,
gOk(NetMonitorController._shutdown,
`The network monitor controller object still exists and is destroyed (${tag}).`);
gOk(!monitor.panelWin.NetMonitorController.tabClient,
gOk(!NetMonitorController.tabClient,
`There shouldn't be a tabClient available after destruction (${tag}).`);
gOk(!monitor.panelWin.NetMonitorController.webConsoleClient,
gOk(!NetMonitorController.webConsoleClient,
`There shouldn't be a webConsoleClient available after destruction (${tag}).`);
gOk(!monitor.panelWin.NetMonitorController.timelineFront,
gOk(!NetMonitorController.timelineFront,
`There shouldn't be a timelineFront available after destruction (${tag}).`);
}
executeSoon(() => {
checkIfInitialized(1);
monitor.panelWin.NetMonitorController.startupNetMonitor()
NetMonitorController.startupNetMonitor()
.then(() => {
info("Starting up again shouldn't do anything special.");
checkIfInitialized(2);
return monitor.panelWin.NetMonitorController.connect();
return NetMonitorController.connect();
})
.then(() => {
info("Connecting again shouldn't do anything special.");
@ -74,11 +78,11 @@ function test() {
registerCleanupFunction(() => {
checkIfDestroyed(1);
monitor.panelWin.NetMonitorController.shutdownNetMonitor()
NetMonitorController.shutdownNetMonitor()
.then(() => {
gInfo("Shutting down again shouldn't do anything special.");
checkIfDestroyed(2);
return monitor.panelWin.NetMonitorController.disconnect();
return NetMonitorController.disconnect();
})
.then(() => {
gInfo("Disconnecting again shouldn't do anything special.");

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

@ -14,9 +14,11 @@ function* throttleTest(actuallyThrottle) {
requestLongerTimeout(2);
let { monitor } = yield initNetMonitor(SIMPLE_URL);
let { gStore, windowRequire, NetMonitorController } = monitor.panelWin;
let { gStore, 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 {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");

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

@ -181,6 +181,9 @@ function teardown(monitor) {
function waitForNetworkEvents(monitor, getRequests, postRequests = 0) {
let deferred = promise.defer();
let panel = monitor.panelWin;
let { windowRequire } = panel;
let { NetMonitorController } =
windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
let progress = {};
let genericEvents = 0;
let postEvents = 0;
@ -233,8 +236,7 @@ function waitForNetworkEvents(monitor, getRequests, postRequests = 0) {
postEvents + "/" + (postRequests * 2) + ", " +
"got " + event + " for " + actor);
let networkInfo =
panel.NetMonitorController.webConsoleClient.getNetworkRequest(actor);
let networkInfo = NetMonitorController.webConsoleClient.getNetworkRequest(actor);
let url = networkInfo.request.url;
updateProgressForURL(url, event);

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

@ -1346,13 +1346,13 @@ date-now@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"
debug@2.6.1:
debug@2.6.1, debug@^2.1.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.1.tgz#79855090ba2c4e3115cc7d8769491d58f0491351"
dependencies:
ms "0.7.2"
debug@2.6.3, debug@^2.1.1, debug@^2.2.0:
debug@2.6.3, debug@^2.2.0:
version "2.6.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d"
dependencies:
@ -3807,7 +3807,7 @@ read-pkg@^1.0.0:
normalize-package-data "^2.3.2"
path-type "^1.0.0"
readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.1.4, readable-stream@^2.2.2, readable-stream@^2.2.6:
readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.1.4, readable-stream@^2.2.2, readable-stream@^2.2.6:
version "2.2.7"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.7.tgz#07057acbe2467b22042d36f98c5ad507054e95b1"
dependencies:
@ -3819,7 +3819,7 @@ readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.
string_decoder "~1.0.0"
util-deprecate "~1.0.1"
readable-stream@~2.0.6:
readable-stream@^2.0.1, readable-stream@^2.0.5, readable-stream@~2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e"
dependencies:
@ -4757,10 +4757,14 @@ window-size@0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
wordwrap@0.0.2, wordwrap@~0.0.2:
wordwrap@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
wordwrap@~0.0.2:
version "0.0.3"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
wordwrap@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"