Bug 1404877 - Migrate browser_webconsole_bug_658368_time_methods.js to the new frontend. r=nchevobbe

MozReview-Commit-ID: 3Z6097zECDn

--HG--
rename : devtools/client/webconsole/new-console-output/test/mochitest/test-bug-658368-time-methods.html => devtools/client/webconsole/new-console-output/test/mochitest/test-time-methods.html
extra : rebase_source : 5ad9c572ac391bafdc01605801cfb6928f5d87ef
This commit is contained in:
sole 2018-02-16 14:25:09 +00:00
Родитель 5f5467402a
Коммит a7c710f1f8
3 изменённых файлов: 40 добавлений и 40 удалений

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

@ -30,7 +30,6 @@ support-files =
test-bug-630733-response-redirect-headers.sjs
test-bug-632275-getters.html
test-bug-646025-console-file-location.html
test-bug-658368-time-methods.html
test-bug-766001-console-log.js
test-bug-766001-js-console-links.html
test-bug-766001-js-errors.js
@ -153,6 +152,7 @@ support-files =
test-subresource-security-error.html
test-subresource-security-error.js
test-subresource-security-error.js^headers^
test-time-methods.html
test-trackingprotection-securityerrors.html
test-webconsole-error-observer.html
test-websocket.html
@ -351,7 +351,6 @@ subsuite = clipboard
[browser_webconsole_strict_mode_errors.js]
[browser_webconsole_string.js]
[browser_webconsole_time_methods.js]
skip-if = true # Bug 1404877
[browser_webconsole_timestamps.js]
[browser_webconsole_trackingprotection_errors.js]
tags = trackingprotection

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

@ -3,65 +3,66 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the Console API implements the time() and timeEnd() methods. See Bug 658368.
// Tests that the Console API implements the time() and timeEnd() methods.
"use strict";
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
"test/test-bug-658368-time-methods.html";
"new-console-output/test/mochitest/test-time-methods.html";
const TEST_URI2 = "data:text/html;charset=utf-8,<script>" +
"console.timeEnd('bTimer');</script>";
const TEST_URI3 = "data:text/html;charset=utf-8,<script>" +
"console.time('bTimer');</script>";
"console.time('bTimer');console.log('smoke signal');</script>";
const TEST_URI4 = "data:text/html;charset=utf-8," +
"<script>console.timeEnd('bTimer');</script>";
add_task(function* () {
yield loadTab(TEST_URI);
add_task(async function () {
// Calling console.time('aTimer') followed by console.timeEnd('aTimer')
// should result in the aTimer being ended, and a message like aTimer: 123ms
// printed to the console
let hud1 = await openNewTabAndConsole(TEST_URI);
let hud1 = yield openConsole();
let aTimerCompleted = await waitFor(() => findMessage(hud1, "aTimer: "));
ok(aTimerCompleted, "Calling console.time('a') and console.timeEnd('a')"
+ "ends the 'a' timer");
yield waitForMessages({
webconsole: hud1,
messages: [{
name: "aTimer started",
consoleTime: "aTimer",
}, {
name: "aTimer end",
consoleTimeEnd: "aTimer",
}],
});
// Calling console.time('bTimer') in the current tab, opening a new tab
// and calling console.timeEnd('bTimer') in the new tab should not result in
// the bTimer in the initial tab being ended, but rather a warning message
// output to the console: Timer "bTimer" doesn't exist
let hud2 = await openNewTabAndConsole(TEST_URI2);
// The next test makes sure that timers with the same name but in separate
// tabs, do not contain the same value.
let { browser } = yield loadTab(TEST_URI2);
let hud2 = yield openConsole();
let error1 = await waitFor(() => findMessage(hud2, "bTimer", ".message.timeEnd.warn"));
ok(error1, "Timers with the same name but in separate tabs do not contain "
+ "the same value");
testLogEntry(hud2.outputNode, "bTimer: timer started",
"bTimer was not started", false, true);
// The next tests make sure that timers with the same name but in separate
// pages do not contain the same value.
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI3);
// The next test makes sure that timers with the same name but in separate
// pages, do not contain the same value.
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI3);
// The new console front-end does not display a message when timers are started,
// so there should not be a 'bTimer started' message on the output
yield waitForMessages({
webconsole: hud2,
messages: [{
name: "bTimer started",
consoleTime: "bTimer",
}],
});
// We use this await to 'sync' until the message appears, as the console API
// guarantees us that the smoke signal will be printed after the message for
// console.time("bTimer") (if there were any)
await waitFor(() => findMessage(hud2, "smoke signal"));
is(findMessage(hud2, "bTimer started"), null, "No message is printed to "
+ "the console when the timer starts");
hud2.jsterm.clearOutput();
// Now the following console.timeEnd() call shouldn't display anything,
// if the timers in different pages are not related.
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI4);
yield loadBrowser(browser);
// Calling console.time('bTimer') on a page, then navigating to another page
// and calling console.timeEnd('bTimer') on the new console front-end should
// result on a warning message: 'Timer "bTimer" does not exist',
// as the timers in different pages are not related
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI4);
testLogEntry(hud2.outputNode, "bTimer: timer started",
"bTimer was not started", false, true);
let error2 = await waitFor(() => findMessage(hud2, "bTimer", ".message.timeEnd.warn"));
ok(error2, "Timers with the same name but in separate pages do not contain "
+ "the same value");
});