Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | * http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | Components.utils.import("resource://gre/modules/PlacesUtils.jsm"); |
michael@0 | 5 | Components.utils.import("resource://gre/modules/NetUtil.jsm"); |
michael@0 | 6 | |
michael@0 | 7 | function test() { |
michael@0 | 8 | waitForExplicitFinish(); |
michael@0 | 9 | open_preferences(runTest); |
michael@0 | 10 | } |
michael@0 | 11 | |
michael@0 | 12 | function runTest(win) { |
michael@0 | 13 | is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded"); |
michael@0 | 14 | |
michael@0 | 15 | let tab = win.document; |
michael@0 | 16 | let elements = tab.getElementById("mainPrefPane").children; |
michael@0 | 17 | |
michael@0 | 18 | //Test if general pane is opened correctly |
michael@0 | 19 | win.gotoPref("paneGeneral"); |
michael@0 | 20 | for (let element of elements) { |
michael@0 | 21 | let attributeValue = element.getAttribute("data-category"); |
michael@0 | 22 | if (attributeValue == "paneGeneral") { |
michael@0 | 23 | is_element_visible(element, "General elements should be visible"); |
michael@0 | 24 | } else { |
michael@0 | 25 | is_element_hidden(element, "Non-General elements should be hidden"); |
michael@0 | 26 | } |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | //Test if tabs pane is opened correctly |
michael@0 | 30 | win.gotoPref("paneTabs"); |
michael@0 | 31 | for (let element of elements) { |
michael@0 | 32 | let attributeValue = element.getAttribute("data-category"); |
michael@0 | 33 | if (attributeValue == "paneTabs") { |
michael@0 | 34 | is_element_visible(element, "Tab elements should be visible"); |
michael@0 | 35 | } else { |
michael@0 | 36 | is_element_hidden(element, "Non-Tab elements should be hidden"); |
michael@0 | 37 | } |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | //Test if content pane is opened correctly |
michael@0 | 41 | win.gotoPref("paneContent"); |
michael@0 | 42 | for (let element of elements) { |
michael@0 | 43 | let attributeValue = element.getAttribute("data-category"); |
michael@0 | 44 | if (attributeValue == "paneContent") { |
michael@0 | 45 | is_element_visible(element, "Content elements should be visible"); |
michael@0 | 46 | } else { |
michael@0 | 47 | is_element_hidden(element, "Non-Content elements should be hidden"); |
michael@0 | 48 | } |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | //Test if applications pane is opened correctly |
michael@0 | 52 | win.gotoPref("paneApplications"); |
michael@0 | 53 | for (let element of elements) { |
michael@0 | 54 | let attributeValue = element.getAttribute("data-category"); |
michael@0 | 55 | if (attributeValue == "paneApplications") { |
michael@0 | 56 | is_element_visible(element, "Application elements should be visible"); |
michael@0 | 57 | } else { |
michael@0 | 58 | is_element_hidden(element, "Non-Application elements should be hidden"); |
michael@0 | 59 | } |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | //Test if privacy pane is opened correctly |
michael@0 | 63 | win.gotoPref("panePrivacy"); |
michael@0 | 64 | for (let element of elements) { |
michael@0 | 65 | let attributeValue = element.getAttribute("data-category"); |
michael@0 | 66 | if (attributeValue == "panePrivacy") { |
michael@0 | 67 | is_element_visible(element, "Privacy elements should be visible"); |
michael@0 | 68 | } else { |
michael@0 | 69 | is_element_hidden(element, "Non-Privacy elements should be hidden"); |
michael@0 | 70 | } |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | //Test if security pane is opened correctly |
michael@0 | 74 | win.gotoPref("paneSecurity"); |
michael@0 | 75 | for (let element of elements) { |
michael@0 | 76 | let attributeValue = element.getAttribute("data-category"); |
michael@0 | 77 | if (attributeValue == "paneSecurity") { |
michael@0 | 78 | is_element_visible(element, "Security elements should be visible"); |
michael@0 | 79 | } else { |
michael@0 | 80 | is_element_hidden(element, "Non-Security elements should be hidden"); |
michael@0 | 81 | } |
michael@0 | 82 | } |
michael@0 | 83 | |
michael@0 | 84 | //Test if sync pane is opened correctly |
michael@0 | 85 | win.gotoPref("paneSync"); |
michael@0 | 86 | for (let element of elements) { |
michael@0 | 87 | let attributeValue = element.getAttribute("data-category"); |
michael@0 | 88 | if (attributeValue == "paneSync") { |
michael@0 | 89 | is_element_visible(element, "Sync elements should be visible"); |
michael@0 | 90 | } else { |
michael@0 | 91 | is_element_hidden(element, "Non-Sync elements should be hidden"); |
michael@0 | 92 | } |
michael@0 | 93 | } |
michael@0 | 94 | |
michael@0 | 95 | //Test if advanced pane is opened correctly |
michael@0 | 96 | win.gotoPref("paneAdvanced"); |
michael@0 | 97 | for (let element of elements) { |
michael@0 | 98 | let attributeValue = element.getAttribute("data-category"); |
michael@0 | 99 | if (attributeValue == "paneAdvanced") { |
michael@0 | 100 | is_element_visible(element, "Advanced elements should be visible"); |
michael@0 | 101 | } else { |
michael@0 | 102 | is_element_hidden(element, "Non-Advanced elements should be hidden"); |
michael@0 | 103 | } |
michael@0 | 104 | } |
michael@0 | 105 | |
michael@0 | 106 | gBrowser.removeCurrentTab(); |
michael@0 | 107 | win.close(); |
michael@0 | 108 | finish(); |
michael@0 | 109 | } |