From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../commandline/test/browser_cmd_appcache_valid.js | 173 +++++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 devtools/client/commandline/test/browser_cmd_appcache_valid.js (limited to 'devtools/client/commandline/test/browser_cmd_appcache_valid.js') diff --git a/devtools/client/commandline/test/browser_cmd_appcache_valid.js b/devtools/client/commandline/test/browser_cmd_appcache_valid.js new file mode 100644 index 000000000..83aa9ca8f --- /dev/null +++ b/devtools/client/commandline/test/browser_cmd_appcache_valid.js @@ -0,0 +1,173 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Tests that the appcache commands works as they should + +const TEST_URI = "http://sub1.test2.example.com/browser/devtools/client/" + + "commandline/test/browser_cmd_appcache_valid_index.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.html + markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV", + 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"), "page1 is not contained in output"); + ok(!text.includes("page3"), "page1 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.html + markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV", + status: "VALID", + args: {} + }, + }, + ]); + + yield helpers.closeToolbar(options); + yield helpers.closeTab(options); +} -- cgit v1.2.3