Bug 1349173 - Fix mochitest failures r=Honza

MozReview-Commit-ID: Gk9q0Y9GqSs

--HG--
extra : rebase_source : dd1a3a30f98c91ee534301eac37b724dc217f136
This commit is contained in:
Ricky Chien 2017-04-24 11:50:40 +08:00
Родитель ee77eda75c
Коммит 8092f83867
4 изменённых файлов: 29 добавлений и 5 удалений

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

@ -71,7 +71,7 @@ add_task(function* test() {
* with the expected content.
*/
function* showTooltipAndVerify(target) {
let anchor = target.querySelector(".requests-list-file");
let anchor = target.querySelector(".requests-list-icon");
yield showTooltipOn(anchor);
info("Tooltip was successfully opened for the image request.");

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

@ -25,7 +25,7 @@ add_task(function* () {
yield performRequests();
for (let subitemNode of Array.from(document.querySelectorAll(
"requests-list-subitem.requests-list-security-and-domain"))) {
"requests-list-column.requests-list-security-and-domain"))) {
let domain = subitemNode.querySelector(".requests-list-domain").textContent;
info("Found a request to " + domain);

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

@ -8,6 +8,13 @@
*/
add_task(function* () {
// Hide file, protocol, remoteip columns to make sure timing division
// can render properly
Services.prefs.setCharPref(
"devtools.netmonitor.hiddenColumns",
"[\"file\",\"protocol\",\"remoteip\"]"
);
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test... ");

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

@ -86,6 +86,9 @@ Services.prefs.setBoolPref("devtools.debugger.log", false);
// Always reset some prefs to their original values after the test finishes.
const gDefaultFilters = Services.prefs.getCharPref("devtools.netmonitor.filters");
// Reveal all hidden columns for test
Services.prefs.setCharPref("devtools.netmonitor.hiddenColumns", "[]");
registerCleanupFunction(() => {
info("finish() was called, cleaning up...");
@ -374,7 +377,8 @@ function verifyRequestItemTarget(document, requestList, requestItem, method,
let name = getUrlBaseName(url);
let query = getUrlQuery(url);
let hostPort = getUrlHost(url);
let remoteAddress = requestItem.remoteAddress;
let { httpVersion = "", remoteAddress, remotePort } = requestItem;
let remoteIP = remoteAddress ? `${remoteAddress}:${remotePort}` : "unknown";
if (fuzzyUrl) {
ok(requestItem.method.startsWith(method), "The attached method is correct.");
@ -400,6 +404,12 @@ function verifyRequestItemTarget(document, requestList, requestItem, method,
unicodeUrl, "The tooltip file is correct.");
}
is(target.querySelector(".requests-list-protocol").textContent,
httpVersion, "The displayed protocol is correct.");
is(target.querySelector(".requests-list-protocol").getAttribute("title"),
httpVersion, "The tooltip protocol is correct.");
is(target.querySelector(".requests-list-domain").textContent,
hostPort, "The displayed domain is correct.");
@ -407,6 +417,12 @@ function verifyRequestItemTarget(document, requestList, requestItem, method,
is(target.querySelector(".requests-list-domain").getAttribute("title"),
domainTooltip, "The tooltip domain is correct.");
is(target.querySelector(".requests-list-remoteip").textContent,
remoteIP, "The displayed remote IP is correct.");
is(target.querySelector(".requests-list-remoteip").getAttribute("title"),
remoteIP, "The tooltip remote IP is correct.");
if (status !== undefined) {
let value = target.querySelector(".requests-list-status-icon")
.getAttribute("data-code");
@ -421,12 +437,13 @@ function verifyRequestItemTarget(document, requestList, requestItem, method,
is(tooltip, status + " " + statusText, "The tooltip status is correct.");
}
if (cause !== undefined) {
let value = target.querySelector(".requests-list-cause > .subitem-label").textContent;
let value = Array.from(target.querySelector(".requests-list-cause").childNodes)
.filter((node) => node.nodeType === Node.TEXT_NODE)[0].textContent;
let tooltip = target.querySelector(".requests-list-cause").getAttribute("title");
info("Displayed cause: " + value);
info("Tooltip cause: " + tooltip);
is(value, cause.type, "The displayed cause is correct.");
is(tooltip, cause.loadingDocumentUri, "The tooltip cause is correct.");
is(tooltip, cause.type, "The tooltip cause is correct.");
}
if (type !== undefined) {
let value = target.querySelector(".requests-list-type").textContent;