browser/components/customizableui/test/browser_945739_showInPrivateBrowsing_customize_mode.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     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/. */
     5 "use strict";
     7 const kWidgetId = "test-private-browsing-customize-mode-widget";
     9 // Add a widget via the API with showInPrivateBrowsing set to false
    10 // and ensure it does not appear in the list of unused widgets in private
    11 // windows.
    12 add_task(function testPrivateBrowsingCustomizeModeWidget() {
    13   CustomizableUI.createWidget({
    14     id: kWidgetId,
    15     showInPrivateBrowsing: false
    16   });
    18   let normalWidgetArray = CustomizableUI.getUnusedWidgets(gNavToolbox.palette);
    19   normalWidgetArray = normalWidgetArray.map((w) => w.id);
    20   ok(normalWidgetArray.indexOf(kWidgetId) > -1,
    21      "Widget should appear as unused in non-private window");
    23   let privateWindow = yield openAndLoadWindow({private: true});
    24   let privateWidgetArray = CustomizableUI.getUnusedWidgets(privateWindow.gNavToolbox.palette);
    25   privateWidgetArray = privateWidgetArray.map((w) => w.id);
    26   is(privateWidgetArray.indexOf(kWidgetId), -1,
    27      "Widget should not appear as unused in private window");
    28   yield promiseWindowClosed(privateWindow);
    30   CustomizableUI.destroyWidget(kWidgetId); 
    31 });
    33 add_task(function asyncCleanup() {
    34   yield resetCustomization();
    35 });

mercurial