Skip to content
Snippets Groups Projects
Commit b4a153d7 authored by Bellindira Castillo [:bellindira]'s avatar Bellindira Castillo [:bellindira]
Browse files

Bug 806717 - Port browser_tabview_bug650280.js to the new per-tab PB APIs; r=ehsan

DONTBUILD because this is NPOTB for global PB builds

--HG--
rename : browser/components/tabview/test/browser_tabview_bug650280.js => browser/components/tabview/test/browser_tabview_bug650280_perwindowpb.js
parent d1484b46
No related merge requests found
......@@ -106,7 +106,6 @@ _BROWSER_FILES = \
browser_tabview_bug649006.js \
browser_tabview_bug649307.js \
browser_tabview_bug649319.js \
browser_tabview_bug650280.js \
browser_tabview_bug650573.js \
browser_tabview_bug651311.js \
browser_tabview_bug654295.js \
......@@ -169,11 +168,13 @@ ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
_BROWSER_FILES += \
browser_tabview_bug624265_perwindowpb.js \
browser_tabview_bug624727_perwindowpb.js \
browser_tabview_bug650280_perwindowpb.js \
$(NULL)
else
_BROWSER_FILES += \
browser_tabview_bug624265.js \
browser_tabview_bug624727.js \
browser_tabview_bug650280.js \
$(NULL)
endif
......
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let enableSearch = function (aCW, aCallback) {
if (aCW.Search.isEnabled()) {
aCallback();
return;
}
aCW.addEventListener("tabviewsearchenabled", function onSearchEnabled() {
aCW.removeEventListener("tabviewsearchenabled", onSearchEnabled, false);
executeSoon(aCallback);
}, false);
aCW.Search.ensureShown();
};
let getSearchboxValue = function (aCW) {
return aCW.iQ("#searchbox").val();
};
let prepareSearchbox = function (aCW, aCallback) {
ok(!aCW.Search.isEnabled(), "search is disabled");
executeSoon(function() {
enableSearch(aCW, function() {
aCW.iQ("#searchbox").val("moz");
aCallback();
});
});
};
let searchAndSwitchPBMode = function (aWindow, aCallback) {
showTabView(function() {
let cw = aWindow.TabView.getContentWindow();
prepareSearchbox(cw, function() {
testOnWindow(!PrivateBrowsingUtils.isWindowPrivate(aWindow), function(win) {
showTabView(function() {
let contentWindow = win.TabView.getContentWindow();
ok(!contentWindow.Search.isEnabled(), "search is disabled");
is(getSearchboxValue(contentWindow), "", "search box is empty");
aWindow.TabView.hide();
win.close();
hideTabView(function() {
aWindow.close();
aCallback();
}, aWindow);
}, win);
});
});
}, aWindow);
};
let testOnWindow = function(aIsPrivate, aCallback) {
let win = OpenBrowserWindow({private: aIsPrivate});
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
executeSoon(function() { aCallback(win) });
}, false);
}
waitForExplicitFinish();
testOnWindow(false, function(win) {
searchAndSwitchPBMode(win, function() {
testOnWindow(true, function(win) {
searchAndSwitchPBMode(win, function() {
finish();
});
});
});
});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment