1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/newtab/browser_newtab_tabsync.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/* 1.8 + * These tests make sure that all changes that are made to a specific 1.9 + * 'New Tab Page' are synchronized with all other open 'New Tab Pages' 1.10 + * automatically. All about:newtab pages should always be in the same 1.11 + * state. 1.12 + */ 1.13 +function runTests() { 1.14 + // Disabled until bug 716543 is fixed. 1.15 + return; 1.16 + 1.17 + yield setLinks("0,1,2,3,4,5,6,7,8,9"); 1.18 + setPinnedLinks(",1"); 1.19 + 1.20 + yield addNewTabPageTab(); 1.21 + checkGrid("0,1p,2,3,4,5,6,7,8"); 1.22 + 1.23 + let resetButton = getContentDocument().getElementById("toolbar-button-reset"); 1.24 + ok(!resetButton.hasAttribute("modified"), "page is not modified"); 1.25 + 1.26 + let oldSites = getGrid().sites; 1.27 + let oldResetButton = resetButton; 1.28 + 1.29 + // create the new tab page 1.30 + yield addNewTabPageTab(); 1.31 + checkGrid("0,1p,2,3,4,5,6,7,8"); 1.32 + 1.33 + resetButton = getContentDocument().getElementById("toolbar-button-reset"); 1.34 + ok(!resetButton.hasAttribute("modified"), "page is not modified"); 1.35 + 1.36 + // unpin a cell 1.37 + yield unpinCell(1); 1.38 + checkGrid("0,1,2,3,4,5,6,7,8"); 1.39 + checkGrid("0,1,2,3,4,5,6,7,8", oldSites); 1.40 + 1.41 + // remove a cell 1.42 + yield blockCell(1); 1.43 + checkGrid("0,2,3,4,5,6,7,8,9"); 1.44 + checkGrid("0,2,3,4,5,6,7,8,9", oldSites); 1.45 + ok(resetButton.hasAttribute("modified"), "page is modified"); 1.46 + ok(oldResetButton.hasAttribute("modified"), "page is modified"); 1.47 + 1.48 + // insert a new cell by dragging 1.49 + yield simulateExternalDrop(1); 1.50 + checkGrid("0,99p,2,3,4,5,6,7,8"); 1.51 + checkGrid("0,99p,2,3,4,5,6,7,8", oldSites); 1.52 + 1.53 + // drag a cell around 1.54 + yield simulateDrop(2, 1); 1.55 + checkGrid("0,2p,99p,3,4,5,6,7,8"); 1.56 + checkGrid("0,2p,99p,3,4,5,6,7,8", oldSites); 1.57 + 1.58 + // reset the new tab page 1.59 + yield getContentWindow().gToolbar.reset(TestRunner.next); 1.60 + checkGrid("0,1,2,3,4,5,6,7,8"); 1.61 + checkGrid("0,1,2,3,4,5,6,7,8", oldSites); 1.62 + ok(!resetButton.hasAttribute("modified"), "page is not modified"); 1.63 + ok(!oldResetButton.hasAttribute("modified"), "page is not modified"); 1.64 +}