--- a/devtools/client/commandline/test/browser.ini
+++ b/devtools/client/commandline/test/browser.ini
@@ -2,100 +2,35 @@
skip-if = e10s # Bug 1034511
tags = devtools
subsuite = devtools
support-files =
head.js
helpers.js
mockCommands.js
-[browser_cmd_addon.js]
[browser_cmd_calllog.js]
skip-if = true # Bug 845831
[browser_cmd_calllog_chrome.js]
skip-if = true # Bug 845831
-[browser_cmd_appcache_invalid.js]
-support-files =
- browser_cmd_appcache_invalid_appcache.appcache
- browser_cmd_appcache_invalid_appcache.appcache^headers^
- browser_cmd_appcache_invalid_index.html
- browser_cmd_appcache_invalid_page1.html
- browser_cmd_appcache_invalid_page2.html
- browser_cmd_appcache_invalid_page3.html
- browser_cmd_appcache_invalid_page3.html^headers^
-[browser_cmd_appcache_valid.js]
-skip-if = !e10s
-support-files =
- browser_cmd_appcache_valid_appcache.appcache
- browser_cmd_appcache_valid_appcache.appcache^headers^
- browser_cmd_appcache_valid_index_relative_manifest.html
- browser_cmd_appcache_valid_index_root_relative_manifest.html
- browser_cmd_appcache_valid_index_absolute_manifest.html
- browser_cmd_appcache_valid_page1.html
- browser_cmd_appcache_valid_page2.html
- browser_cmd_appcache_valid_page3.html
-[browser_cmd_commands.js]
[browser_cmd_cookie.js]
support-files =
browser_cmd_cookie.html
[browser_cmd_cookie_host.js]
support-files =
browser_cmd_cookie.html
-[browser_cmd_csscoverage_oneshot.js]
-support-files =
- browser_cmd_csscoverage_page1.html
- browser_cmd_csscoverage_page2.html
- browser_cmd_csscoverage_page3.html
- browser_cmd_csscoverage_sheetA.css
- browser_cmd_csscoverage_sheetB.css
- browser_cmd_csscoverage_sheetC.css
- browser_cmd_csscoverage_sheetD.css
-[browser_cmd_csscoverage_startstop.js]
-support-files =
- browser_cmd_csscoverage_page1.html
- browser_cmd_csscoverage_page2.html
- browser_cmd_csscoverage_page3.html
- browser_cmd_csscoverage_sheetA.css
- browser_cmd_csscoverage_sheetB.css
- browser_cmd_csscoverage_sheetC.css
- browser_cmd_csscoverage_sheetD.css
[browser_cmd_folder.js]
skip-if = (e10s && debug) # Bug 1034511 (docShell leaks on debug)
-[browser_cmd_highlight_01.js]
-[browser_cmd_highlight_02.js]
-[browser_cmd_highlight_03.js]
-[browser_cmd_highlight_04.js]
[browser_cmd_inject.js]
support-files =
browser_cmd_inject.html
[browser_cmd_csscoverage_util.js]
skip-if = (e10s && debug) # Bug 1034511 (docShell leaks on debug)
-[browser_cmd_jsb.js]
-support-files =
- browser_cmd_jsb_script.jsi
-[browser_cmd_listen.js]
-[browser_cmd_measure.js]
-[browser_cmd_media.js]
-support-files =
- browser_cmd_media.html
-[browser_cmd_pagemod_export.js]
-support-files =
- browser_cmd_pagemod_export.html
-[browser_cmd_paintflashing.js]
-[browser_cmd_pref1.js]
-[browser_cmd_pref2.js]
-[browser_cmd_pref3.js]
[browser_cmd_qsa.js]
[browser_cmd_restart.js]
-[browser_cmd_rulers.js]
-[browser_cmd_screenshot.js]
-subsuite = clipboard
-skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts
-support-files =
- browser_cmd_screenshot.html
[browser_cmd_settings.js]
[browser_gcli_async.js]
[browser_gcli_canon.js]
[browser_gcli_cli1.js]
[browser_gcli_cli2.js]
[browser_gcli_completion1.js]
[browser_gcli_completion2.js]
[browser_gcli_date.js]
@@ -116,15 +51,13 @@ skip-if = true # Bug 1093205 - Test does
[browser_gcli_keyboard4.js]
[browser_gcli_keyboard5.js]
[browser_gcli_menu.js]
[browser_gcli_node.js]
[browser_gcli_resource.js]
[browser_gcli_short.js]
[browser_gcli_spell.js]
[browser_gcli_split.js]
-[browser_gcli_telemetry.js]
-skip-if = true # Disabling: Monkeypatches telemetry and GCLI is soon to be removed.
[browser_gcli_tokenize.js]
[browser_gcli_tooltip.js]
skip-if = true # Bug 1093205 - Test does not run in Firefox due to missing terminal
[browser_gcli_types.js]
[browser_gcli_union.js]
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_addon.js
+++ /dev/null
@@ -1,199 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the addon commands works as they should
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab("about:blank");
- yield helpers.openToolbar(options);
-
- yield helpers.audit(options, [
- {
- setup: "addon list dictionary",
- check: {
- input: "addon list dictionary",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "There are no add-ons of that type installed."
- }
- },
- {
- setup: "addon list extension",
- check: {
- input: "addon list extension",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: [/The following/, /Mochitest/, /Special Powers/],
- notinoutput: [
- /Web Compat/, /Pocket/, /Multi-process staged rollout/,
- /Form Autofill/, /Application Update Service Helper/,
- /Shield Recipe Client/]
- }
- },
- {
- setup: "addon list locale",
- check: {
- input: "addon list locale",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "There are no add-ons of that type installed."
- }
- },
- {
- setup: "addon list plugin",
- check: {
- input: "addon list plugin",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: [/Test Plug-in/, /Second Test Plug-in/]
- }
- },
- {
- setup: "addon list theme",
- check: {
- input: "addon list theme",
- hints: "",
- markup: "VVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: [/following themes/, /Default/]
- }
- },
- {
- setup: "addon list all",
- check: {
- input: "addon list all",
- hints: "",
- markup: "VVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: [/The following/, /Default/, /Mochitest/, /Test Plug-in/,
- /Second Test Plug-in/, /Special Powers/]
- }
- },
- {
- setup: "addon disable Test_Plug-in_1.0.0.0",
- check: {
- input: "addon disable Test_Plug-in_1.0.0.0",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "Test Plug-in 1.0.0.0 disabled."
- }
- },
- {
- setup: "addon disable WRONG",
- check: {
- input: "addon disable WRONG",
- hints: "",
- markup: "VVVVVVVVVVVVVVEEEEE",
- status: "ERROR"
- }
- },
- {
- setup: "addon enable Test_Plug-in_1.0.0.0",
- check: {
- input: "addon enable Test_Plug-in_1.0.0.0",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {
- command: { name: "addon enable" },
- addon: {
- value: function (addon) {
- is(addon.name, "Test Plug-in", "test plugin name");
- },
- status: "VALID"
- }
- }
- },
- exec: {
- output: "Test Plug-in 1.0.0.0 enabled."
- }
- },
- {
- setup: "addon ctp Test_Plug-in_1.0.0.0",
- check: {
- input: "addon ctp Test_Plug-in_1.0.0.0",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {
- command: { name: "addon ctp" },
- addon: {
- value: function (addon) {
- is(addon.name, "Test Plug-in", "test plugin name");
- },
- status: "VALID"
- }
- }
- },
- exec: {
- output: "Test Plug-in 1.0.0.0 set to click-to-play."
- }
- },
- {
- setup: "addon ctp OpenH264_Video_Codec_provided_by_Cisco_Systems,_Inc._null",
- check: {
- input: "addon ctp OpenH264_Video_Codec_provided_by_Cisco_Systems,_Inc._null",
- hints: "",
- status: "VALID",
- args: {
- command: { name: "addon ctp" },
- addon: {
- value: function (addon) {
- is(addon.name, "OpenH264 Video Codec provided by Cisco Systems, Inc.", "openh264");
- },
- status: "VALID"
- }
- }
- },
- exec: {
- output: "OpenH264 Video Codec provided by Cisco Systems, Inc. null cannot be set to click-to-play."
- }
- },
- {
- setup: "addon ctp Mochitest_1.0",
- check: {
- input: "addon ctp Mochitest_1.0",
- hints: "",
- status: "VALID",
- args: {
- command: { name: "addon ctp" },
- addon: {
- value: function (addon) {
- is(addon.name, "Mochitest", "mochitest");
- },
- status: "VALID"
- }
- }
- },
- exec: {
- output: "Mochitest 1.0 cannot be set to click-to-play because it is not a plugin."
- }
- }
- ]);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_invalid.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-// Tests that the appcache validate works as they should with an invalid
-// manifest.
-
-const TEST_URI = "https://sub1.test1.example.com/browser/devtools/client/commandline/" +
- "test/browser_cmd_appcache_invalid_index.html";
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let lines = [
- "Manifest has a character encoding of ISO-8859-1. Manifests must have the " +
- "utf-8 character encoding.",
- "The first line of the manifest must be \u201cCACHE MANIFEST\u201d at line 1.",
- "\u201cCACHE MANIFEST\u201d is only valid on the first line but was found at line 3.",
- "images/sound-icon.png points to a resource that is not available at line 9.",
- "images/background.png points to a resource that is not available at line 10.",
- "/checking.cgi points to a resource that is not available at line 13.",
- "Asterisk (*) incorrectly used in the NETWORK section at line 14. If a line " +
- "in the NETWORK section contains only a single asterisk character, then any " +
- "URI not listed in the manifest will be treated as if the URI was listed in " +
- "the NETWORK section. Otherwise such URIs will be treated as unavailable. " +
- "Other uses of the * character are prohibited",
- "../rel.html points to a resource that is not available at line 17.",
- "../../rel.html points to a resource that is not available at line 18.",
- "../../../rel.html points to a resource that is not available at line 19.",
- "../../../../rel.html points to a resource that is not available at line 20.",
- "../../../../../rel.html points to a resource that is not available at line 21.",
- "/../ is not a valid URI prefix at line 22.",
- "/test.css points to a resource that is not available at line 23.",
- "/test.js points to a resource that is not available at line 24.",
- "test.png points to a resource that is not available at line 25.",
- "/main/features.js points to a resource that is not available at line 27.",
- "/main/settings/index.css points to a resource that is not available at line 28.",
- "https://example.com/scene.jpg points to a resource that is not available at line 29.",
- "/section1/blockedbyfallback.html points to a resource that is not available at line 30.",
- "https://example.com/images/world.jpg points to a resource that is not available at line 31.",
- "/section2/blockedbyfallback.html points to a resource that is not available at line 32.",
- "/main/home points to a resource that is not available at line 34.",
- "main/app.js points to a resource that is not available at line 35.",
- "/settings/home points to a resource that is not available at line 37.",
- "/settings/app.js points to a resource that is not available at line 38.",
- "The file https://sub1.test1.example.com/browser/devtools/client/" +
- "commandline/test/browser_cmd_appcache_invalid_page3.html was modified " +
- "after https://sub1.test1.example.com/browser/devtools/client/" +
- "commandline/test/browser_cmd_appcache_invalid_appcache.appcache. Unless " +
- "the text in the manifest file is changed the cached version will be used " +
- "instead at line 39.",
- "browser_cmd_appcache_invalid_page3.html has cache-control set to no-store. " +
- "This will prevent the application cache from storing the file at line 39.",
- "https://example.com/logo.png points to a resource that is not available at line 40.",
- "https://example.com/check.png points to a resource that is not available at line 41.",
- "Spaces in URIs need to be replaced with %20 at line 42.",
- "https://example.com/cr oss.png points to a resource that is not available at line 42.",
- "Asterisk (*) incorrectly used in the CACHE section at line 43. If a line " +
- "in the NETWORK section contains only a single asterisk character, then " +
- "any URI not listed in the manifest will be treated as if the URI was " +
- "listed in the NETWORK section. Otherwise such URIs will be treated as " +
- "unavailable. Other uses of the * character are prohibited",
- "The SETTINGS section may only contain a single value, \u201cprefer-online\u201d or \u201cfast\u201d at line 47.",
- "FALLBACK section line 50 (/section1/ /offline1.html) prevents caching of " +
- "line 30 (/section1/blockedbyfallback.html) in the CACHE section.",
- "/offline1.html points to a resource that is not available at line 50.",
- "FALLBACK section line 51 (/section2/ offline2.html) prevents caching of " +
- "line 32 (/section2/blockedbyfallback.html) in the CACHE section.",
- "offline2.html points to a resource that is not available at line 51.",
- "Only two URIs separated by spaces are allowed in the FALLBACK section at line 52.",
- "Asterisk (*) incorrectly used in the FALLBACK section at line 53. URIs " +
- "in the FALLBACK section simply need to match a prefix of the request URI.",
- "offline3.html points to a resource that is not available at line 53.",
- "Invalid section name (BLAH) at line 55.",
- "Only two URIs separated by spaces are allowed in the FALLBACK section at line 55."
- ];
-
- let options = yield helpers.openTab(TEST_URI);
- info("window open");
-
- // Wait for site to be cached.
- yield helpers.listenOnce(gBrowser.contentWindow.applicationCache, "error");
- info("applicationCache error happened");
-
- yield helpers.openToolbar(options);
- info("toolbar open");
-
- // Pages containing an appcache the notification bar gives options to allow
- // or deny permission for the app to save data offline. Let's click Allow.
- let notificationID = "offline-app-requested-sub1.test1.example.com";
- let notification =
- PopupNotifications.getNotification(notificationID, gBrowser.selectedBrowser);
-
- if (notification) {
- info("Authorizing offline storage.");
- notification.mainAction.callback();
- } else {
- info("No notification box is available.");
- }
-
- info("Site now cached, running tests.");
- yield helpers.audit(options, [
- {
- setup: "appcache validate",
- check: {
- input: "appcache validate",
- markup: "VVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {}
- },
- exec: {
- output: lines.map(getRegexForString)
- },
- },
- ]);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
-
-/**
- * Creates a regular expression that matches a string. This greatly simplifies
- * matching and debugging long strings.
- *
- * @param {String} text
- * Text to convert
- * @return {RegExp}
- * Regular expression matching text
- */
-function getRegexForString(str) {
- str = str.replace(/(\.|\\|\/|\(|\)|\[|\]|\*|\+|\?|\$|\^|\|)/g, "\\$1");
- return new RegExp(str);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_invalid_appcache.appcache
+++ /dev/null
@@ -1,55 +0,0 @@
-# some comment
-
-CACHE MANIFEST
-# the above is a required line
-# this is a comment
-# spaces are ignored
-# blank lines are ignored
-
-images/sound-icon.png
-images/background.png
-
-NETWORK:
-/checking.cgi
-/checking.*
-
-CACHE:
-../rel.html
-../../rel.html
-../../../rel.html
-../../../../rel.html
-../../../../../rel.html
-/../invalid.html
-/test.css
-/test.js
-test.png
-browser_cmd_appcache_invalid_index.html
-/main/features.js
-/main/settings/index.css
-https://example.com/scene.jpg
-/section1/blockedbyfallback.html
-https://example.com/images/world.jpg
-/section2/blockedbyfallback.html
-browser_cmd_appcache_invalid_page1.html
-/main/home
-main/app.js
-browser_cmd_appcache_invalid_page2.html
-/settings/home
-/settings/app.js
-browser_cmd_appcache_invalid_page3.html
-https://example.com/logo.png
-https://example.com/check.png
-https://example.com/cr oss.png
-/checking*.png
-
-SETTINGS:
-prefer-online
-fast
-
-FALLBACK:
-/section1/ /offline1.html
-/section2/ offline2.html
-dadsdsd
-* offline3.html
-
-BLAH:
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_invalid_appcache.appcache^headers^
+++ /dev/null
@@ -1,2 +0,0 @@
-Content-Type: text/cache-manifest; charset=ISO-8859-1
-Last-Modified: Tue, 23 Apr 9998 11:41:13 GMT
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_invalid_index.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_invalid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example index.html</h1>
- <br />
- <a href="browser_cmd_appcache_invalid_index.html">Home</a> |
- <a href="browser_cmd_appcache_invalid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_invalid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_invalid_page3.html">Page 3</a>
- </body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_invalid_page1.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_invalid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example page1.html</h1>
- <br />
- <a href="browser_cmd_appcache_invalid_index.html">Home</a> |
- <a href="browser_cmd_appcache_invalid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_invalid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_invalid_page3.html">Page 3</a>
- </body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_invalid_page2.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_invalid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example page2.html</h1>
- <br />
- <a href="browser_cmd_appcache_invalid_index.html">Home</a> |
- <a href="browser_cmd_appcache_invalid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_invalid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_invalid_page3.html">Page 3</a>
- </body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_invalid_page3.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_invalid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example page3.html</h1>
- <br />
- <a href="browser_cmd_appcache_invalid_index.html">Home</a> |
- <a href="browser_cmd_appcache_invalid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_invalid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_invalid_page3.html">Page 3</a>
- </body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_invalid_page3.html^headers^
+++ /dev/null
@@ -1,2 +0,0 @@
-Cache-Control: no-store, no-cache
-Last-Modified: Tue, 23 Apr 9999 11:41:13 GMT
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_valid.js
+++ /dev/null
@@ -1,175 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-// Tests that the appcache commands works as they should
-
-const TEST_URI = "https://sub1.test2.example.com/browser/devtools/client/" +
- "commandline/test/" +
- "browser_cmd_appcache_valid_index_relative_manifest.html";
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab(TEST_URI);
-
- info("adding cache listener.");
- // Wait for site to be cached.
- yield helpers.listenOnce(gBrowser.contentWindow.applicationCache, "cached");
-
- yield helpers.openToolbar(options);
-
- // Pages containing an appcache the notification bar gives options to allow
- // or deny permission for the app to save data offline. Let's click Allow.
- let notificationID = "offline-app-requested-sub1.test2.example.com";
- let notification = PopupNotifications.getNotification(notificationID, gBrowser.selectedBrowser);
-
- if (notification) {
- info("Authorizing offline storage.");
- notification.mainAction.callback();
- } else {
- info("No notification box is available.");
- }
-
- info("Site now cached, running tests.");
- yield helpers.audit(options, [
- {
- setup: "appcache",
- check: {
- input: "appcache",
- markup: "IIIIIIII",
- status: "ERROR",
- args: {}
- },
- },
-
- {
- setup: function () {
- Services.prefs.setBoolPref("browser.cache.disk.enable", false);
- return helpers.setInput(options, "appcache list", 13);
- },
- check: {
- input: "appcache list",
- markup: "VVVVVVVVVVVVV",
- status: "VALID",
- args: {},
- },
- exec: {
- output: [ /cache is disabled/ ]
- },
- post: function (output) {
- Services.prefs.setBoolPref("browser.cache.disk.enable", true);
- }
- },
-
- {
- setup: "appcache list",
- check: {
- input: "appcache list",
- markup: "VVVVVVVVVVVVV",
- status: "VALID",
- args: {},
- },
- exec: {
- output: [ /index/, /page1/, /page2/, /page3/ ]
- },
- },
-
- {
- setup: "appcache list page",
- check: {
- input: "appcache list page",
- markup: "VVVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {
- search: { value: "page" },
- }
- },
- exec: {
- output: [ /page1/, /page2/, /page3/ ]
- },
- post: function (output, text) {
- ok(!text.includes("index"), "index is not contained in output");
- }
- },
-
- {
- setup: "appcache validate",
- check: {
- input: "appcache validate",
- markup: "VVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {}
- },
- exec: {
- output: [ /successfully/ ]
- },
- },
-
- {
- setup: "appcache validate " + TEST_URI,
- check: {
- input: "appcache validate " + TEST_URI,
- // appcache validate http://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index_relative_manifest.html
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {
- uri: {
- value: TEST_URI
- },
- }
- },
- exec: {
- output: [ /successfully/ ]
- },
- },
-
- {
- setup: "appcache clear",
- check: {
- input: "appcache clear",
- markup: "VVVVVVVVVVVVVV",
- status: "VALID",
- args: {},
- },
- exec: {
- output: [ /successfully/ ]
- },
- },
-
- {
- setup: "appcache list",
- check: {
- input: "appcache list",
- markup: "VVVVVVVVVVVVV",
- status: "VALID",
- args: {},
- },
- exec: {
- output: [ /no results/ ]
- },
- post: function (output, text) {
- ok(!text.includes("index"), "index is not contained in output");
- ok(!text.includes("page1"), "page1 is not contained in output");
- ok(!text.includes("page2"), "page2 is not contained in output");
- ok(!text.includes("page3"), "page3 is not contained in output");
- }
- },
-
- {
- setup: "appcache viewentry --key " + TEST_URI,
- check: {
- input: "appcache viewentry --key " + TEST_URI,
- // appcache viewentry --key http://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index_relative_manifest.html
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {}
- },
- },
- ]);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_valid_appcache.appcache
+++ /dev/null
@@ -1,5 +0,0 @@
-CACHE MANIFEST
-browser_cmd_appcache_valid_index_relative_manifest.html
-browser_cmd_appcache_valid_page1.html
-browser_cmd_appcache_valid_page2.html
-browser_cmd_appcache_valid_page3.html
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_valid_appcache.appcache^headers^
+++ /dev/null
@@ -1,2 +0,0 @@
-Content-Type: text/cache-manifest
-Last-Modified: Tue, 23 Apr 9998 11:41:13 GMT
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_valid_index_absolute_manifest.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html manifest="http://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example index.html</h1>
- <a href="browser_cmd_appcache_valid_index_absolute_manifest.html">Home</a> |
- <a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
- </body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_valid_index_relative_manifest.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_valid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example index.html</h1>
- <a href="browser_cmd_appcache_valid_index_relative_manifest.html">Home</a> |
- <a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
- </body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_valid_index_root_relative_manifest.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html manifest="/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example index.html</h1>
- <a href="browser_cmd_appcache_valid_index_root_relative_manifest.html">Home</a> |
- <a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
- </body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_valid_page1.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_valid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example page1.html</h1>
- <a href="browser_cmd_appcache_valid_index_relative_manifest.html">Home</a> |
- <a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
- </body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_valid_page2.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_valid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example page2.html</h1>
- <a href="browser_cmd_appcache_valid_index_relative_manifest.html">Home</a> |
- <a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
- </body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_appcache_valid_page3.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_valid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example page3.html</h1>
- <a href="browser_cmd_appcache_valid_index_relative_manifest.html">Home</a> |
- <a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
- </body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_calllog.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-* http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the calllog commands works as they should
-
-const TEST_URI = "data:text/html;charset=utf-8,gcli-calllog";
-
-var tests = {};
-
-function test() {
- return Task.spawn(function* () {
- let options = yield helpers.openTab(TEST_URI);
- yield helpers.openToolbar(options);
-
- yield helpers.runTests(options, tests);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
- }).then(finish, helpers.handleError);
-}
-
-tests.testCallLogStatus = function (options) {
- return helpers.audit(options, [
- {
- setup: "calllog",
- check: {
- input: "calllog",
- hints: "",
- markup: "IIIIIII",
- status: "ERROR"
- }
- },
- {
- setup: "calllog start",
- check: {
- input: "calllog start",
- hints: "",
- markup: "VVVVVVVVVVVVV",
- status: "VALID"
- }
- },
- {
- setup: "calllog stop",
- check: {
- input: "calllog stop",
- hints: "",
- markup: "VVVVVVVVVVVV",
- status: "VALID"
- }
- },
- ]);
-};
-
-tests.testCallLogExec = function (options) {
- return new Promise((resolve, reject) => {
- var onWebConsoleOpen = function (subject) {
- Services.obs.removeObserver(onWebConsoleOpen, "web-console-created");
-
- subject.QueryInterface(Ci.nsISupportsString);
- let hud = HUDService.getHudReferenceById(subject.data);
- ok(hud, "console open");
-
- helpers.audit(options, [
- {
- setup: "calllog stop",
- exec: {
- output: /Stopped call logging/,
- }
- },
- {
- setup: "console clear",
- exec: {
- output: "",
- },
- post: function () {
- let labels = hud.outputNode.querySelectorAll(".webconsole-msg-output");
- is(labels.length, 0, "no output in console");
- }
- },
- {
- setup: "console close",
- exec: {
- output: "",
- }
- },
- ]).then(resolve);
- };
- Services.obs.addObserver(onWebConsoleOpen, "web-console-created");
-
- helpers.audit(options, [
- {
- setup: "calllog stop",
- exec: {
- output: /No call logging/,
- }
- },
- {
- name: "calllog start",
- setup: function () {
- // This test wants to be in a different event
- return new Promise((resolve, reject) => {
- executeSoon(function () {
- helpers.setInput(options, "calllog start").then(resolve);
- });
- });
- },
- exec: {
- output: /Call logging started/,
- },
- },
- ]);
- });
-};
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_calllog_chrome.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-* http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the calllog commands works as they should
-
-const TEST_URI = "data:text/html;charset=utf-8,cmd-calllog-chrome";
-
-var tests = {};
-
-function test() {
- return Task.spawn(function* () {
- let options = yield helpers.openTab(TEST_URI);
- yield helpers.openToolbar(options);
-
- yield helpers.runTests(options, tests);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
- }).then(finish, helpers.handleError);
-}
-
-tests.testCallLogStatus = function (options) {
- return helpers.audit(options, [
- {
- setup: "calllog",
- check: {
- status: "ERROR",
- emptyParameters: [ " " ]
- }
- },
- {
- setup: "calllog chromestop",
- check: {
- status: "VALID",
- emptyParameters: [ " " ]
- }
- },
- {
- setup: "calllog chromestart content-variable window",
- check: {
- status: "VALID",
- emptyParameters: [ " " ]
- }
- },
- {
- setup: "calllog chromestart javascript \"({a1: function() {this.a2()},a2: function() {}});\"",
- check: {
- status: "VALID",
- emptyParameters: [ " " ]
- }
- },
- ]);
-};
-
-tests.testCallLogExec = function (options) {
- return new Promise((resolve, reject) => {
- function onWebConsoleOpen(subject) {
- Services.obs.removeObserver(onWebConsoleOpen, "web-console-created");
-
- subject.QueryInterface(Ci.nsISupportsString);
- let hud = HUDService.getHudReferenceById(subject.data);
- ok(hud, "console open");
-
- helpers.audit(options, [
- {
- setup: "calllog chromestop",
- exec: {
- output: /Stopped call logging/,
- }
- },
- {
- setup: "calllog chromestart javascript XXX",
- exec: {
- output: /following exception/,
- }
- },
- {
- setup: "console clear",
- exec: {
- output: "",
- },
- post: function () {
- let labels = hud.jsterm.outputNode.querySelectorAll(".webconsole-msg-output");
- is(labels.length, 0, "no output in console");
- }
- },
- {
- setup: "console close",
- exec: {
- output: "",
- },
- },
- ]).then(resolve);
- }
- Services.obs.addObserver(onWebConsoleOpen, "web-console-created", false);
-
- helpers.audit(options, [
- {
- setup: "calllog chromestop",
- exec: {
- output: /No call logging/
- }
- },
- {
- setup: "calllog chromestart javascript \"({a1: function() {this.a2()},a2: function() {}});\"",
- exec: {
- output: /Call logging started/,
- }
- },
- ]);
- });
-};
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_commands.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test various GCLI commands
-
-const TEST_URI = "data:text/html;charset=utf-8,gcli-commands";
-const {HUDService} = require("devtools/client/webconsole/hudservice");
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab(TEST_URI);
- yield helpers.openToolbar(options);
-
- let subjectPromise = helpers.observeOnce("web-console-created");
-
- helpers.audit(options, [
- {
- setup: "console open",
- exec: { }
- }
- ]);
-
- let subject = yield subjectPromise;
-
- subject.QueryInterface(Ci.nsISupportsString);
- let hud = HUDService.getHudReferenceById(subject.data);
- ok(hud, "console open");
-
- let msg = yield hud.jsterm.execute("pprint(window)");
-
- ok(msg, "output for pprint(window)");
-
- yield helpers.audit(options, [
- {
- setup: "console clear",
- exec: { output: "" }
- }
- ]);
-
- let labels = hud.outputNode.querySelectorAll(".message");
- is(labels.length, 0, "no output in console");
-
- yield helpers.audit(options, [
- {
- setup: "console close",
- exec: { output: "" }
- }
- ]);
-
- ok(!HUDService.getHudReferenceById(hud.hudId), "console closed");
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_csscoverage_oneshot.js
+++ /dev/null
@@ -1,318 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the addon commands works as they should
-
-const csscoverage = require("devtools/shared/fronts/csscoverage");
-
-const PAGE_1 = TEST_BASE_HTTPS + "browser_cmd_csscoverage_page1.html";
-const PAGE_2 = TEST_BASE_HTTPS + "browser_cmd_csscoverage_page2.html";
-const PAGE_3 = TEST_BASE_HTTPS + "browser_cmd_csscoverage_page3.html";
-
-const SHEET_A = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetA.css";
-const SHEET_B = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetB.css";
-const SHEET_C = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetC.css";
-const SHEET_D = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetD.css";
-
-add_task(async function() {
- let options = await helpers.openTab(PAGE_3);
- await helpers.openToolbar(options);
-
- let usage = await csscoverage.getUsage(options.target);
-
- await navigate(usage, options);
- await checkPages(usage);
- await checkEditorReport(usage);
- // usage.createPageReport is not supported for usage.oneshot data as of
- // bug 1035300 because the page report assumed we have preload data which
- // oneshot can't gather. The ideal solution is to have a special no-preload
- // mode for the page report, but since oneshot isn't needed for the UI to
- // function, we're currently not supporting page report for oneshot data
- // yield checkPageReport(usage);
-
- await helpers.closeToolbar(options);
- await helpers.closeTab(options);
-});
-
-/**
- * Just check current page
- */
-async function navigate(usage, options) {
- ok(!usage.isRunning(), "csscoverage is not running");
-
- await usage.oneshot();
-
- ok(!usage.isRunning(), "csscoverage is still not running");
-}
-
-/**
- * Check the expected pages have been visited
- */
-async function checkPages(usage) {
- let expectedVisited = [ PAGE_3 ];
- let actualVisited = await usage._testOnlyVisitedPages();
- isEqualJson(actualVisited, expectedVisited, "Visited");
-}
-
-/**
- * Check that createEditorReport returns the expected JSON
- */
-async function checkEditorReport(usage) {
- // Page1
- let expectedPage1 = { reports: [] };
- let actualPage1 = await usage.createEditorReport(PAGE_1 + " \u2192 <style> index 0");
- isEqualJson(actualPage1, expectedPage1, "Page1");
-
- // Page2
- let expectedPage2 = { reports: [] };
- let actualPage2 = await usage.createEditorReport(PAGE_2 + " \u2192 <style> index 0");
- isEqualJson(actualPage2, expectedPage2, "Page2");
-
- // Page3a
- let expectedPage3a = {
- reports: [
- {
- selectorText: ".page3-test2",
- start: { line: 9, column: 5 },
- }
- ]
- };
- let actualPage3a = await usage.createEditorReport(PAGE_3 + " \u2192 <style> index 0");
- isEqualJson(actualPage3a, expectedPage3a, "Page3a");
-
- // Page3b
- let expectedPage3b = {
- reports: [
- {
- selectorText: ".page3-test3",
- start: { line: 3, column: 5 },
- }
- ]
- };
- let actualPage3b = await usage.createEditorReport(PAGE_3 + " \u2192 <style> index 1");
- isEqualJson(actualPage3b, expectedPage3b, "Page3b");
-
- // SheetA
- let expectedSheetA = {
- reports: [
- {
- selectorText: ".sheetA-test2",
- start: { line: 8, column: 1 },
- },
- {
- selectorText: ".sheetA-test3",
- start: { line: 12, column: 1 },
- },
- {
- selectorText: ".sheetA-test4",
- start: { line: 16, column: 1 },
- }
- ]
- };
- let actualSheetA = await usage.createEditorReport(SHEET_A);
- isEqualJson(actualSheetA, expectedSheetA, "SheetA");
-
- // SheetB
- let expectedSheetB = {
- reports: [
- {
- selectorText: ".sheetB-test2",
- start: { line: 6, column: 1 },
- },
- {
- selectorText: ".sheetB-test3",
- start: { line: 10, column: 1 },
- },
- {
- selectorText: ".sheetB-test4",
- start: { line: 14, column: 1 },
- }
- ]
- };
- let actualSheetB = await usage.createEditorReport(SHEET_B);
- isEqualJson(actualSheetB, expectedSheetB, "SheetB");
-
- // SheetC
- let expectedSheetC = {
- reports: [
- {
- selectorText: ".sheetC-test2",
- start: { line: 6, column: 1 },
- },
- {
- selectorText: ".sheetC-test3",
- start: { line: 10, column: 1 },
- },
- {
- selectorText: ".sheetC-test4",
- start: { line: 14, column: 1 },
- }
- ]
- };
- let actualSheetC = await usage.createEditorReport(SHEET_C);
- isEqualJson(actualSheetC, expectedSheetC, "SheetC");
-
- // SheetD
- let expectedSheetD = {
- reports: [
- {
- selectorText: ".sheetD-test2",
- start: { line: 6, column: 1 },
- },
- {
- selectorText: ".sheetD-test3",
- start: { line: 10, column: 1 },
- },
- {
- selectorText: ".sheetD-test4",
- start: { line: 14, column: 1 },
- }
- ]
- };
- let actualSheetD = await usage.createEditorReport(SHEET_D);
- isEqualJson(actualSheetD, expectedSheetD, "SheetD");
-}
-
-/**
- * Check that checkPageReport returns the expected JSON
- */
-async function checkPageReport(usage) {
- let actualReport = await usage.createPageReport();
-
- // Quick check on trivial things. See doc comment for checkRuleProperties
- actualReport.preload.forEach(page => page.rules.forEach(checkRuleProperties));
- actualReport.unused.forEach(page => page.rules.forEach(checkRuleProperties));
-
- // Check the summary
- let expectedSummary = { "used": 23, "unused": 9, "preload": 0 };
- isEqualJson(actualReport.summary, expectedSummary, "summary");
-
- // Check the preload header
- isEqualJson(actualReport.preload.length, 0, "preload length");
-
- // Check the unused header
- isEqualJson(actualReport.unused.length, 6, "unused length");
-
- // Check the unused rules
- isEqualJson(actualReport.unused[0].url, PAGE_3 + " \u2192 <style> index 0", "unused url 0");
- let expectedUnusedRules0 = [
- {
- "url": PAGE_3 + " \u2192 <style> index 0",
- "start": { "line": 9, "column": 5 },
- "selectorText": ".page3-test2"
- }
- ];
- isEqualJson(actualReport.unused[0].rules, expectedUnusedRules0, "unused rules 0");
-
- isEqualJson(actualReport.unused[1].url, PAGE_3 + " \u2192 <style> index 1", "unused url 1");
- let expectedUnusedRules1 = [
- {
- "url": PAGE_3 + " \u2192 <style> index 1",
- "start": { "line": 3, "column": 5 },
- "selectorText": ".page3-test3"
- }
- ];
- isEqualJson(actualReport.unused[1].rules, expectedUnusedRules1, "unused rules 1");
-
- isEqualJson(actualReport.unused[2].url, SHEET_A, "unused url 2");
- let expectedUnusedRules2 = [
- {
- "url": SHEET_A,
- "start": { "line": 8, "column": 1 },
- "selectorText": ".sheetA-test2"
- },
- {
- "url": SHEET_A,
- "start": { "line": 12, "column": 1 },
- "selectorText": ".sheetA-test3"
- },
- {
- "url": SHEET_A,
- "start": { "line": 16, "column": 1 },
- "selectorText": ".sheetA-test4"
- }
- ];
- isEqualJson(actualReport.unused[2].rules, expectedUnusedRules2, "unused rules 2");
-
- isEqualJson(actualReport.unused[3].url, SHEET_B, "unused url 3");
- let expectedUnusedRules3 = [
- {
- "url": SHEET_B,
- "start": { "line": 6, "column": 1 },
- "selectorText": ".sheetB-test2"
- },
- {
- "url": SHEET_B,
- "start": { "line": 10, "column": 1 },
- "selectorText": ".sheetB-test3"
- },
- {
- "url": SHEET_B,
- "start": { "line": 14, "column": 1 },
- "selectorText": ".sheetB-test4"
- }
- ];
- isEqualJson(actualReport.unused[3].rules, expectedUnusedRules3, "unused rules 3");
-
- isEqualJson(actualReport.unused[4].url, SHEET_D, "unused url 4");
- let expectedUnusedRules4 = [
- {
- "url": SHEET_D,
- "start": { "line": 6, "column": 1 },
- "selectorText": ".sheetD-test2"
- },
- {
- "url": SHEET_D,
- "start": { "line": 10, "column": 1 },
- "selectorText": ".sheetD-test3"
- },
- {
- "url": SHEET_D,
- "start": { "line": 14, "column": 1 },
- "selectorText": ".sheetD-test4"
- }
- ];
- isEqualJson(actualReport.unused[4].rules, expectedUnusedRules4, "unused rules 4");
-
- isEqualJson(actualReport.unused[5].url, SHEET_C, "unused url 5");
- let expectedUnusedRules5 = [
- {
- "url": SHEET_C,
- "start": { "line": 6, "column": 1 },
- "selectorText": ".sheetC-test2"
- },
- {
- "url": SHEET_C,
- "start": { "line": 10, "column": 1 },
- "selectorText": ".sheetC-test3"
- },
- {
- "url": SHEET_C,
- "start": { "line": 14, "column": 1 },
- "selectorText": ".sheetC-test4"
- }
- ];
- isEqualJson(actualReport.unused[5].rules, expectedUnusedRules5, "unused rules 5");
-}
-
-/**
- * We do basic tests on the shortUrl and formattedCssText because they are
- * very derivative, and so make for fragile tests, and having done those quick
- * existence checks we remove them so the JSON check later can ignore them
- */
-function checkRuleProperties(rule, index) {
- is(typeof rule.shortUrl, "string", "typeof rule.shortUrl for " + index);
- is(rule.shortUrl.indexOf("http://"), -1, "http not in rule.shortUrl for" + index);
- delete rule.shortUrl;
-
- is(typeof rule.formattedCssText, "string", "typeof rule.formattedCssText for " + index);
- ok(rule.formattedCssText.indexOf("{") > 0, "{ in rule.formattedCssText for " + index);
- delete rule.formattedCssText;
-}
-
-/**
- * Utility to compare JSON structures
- */
-function isEqualJson(o1, o2, msg) {
- is(JSON.stringify(o1), JSON.stringify(o2), msg);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_csscoverage_page1.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="utf-8">
- <!--
- First page of the css coverage test.
- * Contains page2 in an iframe
- * Forwards to page2 on a timeout
- -->
- <title>Page 1</title>
- <style>
- @import url(browser_cmd_csscoverage_sheetD.css);
- /* This should match below */
- .page1-test1 {
- color: #011;
- }
- /* This should not match below */
- .page1-test2 {
- color: #012;
- }
- /* This would match if the mouse was in the right place */
- .page1-test3:hover {
- color: #013;
- }
- /* This can't match because it's illegal */
- .page1-test4:broken {
- color: #014;
- }
- /* This doesn't match until the event fires */
- .page1-test5 {
- color: #015;
- }
- /* TODO: include examples of all CSS rules in
- https://developer.mozilla.org/en-US/docs/Web/API/CSSRule
- and include tests for rules nested in media rules, etc */
-
- /* We're not testing unparable CSS right now */
- </style>
- <link rel="stylesheet" type="text/css" href="browser_cmd_csscoverage_sheetA.css">
- <link rel="stylesheet" type="text/css" href="browser_cmd_csscoverage_sheetB.css">
- <script type="application/javascript">
- /* How quickly do we rush through this? */
- let delay = 500;
- window.addEventListener("load", () => {
- dump('TEST-INFO | load from browser_cmd_csscoverage_page1.html\n');
- setTimeout(() => {
- dump('TEST-INFO | timeout from browser_cmd_csscoverage_page1.html\n');
- /* This adds <div class=page1-test5></div> */
- let parent = document.querySelector("#page1-test5-holder");
- let child = document.createElement("div");
- child.classList.add("page1-test5");
- parent.appendChild(child);
-
- /* Then navigate to the next step */
- window.location.href = "browser_cmd_csscoverage_page3.html"
- }, delay);
- });
- </script>
-</head>
-<body>
-
-<h2>Page 1</h2>
-
-<div class=page1-test1>.page1-test1</div>
-<div class=page1-test3>.page1-test3</div>
-
-<div id=page1-test5-holder></div>
-
-<div class=sheetA-test1>.sheetA-test1</div>
-<div class=sheetA-test3>.sheetA-test3</div>
-<div class=sheetB-test1>.sheetB-test1</div>
-<div class=sheetB-test3>.sheetB-test3</div>
-<div class=sheetC-test1>.sheetC-test1</div>
-<div class=sheetC-test3>.sheetC-test3</div>
-<div class=sheetD-test1>.sheetD-test1</div>
-<div class=sheetD-test3>.sheetD-test3</div>
-
-<iframe src=browser_cmd_csscoverage_page2.html></iframe>
-
-<p>
- <a href="browser_cmd_csscoverage_page3.html">Page 3</a>
-</p>
-
-</body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_csscoverage_page2.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Page 2</title>
- <style>
- @import url(browser_cmd_csscoverage_sheetD.css);
-
- /* This should match below */
- .page2-test1 {
- color: #021;
- }
- /* This should not match below */
- .page2-test2 {
- color: #022;
- }
- /* This doesn't match until the event fires */
- .page2-test3 {
- color: #023;
- }
- </style>
-
- <link rel="stylesheet" type="text/css" href="browser_cmd_csscoverage_sheetA.css">
- <link rel="stylesheet" type="text/css" href="browser_cmd_csscoverage_sheetB.css">
- <script type="application/javascript">
- /* How quickly do we rush through this? */
- let delay = 500;
- window.addEventListener("load", () => {
- dump('TEST-INFO | load from browser_cmd_csscoverage_page2.html\n');
- setTimeout(() => {
- dump('TEST-INFO | timeout from browser_cmd_csscoverage_page2.html\n');
- /* This adds <div class=page2-test3></div> */
- let parent = document.querySelector("#page2-test3-holder");
- let child = document.createElement("div");
- child.classList.add("page2-test3");
- parent.appendChild(child);
- }, delay);
- });
- </script>
-</head>
-<body>
-
-<h2>Page 2</h2>
-
-<div class=page2-test1>.page2-test1</div>
-
-<div id=page2-test3-holder></div>
-
-<div class=sheetA-test1>.sheetA-test1</div>
-<div class=sheetA-test4>.sheetA-test4</div>
-<div class=sheetB-test1>.sheetB-test1</div>
-<div class=sheetB-test4>.sheetB-test4</div>
-<div class=sheetC-test1>.sheetC-test1</div>
-<div class=sheetC-test4>.sheetC-test4</div>
-<div class=sheetD-test1>.sheetD-test1</div>
-<div class=sheetD-test4>.sheetD-test4</div>
-
-</body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_csscoverage_page3.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Page 3</title>
- <style>
- @import url(browser_cmd_csscoverage_sheetD.css);
-
- /* This should match below */
- .page3-test1 {
- color: #031;
- }
- /* This should not match below */
- .page3-test2 {
- color: #032;
- }
- </style>
- <style>
- /* This also should not match below, but in a second inline sheet */
- .page3-test3 {
- color: #033;
- }
- </style>
- <link rel="stylesheet" type="text/css" href="browser_cmd_csscoverage_sheetA.css">
- <link rel="stylesheet" type="text/css" href="browser_cmd_csscoverage_sheetB.css">
- <script type="application/javascript">
- window.addEventListener("load", () => {
- dump('TEST-INFO | load from browser_cmd_csscoverage_page3.html\n');
- });
- </script>
-</head>
-<body>
-
-<h2>Page 3</h2>
-
-<div class=page3-test1>.page3-test1</div>
-
-<div class=sheetA-test1>.sheetA-test1</div>
-<div class=sheetA-test5>.sheetA-test5</div>
-<div class=sheetB-test1>.sheetB-test1</div>
-<div class=sheetB-test5>.sheetB-test5</div>
-<div class=sheetC-test1>.sheetC-test1</div>
-<div class=sheetC-test5>.sheetC-test5</div>
-<div class=sheetD-test1>.sheetD-test1</div>
-<div class=sheetD-test5>.sheetD-test5</div>
-
-<p>
- <a href="browser_cmd_csscoverage_page1.html">Page 1</a>
-</p>
-
-</body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_csscoverage_sheetA.css
+++ /dev/null
@@ -1,22 +0,0 @@
-@import url(browser_cmd_csscoverage_sheetC.css);
-
-/* This should match in page 1, 2 and 3 */
-.sheetA-test1 {
- color: #0A1;
-}
-/* This should not match anywhere */
-.sheetA-test2 {
- color: #0A2;
-}
-/* This should match in page 1 only */
-.sheetA-test3 {
- color: #0A3;
-}
-/* This should match in page 2 only */
-.sheetA-test4 {
- color: #0A4;
-}
-/* This should match in page 3 only */
-.sheetA-test5 {
- color: #0A5;
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_csscoverage_sheetB.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/* This should match in page 1, 2 and 3 */
-.sheetB-test1 {
- color: #0B1;
-}
-/* This should not match anywhere */
-.sheetB-test2 {
- color: #0B2;
-}
-/* This should match in page 1 only */
-.sheetB-test3 {
- color: #0B3;
-}
-/* This should match in page 2 only */
-.sheetB-test4 {
- color: #0B4;
-}
-/* This should match in page 3 only */
-.sheetB-test5 {
- color: #0B5;
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_csscoverage_sheetC.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/* This should match in page 1, 2 and 3 */
-.sheetC-test1 {
- color: #0C1;
-}
-/* This should not match anywhere */
-.sheetC-test2 {
- color: #0C2;
-}
-/* This should match in page 1 only */
-.sheetC-test3 {
- color: #0C3;
-}
-/* This should match in page 2 only */
-.sheetC-test4 {
- color: #0C4;
-}
-/* This should match in page 3 only */
-.sheetC-test5 {
- color: #0C5;
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_csscoverage_sheetD.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/* This should match in page 1, 2 and 3 */
-.sheetD-test1 {
- color: #0D1;
-}
-/* This should not match anywhere */
-.sheetD-test2 {
- color: #0D2;
-}
-/* This should match in page 1 only */
-.sheetD-test3 {
- color: #0D3;
-}
-/* This should match in page 2 only */
-.sheetD-test4 {
- color: #0D4;
-}
-/* This should match in page 3 only */
-.sheetD-test5 {
- color: #0D5;
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_csscoverage_startstop.js
+++ /dev/null
@@ -1,466 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the addon commands works as they should
-
-const csscoverage = require("devtools/shared/fronts/csscoverage");
-const {gDevTools} = require("devtools/client/framework/devtools");
-
-const PAGE_1 = TEST_BASE_HTTPS + "browser_cmd_csscoverage_page1.html";
-const PAGE_2 = TEST_BASE_HTTPS + "browser_cmd_csscoverage_page2.html";
-const PAGE_3 = TEST_BASE_HTTPS + "browser_cmd_csscoverage_page3.html";
-
-const SHEET_A = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetA.css";
-const SHEET_B = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetB.css";
-const SHEET_C = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetC.css";
-const SHEET_D = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetD.css";
-
-add_task(async function() {
- let options = await helpers.openTab("about:blank");
- await helpers.openToolbar(options);
-
- let usage = await csscoverage.getUsage(options.target);
-
- await navigate(usage, options);
- await checkPages(usage);
- await checkEditorReport(usage);
- await checkPageReport(usage);
-
- await helpers.closeToolbar(options);
- await helpers.closeTab(options);
-});
-
-/**
- * Visit all the pages in the test
- */
-async function navigate(usage, options) {
- await usage.start(options.chromeWindow, options.target);
-
- ok(usage.isRunning(), "csscoverage is running");
-
- // Load page 1.
- options.browser.loadURI(PAGE_1);
- // And wait until page 1 and page 2 (an iframe inside page 1) are both loaded.
- await Promise.all([
- BrowserTestUtils.browserLoaded(options.browser, false, PAGE_1),
- BrowserTestUtils.browserLoaded(options.browser, true, PAGE_2)
- ]);
- is(options.browser.currentURI.spec, PAGE_1, "page 1 loaded");
-
- // page 2 has JS that navigates to page 3 after a timeout.
- await BrowserTestUtils.browserLoaded(options.browser, false, PAGE_3);
- is(options.browser.currentURI.spec, PAGE_3, "page 3 loaded");
-
- let toolboxReady = gDevTools.once("toolbox-ready");
-
- await usage.stop();
-
- ok(!usage.isRunning(), "csscoverage not is running");
-
- await toolboxReady;
-}
-
-/**
- * Check the expected pages have been visited
- */
-async function checkPages(usage) {
- // 'load' event order. '' is for the initial location
- let expectedVisited = [ "", PAGE_2, PAGE_1, PAGE_3 ];
- let actualVisited = await usage._testOnlyVisitedPages();
- isEqualJson(actualVisited, expectedVisited, "Visited");
-}
-
-/**
- * Check that createEditorReport returns the expected JSON
- */
-async function checkEditorReport(usage) {
- // Page1
- let expectedPage1 = {
- reports: [
- {
- selectorText: ".page1-test2",
- start: { line: 8, column: 5 },
- }
- ]
- };
- let actualPage1 = await usage.createEditorReport(PAGE_1 + " \u2192 <style> index 0");
- isEqualJson(actualPage1, expectedPage1, "Page1");
-
- // Page2
- let expectedPage2 = {
- reports: [
- {
- selectorText: ".page2-test2",
- start: { line: 9, column: 5 },
- },
- ]
- };
- let actualPage2 = await usage.createEditorReport(PAGE_2 + " \u2192 <style> index 0");
- isEqualJson(actualPage2, expectedPage2, "Page2");
-
- // Page3a
- let expectedPage3a = {
- reports: [
- {
- selectorText: ".page3-test2",
- start: { line: 9, column: 5 },
- }
- ]
- };
- let actualPage3a = await usage.createEditorReport(PAGE_3 + " \u2192 <style> index 0");
- isEqualJson(actualPage3a, expectedPage3a, "Page3a");
-
- // Page3b
- let expectedPage3b = {
- reports: [
- {
- selectorText: ".page3-test3",
- start: { line: 3, column: 5 },
- }
- ]
- };
- let actualPage3b = await usage.createEditorReport(PAGE_3 + " \u2192 <style> index 1");
- isEqualJson(actualPage3b, expectedPage3b, "Page3b");
-
- // SheetA
- let expectedSheetA = {
- reports: [
- {
- selectorText: ".sheetA-test2",
- start: { line: 8, column: 1 },
- }
- ]
- };
- let actualSheetA = await usage.createEditorReport(SHEET_A);
- isEqualJson(actualSheetA, expectedSheetA, "SheetA");
-
- // SheetB
- let expectedSheetB = {
- reports: [
- {
- selectorText: ".sheetB-test2",
- start: { line: 6, column: 1 },
- }
- ]
- };
- let actualSheetB = await usage.createEditorReport(SHEET_B);
- isEqualJson(actualSheetB, expectedSheetB, "SheetB");
-
- // SheetC
- let expectedSheetC = {
- reports: [
- {
- selectorText: ".sheetC-test2",
- start: { line: 6, column: 1 },
- }
- ]
- };
- let actualSheetC = await usage.createEditorReport(SHEET_C);
- isEqualJson(actualSheetC, expectedSheetC, "SheetC");
-
- // SheetD
- let expectedSheetD = {
- reports: [
- {
- selectorText: ".sheetD-test2",
- start: { line: 6, column: 1 },
- }
- ]
- };
- let actualSheetD = await usage.createEditorReport(SHEET_D);
- isEqualJson(actualSheetD, expectedSheetD, "SheetD");
-}
-
-/**
- * Check that checkPageReport returns the expected JSON
- */
-async function checkPageReport(usage) {
- let actualReport = await usage.createPageReport();
-
- // Quick check on trivial things. See doc comment for checkRuleProperties
- actualReport.preload.forEach(page => page.rules.forEach(checkRuleProperties));
- actualReport.unused.forEach(page => page.rules.forEach(checkRuleProperties));
-
- // Check the summary
- let expectedSummary = { "used": 92, "unused": 22, "preload": 28 };
- isEqualJson(actualReport.summary, expectedSummary, "summary");
-
- checkPageReportPreload(actualReport);
- checkPageReportUnused(actualReport);
-}
-
-/**
- * Check that checkPageReport returns the expected preload JSON
- */
-function checkPageReportPreload(actualReport) {
- // Check the preload header
- isEqualJson(actualReport.preload.length, 3, "preload length");
-
- // Check the preload rules
- isEqualJson(actualReport.preload[0].url, PAGE_2, "preload url 0");
- let expectedPreloadRules0 = [
- // TODO: This is already pre-loaded, we should note this
- {
- url: PAGE_2 + " \u2192 <style> index 0",
- start: { line: 5, column: 5 },
- selectorText: ".page2-test1"
- },
- {
- url: SHEET_A,
- start: { line: 4, column: 1 },
- selectorText: ".sheetA-test1"
- },
- {
- url: SHEET_A,
- start: { line: 16, column: 1 },
- selectorText: ".sheetA-test4"
- },
- {
- url: SHEET_B,
- start: { line: 2, column: 1 },
- selectorText: ".sheetB-test1"
- },
- {
- url: SHEET_B,
- start: { line: 14, column: 1 },
- selectorText: ".sheetB-test4"
- },
- {
- url: SHEET_D,
- start: { line: 2, column: 1 },
- selectorText: ".sheetD-test1"
- },
- {
- url: SHEET_D,
- start: { line: 14, column: 1 },
- selectorText: ".sheetD-test4"
- },
- {
- url: SHEET_C,
- start: { line: 2, column: 1 },
- selectorText: ".sheetC-test1"
- },
- {
- url: SHEET_C,
- start: { line: 14, column: 1 },
- selectorText: ".sheetC-test4"
- }
- ];
- isEqualJson(actualReport.preload[0].rules, expectedPreloadRules0, "preload rules 0");
-
- isEqualJson(actualReport.preload[1].url, PAGE_1, "preload url 1");
- let expectedPreloadRules1 = [
- {
- url: SHEET_A,
- start: { line: 4, column: 1 },
- selectorText: ".sheetA-test1"
- },
- {
- url: SHEET_A,
- start: { line: 12, column: 1 },
- selectorText: ".sheetA-test3"
- },
- {
- url: SHEET_B,
- start: { line: 2, column: 1 },
- selectorText: ".sheetB-test1"
- },
- {
- url: SHEET_B,
- start: { line: 10, column: 1 },
- selectorText: ".sheetB-test3"
- },
- {
- url: SHEET_D,
- start: { line: 2, column: 1 },
- selectorText: ".sheetD-test1"
- },
- {
- url: SHEET_D,
- start: { line: 10, column: 1 },
- selectorText: ".sheetD-test3"
- },
- {
- url: SHEET_C,
- start: { line: 2, column: 1 },
- selectorText: ".sheetC-test1"
- },
- {
- url: SHEET_C,
- start: { line: 10, column: 1 },
- selectorText: ".sheetC-test3"
- },
- {
- url: PAGE_1 + " \u2192 <style> index 0",
- start: { line: 4, column: 5 },
- selectorText: ".page1-test1"
- },
- {
- url: PAGE_1 + " \u2192 <style> index 0",
- start: { line: 12, column: 5 },
- selectorText: ".page1-test3:hover"
- }
- ];
- isEqualJson(actualReport.preload[1].rules, expectedPreloadRules1, "preload rules 1");
-
- isEqualJson(actualReport.preload[2].url, PAGE_3, "preload url 2");
- let expectedPreloadRules2 = [
- {
- url: SHEET_A,
- start: { line: 4, column: 1 },
- selectorText: ".sheetA-test1"
- },
- {
- url: SHEET_A,
- start: { line: 20, column: 1 },
- selectorText: ".sheetA-test5"
- },
- {
- url: SHEET_B,
- start: { line: 2, column: 1 },
- selectorText: ".sheetB-test1"
- },
- {
- url: SHEET_B,
- start: { line: 18, column: 1 },
- selectorText: ".sheetB-test5"
- },
- {
- url: SHEET_D,
- start: { line: 2, column: 1 },
- selectorText: ".sheetD-test1"
- },
- {
- url: SHEET_D,
- start: { line: 18, column: 1 },
- selectorText: ".sheetD-test5"
- },
- {
- url: SHEET_C,
- start: { line: 2, column: 1 },
- selectorText: ".sheetC-test1"
- },
- {
- url: SHEET_C,
- start: { line: 18, column: 1 },
- selectorText: ".sheetC-test5"
- },
- {
- url: PAGE_3 + " \u2192 <style> index 0",
- start: { line: 5, column: 5 },
- selectorText: ".page3-test1"
- },
- ];
- isEqualJson(actualReport.preload[2].rules, expectedPreloadRules2, "preload rules 2");
-}
-
-/**
- * Check that checkPageReport returns the expected unused JSON
- */
-function checkPageReportUnused(actualReport) {
- // Check the unused header
- isEqualJson(actualReport.unused.length, 8, "unused length");
-
- // Check the unused rules
- isEqualJson(actualReport.unused[0].url, PAGE_2 + " \u2192 <style> index 0", "unused url 0");
- let expectedUnusedRules0 = [
- {
- url: PAGE_2 + " \u2192 <style> index 0",
- start: { line: 9, column: 5 },
- selectorText: ".page2-test2"
- }
- ];
- isEqualJson(actualReport.unused[0].rules, expectedUnusedRules0, "unused rules 0");
-
- isEqualJson(actualReport.unused[1].url, SHEET_A, "unused url 1");
- let expectedUnusedRules1 = [
- {
- url: SHEET_A,
- start: { line: 8, column: 1 },
- selectorText: ".sheetA-test2"
- }
- ];
- isEqualJson(actualReport.unused[1].rules, expectedUnusedRules1, "unused rules 1");
-
- isEqualJson(actualReport.unused[2].url, SHEET_B, "unused url 2");
- let expectedUnusedRules2 = [
- {
- url: SHEET_B,
- start: { line: 6, column: 1 },
- selectorText: ".sheetB-test2"
- }
- ];
- isEqualJson(actualReport.unused[2].rules, expectedUnusedRules2, "unused rules 2");
-
- isEqualJson(actualReport.unused[3].url, SHEET_D, "unused url 3");
- let expectedUnusedRules3 = [
- {
- url: SHEET_D,
- start: { line: 6, column: 1 },
- selectorText: ".sheetD-test2"
- }
- ];
- isEqualJson(actualReport.unused[3].rules, expectedUnusedRules3, "unused rules 3");
-
- isEqualJson(actualReport.unused[4].url, SHEET_C, "unused url 4");
- let expectedUnusedRules4 = [
- {
- url: SHEET_C,
- start: { line: 6, column: 1 },
- selectorText: ".sheetC-test2"
- }
- ];
- isEqualJson(actualReport.unused[4].rules, expectedUnusedRules4, "unused rules 4");
-
- isEqualJson(actualReport.unused[5].url, PAGE_1 + " \u2192 <style> index 0", "unused url 5");
- let expectedUnusedRules5 = [
- {
- url: PAGE_1 + " \u2192 <style> index 0",
- start: { line: 8, column: 5 },
- selectorText: ".page1-test2"
- }
- ];
- isEqualJson(actualReport.unused[5].rules, expectedUnusedRules5, "unused rules 5");
-
- isEqualJson(actualReport.unused[6].url, PAGE_3 + " \u2192 <style> index 0", "unused url 6");
- let expectedUnusedRules6 = [
- {
- url: PAGE_3 + " \u2192 <style> index 0",
- start: { line: 9, column: 5 },
- selectorText: ".page3-test2"
- }
- ];
- isEqualJson(actualReport.unused[6].rules, expectedUnusedRules6, "unused rules 6");
-
- isEqualJson(actualReport.unused[7].url, PAGE_3 + " \u2192 <style> index 1", "unused url 7");
- let expectedUnusedRules7 = [
- {
- url: PAGE_3 + " \u2192 <style> index 1",
- start: { line: 3, column: 5 },
- selectorText: ".page3-test3"
- }
- ];
- isEqualJson(actualReport.unused[7].rules, expectedUnusedRules7, "unused rules 7");
-}
-
-/**
- * We do basic tests on the shortUrl and formattedCssText because they are
- * very derivative, and so make for fragile tests, and having done those quick
- * existence checks we remove them so the JSON check later can ignore them
- */
-function checkRuleProperties(rule, index) {
- is(typeof rule.shortUrl, "string", "typeof rule.shortUrl for " + index);
- is(rule.shortUrl.indexOf("http://"), -1, "http not in rule.shortUrl for" + index);
- delete rule.shortUrl;
-
- is(typeof rule.formattedCssText, "string", "typeof rule.formattedCssText for " + index);
- ok(rule.formattedCssText.indexOf("{") > 0, "{ in rule.formattedCssText for " + index);
- delete rule.formattedCssText;
-}
-
-/**
- * Utility to compare JSON structures
- */
-function isEqualJson(o1, o2, msg) {
- is(JSON.stringify(o1), JSON.stringify(o2), msg);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_csscoverage_util.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the addon commands works as they should
-
-const csscoverage = require("devtools/server/actors/csscoverage");
-
-add_task(async function() {
- testDeconstructRuleId();
-});
-
-function testDeconstructRuleId() {
- // This is the easy case
- let rule = csscoverage.deconstructRuleId("http://thing/blah|10|20");
- is(rule.url, "http://thing/blah", "1 url");
- is(rule.line, 10, "1 line");
- is(rule.column, 20, "1 column");
-
- // This is the harder case with a URL containing a '|'
- rule = csscoverage.deconstructRuleId("http://thing/blah?q=a|b|11|22");
- is(rule.url, "http://thing/blah?q=a|b", "2 url");
- is(rule.line, 11, "2 line");
- is(rule.column, 22, "2 column");
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_highlight_01.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/* eslint key-spacing: 0 */
-
-// Tests the various highlight command parameters and options
-
-// Creating a test page with many elements to test the --showall option
-var TEST_PAGE = "data:text/html;charset=utf-8,<body><ul>";
-for (let i = 0; i < 101; i++) {
- TEST_PAGE += "<li class='item'>" + i + "</li>";
-}
-TEST_PAGE += "</ul></body>";
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab(TEST_PAGE);
- yield helpers.openToolbar(options);
-
- yield helpers.audit(options, [
- {
- setup: "highlight",
- check: {
- input: "highlight",
- hints: " [selector] [options]",
- markup: "VVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "0 nodes highlighted"
- }
- },
- {
- setup: "highlight bo",
- check: {
- input: "highlight bo",
- hints: " [options]",
- markup: "VVVVVVVVVVII",
- status: "ERROR"
- },
- exec: {
- output: "Error: No matches"
- }
- },
- {
- setup: "highlight body",
- check: {
- input: "highlight body",
- hints: " [options]",
- markup: "VVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "1 node highlighted"
- }
- },
- {
- setup: "highlight body --hideguides",
- check: {
- input: "highlight body --hideguides",
- hints: " [options]",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "1 node highlighted"
- }
- },
- {
- setup: "highlight body --showinfobar",
- check: {
- input: "highlight body --showinfobar",
- hints: " [options]",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "1 node highlighted"
- }
- }
- ]);
-
- // Hide all highlighters before finishing the test.
- yield helpers.audit(options, [{
- setup: "unhighlight",
- exec: {}
- }]);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_highlight_02.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the highlight command actually creates a highlighter
-
-const TEST_PAGE = "data:text/html;charset=utf-8,<div></div>";
-
-function test() {
- return Task.spawn(function* () {
- let options = yield helpers.openTab(TEST_PAGE);
- yield helpers.openToolbar(options);
-
- info("highlighting the body node");
- yield runCommand("highlight body", options);
- is(yield getHighlighterNumber(), 1, "The highlighter element exists for body");
-
- info("highlighting the div node");
- yield runCommand("highlight div", options);
- is(yield getHighlighterNumber(), 1, "The highlighter element exists for div");
-
- info("highlighting the body node again, asking to keep the div");
- yield runCommand("highlight body --keep", options);
- is(yield getHighlighterNumber(), 2, "2 highlighter elements have been created");
-
- info("unhighlighting all nodes");
- yield runCommand("unhighlight", options);
- is(yield getHighlighterNumber(), 0, "All highlighters have been removed");
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
- }).then(finish, helpers.handleError);
-}
-
-function getHighlighterNumber() {
- return ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
- const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
- return require("devtools/shared/gcli/commands/highlight").highlighters.length;
- });
-}
-
-function* runCommand(cmd, options) {
- yield helpers.audit(options, [{ setup: cmd, exec: {} }]);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_highlight_03.js
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/* eslint key-spacing: 0 */
-
-// Tests the various highlight command parameters and options that doesn't
-// involve nodes at all.
-
-var TEST_PAGE = "data:text/html;charset=utf-8,";
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab(TEST_PAGE);
- yield helpers.openToolbar(options);
-
- yield helpers.audit(options, [
- {
- setup: "highlight body --hide",
- check: {
- input: "highlight body --hide",
- hints: "guides [options]",
- markup: "VVVVVVVVVVVVVVVIIIIII",
- status: "ERROR"
- },
- exec: {
- output: "Error: Too many arguments"
- }
- },
- {
- setup: "highlight body --show",
- check: {
- input: "highlight body --show",
- hints: "infobar [options]",
- markup: "VVVVVVVVVVVVVVVIIIIII",
- status: "ERROR"
- },
- exec: {
- output: "Error: Too many arguments"
- }
- },
- {
- setup: "highlight body --showa",
- check: {
- input: "highlight body --showa",
- hints: "ll [options]",
- markup: "VVVVVVVVVVVVVVVIIIIIII",
- status: "ERROR"
- },
- exec: {
- output: "Error: Too many arguments"
- }
- },
- {
- setup: "highlight body --r",
- check: {
- input: "highlight body --r",
- hints: "egion [options]",
- markup: "VVVVVVVVVVVVVVVIII",
- status: "ERROR"
- },
- exec: {
- output: "Error: Too many arguments"
- }
- },
- {
- setup: "highlight body --region",
- check: {
- input: "highlight body --region",
- hints: " <selection> [options]",
- markup: "VVVVVVVVVVVVVVVIIIIIIII",
- status: "ERROR"
- },
- exec: {
- output: "Error: Value required for \u2018region\u2019."
- }
- },
- {
- setup: "highlight body --fi",
- check: {
- input: "highlight body --fi",
- hints: "ll [options]",
- markup: "VVVVVVVVVVVVVVVIIII",
- status: "ERROR"
- },
- exec: {
- output: "Error: Too many arguments"
- }
- },
- {
- setup: "highlight body --fill",
- check: {
- input: "highlight body --fill",
- hints: " <string> [options]",
- markup: "VVVVVVVVVVVVVVVIIIIII",
- status: "ERROR"
- },
- exec: {
- output: "Error: Value required for \u2018fill\u2019."
- }
- },
- {
- setup: "highlight body --ke",
- check: {
- input: "highlight body --ke",
- hints: "ep [options]",
- markup: "VVVVVVVVVVVVVVVIIII",
- status: "ERROR"
- },
- exec: {
- output: "Error: Too many arguments"
- }
- },
- {
- setup: "unhighlight",
- check: {
- input: "unhighlight",
- hints: "",
- markup: "VVVVVVVVVVV",
- status: "VALID"
- }
- }
- ]);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_highlight_04.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/* eslint key-spacing: 0 */
-
-// Tests the various highlight command parameters and options
-
-requestLongerTimeout(4);
-
-// Creating a test page with many elements to test the --showall option
-var TEST_PAGE = "data:text/html;charset=utf-8,<body><ul>";
-for (let i = 0; i < 101; i++) {
- TEST_PAGE += "<li class='item'>" + i + "</li>";
-}
-TEST_PAGE += "</ul></body>";
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab(TEST_PAGE);
- yield helpers.openToolbar(options);
-
- yield helpers.audit(options, [
- {
- setup: "highlight body --showall",
- check: {
- input: "highlight body --showall",
- hints: " [options]",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "1 node highlighted"
- }
- },
- {
- setup: "highlight body --keep",
- check: {
- input: "highlight body --keep",
- hints: " [options]",
- markup: "VVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "1 node highlighted"
- }
- },
- {
- setup: "highlight body --hideguides --showinfobar --showall --region " +
- "content --fill red --keep",
- check: {
- input: "highlight body --hideguides --showinfobar --showall --region " +
- "content --fill red --keep",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV" +
- "VVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "1 node highlighted"
- }
- },
- {
- setup: "highlight .item",
- check: {
- input: "highlight .item",
- hints: " [options]",
- markup: "VVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "101 nodes matched, but only 100 nodes highlighted. Use " +
- "\u2018--showall\u2019 to show all"
- }
- },
- {
- setup: "highlight .item --showall",
- check: {
- input: "highlight .item --showall",
- hints: " [options]",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "101 nodes highlighted"
- }
- }
- ]);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_jsb.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the jsb command works as it should
-
-const TEST_URI = "http://example.com/browser/devtools/client/commandline/" +
- "test/browser_cmd_jsb_script.jsi";
-
-function test() {
- return Task.spawn(testTask).then(finish, helpers.handleError);
-}
-
-function* testTask() {
- let options = yield helpers.openTab("about:blank");
- yield helpers.openToolbar(options);
-
- let notifyPromise = wwNotifyOnce();
-
- helpers.audit(options, [
- {
- setup: "jsb",
- check: {
- input: "jsb",
- hints: " <url> [options]",
- markup: "VVV",
- status: "ERROR"
- }
- },
- {
- setup: "jsb " + TEST_URI,
- // Should result in a new scratchpad window
- exec: {
- output: "",
- error: false
- }
- }
- ]);
-
- let { subject } = yield notifyPromise;
- let scratchpadWin = subject.QueryInterface(Ci.nsIDOMWindow);
- yield helpers.listenOnce(scratchpadWin, "load");
-
- let scratchpad = scratchpadWin.Scratchpad;
-
- yield observeOnce(scratchpad);
-
- let result = scratchpad.getText();
- result = result.replace(/[\r\n]]*/g, "\n");
- let correct = "function somefunc() {\n" +
- " if (true) // Some comment\n" +
- " doSomething();\n" +
- " for (let n = 0; n < 500; n++) {\n" +
- " if (n % 2 == 1) {\n" +
- " console.log(n);\n" +
- " console.log(n + 1);\n" +
- " }\n" +
- " }\n" +
- "}";
- is(result, correct, "JS has been correctly prettified");
-
- if (scratchpadWin) {
- scratchpadWin.close();
- scratchpadWin = null;
- }
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
-
-/**
- * A wrapper for calling Services.ww.[un]registerNotification using promises.
- * @return a promise that resolves when the notification service first notifies
- * with topic == "domwindowopened".
- * The value of the promise is { subject: subject, topic: topic, data: data }
- */
-function wwNotifyOnce() {
- return new Promise(resolve => {
- let onNotify = (subject, topic, data) => {
- if (topic == "domwindowopened") {
- Services.ww.unregisterNotification(onNotify);
- resolve({ subject: subject, topic: topic, data: data });
- }
- };
-
- Services.ww.registerNotification(onNotify);
- });
-}
-
-/**
- * YET ANOTHER WRAPPER for a place where we are using events as poor-man's
- * promises. Perhaps this should be promoted to scratchpad?
- */
-function observeOnce(scratchpad) {
- return new Promise(resolve => {
- let observer = {
- onReady: function () {
- scratchpad.removeObserver(observer);
- resolve();
- },
- };
- scratchpad.addObserver(observer);
- });
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_jsb_script.jsi
+++ /dev/null
@@ -1,2 +0,0 @@
-function somefunc(){if (true) // Some comment
-doSomething();for(let n=0;n<500;n++){if(n%2==1){console.log(n);console.log(n+1);}}}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_listen.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-* http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the listen/unlisten commands work as they should.
-
-const TEST_URI = "http://example.com/browser/devtools/client/commandline/" +
- "test/browser_cmd_cookie.html";
-
-function test() {
- return Task.spawn(testTask).then(finish, helpers.handleError);
-}
-
-var tests = {
- testInput: function (options) {
- return helpers.audit(options, [
- {
- setup: "listen",
- check: {
- input: "listen",
- markup: "VVVVVV",
- status: "VALID"
- },
- },
- {
- setup: "unlisten",
- check: {
- input: "unlisten",
- markup: "VVVVVVVV",
- status: "VALID"
- },
- exec: {
- output: "All TCP ports closed"
- }
- },
- {
- setup: function () {
- return helpers.setInput(options, "listen");
- },
- check: {
- input: "listen",
- hints: " [port] [protocol]",
- markup: "VVVVVV",
- status: "VALID"
- },
- exec: {
- output: "Listening on port " + Services.prefs
- .getIntPref("devtools.debugger.remote-port")
- }
- },
- {
- setup: function () {
- return helpers.setInput(options, "listen 8000");
- },
- exec: {
- output: "Listening on port 8000"
- }
- },
- {
- setup: function () {
- return helpers.setInput(options, "unlisten");
- },
- exec: {
- output: "All TCP ports closed"
- }
- }
- ]);
- },
-};
-
-function* testTask() {
- Services.prefs.setBoolPref("devtools.debugger.remote-enabled", true);
- let options = yield helpers.openTab(TEST_URI);
- yield helpers.openToolbar(options);
-
- yield helpers.runTests(options, tests);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
- Services.prefs.clearUserPref("devtools.debugger.remote-enabled");
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_measure.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests the highlight command, ensure no invalid arguments are given
-
-const TEST_PAGE = "data:text/html;charset=utf-8,foo";
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab(TEST_PAGE);
- yield helpers.openToolbar(options);
-
- yield helpers.audit(options, [
- {
- setup: "measure",
- check: {
- input: "measure",
- markup: "VVVVVVV",
- status: "VALID"
- }
- },
- {
- setup: "measure on",
- check: {
- input: "measure on",
- markup: "VVVVVVVVEE",
- status: "ERROR"
- },
- exec: {
- output: "Error: Too many arguments"
- }
- },
- {
- setup: "measure --visible",
- check: {
- input: "measure --visible",
- markup: "VVVVVVVVEEEEEEEEE",
- status: "ERROR"
- },
- exec: {
- output: "Error: Too many arguments"
- }
- }
- ]);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_media.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset="utf-8">
- <title>GCLI Test for Bug 819930</title>
- <style>
- @media braille {
- body {
- background-color: yellow;
- }
- }
-
- @media embossed {
- body {
- background-color: indigo;
- }
- }
-
- @media screen {
- body {
- background-color: white;
- }
- }
- </style>
- </head>
- <body>
- </body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_media.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test that screenshot command works properly
-const TEST_URI = "http://example.com/browser/devtools/client/commandline/" +
- "test/browser_cmd_media.html";
-var tests = {
- testInput: function (options) {
- return helpers.audit(options, [
- {
- setup: "media emulate braille",
- check: {
- input: "media emulate braille",
- markup: "VVVVVVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {
- type: { value: "braille"},
- }
- },
- },
- {
- setup: "media reset",
- check: {
- input: "media reset",
- markup: "VVVVVVVVVVV",
- status: "VALID",
- args: {
- }
- },
- },
- ]);
- },
-
- testEmulateMedia: function (options) {
- return helpers.audit(options, [
- {
- setup: "media emulate braille",
- check: {
- args: {
- type: { value: "braille"}
- }
- },
- exec: {
- output: ""
- },
- post: Task.async(function* () {
- yield ContentTask.spawn(options.browser, {}, function* () {
- let color = content.getComputedStyle(content.document.body).backgroundColor;
- is(color, "rgb(255, 255, 0)", "media correctly emulated");
- });
- })
- }
- ]);
- },
-
- testEmulateBadMedia: function (options) {
- return helpers.audit(options, [
- {
- setup: "media emulate nonsense",
- check: {
- input: "media emulate nonsense",
- markup: "VVVVVVVVVVVVVVEEEEEEEE",
- status: "ERROR",
- },
- output: "Can't use `nonsense`",
- error: true
- }
- ]);
- },
-
- testEndMediaEmulation: function (options) {
- return helpers.audit(options, [
- {
- setup: function () {
- let mDV = options.browser.markupDocumentViewer;
- mDV.emulateMedium("embossed");
- return helpers.setInput(options, "media reset");
- },
- exec: {
- output: ""
- },
- post: Task.async(function* () {
- yield ContentTask.spawn(options.browser, {}, function* () {
- let color = content.getComputedStyle(content.document.body).backgroundColor;
- is(color, "rgb(255, 255, 255)", "media reset");
- });
- })
- }
- ]);
- }
-};
-
-function test() {
- return Task.spawn(function* () {
- let options = yield helpers.openTab(TEST_URI);
- yield helpers.openToolbar(options);
-
- yield helpers.runTests(options, tests);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
- }).then(finish, helpers.handleError);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_pagemod_export.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>GCLI inspect command test</title>
-</head>
-<body>
-
- <!-- This is a list of 0 h1 elements -->
-
- <!-- This is a list of 1 div elements -->
- <div>Hello, I'm a div</div>
-
- <!-- This is a list of 2 span elements -->
- <span>Hello, I'm a span</span>
- <span>And me</span>
-
- <!-- This is a collection of various things that match only once -->
- <p class="someclass">.someclass</p>
- <p id="someid">#someid</p>
- <button disabled>button[disabled]</button>
- <p><strong>p>strong</strong></p>
-
-</body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_pagemod_export.js
+++ /dev/null
@@ -1,417 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the inspect command works as it should
-
-const TEST_URI = "http://example.com/browser/devtools/client/commandline/" +
- "test/browser_cmd_pagemod_export.html";
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab(TEST_URI);
- yield helpers.openToolbar(options);
-
- function getHTML() {
- return ContentTask.spawn(options.browser, {}, function* () {
- return content.document.documentElement.innerHTML;
- });
- }
-
- const initialHtml = yield getHTML();
-
- function resetContent() {
- return ContentTask.spawn(options.browser, initialHtml, function* (html) {
- content.document.documentElement.innerHTML = html;
- });
- }
-
- // Test exporting HTML
- yield ContentTask.spawn(options.browser, {}, function* () {
- content.wrappedJSObject.oldOpen = content.open;
- content.wrappedJSObject.openURL = "";
- content.wrappedJSObject.open = function (url) {
- // The URL is a data: URL that contains the document source
- content.wrappedJSObject.openURL = decodeURIComponent(url);
- };
- });
-
- yield helpers.audit(options, [
- {
- setup: "export html",
- skipIf: true,
- check: {
- input: "export html",
- hints: " [destination]",
- markup: "VVVVVVVVVVV",
- status: "VALID",
- },
- exec: {
- output: ""
- },
- post: Task.async(function* () {
- yield ContentTask.spawn(options.browser, {}, function* () {
- let openURL = content.wrappedJSObject.openURL;
- isnot(openURL.indexOf('<html lang="en">'), -1, "export html works: <html>");
- isnot(openURL.indexOf("<title>GCLI"), -1, "export html works: <title>");
- isnot(openURL.indexOf('<p id="someid">#'), -1, "export html works: <p>");
- });
- })
- },
- {
- setup: "export html stdout",
- check: {
- input: "export html stdout",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {
- destination: { value: "stdout" }
- },
- },
- exec: {
- output: [
- /<html lang="en">/,
- /<title>GCLI/,
- /<p id="someid">#/
- ]
- }
- }
- ]);
-
- yield ContentTask.spawn(options.browser, {}, function* () {
- content.wrappedJSObject.open = content.wrappedJSObject.oldOpen;
- delete content.wrappedJSObject.openURL;
- delete content.wrappedJSObject.oldOpen;
- });
-
- // Test 'pagemod replace'
- yield helpers.audit(options, [
- {
- setup: "pagemod replace",
- check: {
- input: "pagemod replace",
- hints: " <search> <replace> [ignoreCase] [selector] [root] [attrOnly] [contentOnly] [attributes]",
- markup: "VVVVVVVVVVVVVVV",
- status: "ERROR"
- }
- },
- {
- setup: "pagemod replace some foo",
- check: {
- input: "pagemod replace some foo",
- hints: " [ignoreCase] [selector] [root] [attrOnly] [contentOnly] [attributes]",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- }
- },
- {
- setup: "pagemod replace some foo true",
- check: {
- input: "pagemod replace some foo true",
- hints: " [selector] [root] [attrOnly] [contentOnly] [attributes]",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- }
- },
- {
- setup: "pagemod replace some foo true --attrOnly",
- check: {
- input: "pagemod replace some foo true --attrOnly",
- hints: " [selector] [root] [contentOnly] [attributes]",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- }
- },
- {
- setup: "pagemod replace sOme foOBar",
- exec: {
- output: /^[^:]+: 13\. [^:]+: 0\. [^:]+: 0\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
- is(html, initialHtml, "no change in the page");
- })
- },
- {
- setup: "pagemod replace sOme foOBar true",
- exec: {
- output: /^[^:]+: 13\. [^:]+: 2\. [^:]+: 2\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
-
- isnot(html.indexOf('<p class="foOBarclass">.foOBarclass'), -1,
- ".someclass changed to .foOBarclass");
- isnot(html.indexOf('<p id="foOBarid">#foOBarid'), -1,
- "#someid changed to #foOBarid");
-
- yield resetContent();
- })
- },
- {
- setup: "pagemod replace some foobar --contentOnly",
- exec: {
- output: /^[^:]+: 13\. [^:]+: 2\. [^:]+: 0\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
-
- isnot(html.indexOf('<p class="someclass">.foobarclass'), -1,
- ".someclass changed to .foobarclass (content only)");
- isnot(html.indexOf('<p id="someid">#foobarid'), -1,
- "#someid changed to #foobarid (content only)");
-
- yield resetContent();
- })
- },
- {
- setup: "pagemod replace some foobar --attrOnly",
- exec: {
- output: /^[^:]+: 13\. [^:]+: 0\. [^:]+: 2\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
-
- isnot(html.indexOf('<p class="foobarclass">.someclass'), -1,
- ".someclass changed to .foobarclass (attr only)");
- isnot(html.indexOf('<p id="foobarid">#someid'), -1,
- "#someid changed to #foobarid (attr only)");
-
- yield resetContent();
- })
- },
- {
- setup: "pagemod replace some foobar --root head",
- exec: {
- output: /^[^:]+: 2\. [^:]+: 0\. [^:]+: 0\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
- is(html, initialHtml, "nothing changed");
- })
- },
- {
- setup: "pagemod replace some foobar --selector .someclass,div,span",
- exec: {
- output: /^[^:]+: 4\. [^:]+: 1\. [^:]+: 1\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
-
- isnot(html.indexOf('<p class="foobarclass">.foobarclass'), -1,
- ".someclass changed to .foobarclass");
- isnot(html.indexOf('<p id="someid">#someid'), -1,
- "#someid did not change");
-
- yield resetContent();
- })
- },
- ]);
-
- // Test 'pagemod remove element'
- yield helpers.audit(options, [
- {
- setup: "pagemod remove",
- check: {
- input: "pagemod remove",
- hints: " attribute",
- markup: "IIIIIIIVIIIIII",
- status: "ERROR"
- },
- },
- {
- setup: "pagemod remove element",
- check: {
- input: "pagemod remove element",
- hints: " <search> [root] [stripOnly] [ifEmptyOnly]",
- markup: "VVVVVVVVVVVVVVVVVVVVVV",
- status: "ERROR"
- },
- },
- {
- setup: "pagemod remove element foo",
- check: {
- input: "pagemod remove element foo",
- hints: " [root] [stripOnly] [ifEmptyOnly]",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- },
- {
- setup: "pagemod remove element p",
- exec: {
- output: /^[^:]+: 3\. [^:]+: 3\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
-
- is(html.indexOf('<p class="someclass">'), -1, "p.someclass removed");
- is(html.indexOf('<p id="someid">'), -1, "p#someid removed");
- is(html.indexOf("<p><strong>"), -1, "<p> wrapping <strong> removed");
- isnot(html.indexOf("<span>"), -1, "<span> not removed");
-
- yield resetContent();
- })
- },
- {
- setup: "pagemod remove element p head",
- exec: {
- output: /^[^:]+: 0\. [^:]+: 0\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
- is(html, initialHtml, "nothing changed in the page");
- })
- },
- {
- setup: "pagemod remove element p --ifEmptyOnly",
- exec: {
- output: /^[^:]+: 3\. [^:]+: 0\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
- is(html, initialHtml, "nothing changed in the page");
- })
- },
- {
- setup: "pagemod remove element meta,title --ifEmptyOnly",
- exec: {
- output: /^[^:]+: 2\. [^:]+: 1\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
-
- is(html.indexOf("<meta charset="), -1, "<meta> removed");
- isnot(html.indexOf("<title>"), -1, "<title> not removed");
-
- yield resetContent();
- })
- },
- {
- setup: "pagemod remove element p --stripOnly",
- exec: {
- output: /^[^:]+: 3\. [^:]+: 3\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
-
- is(html.indexOf('<p class="someclass">'), -1, "p.someclass removed");
- is(html.indexOf('<p id="someid">'), -1, "p#someid removed");
- is(html.indexOf("<p><strong>"), -1, "<p> wrapping <strong> removed");
- isnot(html.indexOf(".someclass"), -1, ".someclass still exists");
- isnot(html.indexOf("#someid"), -1, "#someid still exists");
- isnot(html.indexOf("<strong>p"), -1, "<strong> still exists");
-
- yield resetContent();
- })
- },
- ]);
-
- // Test 'pagemod remove attribute'
- yield helpers.audit(options, [
- {
- setup: "pagemod remove attribute",
- check: {
- input: "pagemod remove attribute",
- hints: " <searchAttributes> <searchElements> [root] [ignoreCase]",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVV",
- status: "ERROR",
- args: {
- searchAttributes: { value: undefined, status: "INCOMPLETE" },
- searchElements: { value: undefined, status: "INCOMPLETE" },
- // root: { value: undefined }, // 'root' is a node which is remote
- // so we can't see the value in tests
- ignoreCase: { value: false },
- }
- },
- },
- {
- setup: "pagemod remove attribute foo bar",
- check: {
- input: "pagemod remove attribute foo bar",
- hints: " [root] [ignoreCase]",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {
- searchAttributes: { value: "foo" },
- searchElements: { value: "bar" },
- // root: { value: undefined }, // 'root' is a node which is remote
- // so we can't see the value in tests
- ignoreCase: { value: false },
- }
- },
- post: function () {
- return new Promise(resolve => {
- executeSoon(resolve);
- });
- }
- },
- {
- setup: "pagemod remove attribute foo bar",
- exec: {
- output: /^[^:]+: 0\. [^:]+: 0\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
- is(html, initialHtml, "nothing changed in the page");
- })
- },
- {
- setup: "pagemod remove attribute foo p",
- exec: {
- output: /^[^:]+: 3\. [^:]+: 0\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
- is(html, initialHtml, "nothing changed in the page");
- })
- },
- {
- setup: "pagemod remove attribute id p,span",
- exec: {
- output: /^[^:]+: 5\. [^:]+: 1\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
-
- is(html.indexOf('<p id="someid">#someid'), -1, "p#someid attribute removed");
- isnot(html.indexOf("<p>#someid"), -1, "p with someid content still exists");
-
- yield resetContent();
- })
- },
- {
- setup: "pagemod remove attribute Class p",
- exec: {
- output: /^[^:]+: 3\. [^:]+: 0\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
- is(html, initialHtml, "nothing changed in the page");
- })
- },
- {
- setup: "pagemod remove attribute Class p --ignoreCase",
- exec: {
- output: /^[^:]+: 3\. [^:]+: 1\.\s*$/
- },
- post: Task.async(function* () {
- let html = yield getHTML();
-
- is(html.indexOf('<p class="someclass">.someclass'), -1,
- "p.someclass attribute removed");
- isnot(html.indexOf("<p>.someclass"), -1,
- "p with someclass content still exists");
-
- yield resetContent();
- })
- },
- ]);
-
- // Shutdown
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_paintflashing.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-* http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the paintflashing command correctly sets its state.
-
-"use strict";
-
-const TEST_URI = "http://example.com/browser/devtools/client/commandline/" +
- "test/browser_cmd_cookie.html";
-
-function test() {
- return Task.spawn(testTask).then(finish, helpers.handleError);
-}
-
-var tests = {
- testInput: function (options) {
- let toggleCommand = options.requisition.system.commands.get("paintflashing toggle");
-
- let { tab } = options;
-
- let actions = [
- {
- command: "paintflashing on",
- isChecked: true,
- label: "checked after on"
- },
- {
- command: "paintflashing off",
- isChecked: false,
- label: "unchecked after off"
- },
- {
- command: "paintflashing toggle",
- isChecked: true,
- label: "checked after toggle"
- },
- {
- command: "paintflashing toggle",
- isChecked: false,
- label: "unchecked after toggle"
- }
- ];
-
- return helpers.audit(options, actions.map(spec => ({
- setup: spec.command,
- exec: {},
- post: () => is(toggleCommand.state.isChecked({tab}), spec.isChecked, spec.label)
- })));
- },
-};
-
-function* testTask() {
- let options = yield helpers.openTab(TEST_URI);
- yield helpers.openToolbar(options);
-
- yield helpers.runTests(options, tests);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_pref1.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the pref commands work
-
-var prefBranch = Cc["@mozilla.org/preferences-service;1"]
- .getService(Ci.nsIPrefService).getBranch(null)
- .QueryInterface(Ci.nsIPrefBranch);
-
-const TEST_URI = "data:text/html;charset=utf-8,gcli-pref1";
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab(TEST_URI);
- yield helpers.openToolbar(options);
-
- let netmonEnabledOrig = prefBranch.getBoolPref("devtools.netmonitor.enabled");
- info("originally: devtools.netmonitor.enabled = " + netmonEnabledOrig);
-
- yield helpers.audit(options, [
- {
- setup: "pref",
- check: {
- input: "pref",
- hints: " reset",
- markup: "IIII",
- status: "ERROR"
- },
- },
- {
- setup: "pref s",
- check: {
- input: "pref s",
- hints: "et",
- markup: "IIIIVI",
- status: "ERROR"
- },
- },
- {
- setup: "pref sh",
- check: {
- input: "pref sh",
- hints: "ow",
- markup: "IIIIVII",
- status: "ERROR"
- },
- },
- {
- setup: "pref show ",
- check: {
- input: "pref show ",
- markup: "VVVVVVVVVV",
- status: "ERROR"
- },
- },
- {
- setup: "pref show usetexttospeech",
- check: {
- input: "pref show usetexttospeech",
- hints: " -> accessibility.usetexttospeech",
- markup: "VVVVVVVVVVIIIIIIIIIIIIIII",
- status: "ERROR"
- },
- },
- {
- setup: "pref show devtools.netmoni",
- check: {
- input: "pref show devtools.netmoni",
- hints: "tor.enabled",
- markup: "VVVVVVVVVVIIIIIIIIIIIIIIII",
- status: "ERROR",
- tooltipState: "true:importantFieldFlag",
- args: {
- setting: { value: undefined, status: "INCOMPLETE" },
- }
- },
- },
- {
- setup: "pref reset devtools.netmonitor.enabled",
- check: {
- input: "pref reset devtools.netmonitor.enabled",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID"
- },
- },
- {
- setup: "pref show devtools.netmonitor.enabled 4",
- check: {
- input: "pref show devtools.netmonitor.enabled 4",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVE",
- status: "ERROR"
- },
- },
- {
- setup: "pref set devtools.netmonitor.enabled 4",
- check: {
- input: "pref set devtools.netmonitor.enabled 4",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVE",
- status: "ERROR",
- args: {
- setting: { arg: " devtools.netmonitor.enabled" },
- value: { status: "ERROR", message: "Can\u2019t use \u20184\u2019." },
- }
- },
- },
- {
- setup: "pref set devtools.editor.tabsize 4",
- check: {
- input: "pref set devtools.editor.tabsize 4",
- hints: "",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {
- setting: { arg: " devtools.editor.tabsize" },
- value: { value: 4 },
- }
- },
- },
- {
- setup: "pref list",
- check: {
- input: "pref list",
- hints: " -> pref set",
- markup: "IIIIVIIII",
- status: "ERROR"
- },
- },
- {
- setup: "pref show devtools.netmonitor.enabled",
- check: {
- args: {
- setting: {
- value: options.requisition.system.settings.get("devtools.netmonitor.enabled")
- }
- },
- },
- exec: {
- output: "devtools.netmonitor.enabled: " + netmonEnabledOrig,
- },
- post: function () {
- prefBranch.setBoolPref("devtools.netmonitor.enabled", netmonEnabledOrig);
- }
- },
- ]);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_pref2.js
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the pref commands work
-
-var prefBranch = Cc["@mozilla.org/preferences-service;1"]
- .getService(Ci.nsIPrefService).getBranch(null)
- .QueryInterface(Ci.nsIPrefBranch);
-
-const TEST_URI = "data:text/html;charset=utf-8,gcli-pref2";
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab(TEST_URI);
- yield helpers.openToolbar(options);
-
- let tabSizeOrig = prefBranch.getIntPref("devtools.editor.tabsize");
- info("originally: devtools.editor.tabsize = " + tabSizeOrig);
-
- yield helpers.audit(options, [
- {
- setup: "pref show devtools.editor.tabsize",
- check: {
- args: {
- setting: {
- value: options.requisition.system.settings.get("devtools.editor.tabsize")
- }
- },
- },
- exec: {
- output: "devtools.editor.tabsize: " + tabSizeOrig,
- },
- },
- {
- setup: "pref set devtools.editor.tabsize 20",
- check: {
- args: {
- setting: {
- value: options.requisition.system.settings.get("devtools.editor.tabsize")
- },
- value: { value: 20 }
- },
- },
- exec: {
- output: "",
- },
- post: function () {
- is(prefBranch.getIntPref("devtools.editor.tabsize"), 20,
- "devtools.editor.tabsize is 20");
- }
- },
- {
- setup: "pref show devtools.editor.tabsize",
- check: {
- args: {
- setting: {
- value: options.requisition.system.settings.get("devtools.editor.tabsize")
- }
- },
- },
- exec: {
- output: "devtools.editor.tabsize: 20",
- }
- },
- {
- setup: "pref set devtools.editor.tabsize 1",
- check: {
- args: {
- setting: {
- value: options.requisition.system.settings.get("devtools.editor.tabsize")
- },
- value: { value: 1 }
- },
- },
- exec: {
- output: "",
- },
- },
- {
- setup: "pref show devtools.editor.tabsize",
- check: {
- args: {
- setting: {
- value: options.requisition.system.settings.get("devtools.editor.tabsize")
- }
- },
- },
- exec: {
- output: "devtools.editor.tabsize: 1",
- },
- post: function () {
- is(prefBranch.getIntPref("devtools.editor.tabsize"), 1,
- "devtools.editor.tabsize is 1");
- }
- },
- ]);
-
- prefBranch.setIntPref("devtools.editor.tabsize", tabSizeOrig);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_pref3.js
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the pref commands work
-
-var prefBranch = Cc["@mozilla.org/preferences-service;1"]
- .getService(Ci.nsIPrefService).getBranch(null)
- .QueryInterface(Ci.nsIPrefBranch);
-
-const TEST_URI = "data:text/html;charset=utf-8,gcli-pref3";
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab(TEST_URI);
- yield helpers.openToolbar(options);
-
- let remoteHostOrig = prefBranch.getStringPref("devtools.debugger.remote-host");
- info("originally: devtools.debugger.remote-host = " + remoteHostOrig);
-
- yield helpers.audit(options, [
- {
- setup: "pref show devtools.debugger.remote-host",
- check: {
- args: {
- setting: {
- value: options.requisition.system.settings.get("devtools.debugger.remote-host")
- }
- },
- },
- exec: {
- output: new RegExp("^devtools\.debugger\.remote-host: " + remoteHostOrig + "$"),
- },
- },
- {
- setup: "pref set devtools.debugger.remote-host e.com",
- check: {
- args: {
- setting: {
- value: options.requisition.system.settings.get("devtools.debugger.remote-host")
- },
- value: { value: "e.com" }
- },
- },
- exec: {
- output: "",
- },
- },
- {
- setup: "pref show devtools.debugger.remote-host",
- check: {
- args: {
- setting: {
- value: options.requisition.system.settings.get("devtools.debugger.remote-host")
- }
- },
- },
- exec: {
- output: new RegExp("^devtools\.debugger\.remote-host: e.com$"),
- },
- post: function () {
- var ecom = prefBranch.getStringPref("devtools.debugger.remote-host");
- is(ecom, "e.com", "devtools.debugger.remote-host is e.com");
- }
- },
- {
- setup: "pref set devtools.debugger.remote-host moz.foo",
- check: {
- args: {
- setting: {
- value: options.requisition.system.settings.get("devtools.debugger.remote-host")
- },
- value: { value: "moz.foo" }
- },
- },
- exec: {
- output: "",
- },
- },
- {
- setup: "pref show devtools.debugger.remote-host",
- check: {
- args: {
- setting: {
- value: options.requisition.system.settings.get("devtools.debugger.remote-host")
- }
- },
- },
- exec: {
- output: new RegExp("^devtools\.debugger\.remote-host: moz.foo$"),
- },
- post: function () {
- var mozfoo = prefBranch.getStringPref("devtools.debugger.remote-host");
- is(mozfoo, "moz.foo", "devtools.debugger.remote-host is moz.foo");
- }
- },
- ]);
-
- prefBranch.setStringPref("devtools.debugger.remote-host", remoteHostOrig);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_rulers.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests the various highlight command parameters and options
-
-var TEST_PAGE = "data:text/html;charset=utf-8,foo";
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab(TEST_PAGE);
- yield helpers.openToolbar(options);
-
- yield helpers.audit(options, [
- {
- setup: "rulers",
- check: {
- input: "rulers",
- markup: "VVVVVV",
- status: "VALID"
- }
- },
- {
- setup: "rulers on",
- check: {
- input: "rulers on",
- markup: "VVVVVVVEE",
- status: "ERROR"
- },
- exec: {
- output: "Error: Too many arguments"
- }
- },
- {
- setup: "rulers --visible",
- check: {
- input: "rulers --visible",
- markup: "VVVVVVVEEEEEEEEE",
- status: "ERROR"
- },
- exec: {
- output: "Error: Too many arguments"
- }
- }
- ]);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_screenshot.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<html>
- <head>
- <style>
- img {
- height: 100px;
- width: 100px;
- }
- .overflow {
- overflow: scroll;
- height: 200%;
- width: 200%;
- }
- </style>
- </head>
- <body>
- <img id="testImage" ></img>
- </body>
-</html>
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_cmd_screenshot.js
+++ /dev/null
@@ -1,373 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/* global helpers, btoa, whenDelayedStartupFinished, OpenBrowserWindow */
-
-// Test that screenshot command works properly
-
-"use strict";
-
-const TEST_URI = "http://example.com/browser/devtools/client/commandline/" +
- "test/browser_cmd_screenshot.html";
-
-var FileUtils = (ChromeUtils.import("resource://gre/modules/FileUtils.jsm", {})).FileUtils;
-
-function test() {
- // This test gets bombarded by a cascade of GCs and often takes 50s so lets be
- // safe and give the test 90s to run.
- requestLongerTimeout(3);
-
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- waitForExplicitFinish();
-
- info("RUN TEST: non-private window");
- let normWin = yield addWindow({ private: false });
- yield addTabWithToolbarRunTests(normWin);
- normWin.close();
-
- info("RUN TEST: private window");
- let pbWin = yield addWindow({ private: true });
- yield addTabWithToolbarRunTests(pbWin);
- pbWin.close();
-}
-
-function* addTabWithToolbarRunTests(win) {
- let options = yield helpers.openTab(TEST_URI, { chromeWindow: win });
- let browser = options.browser;
- yield helpers.openToolbar(options);
-
- // Test input status
- yield helpers.audit(options, [
- {
- setup: "screenshot",
- check: {
- input: "screenshot",
- markup: "VVVVVVVVVV",
- status: "VALID",
- args: {
- }
- },
- },
- {
- setup: "screenshot abc.png",
- check: {
- input: "screenshot abc.png",
- markup: "VVVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {
- filename: { value: "abc.png"},
- }
- },
- },
- {
- setup: "screenshot --fullpage",
- check: {
- input: "screenshot --fullpage",
- markup: "VVVVVVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {
- fullpage: { value: true},
- }
- },
- },
- {
- setup: "screenshot abc --delay 5",
- check: {
- input: "screenshot abc --delay 5",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID",
- args: {
- filename: { value: "abc"},
- delay: { value: 5 },
- }
- },
- },
- {
- setup: "screenshot --selector img#testImage",
- check: {
- input: "screenshot --selector img#testImage",
- markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
- status: "VALID",
- },
- },
- ]);
-
- // Test capture to file
- let file = FileUtils.getFile("TmpD", [ "TestScreenshotFile.png" ]);
-
- yield helpers.audit(options, [
- {
- setup: "screenshot " + file.path.replace(/\\/g, "\\\\"),
- check: {
- args: {
- filename: { value: "" + file.path },
- fullpage: { value: false },
- clipboard: { value: false },
- },
- },
- exec: {
- output: new RegExp("^Saved to "),
- },
- post: function () {
- // Bug 849168: screenshot command tests fail in try but not locally
- // ok(file.exists(), "Screenshot file exists");
-
- if (file.exists()) {
- file.remove(false);
- }
- }
- },
- ]);
-
- // Test capture to clipboard
- yield helpers.audit(options, [
- {
- setup: "screenshot --clipboard",
- check: {
- args: {
- clipboard: { value: true },
- },
- },
- exec: {
- output: new RegExp("^Copied to clipboard.$"),
- },
- post: Task.async(function* () {
- let imgSize1 = yield getImageSizeFromClipboard();
- yield ContentTask.spawn(browser, imgSize1, function* (imgSize) {
- Assert.equal(imgSize.width, content.innerWidth,
- "Image width matches window size");
- Assert.equal(imgSize.height, content.innerHeight,
- "Image height matches window size");
- });
- })
- },
- {
- setup: "screenshot --fullpage --clipboard",
- check: {
- args: {
- fullpage: { value: true },
- clipboard: { value: true },
- },
- },
- exec: {
- output: new RegExp("^Copied to clipboard.$"),
- },
- post: Task.async(function* () {
- let imgSize1 = yield getImageSizeFromClipboard();
- yield ContentTask.spawn(browser, imgSize1, function* (imgSize) {
- Assert.equal(imgSize.width,
- content.innerWidth + content.scrollMaxX - content.scrollMinX,
- "Image width matches page size");
- Assert.equal(imgSize.height,
- content.innerHeight + content.scrollMaxY - content.scrollMinY,
- "Image height matches page size");
- });
- })
- },
- {
- setup: "screenshot --selector img#testImage --clipboard",
- check: {
- args: {
- clipboard: { value: true },
- },
- },
- exec: {
- output: new RegExp("^Copied to clipboard.$"),
- },
- post: Task.async(function* () {
- let imgSize1 = yield getImageSizeFromClipboard();
- yield ContentTask.spawn(browser, imgSize1, function* (imgSize) {
- let img = content.document.querySelector("img#testImage");
- Assert.equal(imgSize.width, img.clientWidth,
- "Image width matches element size");
- Assert.equal(imgSize.height, img.clientHeight,
- "Image height matches element size");
- });
- })
- },
- ]);
-
- // Trigger scrollbars by forcing document to overflow
- // This only affects results on OSes with scrollbars that reduce document size
- // (non-floating scrollbars). With default OS settings, this means Windows
- // and Linux are affected, but Mac is not. For Mac to exhibit this behavior,
- // change System Preferences -> General -> Show scroll bars to Always.
- yield ContentTask.spawn(browser, {}, function* () {
- content.document.body.classList.add("overflow");
- });
-
- let scrollbarSize = yield ContentTask.spawn(browser, {}, function* () {
- const winUtils = content.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindowUtils);
- let scrollbarHeight = {};
- let scrollbarWidth = {};
- winUtils.getScrollbarSize(true, scrollbarWidth, scrollbarHeight);
- return {
- width: scrollbarWidth.value,
- height: scrollbarHeight.value,
- };
- });
-
- info(`Scrollbar size: ${scrollbarSize.width}x${scrollbarSize.height}`);
-
- // Test capture to clipboard in presence of scrollbars
- yield helpers.audit(options, [
- {
- setup: "screenshot --clipboard",
- check: {
- args: {
- clipboard: { value: true },
- },
- },
- exec: {
- output: new RegExp("^Copied to clipboard.$"),
- },
- post: Task.async(function* () {
- let imgSize1 = yield getImageSizeFromClipboard();
- imgSize1.scrollbarWidth = scrollbarSize.width;
- imgSize1.scrollbarHeight = scrollbarSize.height;
- yield ContentTask.spawn(browser, imgSize1, function* (imgSize) {
- Assert.equal(imgSize.width, content.innerWidth - imgSize.scrollbarWidth,
- "Image width matches window size minus scrollbar size");
- Assert.equal(imgSize.height, content.innerHeight - imgSize.scrollbarHeight,
- "Image height matches window size minus scrollbar size");
- });
- })
- },
- {
- setup: "screenshot --fullpage --clipboard",
- check: {
- args: {
- fullpage: { value: true },
- clipboard: { value: true },
- },
- },
- exec: {
- output: new RegExp("^Copied to clipboard.$"),
- },
- post: Task.async(function* () {
- let imgSize1 = yield getImageSizeFromClipboard();
- imgSize1.scrollbarWidth = scrollbarSize.width;
- imgSize1.scrollbarHeight = scrollbarSize.height;
- yield ContentTask.spawn(browser, imgSize1, function* (imgSize) {
- Assert.equal(imgSize.width,
- (content.innerWidth + content.scrollMaxX -
- content.scrollMinX) - imgSize.scrollbarWidth,
- "Image width matches page size minus scrollbar size");
- Assert.equal(imgSize.height,
- (content.innerHeight + content.scrollMaxY -
- content.scrollMinY) - imgSize.scrollbarHeight,
- "Image height matches page size minus scrollbar size");
- });
- })
- },
- {
- setup: "screenshot --selector img#testImage --clipboard",
- check: {
- args: {
- clipboard: { value: true },
- },
- },
- exec: {
- output: new RegExp("^Copied to clipboard.$"),
- },
- post: Task.async(function* () {
- let imgSize1 = yield getImageSizeFromClipboard();
- yield ContentTask.spawn(browser, imgSize1, function* (imgSize) {
- let img = content.document.querySelector("img#testImage");
- Assert.equal(imgSize.width, img.clientWidth,
- "Image width matches element size");
- Assert.equal(imgSize.height, img.clientHeight,
- "Image height matches element size");
- });
- })
- },
- ]);
-
- yield helpers.closeToolbar(options);
- yield helpers.closeTab(options);
-}
-
-function addWindow(windowOptions) {
- return new Promise(resolve => {
- let win = OpenBrowserWindow(windowOptions);
-
- // This feels hacky, we should refactor it
- whenDelayedStartupFinished(win, () => {
- // Would like to get rid of this executeSoon, but without it the url
- // (TEST_URI) provided in addTabWithToolbarRunTests hasn't loaded
- executeSoon(() => {
- resolve(win);
- });
- });
- });
-}
-
-let getImageSizeFromClipboard = Task.async(function* () {
- let clipid = Ci.nsIClipboard;
- let clip = Cc["@mozilla.org/widget/clipboard;1"].getService(clipid);
- let trans = Cc["@mozilla.org/widget/transferable;1"]
- .createInstance(Ci.nsITransferable);
- let flavor = "image/png";
- trans.init(null);
- trans.addDataFlavor(flavor);
-
- clip.getData(trans, clipid.kGlobalClipboard);
- let data = new Object();
- let dataLength = new Object();
- trans.getTransferData(flavor, data, dataLength);
-
- ok(data.value, "screenshot exists");
- ok(dataLength.value > 0, "screenshot has length");
-
- let image = data.value;
- let dataURI = `data:${flavor};base64,`;
-
- // Due to the differences in how images could be stored in the clipboard the
- // checks below are needed. The clipboard could already provide the image as
- // byte streams, but also as pointer, or as image container. If it's not
- // possible obtain a byte stream, the function returns `null`.
- if (image instanceof Ci.nsISupportsInterfacePointer) {
- image = image.data;
- }
-
- if (image instanceof Ci.imgIContainer) {
- image = Cc["@mozilla.org/image/tools;1"]
- .getService(Ci.imgITools)
- .encodeImage(image, flavor);
- }
-
- if (image instanceof Ci.nsIInputStream) {
- let binaryStream = Cc["@mozilla.org/binaryinputstream;1"]
- .createInstance(Ci.nsIBinaryInputStream);
- binaryStream.setInputStream(image);
- let rawData = binaryStream.readBytes(binaryStream.available());
- let charCodes = Array.from(rawData, c => c.charCodeAt(0) & 0xff);
- let encodedData = String.fromCharCode(...charCodes);
- encodedData = btoa(encodedData);
- dataURI = dataURI + encodedData;
- } else {
- throw new Error("Unable to read image data");
- }
-
- let img = document.createElementNS("http://www.w3.org/1999/xhtml", "img");
-
- let loaded = new Promise(resolve => {
- img.addEventListener("load", function () {
- resolve();
- }, {once: true});
- });
-
- img.src = dataURI;
- document.documentElement.appendChild(img);
- yield loaded;
- img.remove();
-
- return {
- width: img.width,
- height: img.height,
- };
-});
deleted file mode 100644
--- a/devtools/client/commandline/test/browser_gcli_telemetry.js
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/* global helpers, btoa, whenDelayedStartupFinished, OpenBrowserWindow */
-
-// Test that GCLI telemetry works properly
-
-"use strict";
-
-const TEST_URI = "data:text/html;charset=utf-8,browser_gcli_telemetry.js";
-const COMMAND_HISTOGRAM_ID = "DEVTOOLS_GCLI_COMMANDS_KEYED";
-
-function test() {
- return Task.spawn(spawnTest).then(finish, helpers.handleError);
-}
-
-function* spawnTest() {
- let options = yield helpers.openTab(TEST_URI);
- let Telemetry = loadTelemetryAndRecordLogs();
-
- yield helpers.openToolbar(options);
-
- yield helpers.audit(options, [
- {
- setup: "addon list<RETURN>"
- },
- {
- setup: "appcache clear<RETURN>"
- },
- {
- setup: "clear<RETURN>"
- },
- {
- setup: "console clear<RETURN>"
- },
- {
- setup: "cookie list<RETURN>"
- },
- {
- setup: "help<RETURN>"
- },
- {
- setup: "help addon<RETURN>"
- },
- {
- setup: "screenshot<RETURN>"
- },
- {
- setup: "listen 6000<RETURN>"
- },
- {
- setup: "unlisten<RETURN>"
- },
- {
- setup: "context addon<RETURN>"
- },
- ]);
-
- let results = Telemetry.prototype.telemetryInfo;
-
- checkTelemetryResults(results);
- stopRecordingTelemetryLogs(Telemetry);
-
- info("Closing Developer Toolbar");
- yield helpers.closeToolbar(options);
-
- info("Closing tab");
- yield helpers.closeTab(options);
-}
-
-/**
- * Load the Telemetry utils, then stub Telemetry.prototype.log and
- * Telemetry.prototype.logKeyed in order to record everything that's logged in
- * it.
- * Store all recordings in Telemetry.telemetryInfo.
- * @return {Telemetry}
- */
-function loadTelemetryAndRecordLogs() {
- info("Mock the Telemetry log function to record logged information");
-
- let Telemetry = require("devtools/client/shared/telemetry");
- Telemetry.prototype.telemetryInfo = {};
- Telemetry.prototype._oldlog = Telemetry.prototype.log;
- Telemetry.prototype.log = function (histogramId, value) {
- if (!this.telemetryInfo) {
- // Telemetry instance still in use after stopRecordingTelemetryLogs
- return;
- }
- if (histogramId) {
- if (!this.telemetryInfo[histogramId]) {
- this.telemetryInfo[histogramId] = [];
- }
- this.telemetryInfo[histogramId].push(value);
- }
- };
- Telemetry.prototype._oldlogScalar = Telemetry.prototype.logScalar;
- Telemetry.prototype.logScalar = Telemetry.prototype.log;
- Telemetry.prototype._oldlogKeyed = Telemetry.prototype.logKeyed;
- Telemetry.prototype.logKeyed = function (histogramId, key, value) {
- this.log(`${histogramId}|${key}`, value);
- };
-
- return Telemetry;
-}
-
-/**
- * Stop recording the Telemetry logs and put back the utils as it was before.
- * @param {Telemetry} Required Telemetry
- * Telemetry object that needs to be stopped.
- */
-function stopRecordingTelemetryLogs(Telemetry) {
- info("Stopping Telemetry");
- Telemetry.prototype.log = Telemetry.prototype._oldlog;
- Telemetry.prototype.logScalar = Telemetry.prototype._oldlogScalar;
- Telemetry.prototype.logKeyed = Telemetry.prototype._oldlogKeyed;
- delete Telemetry.prototype._oldlog;
- delete Telemetry.prototype._oldlogScalar;
- delete Telemetry.prototype._oldlogKeyed;
- delete Telemetry.prototype.telemetryInfo;
-}
-
-function checkTelemetryResults(results) {
- let prefix = COMMAND_HISTOGRAM_ID + "|";
- let keys = Object.keys(results).filter(result => {
- return result.startsWith(prefix);
- });
-
- let commands = [
- "addon list",
- "appcache clear",
- "clear",
- "console clear",
- "cookie list",
- "screenshot",
- "listen",
- "unlisten",
- "context",
- "help"
- ];
-
- for (let command of commands) {
- let key = prefix + command;
-
- switch (key) {
- case "DEVTOOLS_GCLI_COMMANDS_KEYED|addon list":
- case "DEVTOOLS_GCLI_COMMANDS_KEYED|appcache clear":
- case "DEVTOOLS_GCLI_COMMANDS_KEYED|clear":
- case "DEVTOOLS_GCLI_COMMANDS_KEYED|console clear":
- case "DEVTOOLS_GCLI_COMMANDS_KEYED|cookie list":
- case "DEVTOOLS_GCLI_COMMANDS_KEYED|screenshot":
- case "DEVTOOLS_GCLI_COMMANDS_KEYED|listen":
- case "DEVTOOLS_GCLI_COMMANDS_KEYED|unlisten":
- case "DEVTOOLS_GCLI_COMMANDS_KEYED|context":
- is(results[key].length, 1, `${key} is correct`);
- break;
- case "DEVTOOLS_GCLI_COMMANDS_KEYED|help":
- is(results[key].length, 2, `${key} is correct`);
- break;
- default:
- ok(false, `No telemetry pings were sent for command "${command}"`);
- }
- }
-}