Wed, 31 Dec 2014 06:09:35 +0100
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 | function test() { |
michael@0 | 5 | let win; |
michael@0 | 6 | let cw; |
michael@0 | 7 | |
michael@0 | 8 | let getGroupItem = function (index) { |
michael@0 | 9 | return cw.GroupItems.groupItems[index]; |
michael@0 | 10 | } |
michael@0 | 11 | |
michael@0 | 12 | let newWindow = function (test) { |
michael@0 | 13 | newWindowWithTabView(function (tvwin) { |
michael@0 | 14 | registerCleanupFunction(function () { |
michael@0 | 15 | if (!tvwin.closed) |
michael@0 | 16 | tvwin.close(); |
michael@0 | 17 | }); |
michael@0 | 18 | |
michael@0 | 19 | win = tvwin; |
michael@0 | 20 | cw = win.TabView.getContentWindow(); |
michael@0 | 21 | |
michael@0 | 22 | // setup group items |
michael@0 | 23 | getGroupItem(0).setSize(200, 200, true); |
michael@0 | 24 | createGroupItemWithBlankTabs(win, 200, 200, 300, 1); |
michael@0 | 25 | |
michael@0 | 26 | test(); |
michael@0 | 27 | }); |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | let assertNumberOfTabsInGroupItem = function (groupItem, numTabs) { |
michael@0 | 31 | is(groupItem.getChildren().length, numTabs, |
michael@0 | 32 | 'there are ' + numTabs + ' tabs in this groupItem'); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | let testDragOnHiddenGroup = function () { |
michael@0 | 36 | let groupItem = getGroupItem(1); |
michael@0 | 37 | |
michael@0 | 38 | hideGroupItem(groupItem, function () { |
michael@0 | 39 | let drag = groupItem.getChild(0).container; |
michael@0 | 40 | let drop = groupItem.$undoContainer[0]; |
michael@0 | 41 | |
michael@0 | 42 | assertNumberOfTabsInGroupItem(groupItem, 1); |
michael@0 | 43 | |
michael@0 | 44 | EventUtils.synthesizeMouseAtCenter(drag, {type: 'mousedown'}, cw); |
michael@0 | 45 | EventUtils.synthesizeMouseAtCenter(drop, {type: 'mousemove'}, cw); |
michael@0 | 46 | EventUtils.synthesizeMouseAtCenter(drop, {type: 'mouseup'}, cw); |
michael@0 | 47 | |
michael@0 | 48 | assertNumberOfTabsInGroupItem(groupItem, 1); |
michael@0 | 49 | |
michael@0 | 50 | win.close(); |
michael@0 | 51 | newWindow(testDragOnVisibleGroup); |
michael@0 | 52 | }); |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | let testDragOnVisibleGroup = function () { |
michael@0 | 56 | let groupItem = getGroupItem(0); |
michael@0 | 57 | let drag = getGroupItem(1).getChild(0).container; |
michael@0 | 58 | let drop = groupItem.container; |
michael@0 | 59 | |
michael@0 | 60 | assertNumberOfTabsInGroupItem(groupItem, 1); |
michael@0 | 61 | |
michael@0 | 62 | EventUtils.synthesizeMouseAtCenter(drag, {type: 'mousedown'}, cw); |
michael@0 | 63 | EventUtils.synthesizeMouseAtCenter(drop, {type: 'mousemove'}, cw); |
michael@0 | 64 | EventUtils.synthesizeMouseAtCenter(drop, {type: 'mouseup'}, cw); |
michael@0 | 65 | |
michael@0 | 66 | assertNumberOfTabsInGroupItem(groupItem, 2); |
michael@0 | 67 | |
michael@0 | 68 | win.close(); |
michael@0 | 69 | finish(); |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | waitForExplicitFinish(); |
michael@0 | 73 | newWindow(testDragOnHiddenGroup); |
michael@0 | 74 | } |