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.

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

mercurial