gecko-dev/browser/components/uitour/test/browser_UITour_defaultBrowser.js
Ian Moody 7d6860c063 Bug 612373 - Add "Span" option for Windows and Linux to "Set As Desktop Background". r=Gijs
Gnome introduced this in 2.30[0], Windows in 8[1].
Preview is just an "international prohibition symbol" to save the complicated
business of trying to calculate a semi-accurate one.

[0]
8eb0886312
https://bugzilla.gnome.org/show_bug.cgi?id=603551
[1]
https://superuser.com/questions/1061416/which-version-of-windows-introduced-the-span-wallpaper-style

Differential Revision: https://phabricator.services.mozilla.com/D23336

--HG--
extra : moz-landing-system : lando
2019-03-27 18:26:19 +00:00

60 lines
1.9 KiB
JavaScript

"use strict";
var gTestTab;
var gContentAPI;
var gContentWindow;
var setDefaultBrowserCalled = false;
Services.scriptloader
.loadSubScript("chrome://mochikit/content/tests/SimpleTest/MockObjects.js", this);
function MockShellService() {}
MockShellService.prototype = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIShellService]),
isDefaultBrowser(aStartupCheck, aForAllTypes) { return false; },
setDefaultBrowser(aClaimAllTypes, aForAllUsers) {
setDefaultBrowserCalled = true;
},
shouldCheckDefaultBrowser: false,
canSetDesktopBackground: false,
BACKGROUND_TILE: 1,
BACKGROUND_STRETCH: 2,
BACKGROUND_CENTER: 3,
BACKGROUND_FILL: 4,
BACKGROUND_FIT: 5,
BACKGROUND_SPAN: 6,
setDesktopBackground(aElement, aPosition) {},
APPLICATION_MAIL: 0,
APPLICATION_NEWS: 1,
openApplication(aApplication) {},
desktopBackgroundColor: 0,
openApplicationWithURI(aApplication, aURI) {},
};
var mockShellService = new MockObjectRegisterer("@mozilla.org/browser/shell-service;1",
MockShellService);
// Temporarily disabled, see note at test_setDefaultBrowser.
// mockShellService.register();
add_task(setup_UITourTest);
/* This test is disabled (bug 1180714) since the MockObjectRegisterer
is not actually replacing the original ShellService.
add_UITour_task(function* test_setDefaultBrowser() {
try {
yield gContentAPI.setConfiguration("defaultBrowser");
ok(setDefaultBrowserCalled, "setDefaultBrowser called");
} finally {
mockShellService.unregister();
}
});
*/
add_UITour_task(async function test_isDefaultBrowser() {
let shell = Cc["@mozilla.org/browser/shell-service;1"]
.getService(Ci.nsIShellService);
let isDefault = shell.isDefaultBrowser(false);
let data = await getConfigurationPromise("appinfo");
is(isDefault, data.defaultBrowser, "gContentAPI result should match shellService.isDefaultBrowser");
});