7 var
bs =
Cc[
"@mozilla.org/intl/stringbundle;1"].
9 var brandName = bs.createBundle(
"chrome://branding/locale/brand.properties").
10 GetStringFromName(
"brandShortName");
12 var
dirSvc =
Cc[
"@mozilla.org/file/directory_service;1"].
14 var homeDir = dirSvc.getFile(
"Home", {});
16 var wpFile = homeDir.clone();
17 wpFile.append(brandName +
"_wallpaper.png");
21 var wpFileBackup = homeDir.clone()
22 wpFileBackup.append(brandName +
"_wallpaper.png.backup");
24 if (wpFileBackup.exists())
25 wpFileBackup.remove(
false);
28 wpFile.copyTo(
null, wpFileBackup.leafName);
30 var shell =
Cc[
"@mozilla.org/browser/shell-service;1"].
32 var gconf =
Cc[
"@mozilla.org/gnome-gconf-service;1"].
35 var prevImageKey = gconf.getString(DG_IMAGE_KEY);
39 var image = content.document.images[0];
41 function checkWallpaper(
position, expectedGConfPosition) {
42 shell.setDesktopBackground(image,
position);
43 ok(wpFile.exists(),
"Wallpaper was written to disk");
44 is(gconf.getString(DG_IMAGE_KEY), wpFile.path,
45 "Wallpaper file GConf key is correct");
47 "Wallpaper position GConf key is correct");
50 checkWallpaper(
Ci.nsIShellService.BACKGROUND_TILE,
"wallpaper");
51 checkWallpaper(
Ci.nsIShellService.BACKGROUND_STRETCH,
"stretched");
52 checkWallpaper(
Ci.nsIShellService.BACKGROUND_CENTER,
"centered");
53 checkWallpaper(
Ci.nsIShellService.BACKGROUND_FILL,
"centered");
57 gconf.setString(DG_IMAGE_KEY, prevImageKey);
62 if (wpFileBackup.exists())
63 wpFileBackup.moveTo(
null, wpFile.leafName);
65 gBrowser.removeCurrentTab();
70 var osString =
Cc[
"@mozilla.org/xre/app-info;1"].
74 if (osString !=
"Linux")
77 gBrowser.selectedTab = gBrowser.addTab();
78 gBrowser.selectedBrowser.addEventListener(
"load",
onPageLoad,
true);
79 content.location =
"about:logo";
getService(Ci.sbIFaceplateManager)