diff options
Diffstat (limited to 'devtools/client/webconsole/test/browser/browser_webconsole_file_uri.js')
-rw-r--r-- | devtools/client/webconsole/test/browser/browser_webconsole_file_uri.js | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_file_uri.js b/devtools/client/webconsole/test/browser/browser_webconsole_file_uri.js new file mode 100644 index 0000000000..668cfe925b --- /dev/null +++ b/devtools/client/webconsole/test/browser/browser_webconsole_file_uri.js @@ -0,0 +1,77 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// XXX Remove this when the file is migrated to the new frontend. +/* eslint-disable no-undef */ + +// See Bug 595223. + +const PREF = "devtools.webconsole.persistlog"; +const TEST_FILE = "test-network.html"; + +var hud; + +add_task(async function () { + Services.prefs.setBoolPref(PREF, true); + + const jar = getJar(getRootDirectory(gTestPath)); + const dir = jar + ? extractJarToTmp(jar) + : getChromeDir(getResolvedURI(gTestPath)); + + dir.append(TEST_FILE); + const uri = Services.io.newFileURI(dir); + + // Open tab with correct remote type so we don't switch processes when we load + // the file:// URI, otherwise we won't get the same web console. + const remoteType = E10SUtils.getRemoteTypeForURI( + uri.spec, + gMultiProcessBrowser, + gFissionBrowser + ); + await loadTab("about:blank", remoteType); + + hud = await openConsole(); + await clearOutput(hud); + + await navigateTo(uri.spec); + + await testMessages(); + + Services.prefs.clearUserPref(PREF); + hud = null; +}); + +function testMessages() { + return waitForMessagesByType({ + webconsole: hud, + messages: [ + { + text: "running network console logging tests", + typeSelector: ".console-api", + category: CATEGORY_WEBDEV, + severity: SEVERITY_LOG, + }, + { + text: "test-network.html", + typeSelector: ".network", + category: CATEGORY_NETWORK, + severity: SEVERITY_LOG, + }, + { + text: "test-image.png", + typeSelector: ".network", + category: CATEGORY_NETWORK, + severity: SEVERITY_LOG, + }, + { + text: "testscript.js", + typeSelector: ".network", + category: CATEGORY_NETWORK, + severity: SEVERITY_LOG, + }, + ], + }); +} |