Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | const kWidgetId = "test-private-browsing-customize-mode-widget"; |
michael@0 | 8 | |
michael@0 | 9 | // Add a widget via the API with showInPrivateBrowsing set to false |
michael@0 | 10 | // and ensure it does not appear in the list of unused widgets in private |
michael@0 | 11 | // windows. |
michael@0 | 12 | add_task(function testPrivateBrowsingCustomizeModeWidget() { |
michael@0 | 13 | CustomizableUI.createWidget({ |
michael@0 | 14 | id: kWidgetId, |
michael@0 | 15 | showInPrivateBrowsing: false |
michael@0 | 16 | }); |
michael@0 | 17 | |
michael@0 | 18 | let normalWidgetArray = CustomizableUI.getUnusedWidgets(gNavToolbox.palette); |
michael@0 | 19 | normalWidgetArray = normalWidgetArray.map((w) => w.id); |
michael@0 | 20 | ok(normalWidgetArray.indexOf(kWidgetId) > -1, |
michael@0 | 21 | "Widget should appear as unused in non-private window"); |
michael@0 | 22 | |
michael@0 | 23 | let privateWindow = yield openAndLoadWindow({private: true}); |
michael@0 | 24 | let privateWidgetArray = CustomizableUI.getUnusedWidgets(privateWindow.gNavToolbox.palette); |
michael@0 | 25 | privateWidgetArray = privateWidgetArray.map((w) => w.id); |
michael@0 | 26 | is(privateWidgetArray.indexOf(kWidgetId), -1, |
michael@0 | 27 | "Widget should not appear as unused in private window"); |
michael@0 | 28 | yield promiseWindowClosed(privateWindow); |
michael@0 | 29 | |
michael@0 | 30 | CustomizableUI.destroyWidget(kWidgetId); |
michael@0 | 31 | }); |
michael@0 | 32 | |
michael@0 | 33 | add_task(function asyncCleanup() { |
michael@0 | 34 | yield resetCustomization(); |
michael@0 | 35 | }); |