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.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 let win;
5 let cw;
7 function test() {
8 waitForExplicitFinish();
10 let onLoad = function (tvwin) {
11 win = tvwin;
12 registerCleanupFunction(function () win.close());
13 win.gBrowser.loadOneTab("http://mochi.test:8888/", {inBackground: true});
14 };
16 let onShow = function () {
17 cw = win.TabView.getContentWindow();
18 ok(win.TabView.isVisible(), "Tab View is visible");
19 afterAllTabItemsUpdated(testOne, win);
20 };
22 newWindowWithTabView(onShow, onLoad);
23 }
25 function testOne() {
26 hideSearchWhenSearchEnabled(testTwo);
27 // press cmd/ctrl F
28 EventUtils.synthesizeKey("f", {accelKey: true}, cw);
29 }
31 function testTwo() {
32 hideSearchWhenSearchEnabled(testThree);
33 // press /
34 EventUtils.synthesizeKey("VK_SLASH", {}, cw);
35 }
37 function testThree() {
38 ok(win.TabView.isVisible(), "Tab View is visible");
39 // create another group with a tab.
40 let groupItem = createGroupItemWithBlankTabs(win, 300, 300, 200, 1);
41 is(cw.UI.getActiveTab(), groupItem.getChild(0),
42 "The active tab is newly created tab item");
44 whenSearchIsEnabled(function () {
45 let doc = cw.document;
46 let searchBox = cw.iQ("#searchbox");
47 let hasFocus = doc.hasFocus() && doc.activeElement == searchBox[0];
48 ok(hasFocus, "The search box has focus");
50 let tab = win.gBrowser.tabs[1];
51 searchBox.val(tab._tabViewTabItem.$tabTitle[0].innerHTML);
53 cw.Search.perform();
55 whenTabViewIsHidden(function () {
56 is(tab, win.gBrowser.selectedTab, "The search result tab is shown");
57 finish()
58 }, win);
60 // use the tabview menu (the same as pressing cmd/ctrl + e)
61 win.document.getElementById("menu_tabview").doCommand();
62 }, win);
63 EventUtils.synthesizeKey("VK_SLASH", {}, cw);
64 }
66 function hideSearchWhenSearchEnabled(callback) {
67 whenSearchIsEnabled(function() {
68 hideSearch(callback, win);
69 }, win);
70 }