fune/browser/components/uitour/test/browser_UITour_defaultBrowser.js
Jared Wein a54eda04ca Bug 1348068 - Enable the key-spacing rule for eslint and fix the related issues. r=standard8
Running eslint with --fix didn't fix many of the issues. The majority here had to be fixed by hand but a significant majority of the issues were related to a few files that I was able to use find-and-replace with. I regret not making this in to separate commits of the hand-fixes and the fixes from --fix but I don't recall --fix fixing any of the issues.

MozReview-Commit-ID: ANyg2qfo3Qx

--HG--
extra : rebase_source : 61d2aa91bf9474af3d72a5dea41b25dca442c1b7
2017-03-21 14:29:43 -04:00

61 lines
2 KiB
JavaScript

"use strict";
var gTestTab;
var gContentAPI;
var gContentWindow;
var setDefaultBrowserCalled = false;
Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://mochikit/content/tests/SimpleTest/MockObjects.js", this);
function MockShellService() {}
MockShellService.prototype = {
QueryInterface: XPCOMUtils.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,
setDesktopBackground(aElement, aPosition) {},
APPLICATION_MAIL: 0,
APPLICATION_NEWS: 1,
openApplication(aApplication) {},
desktopBackgroundColor: 0,
openApplicationWithURI(aApplication, aURI) {},
defaultFeedReader: 0,
};
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(function* test_isDefaultBrowser() {
let shell = Components.classes["@mozilla.org/browser/shell-service;1"]
.getService(Components.interfaces.nsIShellService);
let isDefault = shell.isDefaultBrowser(false);
let data = yield getConfigurationPromise("appinfo");
is(isDefault, data.defaultBrowser, "gContentAPI result should match shellService.isDefaultBrowser");
});