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

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:0f1016b2c8c1
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
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;
13
14 yield setLinks("0,1,2,3,4,5,6,7,8,9");
15 setPinnedLinks(",1");
16
17 yield addNewTabPageTab();
18 checkGrid("0,1p,2,3,4,5,6,7,8");
19
20 let resetButton = getContentDocument().getElementById("toolbar-button-reset");
21 ok(!resetButton.hasAttribute("modified"), "page is not modified");
22
23 let oldSites = getGrid().sites;
24 let oldResetButton = resetButton;
25
26 // create the new tab page
27 yield addNewTabPageTab();
28 checkGrid("0,1p,2,3,4,5,6,7,8");
29
30 resetButton = getContentDocument().getElementById("toolbar-button-reset");
31 ok(!resetButton.hasAttribute("modified"), "page is not modified");
32
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);
37
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");
44
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);
49
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);
54
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