mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1087303 - Add test for the functionality of remaining Panel Menu buttons in Australis (fullscreen, preferences). r=Gijs
This commit is contained in:
parent
f6ad6d6d08
commit
743afc816b
@ -148,6 +148,9 @@ skip-if = e10s # Bug 1088710
|
||||
[browser_1008559_anchor_undo_restore.js]
|
||||
[browser_1042100_default_placements_update.js]
|
||||
[browser_1058573_showToolbarsDropdown.js]
|
||||
[browser_1087303_button_fullscreen.js]
|
||||
skip-if = os == "mac"
|
||||
[browser_1087303_button_preferences.js]
|
||||
[browser_bootstrapped_custom_toolbar.js]
|
||||
[browser_panel_toggle.js]
|
||||
[browser_1089591_still_customizable_after_reset.js]
|
||||
|
@ -0,0 +1,46 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(function() {
|
||||
info("Check fullscreen button existence and functionality");
|
||||
|
||||
yield PanelUI.show();
|
||||
|
||||
let fullscreenButton = document.getElementById("fullscreen-button");
|
||||
ok(fullscreenButton, "Fullscreen button appears in Panel Menu");
|
||||
|
||||
let fullscreenPromise = promiseFullscreenChange();
|
||||
fullscreenButton.click();
|
||||
yield fullscreenPromise;
|
||||
|
||||
ok(window.fullScreen, "Fullscreen mode was opened");
|
||||
|
||||
// exit full screen mode
|
||||
fullscreenPromise = promiseFullscreenChange();
|
||||
window.fullScreen = !window.fullScreen;
|
||||
yield fullscreenPromise;
|
||||
|
||||
ok(!window.fullScreen, "Successfully exited fullscreen");
|
||||
});
|
||||
|
||||
function promiseFullscreenChange() {
|
||||
let deferred = Promise.defer();
|
||||
info("Wait for fullscreen change");
|
||||
|
||||
let timeoutId = setTimeout(() => {
|
||||
window.removeEventListener("fullscreen", onFullscreenChange, true);
|
||||
deferred.reject("Fullscreen change did not happen within " + 20000 + "ms");
|
||||
}, 20000);
|
||||
|
||||
function onFullscreenChange(event) {
|
||||
clearTimeout(timeoutId);
|
||||
window.removeEventListener("fullscreen", onFullscreenChange, true);
|
||||
info("Fullscreen event received");
|
||||
deferred.resolve();
|
||||
}
|
||||
window.addEventListener("fullscreen", onFullscreenChange, true);
|
||||
return deferred.promise;
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const PREF_INCONTENT = "browser.preferences.inContent";
|
||||
|
||||
let newTab = null;
|
||||
|
||||
add_task(function() {
|
||||
info("Check preferences button existence and functionality");
|
||||
|
||||
Services.prefs.setBoolPref(PREF_INCONTENT, true);
|
||||
|
||||
yield PanelUI.show();
|
||||
info("Menu panel was opened");
|
||||
|
||||
let preferencesButton = document.getElementById("preferences-button");
|
||||
ok(preferencesButton, "Preferences button exists in Panel Menu");
|
||||
preferencesButton.click();
|
||||
|
||||
newTab = gBrowser.selectedTab;
|
||||
yield waitForPageLoad(newTab);
|
||||
|
||||
let openedPage = gBrowser.currentURI.spec;
|
||||
is(openedPage, "about:preferences", "Preferences page was opened");
|
||||
});
|
||||
|
||||
add_task(function asyncCleanup() {
|
||||
if (gBrowser.tabs.length == 1)
|
||||
gBrowser.addTab("about:blank");
|
||||
|
||||
gBrowser.removeTab(gBrowser.selectedTab);
|
||||
info("Tabs were restored");
|
||||
|
||||
// restore the browser.preferences.inContent preference
|
||||
Services.prefs.clearUserPref(PREF_INCONTENT);
|
||||
});
|
||||
|
||||
function waitForPageLoad(aTab) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let timeoutId = setTimeout(() => {
|
||||
aTab.linkedBrowser.removeEventListener("load", onTabLoad, true);
|
||||
deferred.reject("Page didn't load within " + 20000 + "ms");
|
||||
}, 20000);
|
||||
|
||||
function onTabLoad(event) {
|
||||
clearTimeout(timeoutId);
|
||||
aTab.linkedBrowser.removeEventListener("load", onTabLoad, true);
|
||||
info("Tab event received: " + "load");
|
||||
deferred.resolve();
|
||||
}
|
||||
aTab.linkedBrowser.addEventListener("load", onTabLoad, true, true);
|
||||
return deferred.promise;
|
||||
}
|
Loading…
Reference in New Issue
Block a user