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 the tab view |
michael@0 | 8 | window.addEventListener("tabviewshown", onTabViewWindowLoaded, false); |
michael@0 | 9 | ok(!TabView.isVisible(), "Tab View is hidden"); |
michael@0 | 10 | TabView.toggle(); |
michael@0 | 11 | } |
michael@0 | 12 | |
michael@0 | 13 | function onTabViewWindowLoaded() { |
michael@0 | 14 | window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false); |
michael@0 | 15 | |
michael@0 | 16 | ok(TabView.isVisible(), "Tab View is visible"); |
michael@0 | 17 | |
michael@0 | 18 | let contentWindow = document.getElementById("tab-view").contentWindow; |
michael@0 | 19 | let searchButton = contentWindow.document.getElementById("searchbutton"); |
michael@0 | 20 | |
michael@0 | 21 | ok(searchButton, "Search button exists"); |
michael@0 | 22 | |
michael@0 | 23 | let onSearchEnabled = function() { |
michael@0 | 24 | contentWindow.removeEventListener( |
michael@0 | 25 | "tabviewsearchenabled", onSearchEnabled, false); |
michael@0 | 26 | let search = contentWindow.document.getElementById("search"); |
michael@0 | 27 | ok(search.style.display != "none", "Search is enabled"); |
michael@0 | 28 | escapeTest(contentWindow); |
michael@0 | 29 | } |
michael@0 | 30 | contentWindow.addEventListener("tabviewsearchenabled", onSearchEnabled, |
michael@0 | 31 | false); |
michael@0 | 32 | // enter search mode |
michael@0 | 33 | EventUtils.sendMouseEvent({ type: "mousedown" }, searchButton, |
michael@0 | 34 | contentWindow); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | function escapeTest(contentWindow) { |
michael@0 | 38 | let onSearchDisabled = function() { |
michael@0 | 39 | contentWindow.removeEventListener( |
michael@0 | 40 | "tabviewsearchdisabled", onSearchDisabled, false); |
michael@0 | 41 | |
michael@0 | 42 | let search = contentWindow.document.getElementById("search"); |
michael@0 | 43 | ok(search.style.display == "none", "Search is disabled"); |
michael@0 | 44 | toggleTabViewTest(contentWindow); |
michael@0 | 45 | } |
michael@0 | 46 | contentWindow.addEventListener("tabviewsearchdisabled", onSearchDisabled, |
michael@0 | 47 | false); |
michael@0 | 48 | EventUtils.synthesizeKey("VK_ESCAPE", { }, contentWindow); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | function toggleTabViewTest(contentWindow) { |
michael@0 | 52 | let onTabViewHidden = function() { |
michael@0 | 53 | contentWindow.removeEventListener("tabviewhidden", onTabViewHidden, false); |
michael@0 | 54 | |
michael@0 | 55 | ok(!TabView.isVisible(), "Tab View is hidden"); |
michael@0 | 56 | finish(); |
michael@0 | 57 | } |
michael@0 | 58 | contentWindow.addEventListener("tabviewhidden", onTabViewHidden, false); |
michael@0 | 59 | // Use keyboard shortcut to toggle back to browser view |
michael@0 | 60 | EventUtils.synthesizeKey("e", { accelKey: true, shiftKey: true }); |
michael@0 | 61 | } |