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 | let newWin; |
michael@0 | 5 | |
michael@0 | 6 | // ---------- |
michael@0 | 7 | function test() { |
michael@0 | 8 | waitForExplicitFinish(); |
michael@0 | 9 | |
michael@0 | 10 | let panelSelected = false; |
michael@0 | 11 | registerCleanupFunction(function () ok(panelSelected, "panel is selected")); |
michael@0 | 12 | |
michael@0 | 13 | let onLoad = function (win) { |
michael@0 | 14 | registerCleanupFunction(function () win.close()); |
michael@0 | 15 | |
michael@0 | 16 | newWin = win; |
michael@0 | 17 | |
michael@0 | 18 | let onSelect = function(event) { |
michael@0 | 19 | if (deck != event.target) |
michael@0 | 20 | return; |
michael@0 | 21 | |
michael@0 | 22 | let iframe = win.document.getElementById("tab-view"); |
michael@0 | 23 | if (deck.selectedPanel != iframe) |
michael@0 | 24 | return; |
michael@0 | 25 | |
michael@0 | 26 | deck.removeEventListener("select", onSelect, true); |
michael@0 | 27 | panelSelected = true; |
michael@0 | 28 | }; |
michael@0 | 29 | |
michael@0 | 30 | let deck = win.document.getElementById("tab-view-deck"); |
michael@0 | 31 | deck.addEventListener("select", onSelect, true); |
michael@0 | 32 | }; |
michael@0 | 33 | |
michael@0 | 34 | let onShow = function (win) { |
michael@0 | 35 | executeSoon(function() { |
michael@0 | 36 | testMethodToHideAndShowTabView(function() { |
michael@0 | 37 | newWin.document.getElementById("menu_tabview").doCommand(); |
michael@0 | 38 | }, function() { |
michael@0 | 39 | testMethodToHideAndShowTabView(function() { |
michael@0 | 40 | EventUtils.synthesizeKey("E", { accelKey: true, shiftKey: true }, newWin); |
michael@0 | 41 | }, finish); |
michael@0 | 42 | }); |
michael@0 | 43 | }); |
michael@0 | 44 | }; |
michael@0 | 45 | |
michael@0 | 46 | newWindowWithTabView(onShow, onLoad); |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | function testMethodToHideAndShowTabView(executeFunc, callback) { |
michael@0 | 50 | whenTabViewIsHidden(function() { |
michael@0 | 51 | ok(!newWin.TabView.isVisible(), "Tab View is not visible after executing the function"); |
michael@0 | 52 | whenTabViewIsShown(function() { |
michael@0 | 53 | ok(newWin.TabView.isVisible(), "Tab View is visible after executing the function again"); |
michael@0 | 54 | callback(); |
michael@0 | 55 | }, newWin); |
michael@0 | 56 | executeFunc(); |
michael@0 | 57 | }, newWin); |
michael@0 | 58 | executeFunc(); |
michael@0 | 59 | } |