bug 1296207 tests - Remove unused app update billboard capability. r=mhowell

--HG--
rename : toolkit/mozapps/update/tests/chrome/test_0021_available_basic.xul => toolkit/mozapps/update/tests/chrome/test_0010_background_basic.xul
rename : toolkit/mozapps/update/tests/chrome/test_0013_check_basic_staging.xul => toolkit/mozapps/update/tests/chrome/test_0012_check_basic_staging.xul
rename : toolkit/mozapps/update/tests/chrome/test_0052_check_no_updates.xul => toolkit/mozapps/update/tests/chrome/test_0013_check_no_updates.xul
rename : toolkit/mozapps/update/tests/chrome/test_0051_check_error_xml_malformed.xul => toolkit/mozapps/update/tests/chrome/test_0014_check_error_xml_malformed.xul
This commit is contained in:
Robert Strong 2016-08-25 13:32:15 -07:00
Родитель f371088109
Коммит 319980c082
29 изменённых файлов: 86 добавлений и 962 удалений

Просмотреть файл

@ -11,17 +11,13 @@ support-files =
; mochitest-chrome tests must start with "test_" and are executed in sorted
; order and not in the order specified in the manifest.
[test_0010_background_basic.xul]
[test_0011_check_basic.xul]
[test_0012_check_billboard.xul]
[test_0013_check_basic_staging.xul]
[test_0012_check_basic_staging.xul]
skip-if = asan
reason = Bug 1168003
[test_0021_available_basic.xul]
[test_0022_available_billboard.xul]
[test_0051_check_error_xml_malformed.xul]
[test_0052_check_no_updates.xul]
[test_0053_check_billboard_noAttr.xul]
[test_0054_check_billboard_404.xul]
[test_0013_check_no_updates.xul]
[test_0014_check_error_xml_malformed.xul]
[test_0061_check_verifyFailPartial_noComplete.xul]
[test_0062_check_verifyFailComplete_noPartial.xul]
[test_0063_check_verifyFailPartialComplete.xul]
@ -52,7 +48,6 @@ reason = Bug 1168003
skip-if = os != 'win'
reason = only Windows has the maintenance service.
[test_0111_neverButton_basic.xul]
[test_0112_neverButton_billboard.xul]
[test_0113_showNeverForVersionRemovedWithPref.xul]
[test_0151_notify_backgroundCheckError.xul]
[test_0152_notify_backgroundCheckOfflineRetry.xul]
@ -64,6 +59,4 @@ reason = test must be able to prevent file deletion.
[test_0172_notify_noPerms_manual.xul]
skip-if = os != 'win'
reason = test must be able to prevent file deletion.
[test_0900_deprecatedUpdateFormat_minor.xul]
[test_0901_deprecatedUpdateFormat_major.xul]
[test_9999_cleanup.xul]

Просмотреть файл

@ -1,58 +0,0 @@
<?xml version="1.0"?>
<!--
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: update check, billboard, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showDetails=1" + getVersionParams();
setUpdateURLOverride(url);
gUP.checkForUpdates();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</window>

Просмотреть файл

@ -1,57 +0,0 @@
<?xml version="1.0"?>
<!--
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: billboard, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING,
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showDetails=1&showPrompt=1" +
getVersionParams();
setUpdateURLOverride(url);
gAUS.notify(null);
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</window>

Просмотреть файл

@ -1,56 +0,0 @@
<?xml version="1.0"?>
<!--
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: update check, billoard, basic, download, and finished (bug 548061)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading"
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&remoteNoTypeAttr=1" +
"&showDetails=1" + getVersionParams();
setUpdateURLOverride(url);
gUP.checkForUpdates();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</window>

Просмотреть файл

@ -1,56 +0,0 @@
<?xml version="1.0"?>
<!--
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: update check, billoard, basic, download, and finished (bug 548061)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading"
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?billboard404=1&showDetails=1" +
getVersionParams();
setUpdateURLOverride(url);
gUP.checkForUpdates();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</window>

Просмотреть файл

@ -30,8 +30,7 @@ function runTest() {
let patches = getLocalPatchString("complete", null, null, null, "1234", null,
STATE_DOWNLOADING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion);
Services.appinfo.version);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);

Просмотреть файл

@ -32,9 +32,8 @@ function runTest() {
getLocalPatchString("complete", null, null, null, "1234",
"false");
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion, null,
null, null, null, null, null, "false");
Services.appinfo.version, null,
null, null, null, null, "false");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);

Просмотреть файл

@ -32,9 +32,8 @@ function runTest() {
getLocalPatchString("complete", null, null, null, null,
"false");
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion, null,
null, null, null, null, null, "false");
Services.appinfo.version, null,
null, null, null, null, "false");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);

Просмотреть файл

@ -30,9 +30,8 @@ function runTest() {
let patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion, null,
null, null, null, null, null, "false");
Services.appinfo.version, null,
null, null, null, null, "false");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);

Просмотреть файл

@ -30,8 +30,7 @@ function runTest() {
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion);
Services.appinfo.version);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);

Просмотреть файл

@ -44,9 +44,8 @@ function runTest() {
getLocalPatchString("complete", slowDownloadURL, null, null,
null, "false");
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion, null,
null, null, null, null, null, "false");
Services.appinfo.version, null,
null, null, null, null, "false");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);

Просмотреть файл

@ -45,9 +45,8 @@ function runTest() {
null, "1234",
"false");
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion, null,
null, null, null, null, null, "false");
Services.appinfo.version, null,
null, null, null, null, "false");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);

Просмотреть файл

@ -30,8 +30,7 @@ function runTest() {
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion);
Services.appinfo.version);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_SUCCEEDED);

Просмотреть файл

@ -30,9 +30,8 @@ function runTest() {
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion,
null, null, null, null, null, null, false,
Services.appinfo.version, null,
null, null, null, null, false,
null, false, false, false, 1);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);

Просмотреть файл

@ -31,8 +31,7 @@ function runTest() {
STATE_PENDING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion,
null, null, null,
null, null,
null, null, null,
null, false, null,
false, false,

Просмотреть файл

@ -1,69 +0,0 @@
<?xml version="1.0"?>
<!--
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: update check and billboard (never button test)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
gPrefToCheck = PREFBRANCH_APP_UPDATE_NEVER + Services.appinfo.version;
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener,
neverButton: true
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraDelayedCheckFunction: checkPrefHasUserValue,
prefHasUserValue: false,
neverButton: true,
buttonClick: "extra2"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showNever=1" +
getVersionParams();
setUpdateURLOverride(url);
// add the never preference for this version to verify that checking for
// updates clears the preference.
Services.prefs.setBoolPref(gPrefToCheck, true)
gUP.checkForUpdates();
}
function finishTest() {
checkPrefHasUserValue(true);
finishTestDefault();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</window>

Просмотреть файл

@ -1,47 +0,0 @@
<?xml version="1.0"?>
<!--
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: minor update with deprecated update xml format"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?oldFormat=1&type=minor" +
getVersionParams();
setUpdateURLOverride(url);
gUP.checkForUpdates();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</window>

Просмотреть файл

@ -1,56 +0,0 @@
<?xml version="1.0"?>
<!--
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: major update with deprecated update xml format"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener,
neverButton: true
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
neverButton: true,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?oldFormat=1&type=major" +
getVersionParams();
setUpdateURLOverride(url);
gUP.checkForUpdates();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</window>

Просмотреть файл

@ -122,52 +122,21 @@ function handleRequest(aRequest, aResponse) {
let type = params.type ? params.type : "major";
let name = params.name ? params.name : "App Update Test";
let appVersion = params.appVersion ? params.appVersion : "99.9";
let appVersion = params.appVersion ? params.appVersion : "999999.9";
let displayVersion = params.displayVersion ? params.displayVersion
: "version " + appVersion;
let platformVersion = params.platformVersion ? params.platformVersion : "99.8";
let buildID = params.buildID ? params.buildID : "01234567890123";
// XXXrstrong - not specifying a detailsURL will cause a leak due to bug 470244
// let detailsURL = params.showDetails ? URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS" : null;
let detailsURL = URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS";
let billboardURL = params.showBillboard ? URL_HTTP_UPDATE_SJS + "?uiURL=BILLBOARD" : null;
if (billboardURL && params.remoteNoTypeAttr) {
billboardURL += "&amp;remoteNoTypeAttr=1";
}
if (params.billboard404) {
billboardURL = URL_HOST + "/missing.html";
}
let showPrompt = params.showPrompt ? "true" : null;
let showNever = params.showNever ? "true" : null;
let promptWaitTime = params.promptWaitTime ? params.promptWaitTime : null;
let showSurvey = params.showSurvey ? "true" : null;
let extensionVersion;
let version;
// For testing the deprecated update xml format
if (params.oldFormat) {
appVersion = null;
displayVersion = null;
billboardURL = null;
showPrompt = null;
showNever = null;
showSurvey = null;
detailsURL = URL_HTTP_UPDATE_SJS + "?uiURL=BILLBOARD";
if (params.remoteNoTypeAttr) {
detailsURL += "&amp;remoteNoTypeAttr=1";
}
extensionVersion = params.appVersion ? params.appVersion : "99.9";
version = params.displayVersion ? params.displayVersion
: "version " + extensionVersion;
}
let updates = getRemoteUpdateString(patches, type, "App Update Test",
displayVersion, appVersion,
platformVersion, buildID, detailsURL,
billboardURL, showPrompt,
showNever, promptWaitTime, showSurvey,
version, extensionVersion);
displayVersion, appVersion, buildID,
detailsURL, showPrompt, showNever,
promptWaitTime);
aResponse.write(getRemoteUpdatesXMLString(updates));
}

Просмотреть файл

@ -65,11 +65,6 @@
* For comparing the expected value defined by this property with the return
* value of prefHasUserValue using gPrefToCheck for the preference name in the
* checkPrefHasUserValue function.
*
* expectedRemoteContentState (optional)
* For comparing the expected remotecontent state attribute value of the
* wizard's billboard page in the checkRemoteContentState and
* waitForRemoteContentLoaded functions.
*/
'use strict';
@ -90,7 +85,6 @@ const PAGEID_NO_UPDATES_FOUND = "noupdatesfound"; // Done
const PAGEID_MANUAL_UPDATE = "manualUpdate"; // Done
const PAGEID_UNSUPPORTED = "unsupported"; // Done
const PAGEID_FOUND_BASIC = "updatesfoundbasic"; // Done
const PAGEID_FOUND_BILLBOARD = "updatesfoundbillboard"; // Done
const PAGEID_DOWNLOADING = "downloading"; // Done
const PAGEID_ERRORS = "errors"; // Done
const PAGEID_ERROR_EXTRA = "errorextra"; // Done
@ -149,7 +143,7 @@ var gUseTestUpdater = false;
// Set to true to log additional information for debugging. To log additional
// information for an individual test set DEBUG_AUS_TEST to true in the test's
// onload function.
var DEBUG_AUS_TEST = false;
var DEBUG_AUS_TEST = true;
const DATA_URI_SPEC = "chrome://mochitests/content/chrome/toolkit/mozapps/update/tests/data/";
Services.scriptloader.loadSubScript(DATA_URI_SPEC + "shared.js", this);
@ -171,28 +165,6 @@ this.__defineGetter__("gCallback", function() {
: defaultCallback;
});
/**
* The remotecontent element for the current page if one exists or null if a
* remotecontent element doesn't exist.
*/
this.__defineGetter__("gRemoteContent", function() {
if (gTest.pageid == PAGEID_FOUND_BILLBOARD) {
return gWin.document.getElementById("updateMoreInfoContent");
}
return null;
});
/**
* The state for the remotecontent element if one exists or null if a
* remotecontent element doesn't exist.
*/
this.__defineGetter__("gRemoteContentState", function() {
if (gRemoteContent) {
return gRemoteContent.getAttribute("state");
}
return null;
});
/**
* Default test run function that can be used by most tests. This function uses
* protective measures to prevent the test from failing provided by
@ -537,7 +509,6 @@ function getExpectedButtonStates() {
case PAGEID_CHECKING:
return { cancel: { disabled: false, hidden: false } };
case PAGEID_FOUND_BASIC:
case PAGEID_FOUND_BILLBOARD:
if (gTest.neverButton) {
return { extra1: { disabled: false, hidden: false },
extra2: { disabled: false, hidden: false },
@ -563,72 +534,6 @@ function getExpectedButtonStates() {
return null;
}
/**
* Adds a load event listener to the current remotecontent element.
*/
function addRemoteContentLoadListener() {
debugDump("entering - TESTS[" + gTestCounter + "], pageid: " + gTest.pageid);
gRemoteContent.addEventListener("load", remoteContentLoadListener, false);
}
/**
* The nsIDOMEventListener for a remotecontent load event.
*/
function remoteContentLoadListener(aEvent) {
// Return early if the event's original target's nodeName isn't remotecontent.
if (aEvent.originalTarget.nodeName != "remotecontent") {
debugDump("only handles events with an originalTarget nodeName of " +
"|remotecontent|. aEvent.originalTarget.nodeName = " +
aEvent.originalTarget.nodeName);
return;
}
gTestCounter++;
gCallback(aEvent);
}
/**
* Waits until a remotecontent element to finish loading which is determined
* by the current test's expectedRemoteContentState property and then removes
* the event listener.
*
* Note: tests that use this function should not test the state of the
* remotecontent since this will check the expected state.
*
* @return false if the remotecontent has loaded and its state is the state
* specified in the current test's expectedRemoteContentState
* property... otherwise true.
*/
function waitForRemoteContentLoaded(aEvent) {
// Return early until the remotecontent has loaded with the state that is
// expected or isn't the event's originalTarget.
if (gRemoteContentState != gTest.expectedRemoteContentState ||
aEvent.originalTarget != gRemoteContent) {
debugDump("returning early. " +
"gRemoteContentState: " +
gRemoteContentState + ", " +
"expectedRemoteContentState: " +
gTest.expectedRemoteContentState + ", " +
"aEvent.originalTarget.nodeName: " +
aEvent.originalTarget.nodeName);
return true;
}
gRemoteContent.removeEventListener("load", remoteContentLoadListener, false);
return false;
}
/**
* Compares the value of the remotecontent state attribute with the value
* specified in the test's expectedRemoteContentState property.
*/
function checkRemoteContentState() {
is(gRemoteContentState, gTest.expectedRemoteContentState, "Checking remote " +
"content state equals " + gTest.expectedRemoteContentState + " - pageid " +
gTest.pageid);
}
/**
* Compares the return value of prefHasUserValue for the preference specified in
* gPrefToCheck with the value passed in the aPrefHasValue parameter or the
@ -680,43 +585,12 @@ function checkErrorExtraPage(aShouldBeHidden) {
* @param aAppVersion (optional)
* The application version for the update snippet. If not specified the
* current application version will be used.
* @param aPlatformVersion (optional)
* The platform version for the update snippet. If not specified the
* current platform version will be used.
* @return The url parameters for the application and platform version to send
* to update.sjs.
*/
function getVersionParams(aAppVersion, aPlatformVersion) {
function getVersionParams(aAppVersion) {
let appInfo = Services.appinfo;
return "&appVersion=" + (aAppVersion ? aAppVersion : appInfo.version) +
"&platformVersion=" + (aPlatformVersion ? aPlatformVersion
: appInfo.platformVersion);
}
/**
* Gets an application version that is greater than the current application
* version. The version is created by taking the first sequence from the current
* application version and adding 1 to it.
*
* @return A version string greater than the current application version string.
*/
function getNewerAppVersion() {
let appVersion = Services.appinfo.version.split(".")[0];
appVersion++;
return appVersion;
}
/**
* Gets a platform version that is greater than the current platform version.
* The version is created by taking the first sequence from the current platform
* version and adding 1 to it.
*
* @return A version string greater than the current platform version string.
*/
function getNewerPlatformVersion() {
let platformVersion = Services.appinfo.platformVersion.split(".")[0];
platformVersion++;
return platformVersion;
return "&appVersion=" + (aAppVersion ? aAppVersion : appInfo.version);
}
/**

Просмотреть файл

@ -80,16 +80,13 @@ function getRemoteUpdatesXMLString(aUpdates) {
* @return The string representing an update element for an update xml file.
*/
function getRemoteUpdateString(aPatches, aType, aName, aDisplayVersion,
aAppVersion, aPlatformVersion, aBuildID,
aDetailsURL, aBillboardURL, aShowPrompt,
aAppVersion, aBuildID, aDetailsURL, aShowPrompt,
aShowNeverForVersion, aPromptWaitTime,
aShowSurvey, aVersion, aExtensionVersion,
aCustom1, aCustom2) {
return getUpdateString(aType, aName, aDisplayVersion, aAppVersion,
aPlatformVersion, aBuildID, aDetailsURL,
aBillboardURL, aShowPrompt, aShowNeverForVersion,
aPromptWaitTime, aShowSurvey, aVersion,
aExtensionVersion, aCustom1, aCustom2) + ">\n" +
aBuildID, aDetailsURL, aShowPrompt,
aShowNeverForVersion, aPromptWaitTime,
aCustom1, aCustom2) + ">\n" +
aPatches +
" </update>\n";
}
@ -148,12 +145,10 @@ function getLocalUpdatesXMLString(aUpdates) {
* @return The string representing an update element for an update xml file.
*/
function getLocalUpdateString(aPatches, aType, aName, aDisplayVersion,
aAppVersion, aPlatformVersion, aBuildID,
aDetailsURL, aBillboardURL, aServiceURL,
aAppVersion, aBuildID, aDetailsURL, aServiceURL,
aInstallDate, aStatusText, aIsCompleteUpdate,
aChannel, aForegroundDownload, aShowPrompt,
aShowNeverForVersion, aPromptWaitTime,
aShowSurvey, aVersion, aExtensionVersion,
aPreviousAppVersion, aCustom1, aCustom2) {
let serviceURL = aServiceURL ? aServiceURL : "http://test_service/";
let installDate = aInstallDate ? aInstallDate : "1238441400314";
@ -167,11 +162,9 @@ function getLocalUpdateString(aPatches, aType, aName, aDisplayVersion,
let previousAppVersion = aPreviousAppVersion ? "previousAppVersion=\"" +
aPreviousAppVersion + "\" "
: "";
return getUpdateString(aType, aName, aDisplayVersion, aAppVersion,
aPlatformVersion, aBuildID, aDetailsURL, aBillboardURL,
aShowPrompt, aShowNeverForVersion, aPromptWaitTime,
aShowSurvey, aVersion, aExtensionVersion,
aCustom1, aCustom2) +
return getUpdateString(aType, aName, aDisplayVersion, aAppVersion, aBuildID,
aDetailsURL, aShowPrompt, aShowNeverForVersion,
aPromptWaitTime, aCustom1, aCustom2) +
" " +
previousAppVersion +
"serviceURL=\"" + serviceURL + "\" " +
@ -224,10 +217,6 @@ function getLocalPatchString(aType, aURL, aHashFunction, aHashValue, aSize,
* The update's application version.
* If not specified it will default to the value of
* DEFAULT_UPDATE_VERSION.
* @param aPlatformVersion (optional)
* The update's platform version.
* If not specified it will default to the value of
* DEFAULT_UPDATE_VERSION.
* @param aBuildID (optional)
* The update's build id.
* If not specified it will default to '20080811053724'.
@ -235,9 +224,6 @@ function getLocalPatchString(aType, aURL, aHashFunction, aHashValue, aSize,
* The update's details url.
* If not specified it will default to 'http://test_details/' due to due
* to bug 470244.
* @param aBillboardURL (optional)
* The update's billboard url.
* If not specified it will not be present.
* @param aShowPrompt (optional)
* Whether to show the prompt for the update when auto update is
* enabled.
@ -249,16 +235,6 @@ function getLocalPatchString(aType, aURL, aHashFunction, aHashValue, aSize,
* default to false.
* @param aPromptWaitTime (optional)
* Override for the app.update.promptWaitTime preference.
* @param aShowSurvey (optional)
* Whether to show the 'No Thanks' button in the update prompt.
* If not specified it will not be present and the update service will
* default to false.
* @param aVersion (optional)
* The update's application version from 1.9.2.
* If not specified it will not be present.
* @param aExtensionVersion (optional)
* The update's application version from 1.9.2.
* If not specified it will not be present.
* @param aCustom1 (optional)
* A custom attribute name and attribute value to add to the xml.
* Example: custom1_attribute="custom1 value"
@ -269,48 +245,23 @@ function getLocalPatchString(aType, aURL, aHashFunction, aHashValue, aSize,
* If not specified it will not be present.
* @return The string representing an update element for an update xml file.
*/
function getUpdateString(aType, aName, aDisplayVersion, aAppVersion,
aPlatformVersion, aBuildID, aDetailsURL, aBillboardURL,
aShowPrompt, aShowNeverForVersion, aPromptWaitTime,
aShowSurvey, aVersion, aExtensionVersion,
aCustom1, aCustom2) {
function getUpdateString(aType, aName, aDisplayVersion, aAppVersion, aBuildID,
aDetailsURL, aShowPrompt, aShowNeverForVersion,
aPromptWaitTime, aCustom1, aCustom2) {
let type = aType ? aType : "major";
let name = aName ? aName : "App Update Test";
let displayVersion = "";
if (aDisplayVersion || !aVersion) {
displayVersion = "displayVersion=\"" +
(aDisplayVersion ? aDisplayVersion
: "version " + DEFAULT_UPDATE_VERSION) +
"\" ";
}
// version has been deprecated in favor of displayVersion but it still needs
// to be tested for forward compatibility.
let version = aVersion ? "version=\"" + aVersion + "\" " : "";
let appVersion = "";
if (aAppVersion || !aExtensionVersion) {
appVersion = "appVersion=\"" +
(aAppVersion ? aAppVersion : DEFAULT_UPDATE_VERSION) +
"\" ";
}
// extensionVersion has been deprecated in favor of appVersion but it still
// needs to be tested for forward compatibility.
let extensionVersion = aExtensionVersion ? "extensionVersion=\"" +
aExtensionVersion + "\" "
: "";
let platformVersion = "";
if (aPlatformVersion) {
platformVersion = "platformVersion=\"" +
(aPlatformVersion ? aPlatformVersion
: DEFAULT_UPDATE_VERSION) + "\" ";
}
let displayVersion = aDisplayVersion ? "displayVersion=\"" +
aDisplayVersion + "\" "
: "";
let appVersion = "appVersion=\"" +
(aAppVersion ? aAppVersion : DEFAULT_UPDATE_VERSION) +
"\" ";
let buildID = aBuildID ? aBuildID : "20080811053724";
// XXXrstrong - not specifying a detailsURL will cause a leak due to bug 470244
// let detailsURL = aDetailsURL ? "detailsURL=\"" + aDetailsURL + "\" " : "";
let detailsURL = "detailsURL=\"" +
(aDetailsURL ? aDetailsURL
: "http://test_details/") + "\" ";
let billboardURL = aBillboardURL ? "billboardURL=\"" + aBillboardURL + "\" "
: "";
let showPrompt = aShowPrompt ? "showPrompt=\"" + aShowPrompt + "\" " : "";
let showNeverForVersion = aShowNeverForVersion ? "showNeverForVersion=\"" +
aShowNeverForVersion + "\" "
@ -323,12 +274,8 @@ function getUpdateString(aType, aName, aDisplayVersion, aAppVersion,
return " <update type=\"" + type + "\" " +
"name=\"" + name + "\" " +
displayVersion +
version +
appVersion +
extensionVersion +
platformVersion +
detailsURL +
billboardURL +
showPrompt +
showNeverForVersion +
promptWaitTime +

Просмотреть файл

@ -1827,8 +1827,7 @@ function setupActiveUpdate() {
let patches = getLocalPatchString(null, null, null, null, null, "true",
state);
let updates = getLocalUpdateString(patches, null, null, null, null, null,
null, null, null, null, null, null,
"true", channel);
null, null, null, null, "true", channel);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeVersionFile(DEFAULT_UPDATE_VERSION);
writeStatusFile(state);

Просмотреть файл

@ -13,7 +13,7 @@ function run_test() {
let patches = getLocalPatchString(null, null, null, null, null, null,
STATE_DOWNLOADING);
let updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0",
null, "2007010101");
"2007010101");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeStatusFile(STATE_DOWNLOADING);

Просмотреть файл

@ -55,11 +55,10 @@ function run_test_pt02() {
"1316138");
let updates = getRemoteUpdateString(patches, "minor", "Minor Test",
"version 2.1a1pre", "2.1a1pre",
"3.1a1pre", "20080811053724",
"20080811053724",
"http://details/",
"http://billboard/", "true",
"true", "345600", "true", "4.1a1pre",
"5.1a1pre",
"true",
"true", "345600",
"custom1_attr=\"custom1 value\"",
"custom2_attr=\"custom2 value\"");
gResponseBody = getRemoteUpdatesXMLString(updates);
@ -92,14 +91,10 @@ function check_test_pt02() {
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.appVersion, "2.1a1pre",
"the update appVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.platformVersion, "3.1a1pre",
"the update platformVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.buildID, "20080811053724",
"the update buildID attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.detailsURL, "http://details/",
"the update detailsURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.billboardURL, "http://billboard/",
"the update billboardURL attribute" + MSG_SHOULD_EQUAL);
Assert.ok(bestUpdate.showPrompt,
"the update showPrompt attribute" + MSG_SHOULD_EQUAL);
Assert.ok(bestUpdate.showNeverForVersion,
@ -178,128 +173,32 @@ function check_test_pt02() {
run_test_pt03();
}
// one update available and the update's property default values
function run_test_pt03() {
debugDump("testing one update available and the update's property values " +
"with the format prior to bug 530872");
gUpdates = null;
gUpdateCount = null;
gCheckFunc = check_test_pt03;
let patches = getRemotePatchString("complete", "http://complete/", "SHA1",
"98db9dad8e1d80eda7e1170d0187d6f53e477059",
"9856459");
let updates = getRemoteUpdateString(patches, "major", "Major Test",
null, null,
"5.1a1pre", "20080811053724",
"http://details/",
null, null, null, "691200",
null, "version 4.1a1pre", "4.1a1pre");
gResponseBody = getRemoteUpdatesXMLString(updates);
gUpdateChecker.checkForUpdates(updateCheckListener, true);
}
function check_test_pt03() {
Assert.equal(gUpdateCount, 1,
"the update count" + MSG_SHOULD_EQUAL);
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
Assert.equal(bestUpdate.type, "major",
"the update type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.name, "Major Test",
"the update name attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.displayVersion, "version 4.1a1pre",
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.appVersion, "4.1a1pre",
"the update appVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.platformVersion, "5.1a1pre",
"the update platformVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.buildID, "20080811053724",
"the update buildID attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.detailsURL, "http://details/",
"the update detailsURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.billboardURL, "http://details/",
"the update billboardURL attribute" + MSG_SHOULD_EQUAL);
Assert.ok(bestUpdate.showPrompt,
"the update showPrompt attribute" + MSG_SHOULD_EQUAL);
Assert.ok(bestUpdate.showNeverForVersion,
"the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.promptWaitTime, "691200",
"the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.serviceURL, gURLData + gHTTPHandlerPath + "?force=1",
"the update serviceURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.channel, "test_channel",
"the update channel attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!bestUpdate.isCompleteUpdate,
"the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!bestUpdate.isSecurityUpdate,
"the update isSecurityUpdate attribute" + MSG_SHOULD_EQUAL);
// Check that installDate is within 10 seconds of the current date.
Assert.ok((Date.now() - bestUpdate.installDate) < 10000,
"the update installDate attribute should be within 10 seconds of " +
"the current time");
Assert.ok(!bestUpdate.statusText,
"the update statusText attribute" + MSG_SHOULD_EQUAL);
// nsIUpdate:state returns an empty string when no action has been performed
// on an available update
Assert.equal(bestUpdate.state, "",
"the update state attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.errorCode, 0,
"the update errorCode attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.patchCount, 1,
"the update patchCount attribute" + MSG_SHOULD_EQUAL);
//XXX TODO - test nsIUpdate:serialize
let patch = bestUpdate.getPatchAt(0);
Assert.equal(patch.type, "complete",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.URL, "http://complete/",
"the update patch URL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashFunction, "SHA1",
"the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashValue, "98db9dad8e1d80eda7e1170d0187d6f53e477059",
"the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.size, 9856459,
"the update patch size attribute" + MSG_SHOULD_EQUAL);
// The value for patch.state can be the string 'null' as a valid value. This
// is confusing if it returns null which is an invalid value since the test
// failure output will show a failure for null == null. To lessen the
// confusion first check that the typeof for patch.state is string.
Assert.equal(typeof(patch.state), "string",
"the update patch state typeof value should equal |string|");
Assert.equal(patch.state, STATE_NONE,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!patch.selected,
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
//XXX TODO - test nsIUpdatePatch:serialize
run_test_pt04();
}
// Empty update xml (an empty xml file returns a root node name of parsererror)
function run_test_pt04() {
function run_test_pt03() {
gResponseBody = "<parsererror/>";
run_test_helper_pt1("testing empty update xml",
null, run_test_pt05);
null, run_test_pt04);
}
// no updates available
function run_test_pt05() {
function run_test_pt04() {
gResponseBody = getRemoteUpdatesXMLString("");
run_test_helper_pt1("testing no updates available",
0, run_test_pt06);
0, run_test_pt05);
}
// one update available with two patches
function run_test_pt06() {
function run_test_pt05() {
let patches = getRemotePatchString("complete");
patches += getRemotePatchString("partial");
let updates = getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing one update available",
1, run_test_pt07);
1, run_test_pt06);
}
// three updates available each with two patches
function run_test_pt07() {
function run_test_pt06() {
let patches = getRemotePatchString("complete");
patches += getRemotePatchString("partial");
let updates = getRemoteUpdateString(patches);
@ -307,67 +206,67 @@ function run_test_pt07() {
updates += getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing three updates available",
3, run_test_pt08);
3, run_test_pt07);
}
// one update with complete and partial patches with size 0 specified in the
// update xml
function run_test_pt08() {
function run_test_pt07() {
let patches = getRemotePatchString("complete", null, null, null, "0");
patches += getRemotePatchString("partial", null, null, null, "0");
let updates = getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing one update with complete and partial " +
"patches with size 0", 0, run_test_pt09);
"patches with size 0", 0, run_test_pt08);
}
// one update with complete patch with size 0 specified in the update xml
function run_test_pt09() {
function run_test_pt08() {
let patches = getRemotePatchString("complete", null, null, null, "0");
let updates = getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing one update with complete patch with size 0",
0, run_test_pt10);
0, run_test_pt9);
}
// one update with partial patch with size 0 specified in the update xml
function run_test_pt10() {
function run_test_pt9() {
let patches = getRemotePatchString("partial", null, null, null, "0");
let updates = getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing one update with partial patch with size 0",
0, run_test_pt11);
0, run_test_pt10);
}
// check that updates for older versions of the application aren't selected
function run_test_pt11() {
function run_test_pt10() {
let patches = getRemotePatchString("complete");
patches += getRemotePatchString("partial");
let updates = getRemoteUpdateString(patches, "minor", null, null, "1.0pre");
updates += getRemoteUpdateString(patches, "minor", null, null, "1.0a");
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing two updates older than the current version",
2, check_test_pt11);
2, check_test_pt10);
}
function check_test_pt11() {
function check_test_pt10() {
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
Assert.ok(!bestUpdate,
"there should be no update available");
run_test_pt12();
run_test_pt11();
}
// check that updates for the current version of the application are selected
function run_test_pt12() {
function run_test_pt11() {
let patches = getRemotePatchString("complete");
patches += getRemotePatchString("partial");
let updates = getRemoteUpdateString(patches, "minor", null, "version 1.0");
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing one update equal to the current version",
1, check_test_pt12);
1, check_test_pt11);
}
function check_test_pt12() {
function check_test_pt11() {
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
Assert.ok(!!bestUpdate,
"there should be one update available");

Просмотреть файл

@ -18,27 +18,26 @@ function run_test() {
let patches = getLocalPatchString("partial", "http://partial/", "SHA256",
"cd43", "86", "true", STATE_PENDING);
let updates = getLocalUpdateString(patches, "major", "New", "version 4",
"4.0", "4.0", "20070811053724",
"http://details1/", "http://billboard1/",
"4.0", "20070811053724",
"http://details1/",
"http://service1/", "1238441300314",
"test status text", "false",
"test_channel", "true", "true", "true",
"345600", "true", "test version",
"3.0", "3.0",
"345600", "3.0",
"custom1_attr=\"custom1 value\"",
"custom2_attr=\"custom2 value\"");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeStatusFile(STATE_SUCCEEDED);
patches = getLocalPatchString("complete", "http://complete/", "SHA1", "6232",
"75", "true", STATE_FAILED);
updates = getLocalUpdateString(patches, "major", "Existing", null, null,
"3.0", null, "http://details2/", null,
updates = getLocalUpdateString(patches, "major", "Existing", null, "3.0",
null,
"http://details2/",
"http://service2/", null,
getString("patchApplyFailure"), "true",
"test_channel", "false", null, null, "691200",
null, "version 3", "3.0", null,
null,
"custom3_attr=\"custom3 value\"",
"custom4_attr=\"custom4 value\"");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), false);
@ -50,6 +49,7 @@ function run_test() {
Assert.equal(gUpdateManager.updateCount, 2,
"the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
debugDump("checking the activeUpdate properties");
let update = gUpdateManager.getUpdateAt(0).QueryInterface(Ci.nsIPropertyBag);
Assert.equal(update.state, STATE_SUCCEEDED,
"the update state attribute" + MSG_SHOULD_EQUAL);
@ -61,14 +61,10 @@ function run_test() {
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.appVersion, "4.0",
"the update appVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.platformVersion, "4.0",
"the update platformVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.buildID, "20070811053724",
"the update buildID attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.detailsURL, "http://details1/",
"the update detailsURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.billboardURL, "http://billboard1/",
"the update billboardURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.serviceURL, "http://service1/",
"the update serviceURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.installDate, "1238441300314",
@ -94,6 +90,7 @@ function run_test() {
Assert.equal(update.getProperty("custom2_attr"), "custom2 value",
"the update custom2_attr property" + MSG_SHOULD_EQUAL);
debugDump("checking the activeUpdate patch properties");
let patch = update.selectedPatch;
Assert.equal(patch.type, "partial",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
@ -110,6 +107,7 @@ function run_test() {
Assert.equal(patch.state, STATE_SUCCEEDED,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
debugDump("checking the first update properties");
update = gUpdateManager.getUpdateAt(1).QueryInterface(Ci.nsIPropertyBag);
Assert.equal(update.state, STATE_FAILED,
"the update state attribute" + MSG_SHOULD_EQUAL);
@ -117,16 +115,12 @@ function run_test() {
"the update name attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.type, "major",
"the update type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.displayVersion, "version 3",
Assert.equal(update.displayVersion, "3.0",
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.appVersion, "3.0",
"the update appVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.platformVersion, "3.0",
"the update platformVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.detailsURL, "http://details2/",
"the update detailsURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.billboardURL, "http://details2/",
"the update billboardURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.serviceURL, "http://service2/",
"the update serviceURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.installDate, "1238441400314",
@ -139,10 +133,10 @@ function run_test() {
"the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.channel, "test_channel",
"the update channel attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.showPrompt,
"the update showPrompt attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.showNeverForVersion,
"the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
// Assert.ok(!!update.showPrompt,
// "the update showPrompt attribute" + MSG_SHOULD_EQUAL);
// Assert.ok(!!update.showNeverForVersion,
// "the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.promptWaitTime, "691200",
"the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.previousAppVersion, null,
@ -153,6 +147,7 @@ function run_test() {
Assert.equal(update.getProperty("custom4_attr"), "custom4 value",
"the update custom4_attr property" + MSG_SHOULD_EQUAL);
debugDump("checking the first update patch properties");
patch = update.selectedPatch;
Assert.equal(patch.type, "complete",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
@ -169,148 +164,5 @@ function run_test() {
Assert.equal(patch.state, STATE_FAILED,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
removeUpdateDirsAndFiles();
// XXXrstrong - not specifying a detailsURL will cause a leak due to bug 470244
// and until this is fixed this will not test the value for detailsURL when it
// isn't specified in the update xml.
patches = getLocalPatchString(null, null, null, null, null, null,
STATE_PENDING);
updates = getLocalUpdateString(patches, "major", "New", null, null, "4.0",
null, "http://details/", "http://billboard/",
"http://service/", "1238441400314",
"test status text", null, "test_channel",
"true", "true", "true", "100", "true",
"version 4.0", "4.0", "3.0");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeStatusFile(STATE_SUCCEEDED);
patches = getLocalPatchString(null, null, null, null, null, null,
STATE_FAILED);
updates = getLocalUpdateString(patches, "major", "Existing", "version 3.0",
"3.0", "3.0", null, "http://details/", null,
"http://service/", null,
getString("patchApplyFailure"), null,
"test_channel", "false", null, null, "200",
null, "version 3", null, null);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), false);
reloadUpdateManagerData();
initUpdateServiceStub();
Assert.ok(!gUpdateManager.activeUpdate,
"the update manager activeUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(gUpdateManager.updateCount, 2,
"the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
update = gUpdateManager.getUpdateAt(0);
Assert.equal(update.state, STATE_SUCCEEDED,
"the update state attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.type, "major",
"the update type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.name, "New",
"the update name attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.displayVersion, "version 4.0",
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.appVersion, "4.0",
"the update appVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.platformVersion, "4.0",
"the update platformVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.detailsURL, "http://details/",
"the update detailsURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.billboardURL, "http://billboard/",
"the update billboardURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.serviceURL, "http://service/",
"the update serviceURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.installDate, "1238441400314",
"the update installDate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.statusText, getString("installSuccess"),
"the update statusText attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.buildID, "20080811053724",
"the update buildID attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.isCompleteUpdate,
"the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.channel, "test_channel",
"the update channel attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.showPrompt,
"the update showPrompt attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.showNeverForVersion,
"the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.promptWaitTime, "100",
"the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.previousAppVersion, "3.0",
"the update previousAppVersion attribute" + MSG_SHOULD_EQUAL);
patch = update.selectedPatch;
Assert.equal(patch.type, "complete",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.URL, URL_HOST + "/" + FILE_SIMPLE_MAR,
"the update patch URL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashFunction, "MD5",
"the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashValue, MD5_HASH_SIMPLE_MAR,
"the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.size, SIZE_SIMPLE_MAR,
"the update patch size attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!patch.selected,
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.state, STATE_SUCCEEDED,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
update = gUpdateManager.getUpdateAt(1);
Assert.equal(update.state, STATE_FAILED,
"the update state attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.name, "Existing",
"the update name attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.type, "major",
"the update type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.displayVersion, "version 3.0",
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.appVersion, "3.0",
"the update appVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.platformVersion, "3.0",
"the update platformVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.detailsURL, "http://details/",
"the update detailsURL attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!update.billboardURL,
"the update billboardURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.serviceURL, "http://service/",
"the update serviceURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.installDate, "1238441400314",
"the update installDate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.statusText, getString("patchApplyFailure"),
"the update statusText attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.buildID, "20080811053724",
"the update buildID attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.isCompleteUpdate,
"the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.channel, "test_channel",
"the update channel attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!update.showPrompt,
"the update showPrompt attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!update.showNeverForVersion,
"the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.promptWaitTime, "200",
"the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!update.previousAppVersion,
"the update previousAppVersion attribute" + MSG_SHOULD_EQUAL);
patch = update.selectedPatch;
Assert.equal(patch.type, "complete",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.URL, URL_HOST + "/" + FILE_SIMPLE_MAR,
"the update patch URL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashFunction, "MD5",
"the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashValue, MD5_HASH_SIMPLE_MAR,
"the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.size, SIZE_SIMPLE_MAR,
"the update patch size attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!patch.selected,
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.state, STATE_FAILED,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
doTestFinish();
}