browser/base/content/test/newtab/browser_newtab_tabsync.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /*
     5  * These tests make sure that all changes that are made to a specific
     6  * 'New Tab Page' are synchronized with all other open 'New Tab Pages'
     7  * automatically. All about:newtab pages should always be in the same
     8  * state.
     9  */
    10 function runTests() {
    11   // Disabled until bug 716543 is fixed.
    12   return;
    14   yield setLinks("0,1,2,3,4,5,6,7,8,9");
    15   setPinnedLinks(",1");
    17   yield addNewTabPageTab();
    18   checkGrid("0,1p,2,3,4,5,6,7,8");
    20   let resetButton = getContentDocument().getElementById("toolbar-button-reset");
    21   ok(!resetButton.hasAttribute("modified"), "page is not modified");
    23   let oldSites = getGrid().sites;
    24   let oldResetButton = resetButton;
    26   // create the new tab page
    27   yield addNewTabPageTab();
    28   checkGrid("0,1p,2,3,4,5,6,7,8");
    30   resetButton = getContentDocument().getElementById("toolbar-button-reset");
    31   ok(!resetButton.hasAttribute("modified"), "page is not modified");
    33   // unpin a cell
    34   yield unpinCell(1);
    35   checkGrid("0,1,2,3,4,5,6,7,8");
    36   checkGrid("0,1,2,3,4,5,6,7,8", oldSites);
    38   // remove a cell
    39   yield blockCell(1);
    40   checkGrid("0,2,3,4,5,6,7,8,9");
    41   checkGrid("0,2,3,4,5,6,7,8,9", oldSites);
    42   ok(resetButton.hasAttribute("modified"), "page is modified");
    43   ok(oldResetButton.hasAttribute("modified"), "page is modified");
    45   // insert a new cell by dragging
    46   yield simulateExternalDrop(1);
    47   checkGrid("0,99p,2,3,4,5,6,7,8");
    48   checkGrid("0,99p,2,3,4,5,6,7,8", oldSites);
    50   // drag a cell around
    51   yield simulateDrop(2, 1);
    52   checkGrid("0,2p,99p,3,4,5,6,7,8");
    53   checkGrid("0,2p,99p,3,4,5,6,7,8", oldSites);
    55   // reset the new tab page
    56   yield getContentWindow().gToolbar.reset(TestRunner.next);
    57   checkGrid("0,1,2,3,4,5,6,7,8");
    58   checkGrid("0,1,2,3,4,5,6,7,8", oldSites);
    59   ok(!resetButton.hasAttribute("modified"), "page is not modified");
    60   ok(!oldResetButton.hasAttribute("modified"), "page is not modified");
    61 }

mercurial