Bug 546595 - Add mochitests for the incompatibleList and incompatibleCheck pages. r=dtownsend

This commit is contained in:
Robert Strong 2010-06-02 22:28:45 -07:00
Родитель db58ca5f10
Коммит 8033422f77
41 изменённых файлов: 2078 добавлений и 151 удалений

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

@ -50,12 +50,28 @@ _OTHER_FILES = \
_CHROME_FILES = \
test_0011_check_basic.xul \
test_0012_check_basic_license.xul \
test_0013_check_incompat_basic.xul \
test_0015_check_incompat_basic_addons.xul \
test_0014_check_incompat_basic_license.xul \
test_0016_check_incompat_basic_license_addons.xul \
test_0021_check_billboard.xul \
test_0022_check_billboard_license.xul \
test_0023_check_incompat_billboard.xul \
test_0024_check_incompat_billboard_license.xul \
test_0025_check_incompat_billboard_addons.xul \
test_0026_check_incompat_billboard_license_addons.xul \
test_0031_available_basic.xul \
test_0032_available_basic_license.xul \
test_0033_available_incompat_basic.xul \
test_0034_available_incompat_basic_license.xul \
test_0035_available_incompat_basic_addons.xul \
test_0036_available_incompat_basic_license_addons.xul \
test_0041_available_billboard.xul \
test_0042_available_billboard_license.xul \
test_0043_available_incompat_billboard.xul \
test_0044_available_incompat_billboard_license.xul \
test_0045_available_incompat_billboard_addons.xul \
test_0046_available_incompat_billboard_license_addons.xul \
test_0051_check_error_xml_malformed.xul \
test_0052_check_no_updates.xul \
test_0053_check_billboard_license_noAttr.xul \

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update checking wizard pages (no billboard, no license, no add-ons)"
<window title="Update Wizard pages: update check, basic, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BASIC,
@ -36,7 +36,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?showDetails=1" + getVersionParams();
let url = URL_UPDATE + "?showDetails=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update checking wizard pages (no billboard, no add-ons)"
<window title="Update Wizard pages: update check, basic, license, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BASIC,
@ -76,7 +76,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?showLicense=1&showDetails=1" + getVersionParams();
let url = URL_UPDATE + "?showLicense=1&showDetails=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -0,0 +1,59 @@
<?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, add-ons check, basic, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
gDisableNoUpdateAddon = true;
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showDetails=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump(PREF_APP_UPDATE_URL_OVERRIDE + ": " + 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>

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

@ -0,0 +1,99 @@
<?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, add-ons check, basic, license, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_LICENSE,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "decline"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
gDisableNoUpdateAddon = true;
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showLicense=1&showDetails=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump("Update URL: " + 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>

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

@ -0,0 +1,68 @@
<?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, add-ons check, basic, add-ons list, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showDetails=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump(PREF_APP_UPDATE_URL_OVERRIDE + ": " + 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>

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

@ -0,0 +1,108 @@
<?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, add-ons check, basic, license, add-ons list, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_LICENSE,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "extra1"
}, {
pageid: PAGEID_LICENSE,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "decline"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showLicense=1&showDetails=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump(PREF_APP_UPDATE_URL_OVERRIDE + ": " + 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>

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update checking wizard pages (billboard, no license, no add-ons)"
<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"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
@ -43,7 +43,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?showBillboard=1&showDetails=1" + getVersionParams();
let url = URL_UPDATE + "?showBillboard=1&showDetails=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update checking wizard pages (billboard, no add-ons)"
<window title="Update Wizard pages: update check, billboard, license, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
@ -85,7 +85,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1" +
let url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1" +
getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -0,0 +1,66 @@
<?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, add-ons 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/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_INCOMPAT_CHECK
}, {
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"
} ];
gDisableNoUpdateAddon = true;
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showBillboard=1&showDetails=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump(PREF_APP_UPDATE_URL_OVERRIDE + ": " + 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>

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

@ -0,0 +1,108 @@
<?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, add-ons check, billboard, license, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_LICENSE,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "decline"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
gDisableNoUpdateAddon = true;
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump("Update URL: " + 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>

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

@ -0,0 +1,77 @@
<?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, add-ons check, billboard, add-ons list, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showBillboard=1&showDetails=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump(PREF_APP_UPDATE_URL_OVERRIDE + ": " + 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>

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

@ -0,0 +1,117 @@
<?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, add-ons check, billboard, license, add-ons list, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_LICENSE,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "extra1"
}, {
pageid: PAGEID_LICENSE,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "decline"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump(PREF_APP_UPDATE_URL_OVERRIDE + ": " + 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>

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update available wizard pages (no billboard, no license, no add-ons)"
<window title="Update Wizard pages: basic, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
@ -34,7 +34,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?showDetails=1&showPrompt=1" + getVersionParams();
let url = URL_UPDATE + "?showDetails=1&showPrompt=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update available wizard pages (no billboard, no add-ons)"
<window title="Update Wizard pages: basic, license, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
@ -74,7 +74,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?showLicense=1&showDetails=1&showPrompt=1" +
let url = URL_UPDATE + "?showLicense=1&showDetails=1&showPrompt=1" +
getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -0,0 +1,57 @@
<?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: add-ons check, basic, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
gDisableNoUpdateAddon = true;
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showDetails=1&showPrompt=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump("Update URL: " + 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>

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

@ -0,0 +1,97 @@
<?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: add-ons check, basic, license, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_LICENSE,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "decline"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
gDisableNoUpdateAddon = true;
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showLicense=1&showDetails=1&showPrompt=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump("Update URL: " + 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>

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

@ -0,0 +1,66 @@
<?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: add-ons check, basic, add-ons list, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showDetails=1&showPrompt=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump("Update URL: " + 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>

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

@ -0,0 +1,106 @@
<?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: add-ons check, basic, license, add-ons list, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_LICENSE,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "extra1"
}, {
pageid: PAGEID_LICENSE,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "decline"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showLicense=1&showDetails=1&showPrompt=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump("Update URL: " + 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>

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update available wizard pages (billboard, no license, no add-ons)"
<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"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
@ -41,7 +41,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?showBillboard=1&showDetails=1&showPrompt=1" +
let url = URL_UPDATE + "?showBillboard=1&showDetails=1&showPrompt=1" +
getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update available wizard pages (billboard, no add-ons)"
<window title="Update Wizard pages: billboard, license, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
@ -83,7 +83,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1" +
let url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1" +
"&showPrompt=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -0,0 +1,64 @@
<?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: add-ons 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/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_INCOMPAT_CHECK
}, {
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"
} ];
gDisableNoUpdateAddon = true;
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showBillboard=1&showPrompt=1&showDetails=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump(PREF_APP_UPDATE_URL_OVERRIDE + ": " + 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>

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

@ -0,0 +1,106 @@
<?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: add-ons check, billboard, license, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_LICENSE,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "decline"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
gDisableNoUpdateAddon = true;
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1&showPrompt=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump("Update URL: " + 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>

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

@ -0,0 +1,75 @@
<?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: add-ons check, billboard, add-ons list, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showBillboard=1&showDetails=1&showPrompt=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump("Update URL: " + 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>

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

@ -0,0 +1,115 @@
<?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: add-ons check, billboard, license, add-ons list, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_INCOMPAT_CHECK
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_LICENSE,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "extra1"
}, {
pageid: PAGEID_LICENSE,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "decline"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_INCOMPAT_LIST,
extraDelayedCheckFunction: checkIncompatbleList,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("Entering runTest");
let url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1&showPrompt=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
debugDump("Update URL: " + 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>

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update checking wizard error page (xml malformed)"
<window title="Update Wizard pages: update check and error (xml malformed)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_ERRORS,
@ -31,7 +31,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?xmlMalformed=1";
let url = URL_UPDATE + "?xmlMalformed=1";
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update checking wizard no updates found page"
<window title="Update Wizard pages: update check and no updates found"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_NO_UPDATES_FOUND,
@ -31,7 +31,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?noUpdates=1";
let url = URL_UPDATE + "?noUpdates=1";
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update checking wizard billboard and license without required attribute (bug 548061)"
<window title="Update Wizard pages: update check, billoard, basic, license, and manual update (bug 548061)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
@ -42,7 +42,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?showBillboard=1&showLicense=1&remoteNoTypeAttr=1" +
let url = URL_UPDATE + "?showBillboard=1&showLicense=1&remoteNoTypeAttr=1" +
"&showDetails=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update checking wizard billboard and license not found (bug 548061)"
<window title="Update Wizard pages: update check, billoard, basic, license, and manual update (bug 548061)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
@ -42,7 +42,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?billboard404=1&license404=1&showDetails=1" +
let url = URL_UPDATE + "?billboard404=1&license404=1&showDetails=1" +
getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update prompt error page (partial only patch apply failure)"
<window title="Update Wizard pages: errors (partial only patch apply failure)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_ERRORS,
buttonClick: "finish"
} ];
@ -29,9 +29,9 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var patches = getLocalPatchString("partial", null, null, null, null, null,
let patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches, null, null, null,
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update prompt error page (complete only patch apply failure)"
<window title="Update Wizard pages: errors (complete only patch apply failure)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_ERRORS,
buttonClick: "finish"
} ];
@ -29,9 +29,9 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var patches = getLocalPatchString("complete", null, null, null, null, null,
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches, null, null, null,
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update prompt error patching page (partial failed - download complete)"
<window title="Update Wizard pages: error patching, download, and finished (partial failed and download complete)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_ERROR_PATCHING,
buttonClick: "next"
}, {
@ -36,11 +36,11 @@ function runTest() {
// Specify the url to update.sjs with a slowDownloadMar param so the ui can
// load before the download completes.
var slowDownloadURL = URL_UPDATE + "?slowDownloadMar=1";
var patches = getLocalPatchString("partial", null, null, null, null, null,
let slowDownloadURL = URL_UPDATE + "?slowDownloadMar=1";
let patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING) +
getLocalPatchString("complete", slowDownloadURL);
var updates = getLocalUpdateString(patches, null, null, null,
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update prompt error patching page (partial failed - complete verification failure)"
<window title="Update Wizard pages: error patching, download, and errors (partial failed and download complete verification failure)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_ERROR_PATCHING,
buttonClick: "next"
}, {
@ -36,12 +36,12 @@ function runTest() {
// Specify the url to update.sjs with a slowDownloadMar param so the ui can
// load before the download completes.
var slowDownloadURL = URL_UPDATE + "?slowDownloadMar=1";
var patches = getLocalPatchString("partial", null, null, null, null, null,
let slowDownloadURL = URL_UPDATE + "?slowDownloadMar=1";
let patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING) +
getLocalPatchString("complete", slowDownloadURL, "MD5",
"1234cd43a1c77e30191c53a329a3f99d");
var updates = getLocalUpdateString(patches, null, null, null,
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update prompt installed page"
<window title="Update Wizard pages: installed"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_INSTALLED,
buttonClick: "finish"
} ];
@ -30,9 +30,9 @@ function runTest() {
debugDump("Entering runTest");
Services.prefs.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, true);
var patches = getLocalPatchString("complete", null, null, null, null, null,
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches, null, null, null,
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test update prompt finished background page"
<window title="Update Wizard pages: finished background"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_FINISHED_BKGRD,
buttonClick: "extra1"
} ];
@ -29,9 +29,9 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var patches = getLocalPatchString("complete", null, null, null, null, null,
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches, null, null, null,
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test the never button (no billboard)"
<window title="Update Wizard pages: update check and basic (never button test)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
@ -23,7 +23,7 @@
gPrefToCheck = PREF_APP_UPDATE_NEVER_BRANCH + Services.appinfo.version;
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BASIC,
@ -36,7 +36,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?showNever=1&showDetails=1" + getVersionParams();
let url = URL_UPDATE + "?showNever=1&showDetails=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Test the never button (billboard)"
<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"
@ -23,7 +23,7 @@
gPrefToCheck = PREF_APP_UPDATE_NEVER_BRANCH + Services.appinfo.version;
const gTests = [ {
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
@ -44,7 +44,7 @@ const gTests = [ {
function runTest() {
debugDump("Entering runTest");
var url = URL_UPDATE + "?showBillboard=1&showNever=1" + getVersionParams();
let url = URL_UPDATE + "?showBillboard=1&showNever=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);

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

@ -36,14 +36,16 @@
function runTest() {
ok(true, "Entering runTest - cleanup");
SimpleTest.waitForExplicitFinish();
closeUpdateWindow();
resetPrefs();
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var dir = getCurrentProcessDir();
var file = dir.clone();
let dir = getCurrentProcessDir();
let file = dir.clone();
file.append(FILE_UPDATE_ACTIVE);
ok(!file.exists(), file.path + " should not exist");
@ -61,6 +63,22 @@ function runTest() {
file = dir.clone();
file.append(FILE_UPDATE_ARCHIVE);
ok(!file.exists(), file.path + " should not exist");
let addonPrepDir = Services.dirsvc.get(NS_APP_USER_PROFILE_50_DIR,
AUS_Ci.nsILocalFile);
addonPrepDir.append(ADDON_PREP_DIR);
// Not being able to remove the directory used to create the test add-ons
// will not adversely affect subsequent tests so wrap it in a try lock and
// don't test whether its removal was successful.
try {
removeDirRecursive(addonPrepDir);
}
catch (e) {
debugDump("removeDirRecursive failed to remove the " + ADDON_PREP_DIR +
" from the profile. " + e);
}
resetAddons(SimpleTest.finish);
}
]]>

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

@ -10,15 +10,20 @@ const SERVICE_URL = URL_HOST + URL_PATH + "empty.mar";
const SLOW_MAR_DOWNLOAD_INTERVAL = 100;
function handleRequest(request, response) {
function handleRequest(aRequest, aResponse) {
var params = { };
if (request.queryString)
params = parseQueryString(request.queryString);
if (aRequest.queryString)
params = parseQueryString(aRequest.queryString);
var statusCode = params.statusCode ? parseInt(params.statusCode) : 200;
var statusReason = params.statusReason ? params.statusReason : "OK";
response.setStatusLine(request.httpVersion, statusCode, statusReason);
response.setHeader("Cache-Control", "no-cache", false);
aResponse.setStatusLine(aRequest.httpVersion, statusCode, statusReason);
aResponse.setHeader("Cache-Control", "no-cache", false);
if (params.addonID) {
aResponse.write(getUpdateRDF(params));
return;
}
// When a mar download is started by the update service it can finish
// downloading before the ui has loaded. By specifying a serviceURL for the
@ -26,8 +31,8 @@ function handleRequest(request, response) {
// mar will be downloaded asynchronously which will allow the ui to load
// before the download completes.
if (params.slowDownloadMar) {
response.processAsync();
response.setHeader("Content-Length", "775");
aResponse.processAsync();
aResponse.setHeader("Content-Length", "775");
var marFile = AUS_Cc["@mozilla.org/file/directory_service;1"].
getService(AUS_Ci.nsIProperties).
get("CurWorkD", AUS_Ci.nsILocalFile);
@ -39,8 +44,8 @@ function handleRequest(request, response) {
var timer = AUS_Cc["@mozilla.org/timer;1"].
createInstance(AUS_Ci.nsITimer);
timer.initWithCallback(function() {
response.write(contents);
response.finish();
aResponse.write(contents);
aResponse.finish();
}, SLOW_MAR_DOWNLOAD_INTERVAL, AUS_Ci.nsITimer.TYPE_ONE_SHOT);
return;
}
@ -50,21 +55,21 @@ function handleRequest(request, response) {
if (!params.remoteNoTypeAttr &&
(params.uiURL == "BILLBOARD" || params.uiURL == "LICENSE"))
remoteType = " " + params.uiURL.toLowerCase() + "=\"1\"";
response.write("<html><head><meta http-equiv=\"content-type\" content=" +
"\"text/html; charset=utf-8\"></head><body" +
remoteType + ">" + params.uiURL +
"<br><br>this is a test mar that will not affect your " +
"build.</body></html>");
aResponse.write("<html><head><meta http-equiv=\"content-type\" content=" +
"\"text/html; charset=utf-8\"></head><body" +
remoteType + ">" + params.uiURL +
"<br><br>this is a test mar that will not affect your " +
"build.</body></html>");
return;
}
if (params.xmlMalformed) {
response.write("xml error");
aResponse.write("xml error");
return;
}
if (params.noUpdates) {
response.write(getRemoteUpdatesXMLString(""));
aResponse.write(getRemoteUpdatesXMLString(""));
return;
}
@ -77,7 +82,8 @@ function handleRequest(request, response) {
var type = params.type ? params.type : "major";
var name = params.name ? params.name : "App Update Test";
var appVersion = params.appVersion ? params.appVersion : "99.9";
var displayVersion = params.displayVersion ? params.displayVersion : "version " + appVersion;
var displayVersion = params.displayVersion ? params.displayVersion
: "version " + appVersion;
var platformVersion = params.platformVersion ? params.platformVersion : "99.8";
var buildID = params.buildID ? params.buildID : "01234567890123";
// XXXrstrong - not specifying a detailsURL will cause a leak due to bug 470244
@ -104,11 +110,20 @@ function handleRequest(request, response) {
licenseURL, showPrompt,
showNever, showSurvey, "test extra1");
response.write(getRemoteUpdatesXMLString(updates));
aResponse.write(getRemoteUpdatesXMLString(updates));
}
function parseQueryString(str) {
var paramArray = str.split("&");
/**
* Helper function to create a JS object representing the url parameters from
* the request's queryString.
*
* @param aQueryString
* The request's query string.
* @return A JS object representing the url parameters from the request's
* queryString.
*/
function parseQueryString(aQueryString) {
var paramArray = aQueryString.split("&");
var regex = /^([^=]+)=(.*)$/;
var params = {};
for (var i = 0, sz = paramArray.length; i < sz; i++) {
@ -120,3 +135,62 @@ function parseQueryString(str) {
return params;
}
/**
* Helper function to gets the string representation of the contents of the
* add-on's update manifest file.
*
* @param aParams
* A JS object representing the url parameters from the request's
* queryString.
* @return A string representation of the contents of the add-on's update
* manifest file.
*/
function getUpdateRDF(aParams) {
var addonVersion;
var addonID = aParams.addonID;
var addonUpdateType = addonID.split("_")[0];
var maxVersion = aParams.platformVersion;
switch (addonUpdateType) {
case "updatecompatibility":
// Use "1.0" for the add-on version for the compatibility update case since
// the tests create all add-ons with "1.0" for the version.
addonVersion = "1.0";
break;
case "updateversion":
// Use "2.0" for the add-on version for the version update case since the
// tests create all add-ons with "1.0" for the version.
addonVersion = "2.0";
break;
default:
return "<?xml version=\"1.0\"?>\n" +
"<RDF:RDF xmlns:RDF=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" " +
" xmlns:em=\"http://www.mozilla.org/2004/em-rdf#\">\n" +
"</RDF:RDF>\n";
}
return "<?xml version=\"1.0\"?>\n" +
"<RDF:RDF xmlns:RDF=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" " +
" xmlns:em=\"http://www.mozilla.org/2004/em-rdf#\">\n" +
" <RDF:Description about=\"urn:mozilla:extension:" + addonID + "\">\n" +
" <em:updates>\n" +
" <RDF:Seq>\n" +
" <RDF:li resource=\"urn:mozilla:extension:" + addonID + ":" + addonVersion + "\"/>\n" +
" </RDF:Seq>\n" +
" </em:updates>\n" +
" </RDF:Description>\n" +
" <RDF:Description about=\"urn:mozilla:extension:" + addonID + ":" + addonVersion + "\">\n" +
" <em:version>" + addonVersion + "</em:version>\n" +
" <em:targetApplication>\n" +
" <RDF:Description>\n" +
" <em:id>toolkit@mozilla.org</em:id>\n" +
" <em:minVersion>0</em:minVersion>\n" +
" <em:maxVersion>" + maxVersion + "</em:maxVersion>\n" +
" <em:updateLink>" + URL_HOST + URL_PATH + "</em:updateLink>\n" +
" <em:updateHash>sha256:0</em:updateHash>\n" +
" </RDF:Description>\n" +
" </em:targetApplication>\n" +
" </RDF:Description>\n" +
"</RDF:RDF>\n";
}

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

@ -3,7 +3,9 @@
*/
/**
* Most tests can use an array named gTests that will perform most if not all of
* Test Definition
*
* Most tests can use an array named TESTS that will perform most if not all of
* the necessary checks. Each element in the array must be an object with the
* following possible properties. Additional properties besides the ones listed
* below can be added as needed.
@ -53,7 +55,7 @@
*
* ranTest (should not be specified)
* When delayedDefaultCallback is called a property named ranTest is added to
* the current test it is possible to verify that each test in the gTests
* the current test it is possible to verify that each test in the TESTS
* array has ran.
*
* prefHasUserValue (optional)
@ -70,20 +72,59 @@
* For comparing the expected remotecontent state attribute value of the
* wizard's billboard and license pages in the checkRemoteContentState and
* waitForRemoteContentLoaded functions.
*
*
* Test Add-ons
*
* All tests include the test add-ons specified in the TEST_ADDONS array and
* the only thing that can be configured is whether the noupdate test add-on is
* disabled (see below). The add-on names are in the format of typename_X where
* X is a number to make the add-on ID unique and typename is one of the values
* specified below:
*
* appdisabled
* disabled by the application due to being incompatible with the current
* toolkit version.
*
* compatible
* compatible with the current toolkit version and the update's toolkit
* version.
*
* noupdate
* the add-on is compatible with the current toolkit version and does not have
* an update to make it compatible with the update's toolkit version. Tests
* that need to have all add-ons compatible for the application update can
* disable this add-on by setting the gDisableNoUpdateAddon variable to true.
*
* updatecompatibility
* the add-on is compatible with the current toolkit version and has a
* compatibility update to make it compatible with the update's toolkit
* version.
*
* updateversion
* the add-on is compatible with the current toolkit version and has a version
* update to make it compatible with the update's toolkit version.
*
* userdisabled
* disabled by the user and compatible with the current toolkit version but
* not the update's toolkit version. This add-on will be disabled after its
* install completes.
*/
// The tests have to use the pageid due to the wizard's access method being
// random.
Components.utils.import("resource://gre/modules/AddonManager.jsm");
// The tests have to use the pageid instead of the pageIndex due to the
// app update wizard's access method being random.
const PAGEID_DUMMY = "dummy"; // Done
const PAGEID_CHECKING = "checking"; // Done
const PAGEID_PLUGIN_UPDATES = "pluginupdatesfound";
const PAGEID_NO_UPDATES_FOUND = "noupdatesfound"; // Done
const PAGEID_MANUAL_UPDATE = "manualUpdate"; // Tested on license load failure
const PAGEID_INCOMPAT_CHECK = "incompatibleCheck"; // Bug 546595
const PAGEID_INCOMPAT_CHECK = "incompatibleCheck"; // Done
const PAGEID_FOUND_BASIC = "updatesfoundbasic"; // Done
const PAGEID_FOUND_BILLBOARD = "updatesfoundbillboard"; // Done
const PAGEID_LICENSE = "license"; // Done
const PAGEID_INCOMPAT_LIST = "incompatibleList"; // Bug 546595
const PAGEID_INCOMPAT_LIST = "incompatibleList"; // Done
const PAGEID_DOWNLOADING = "downloading"; // Done
const PAGEID_ERRORS = "errors"; // Done
const PAGEID_ERROR_PATCHING = "errorpatching"; // Done
@ -101,16 +142,35 @@ const URI_UPDATE_PROMPT_DIALOG = "chrome://mozapps/content/update/updates.xul";
const CRC_ERROR = 4;
const ADDON_ID_SUFFIX = "@appupdatetest.mozilla.org";
const ADDON_PREP_DIR = "appupdateprep";
// Preference for storing add-ons that are disabled by the tests to prevent them
// from interefering with the tests.
const PREF_DISABLEDADDONS = "app.update.test.disabledAddons";
const TEST_ADDONS = [ "appdisabled_1", "appdisabled_2",
"compatible_1", "compatible_2",
"noupdate_1", "noupdate_2",
"updatecompatibility_1", "updatecompatibility_2",
"updateversion_1", "updateversion_2",
"userdisabled_1", "userdisabled_2" ];
const DEBUG_DUMP = false;
const TEST_TIMEOUT = 30000; // 30 seconds
var gTimeoutTimer;
// The following vars are for restoring previous preference values (if present)
// when the test finishes.
var gAppUpdateChannel; // app.update.channel (default prefbranch)
var gAppUpdateEnabled; // app.update.enabled
var gAppUpdateURL; // app.update.url.override
var gExtUpdateURL; // extensions.update.url
var gTestCounter = -1;
var gUpdateChannel;
var gDocElem;
var gWin;
var gDocElem;
var gPrefToCheck;
var gDisableNoUpdateAddon = false;
#include ../shared.js
@ -121,10 +181,10 @@ function debugDump(msg) {
}
/**
* The current test in gTests array.
* The current test in TESTS array.
*/
__defineGetter__("gTest", function() {
return gTests[gTestCounter];
return TESTS[gTestCounter];
});
/**
@ -133,8 +193,8 @@ __defineGetter__("gTest", function() {
* overrideCallback property is undefined.
*/
__defineGetter__("gCallback", function() {
return gTest.overrideCallback ? gTest.overrideCallback
: defaultCallback;
return gTest.overrideCallback ? gTest.overrideCallback
: defaultCallback;
});
/**
@ -169,22 +229,32 @@ __defineGetter__("gAcceptDeclineLicense", function() {
return gWin.document.getElementById("acceptDeclineLicense");
});
/**
* The listbox for the incompatibleList page.
*/
__defineGetter__("gIncompatibleListbox", function() {
return gWin.document.getElementById("incompatibleListbox");
});
/**
* Default test run function that can be used by most tests.
*/
function runTestDefault() {
debugDump("Entering runTestDefault");
if (!("@mozilla.org/zipwriter;1" in AUS_Cc)) {
ok(false, "nsIZipWriter is required to run these tests");
return;
}
SimpleTest.waitForExplicitFinish();
Services.ww.registerNotification(gWindowObserver);
setUpdateChannel();
Services.prefs.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
removeUpdateDirsAndFiles
setupPrefs();
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
runTest();
setupAddons(runTest);
}
/**
@ -215,8 +285,8 @@ function finishTestDefault() {
* Window doesn't close for a test. This allows the next test to run properly if
* a previous test fails.
*
* @param aTimer
* The nsITimer that fired.
* @param aTimer
* The nsITimer that fired.
*/
function finishTestTimeout(aTimer) {
gTimeoutTimer = null;
@ -249,7 +319,7 @@ function onPageShowDefault(aEvent) {
* Default callback that can be used by most tests.
*/
function defaultCallback(aEvent) {
debugDump("Entering defaultCallback - gTests[" + gTestCounter + "], " +
debugDump("Entering defaultCallback - TESTS[" + gTestCounter + "], " +
"pageid: " + gTest.pageid + ", " +
"aEvent.originalTarget.nodeName: " + aEvent.originalTarget.nodeName);
@ -263,7 +333,7 @@ function defaultCallback(aEvent) {
}
is(gDocElem.currentPage.pageid, gTest.pageid,
"Checking currentPage.pageid equals " + gTest.pageid + " in onPageShow");
"Checking currentPage.pageid equals " + gTest.pageid + " in pageshow");
// Perform extra checks if specified by the test
if (gTest.extraCheckFunction) {
@ -284,7 +354,7 @@ function defaultCallback(aEvent) {
* before checking their values.
*/
function delayedDefaultCallback() {
debugDump("Entering delayedDefaultCallback - gTests[" + gTestCounter + "], " +
debugDump("Entering delayedDefaultCallback - TESTS[" + gTestCounter + "], " +
"pageid: " + gTest.pageid);
// Verify the pageid hasn't changed after executeSoon was called.
@ -325,7 +395,7 @@ function delayedDefaultCallback() {
* and hidden attribute value is true.
*/
function checkButtonStates() {
debugDump("Entering checkButtonStates - gTests[" + gTestCounter + "], " +
debugDump("Entering checkButtonStates - TESTS[" + gTestCounter + "], " +
"pageid: " + gTest.pageid);
const buttonNames = ["extra1", "extra2", "back", "next", "finish", "cancel"];
@ -400,7 +470,7 @@ function getExpectedButtonStates() {
* Adds a load event listener to the current remotecontent element.
*/
function addRemoteContentLoadListener() {
debugDump("Entering addRemoteContentLoadListener - gTests[" + gTestCounter +
debugDump("Entering addRemoteContentLoadListener - TESTS[" + gTestCounter +
"], pageid: " + gTest.pageid);
gRemoteContent.addEventListener("load", remoteContentLoadListener, false);
@ -468,7 +538,7 @@ function checkRemoteContentState() {
* the radio element specified in the current test's radioClick property.
*/
function addRadioGroupSelectListenerAndClick() {
debugDump("Entering addRadioGroupSelectListenerAndClick - gTests[" +
debugDump("Entering addRadioGroupSelectListenerAndClick - TESTS[" +
gTestCounter + "], pageid: " + gTest.pageid);
gAcceptDeclineLicense.addEventListener("select", radioGroupSelectListener,
@ -505,19 +575,32 @@ function checkRadioGroupSelectedIndex() {
gTest.expectedRadioGroupSelectedIndex);
}
/**
* Checks that only incompatible add-ons (e.g. noupdate_X add-ons) that don't
* have an update are listed in the add-ons incompatible list.
*/
function checkIncompatbleList() {
for (let i = 0; i < gIncompatibleListbox.itemCount; i++) {
let label = gIncompatibleListbox.getItemAtIndex(i).label;
// Use indexOf since locales can change the text displayed
ok(label.indexOf("noupdate") != -1, "Checking that only incompatible " +
"add-ons that don't have an update are listed in the incompatible list");
}
}
/**
* Compares the return value of prefHasUserValue for the preference specified in
* gPrefToCheck with the value passed in the aPrefHasValue param or the value
* specified in the current test's prefHasUserValue property if aPrefHasValue
* is undefined.
* gPrefToCheck with the value passed in the aPrefHasValue parameter or the
* value specified in the current test's prefHasUserValue property if
* aPrefHasValue is undefined.
*
* @param aPrefHasValue
* The expected value returned from prefHasUserValue for the preference
* specified in gPrefToCheck. If aPrefHasValue is undefined the value
* of the current test's prefHasUserValue property will be used.
* @param aPrefHasValue (optional)
* The expected value returned from prefHasUserValue for the preference
* specified in gPrefToCheck. If aPrefHasValue is undefined the value
* of the current test's prefHasUserValue property will be used.
*/
function checkPrefHasUserValue(aPrefHasValue) {
var prefHasUserValue = aPrefHasValue === undefined ? gTest.prefHasUserValue
let prefHasUserValue = aPrefHasValue === undefined ? gTest.prefHasUserValue
: aPrefHasValue;
is(Services.prefs.prefHasUserValue(gPrefToCheck), prefHasUserValue,
"Checking prefHasUserValue for preference " + gPrefToCheck + " equals " +
@ -525,16 +608,17 @@ function checkPrefHasUserValue(aPrefHasValue) {
}
/**
* Gets the update version info for the update url params to send to update.sjs.
* Gets the update version info for the update url parameters to send to
* update.sjs.
*
* @param aAppVersion
* @param aAppVersion (optional)
* The application version for the update snippet. If not specified the
* current application version will be used.
* @param aPlatformVersion
* @param aPlatformVersion (optional)
* The platform version for the update snippet. If not specified the
* current platform version will be used.
* @return The url params for the application and platform version to send to
* update.sjs.
* @return The url parameters for the application and platform version to send
* to update.sjs.
*/
function getVersionParams(aAppVersion, aPlatformVersion) {
let appInfo = Services.appinfo;
@ -543,6 +627,32 @@ function getVersionParams(aAppVersion, 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;
}
/**
* Verifies that all tests ran.
*/
@ -550,49 +660,94 @@ function verifyTestsRan() {
debugDump("Entering verifyTestsRan");
// Return early if there are no tests defined.
if (!gTests) {
if (!TESTS) {
return;
}
gTestCounter = -1;
for (let i = 0; i < gTests.length; ++i) {
for (let i = 0; i < TESTS.length; ++i) {
gTestCounter++;
let test = gTests;
let msg = "Checking if gTests[" + i + "] test was performed... " +
"callback function name = " + gCallback.name + "," +
"pageid = " + (gTest.pageid ? gTest.pageid : "N/A");
ok(gTest.ranTest, msg);
let test = TESTS[i];
let msg = "Checking if TESTS[" + i + "] test was performed... " +
"callback function name = " + gCallback.name + ", " +
"pageid = " + test.pageid;
ok(test.ranTest, msg);
}
}
/**
* Resets the most common preferences used by tests to their original value.
* Sets the most common preferences used by tests to values used by the tests
* and saves some of the preference's original values if present so they can be
* set back to the original values when each test has finished.
*/
function setupPrefs() {
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_OVERRIDE)) {
gAppUpdateURL = Services.prefs.setIntPref(PREF_APP_UPDATE_URL_OVERRIDE);
}
gAppUpdateChannel = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_CHANNEL);
setUpdateChannel();
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_ENABLED)) {
gAppUpdateEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED);
}
if (Services.prefs.prefHasUserValue(PREF_EXTENSIONS_UPDATE_URL)) {
gExtUpdateURL = Services.prefs.getCharPref(PREF_EXTENSIONS_UPDATE_URL);
}
let extUpdateUrl = URL_UPDATE + "?addonID=%ITEM_ID%&platformVersion=" +
getNewerPlatformVersion();
Services.prefs.setCharPref(PREF_EXTENSIONS_UPDATE_URL, extUpdateUrl);
debugDump("extensions.update.url: " + extUpdateUrl);
Services.prefs.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
}
/**
* Resets the most common preferences used by tests to their original values.
*/
function resetPrefs() {
if (gUpdateChannel) {
setUpdateChannel(gUpdateChannel);
if (gAppUpdateURL) {
Services.prefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, gAppUpdateURL);
}
else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_OVERRIDE)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_URL_OVERRIDE);
}
if (gAppUpdateChannel) {
setUpdateChannel(gAppUpdateChannel);
}
if (gAppUpdateEnabled) {
Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, gAppUpdateEnabled);
}
else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_ENABLED)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_ENABLED);
}
if (gExtUpdateURL) {
Services.prefs.setCharPref(PREF_EXTENSIONS_UPDATE_URL, gExtUpdateURL);
}
else if (Services.prefs.prefHasUserValue(PREF_EXTENSIONS_UPDATE_URL)) {
Services.prefs.clearUserPref(PREF_EXTENSIONS_UPDATE_URL);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_IDLETIME)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_IDLETIME);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_ENABLED)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_ENABLED);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_LOG)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_LOG);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_SHOW_INSTALLED_UI)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_DETAILS)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_URL_DETAILS);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_OVERRIDE)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_URL_OVERRIDE);
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_SHOW_INSTALLED_UI)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_IDLETIME)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_IDLETIME);
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_LOG)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_LOG);
}
try {
Services.prefs.deleteBranch(PREF_APP_UPDATE_NEVER_BRANCH);
}
@ -600,6 +755,267 @@ function resetPrefs() {
}
}
/**
* Disables pre-existing add-ons so they don't interfere with the tests,
* installs the test add-ons, sets the noupdate test add-ons' userDisabled value
* for the test, and calls the callback specified in the aCallback parameter. If
* the app.update.test.disabledAddons has a user value then setting the noupdate
* test add-ons' userDisabled value for the test is the only thing that is done.
*
* @param aCallback
* A callback to call after all operations have completed.
*/
function setupAddons(aCallback) {
debugDump("Entering setupAddons");
// Sets the appropriate userDisabled value for the noupdate test add-ons based
// on the value of gDisableNoUpdateAddon and calls the callback specified in
// setupAddons aCallback parameter.
function setNoUpdateAddonsDisabledState() {
AddonManager.getAllAddons(function(aAddons) {
aAddons.forEach(function(aAddon) {
if (aAddon.name.indexOf("noupdate") != 0)
return;
if (gDisableNoUpdateAddon) {
if (!aAddon.userDisabled) {
aAddon.userDisabled = true;
}
}
else {
if (aAddon.userDisabled) {
aAddon.userDisabled = false;
}
}
});
aCallback();
});
}
// If the app.update.test.disabledAddons preference exists the pre-existing
// add-ons have already been disabled so they don't interfere with the tests,
// the test add-ons have already been installed, and the only thing that needs
// to be done is setting the appropriate userDisabled value for the noupdate
// test add-ons.
if (Services.prefs.prefHasUserValue(PREF_DISABLEDADDONS)) {
setNoUpdateAddonsDisabledState();
return;
}
// Disable all pre-existing enabled addons so they don't interfere with the
// tests.
AddonManager.getAllAddons(function(aAddons) {
let disabledAddons = [];
aAddons.forEach(function(aAddon) {
// If an addon's type equals plugin it is skipped since
// checking plugins compatibility information isn't supported at this
// time (also see bug 566787).
if (aAddon.type != "plugin" && !aAddon.appDisabled &&
!aAddon.userDisabled) {
disabledAddons.push(aAddon);
aAddon.userDisabled = true;
}
});
// If there are no pre-existing add-ons the preference value will be an
// empty string.
Services.prefs.setCharPref(PREF_DISABLEDADDONS, disabledAddons.join(" "));
// Install the test add-ons.
let xpiFiles = getTestAddonXPIFiles();
let xpiCount = xpiFiles.length;
let installs = [];
xpiFiles.forEach(function(aFile) {
AddonManager.getInstallForFile(aFile, function(aInstall) {
if (!aInstall) {
throw "No AddonInstall created for " + aFile.path;
}
installs.push(aInstall);
if (--xpiCount == 0) {
let installCount = installs.length;
function installCompleted(aInstall) {
aInstall.removeListener(listener);
if (getAddonTestType(aInstall.addon.name) == "userdisabled") {
aInstall.addon.userDisabled = true;
}
if (--installCount == 0) {
setNoUpdateAddonsDisabledState();
}
}
let listener = {
onDownloadFailed: installCompleted,
onDownloadCancelled: installCompleted,
onInstallFailed: installCompleted,
onInstallCancelled: installCompleted,
onInstallEnded: installCompleted
};
installs.forEach(function(aInstall) {
aInstall.addListener(listener);
aInstall.install();
});
}
});
});
});
}
/**
* Uninstalls the test add-ons, enables add-ons that were disabled when the
* test started, and calls the callback specified in the aCallback parameter.
*
* @param aCallback
* A callback to call after all operations have completed.
*/
function resetAddons(aCallback) {
debugDump("Entering resetAddons");
// If test_9999_cleanup.xul is ran by itself then the test add-ons will not
// have been installed and any pre-existing add-ons will not have been
// disabled so return early.
if (!Services.prefs.prefHasUserValue(PREF_DISABLEDADDONS)) {
debugDump("resetAddons - preference " + PREF_DISABLEDADDONS + " doesn't " +
"exist... returning early");
aCallback();
return;
}
// Uninstall the test add-ons.
let count = TEST_ADDONS.length;
function uninstallCompleted(aAddon) {
if (--count == 0) {
AddonManager.removeAddonListener(listener);
// Enable the pre-existing add-ons that were disabled so they wouldn't
// interfere with the tests.
let disabledAddons = Services.prefs.getCharPref(PREF_DISABLEDADDONS).split(" ");
Services.prefs.clearUserPref(PREF_DISABLEDADDONS);
AddonManager.getAllAddons(function(aAddons) {
aAddons.forEach(function(aAddon) {
if (disabledAddons.indexOf(aAddon.id)) {
aAddon.userDisabled = false;
}
});
aCallback();
});
}
}
let listener = {
onUninstalled: uninstallCompleted
};
AddonManager.addAddonListener(listener);
TEST_ADDONS.forEach(function(aName) {
AddonManager.getAddonByID(aName + ADDON_ID_SUFFIX, function(aAddon) {
aAddon.uninstall();
});
});
}
/**
* Helper function to get the string before the '_' character in an add-on's
* name or id which is used to determine the add-on test type used by the tests.
*
* @param aName
* The test add-on's name or id.
* @return The string before the '_' character in the string passed in the aName
* parameter.
*/
function getAddonTestType(aName) {
return aName.split("_")[0];
}
/**
* Helper function to create add-on xpi files for the default test add-ons.
*
* @return An array with each member being an nsILocalFile for an add-on XPI
* file.
*/
function getTestAddonXPIFiles() {
let addonPrepDir = Services.dirsvc.get(NS_APP_USER_PROFILE_50_DIR,
AUS_Ci.nsILocalFile);
addonPrepDir.append(ADDON_PREP_DIR);
let bootstrap = addonPrepDir.clone();
bootstrap.append("bootstrap.js");
// If a previous test has already created bootstrap.js don't create it again.
if (!bootstrap.exists()) {
let bootstrapContents = "function install(data, reason){ }\n" +
"function startup(data, reason){ }\n" +
"function shutdown(data, reason){ }\n" +
"function uninstall(data, reason){ }\n";
writeFile(bootstrap, bootstrapContents);
}
let installRDF = addonPrepDir.clone();
installRDF.append("install.rdf");
let xpiFiles = [];
TEST_ADDONS.forEach(function(aName) {
let xpiFile = addonPrepDir.clone();
xpiFile.append(aName + ".xpi");
if (installRDF.exists())
installRDF.remove(false);
writeFile(installRDF, getInstallRDFString(aName));
gZipW.open(xpiFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE);
gZipW.addEntryFile(installRDF.leafName,
AUS_Ci.nsIZipWriter.COMPRESSION_DEFAULT, installRDF,
false);
gZipW.addEntryFile(bootstrap.leafName,
AUS_Ci.nsIZipWriter.COMPRESSION_DEFAULT, bootstrap,
false);
gZipW.close();
xpiFiles.push(xpiFile);
});
return xpiFiles;
}
/**
* Helper function to gets the string representation of the contents of the
* add-on's install.rdf file.
*
* @param aName
* The string to use for the add-on's name which is also used to
* construct the local-part in RFC 5322 format of the add-on's ID.
* @return A string representation of the contents of the add-on's install.rdf
* file.
*/
function getInstallRDFString(aName) {
let maxVersion = Services.appinfo.platformVersion;
switch (getAddonTestType(aName)) {
case "compatible":
maxVersion = getNewerPlatformVersion();
break;
case "appdisabled":
maxVersion = "0.1";
break;
}
return "<?xml version=\"1.0\"?>\n" +
"<RDF xmlns=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n" +
" xmlns:em=\"http://www.mozilla.org/2004/em-rdf#\">\n" +
" <Description about=\"urn:mozilla:install-manifest\">\n" +
" <em:id>" + aName + ADDON_ID_SUFFIX + "</em:id>\n" +
" <em:version>1.0</em:version>\n" +
" <em:bootstrap>true</em:bootstrap>\n" +
" <em:name>" + aName + "</em:name>\n" +
" <em:description>Test Description</em:description>\n" +
" <em:targetApplication>\n" +
" <Description>\n" +
" <em:id>toolkit@mozilla.org</em:id>\n" +
" <em:minVersion>undefined</em:minVersion>\n" +
" <em:maxVersion>" + maxVersion + "</em:maxVersion>\n" +
" </Description>\n" +
" </em:targetApplication>\n" +
" </Description>\n" +
"</RDF>";
}
/**
* Closes the update window if it is open.
*/

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

@ -60,6 +60,8 @@ const PREF_APP_PARTNER_BRANCH = "app.partner.";
const PREF_DISTRIBUTION_ID = "distribution.id";
const PREF_DISTRIBUTION_VERSION = "distribution.version";
const PREF_EXTENSIONS_UPDATE_URL = "extensions.update.url";
const NS_APP_PROFILE_DIR_STARTUP = "ProfDS";
const NS_APP_USER_PROFILE_50_DIR = "ProfD";
const NS_GRE_DIR = "GreD";
@ -88,6 +90,13 @@ const MODE_CREATE = 0x08;
const MODE_APPEND = 0x10;
const MODE_TRUNCATE = 0x20;
const PR_RDWR = 0x04;
const PR_CREATE_FILE = 0x08;
const PR_APPEND = 0x10;
const PR_TRUNCATE = 0x20;
const PR_SYNC = 0x40;
const PR_EXCL = 0x80;
const PERMS_FILE = 0644;
const PERMS_DIRECTORY = 0755;
@ -128,6 +137,12 @@ __defineGetter__("gDefaultPrefBranch", function() {
return this.gDefaultPrefBranch = Services.prefs.getDefaultBranch(null);
});
__defineGetter__("gZipW", function() {
delete this.gZipW;
return this.gZipW = AUS_Cc["@mozilla.org/zipwriter;1"].
createInstance(AUS_Ci.nsIZipWriter);
});
/* Initializes the update service stub */
function initUpdateServiceStub() {
AUS_Cc["@mozilla.org/updates/update-service-stub;1"].