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 | waitForExplicitFinish(); |
michael@0 | 6 | |
michael@0 | 7 | // show tab view |
michael@0 | 8 | window.addEventListener("tabviewshown", onTabViewWindowLoaded, false); |
michael@0 | 9 | TabView.toggle(); |
michael@0 | 10 | } |
michael@0 | 11 | |
michael@0 | 12 | function onTabViewWindowLoaded() { |
michael@0 | 13 | window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false); |
michael@0 | 14 | ok(TabView.isVisible(), "Tab View is visible"); |
michael@0 | 15 | |
michael@0 | 16 | let contentWindow = document.getElementById("tab-view").contentWindow; |
michael@0 | 17 | |
michael@0 | 18 | let onTabViewHidden = function() { |
michael@0 | 19 | window.removeEventListener("tabviewhidden", onTabViewHidden, false); |
michael@0 | 20 | |
michael@0 | 21 | // verify exit button worked |
michael@0 | 22 | ok(!TabView.isVisible(), "Tab View is hidden"); |
michael@0 | 23 | |
michael@0 | 24 | // verify that the exit button no longer has focus |
michael@0 | 25 | is(contentWindow.iQ("#exit-button:focus").length, 0, |
michael@0 | 26 | "The exit button doesn't have the focus"); |
michael@0 | 27 | |
michael@0 | 28 | // verify that the keyboard combo works (this is the crux of bug 595518) |
michael@0 | 29 | // Prepare the key combo |
michael@0 | 30 | window.addEventListener("tabviewshown", onTabViewShown, false); |
michael@0 | 31 | EventUtils.synthesizeKey("e", { accelKey: true, shiftKey: true }, contentWindow); |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | let onTabViewShown = function() { |
michael@0 | 35 | window.removeEventListener("tabviewshown", onTabViewShown, false); |
michael@0 | 36 | |
michael@0 | 37 | // test if the key combo worked |
michael@0 | 38 | ok(TabView.isVisible(), "Tab View is visible"); |
michael@0 | 39 | |
michael@0 | 40 | // clean up |
michael@0 | 41 | let endGame = function() { |
michael@0 | 42 | window.removeEventListener("tabviewhidden", endGame, false); |
michael@0 | 43 | |
michael@0 | 44 | ok(!TabView.isVisible(), "Tab View is hidden"); |
michael@0 | 45 | finish(); |
michael@0 | 46 | } |
michael@0 | 47 | window.addEventListener("tabviewhidden", endGame, false); |
michael@0 | 48 | TabView.toggle(); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | window.addEventListener("tabviewhidden", onTabViewHidden, false); |
michael@0 | 52 | |
michael@0 | 53 | // locate exit button |
michael@0 | 54 | let button = contentWindow.document.getElementById("exit-button"); |
michael@0 | 55 | ok(button, "Exit button exists"); |
michael@0 | 56 | |
michael@0 | 57 | // click exit button |
michael@0 | 58 | button.focus(); |
michael@0 | 59 | EventUtils.sendMouseEvent({ type: "click" }, button, contentWindow); |
michael@0 | 60 | } |