mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-27 13:40:37 -10:00
- mochitest folder is renamed browser. - unit folder is rename xpcshell. - all the file and folder for mocha are put in a node folder. We take this as an opportunity to revist our stub-generating mochitests. Previously we had 2 tests for each kind of stubs, one for check, the other one for updating. It was not ideal when you wanted to update all the stubs at once because you add either to mention every 5 files, or unskip the update test files. We now merge the update and the check files in a single test. By default, the test that the stubs are up to date, and if you pass the --setenv WEBCONSOLE_STUBS_UPDATE=true param, it will update the stubs. This allow us to move the function that actually generate the stub in the test file, and have a helper file for multi-purpose functions. Because these tests are failing on TRY, let's disabled them so we can land the test re-organization (we'll re-enable them in Bug 1572667). Differential Revision: https://phabricator.services.mozilla.com/D41344
51 lines
1.8 KiB
JavaScript
51 lines
1.8 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
// Check that clearing the browser console output also clears the console cache.
|
|
|
|
"use strict";
|
|
|
|
const TEST_URI = "data:text/html;charset=utf8,Test browser console clear cache";
|
|
|
|
add_task(async function() {
|
|
await pushPref("devtools.browserconsole.contentMessages", true);
|
|
await addTab(TEST_URI);
|
|
let hud = await BrowserConsoleManager.toggleBrowserConsole();
|
|
const CACHED_MESSAGE = "CACHED_MESSAGE";
|
|
await logTextToConsole(hud, CACHED_MESSAGE);
|
|
|
|
info("Click the clear output button");
|
|
const onBrowserConsoleOutputCleared = waitFor(
|
|
() => !findMessage(hud, CACHED_MESSAGE)
|
|
);
|
|
hud.ui.window.document.querySelector(".devtools-clear-icon").click();
|
|
await onBrowserConsoleOutputCleared;
|
|
|
|
// Check that there are no other messages logged (see Bug 1457478).
|
|
// Log a message to make sure the console handled any prior log.
|
|
await logTextToConsole(hud, "after clear");
|
|
const messages = hud.ui.outputNode.querySelectorAll(".message");
|
|
is(messages.length, 1, "There is only the new message in the output");
|
|
|
|
info("Close and re-open the browser console");
|
|
await BrowserConsoleManager.toggleBrowserConsole();
|
|
hud = await BrowserConsoleManager.toggleBrowserConsole();
|
|
|
|
info("Log a smoke message in order to know that the console is ready");
|
|
await logTextToConsole(hud, "Smoke message");
|
|
is(
|
|
findMessage(hud, CACHED_MESSAGE),
|
|
null,
|
|
"The cached message is not visible anymore"
|
|
);
|
|
});
|
|
|
|
function logTextToConsole(hud, text) {
|
|
const onMessage = waitForMessage(hud, text);
|
|
ContentTask.spawn(gBrowser.selectedBrowser, text, function(str) {
|
|
content.wrappedJSObject.console.log(str);
|
|
});
|
|
return onMessage;
|
|
}
|