browser_storage_sidebar.js (2907B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 // Test to verify that the sidebar opens, closes and updates 6 // This test is not testing the values in the sidebar, being tested in _values 7 8 // Format: [ 9 // <id of the table item to click> or <id array for tree item to select> or 10 // null to press Escape, 11 // <do we wait for the async "sidebar-updated" event>, 12 // <is the sidebar open> 13 // ] 14 15 "use strict"; 16 17 const testCases = [ 18 { 19 location: ["cookies", "https://sectest1.example.org"], 20 sidebarHidden: true, 21 }, 22 { 23 location: getCookieId("cs2", ".example.org", "/"), 24 sidebarHidden: false, 25 }, 26 { 27 sendEscape: true, 28 }, 29 { 30 location: getCookieId("cs2", ".example.org", "/"), 31 sidebarHidden: true, 32 }, 33 { 34 location: getCookieId("uc1", ".example.org", "/"), 35 sidebarHidden: true, 36 }, 37 { 38 location: getCookieId("uc1", ".example.org", "/"), 39 sidebarHidden: true, 40 }, 41 42 { 43 location: ["localStorage", "http://sectest1.example.org"], 44 sidebarHidden: true, 45 }, 46 { 47 location: "iframe-u-ls1", 48 sidebarHidden: false, 49 }, 50 { 51 location: "iframe-u-ls1", 52 sidebarHidden: false, 53 }, 54 { 55 sendEscape: true, 56 }, 57 58 { 59 location: ["sessionStorage", "http://test1.example.org"], 60 sidebarHidden: true, 61 }, 62 { 63 location: "ss1", 64 sidebarHidden: false, 65 }, 66 { 67 sendEscape: true, 68 }, 69 70 { 71 location: ["indexedDB", "http://test1.example.org"], 72 sidebarHidden: true, 73 }, 74 { 75 location: "idb2 (default)", 76 sidebarHidden: false, 77 }, 78 79 { 80 location: [ 81 "indexedDB", 82 "http://test1.example.org", 83 "idb2 (default)", 84 "obj3", 85 ], 86 sidebarHidden: true, 87 }, 88 89 { 90 location: ["indexedDB", "https://sectest1.example.org", "idb-s2 (default)"], 91 sidebarHidden: true, 92 }, 93 { 94 location: "obj-s2", 95 sidebarHidden: false, 96 }, 97 { 98 sendEscape: true, 99 }, 100 { 101 location: "obj-s2", 102 sidebarHidden: true, 103 }, 104 ]; 105 106 add_task(async function () { 107 // storage-listings.html explicitly mixes secure and insecure frames. 108 // We should not enforce https for tests using this page. 109 await pushPref("dom.security.https_first", false); 110 111 await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); 112 113 for (const test of testCases) { 114 const { location, sidebarHidden, sendEscape } = test; 115 116 info("running " + JSON.stringify(test)); 117 118 if (Array.isArray(location)) { 119 await selectTreeItem(location); 120 } else if (location) { 121 await selectTableItem(location); 122 } 123 124 if (sendEscape) { 125 EventUtils.sendKey("ESCAPE", gPanelWindow); 126 } else { 127 is( 128 gUI.sidebar.hidden, 129 sidebarHidden, 130 "correct visibility state of sidebar." 131 ); 132 } 133 134 info("-".repeat(80)); 135 } 136 });