4. mochitest chrome tests for app update - Bug 530872. r=dtownsend

This commit is contained in:
Robert Strong 2010-03-03 10:57:09 -08:00
Родитель 2c59dc2ec0
Коммит f65845c1c5
24 изменённых файлов: 3756 добавлений и 0 удалений

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

@ -44,6 +44,10 @@ include $(DEPTH)/config/autoconf.mk
MODULE = test_update
DIRS = \
chrome \
$(NULL)
XPCSHELL_TESTS = \
unit \
$(NULL)

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

@ -0,0 +1,84 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# the Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Robert Strong <robert.bugzilla@gmail.com> (Original Author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = toolkit/mozapps/update/test/chrome
include $(DEPTH)/config/autoconf.mk
_OTHER_FILES = \
../unit/data/empty.mar \
$(NULL)
_CHROME_FILES = \
test_0011_check_billboard_noLicense_noAddons.xul \
test_0012_check_billboard_noAddons.xul \
test_0021_check_noBillboard_noLicense_noAddons.xul \
test_0022_check_noBillboard_noAddons.xul \
test_0031_available_billboard_noLicense_noAddons.xul \
test_0032_available_billboard_noAddons.xul \
test_0041_available_noBillboard_noLicense_noAddons.xul \
test_0042_available_noBillboard_noAddons.xul \
test_0051_check_error_xml_malformed.xul \
test_0052_check_no_updates.xul \
test_0081_error_patchApplyFailure_partial_only.xul \
test_0082_error_patchApplyFailure_complete_only.xul \
test_0083_error_patchApplyFailure_partial_complete.xul \
test_0084_error_patchApplyFailure_verify_failed.xul \
test_0091_installed.xul \
test_0092_finishedBackground.xul \
test_0111_neverButton_billboard.xul \
test_0112_neverButton_noBillboard.xul \
test_9999_cleanup.xul \
$(NULL)
include $(topsrcdir)/config/rules.mk
libs:: $(_OTHER_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
libs:: $(_CHROME_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
libs::
$(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) $(srcdir)/utils.js > \
$(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)/utils.js
$(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) $(srcdir)/update.sjs > \
$(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)/update.sjs

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

@ -0,0 +1,234 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var queryString = "?showBillboard=1&showDetails=1";
setUpdateURLOverride(URL_UPDATE + queryString);
gNextFunc = test02;
gPageId = PAGEID_CHECKING;
gUP.checkForUpdates();
}
/**
* updates checking page
*/
function test02() {
ok(true, "Entering test02 - updates checking page");
is(gDocElem.currentPage.pageid, PAGEID_CHECKING,
"Page ID should be " + PAGEID_CHECKING);
ok(gDocElem.getButton("extra1").hidden, "extra1 button should be hidden");
ok(gDocElem.getButton("extra1").disabled, "extra1 button should be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(!gDocElem.getButton("cancel").hidden, "cancel button should not be hidden");
ok(!gDocElem.getButton("cancel").disabled, "cancel button should not be disabled");
gNextFunc = test03;
gPageId = PAGEID_FOUND_BILLBOARD;
// This page will automatically go to the incompatibility check page and the
// incompatibility check page will automatically go to the updates found
// billboard page
addPageShowListener();
}
/**
* updates found billboard page
*/
function test03() {
ok(true, "Entering test03 - updates found billboard page");
var updateMoreInfoContent = gWin.document.getElementById("updateMoreInfoContent");
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BILLBOARD,
"Page ID should be " + PAGEID_FOUND_BILLBOARD);
isnot(updateMoreInfoContent.getAttribute("state"), "loaded",
"updateMoreInfoContent state attribute value should not equal loaded");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test04;
// wait until the remote content has loaded
updateMoreInfoContent.addEventListener("load", nextFuncListener, false);
}
/**
* updates found billboard page
*/
function test04(aEvent) {
// Return early until updateMoreInfoContent has loaded.
var updateMoreInfoContent = gWin.document.getElementById("updateMoreInfoContent");
if (updateMoreInfoContent.getAttribute("state") != "loaded" ||
!aEvent.originalTarget.isSameNode(updateMoreInfoContent))
return;
ok(true, "Entering test04 - updates found billboard page");
updateMoreInfoContent.removeEventListener("load", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BILLBOARD,
"Page ID should be " + PAGEID_FOUND_BILLBOARD);
is(updateMoreInfoContent.getAttribute("state"), "loaded",
"updateMoreInfoContent state attribute value should equal loaded");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test05;
gPageId = PAGEID_DOWNLOADING;
addPageShowListener();
// go forward to the downloading page
gDocElem.getButton("next").click();
}
/**
* downloading page
*/
function test05() {
ok(true, "Entering test05 - downloading page");
is(gDocElem.currentPage.pageid, PAGEID_DOWNLOADING,
"Page ID should be " + PAGEID_DOWNLOADING);
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test06;
gPageId = PAGEID_FINISHED;
addPageShowListener();
// The downloading page will automatically go to the finish page.
}
/**
* finished page
*/
function test06() {
ok(true, "Entering test06 - finished page");
is(gDocElem.currentPage.pageid, PAGEID_FINISHED,
"Page ID should be " + PAGEID_FINISHED);
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(!gDocElem.getButton("finish").hidden, "finish button should not be hidden");
ok(!gDocElem.getButton("finish").disabled, "finish button should not be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = finishTestDefault;
// exit by clicking the extra1 (restart later) button
gDocElem.getButton("extra1").click();
}
]]>
</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,473 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var queryString = "?showBillboard=1&showLicense=1&showDetails=1";
setUpdateURLOverride(URL_UPDATE + queryString);
gNextFunc = test02;
gPageId = PAGEID_CHECKING;
gUP.checkForUpdates();
}
/**
* updates checking page
*/
function test02() {
ok(true, "Entering test02 - updates checking page");
is(gDocElem.currentPage.pageid, PAGEID_CHECKING,
"Page ID should be " + PAGEID_CHECKING);
ok(gDocElem.getButton("extra1").hidden, "extra1 button should be hidden");
ok(gDocElem.getButton("extra1").disabled, "extra1 button should be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(!gDocElem.getButton("cancel").hidden, "cancel button should not be hidden");
ok(!gDocElem.getButton("cancel").disabled, "cancel button should not be disabled");
gNextFunc = test03;
gPageId = PAGEID_FOUND_BILLBOARD;
// This page will automatically go to the incompatibility check page and the
// incompatibility check page will automatically go to the updates found
// billboard page
addPageShowListener();
}
/**
* updates found billboard page
*/
function test03() {
ok(true, "Entering test03 - updates found billboard page");
var updateMoreInfoContent = gWin.document.getElementById("updateMoreInfoContent");
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BILLBOARD,
"Page ID should be " + PAGEID_FOUND_BILLBOARD);
isnot(updateMoreInfoContent.getAttribute("state"), "loaded",
"updateMoreInfoContent state attribute value should not equal loaded");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test04;
// wait until the remote content has loaded
updateMoreInfoContent.addEventListener("load", nextFuncListener, false);
}
/**
* updates found billboard page
*/
function test04(aEvent) {
// Return early until updateMoreInfoContent has loaded.
var updateMoreInfoContent = gWin.document.getElementById("updateMoreInfoContent");
if (updateMoreInfoContent.getAttribute("state") != "loaded" ||
!aEvent.originalTarget.isSameNode(updateMoreInfoContent))
return;
ok(true, "Entering test04 - updates found billboard page");
updateMoreInfoContent.removeEventListener("load", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BILLBOARD,
"Page ID should be " + PAGEID_FOUND_BILLBOARD);
is(updateMoreInfoContent.getAttribute("state"), "loaded",
"updateMoreInfoContent state attribute value should equal loaded");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test05;
gPageId = PAGEID_LICENSE;
addPageShowListener();
// go forward to the license page
gDocElem.getButton("next").click();
}
/**
* license page
*/
function test05() {
ok(true, "Entering test05 - license page");
var licenseContent = gWin.document.getElementById("licenseContent");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
isnot(licenseContent.getAttribute("state"), "loaded",
"licenseContent state attribute value should not equal loaded");
is(acceptDeclineLicense.selectedIndex, 1,
"acceptDeclineLicense selectedIndex should be 1");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test06;
// wait until the remote content has loaded
licenseContent.addEventListener("load", nextFuncListener, false);
}
/**
* license page
*/
function test06(aEvent) {
// Return early until licenseContent has loaded.
var licenseContent = gWin.document.getElementById("licenseContent");
if (licenseContent.getAttribute("state") != "loaded" ||
!aEvent.originalTarget.isSameNode(licenseContent))
return;
ok(true, "Entering test06 - license page");
var licenseContent = gWin.document.getElementById("licenseContent");
licenseContent.removeEventListener("load", nextFuncListener, false);
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(licenseContent.getAttribute("state"), "loaded",
"licenseContent state attribute value should equal loaded");
is(acceptDeclineLicense.selectedIndex, 1,
"acceptDeclineLicense selectedIndex should be 1");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test07;
acceptDeclineLicense.addEventListener("select", nextFuncListener, false);
// accept the license agreement
gWin.document.getElementById("accept").click();
}
/**
* license page
*/
function test07() {
ok(true, "Entering test07 - license page");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
acceptDeclineLicense.removeEventListener("select", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(acceptDeclineLicense.selectedIndex, 0,
"acceptDeclineLicense selectedIndex should be 0");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test08;
gPageId = PAGEID_FOUND_BILLBOARD;
addPageShowListener();
// go back to the updates found billboard page
gDocElem.getButton("extra1").click();
}
/**
* updates found billboard page
*/
function test08() {
ok(true, "Entering test08 - updates found billboard page");
var updateMoreInfoContent = gWin.document.getElementById("updateMoreInfoContent");
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BILLBOARD,
"Page ID should be " + PAGEID_FOUND_BILLBOARD);
is(updateMoreInfoContent.getAttribute("state"), "loaded",
"updateMoreInfoContent state attribute value should equal loaded");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test09;
gPageId = PAGEID_LICENSE;
addPageShowListener();
// go forward to the license page
gDocElem.getButton("next").click();
}
/**
* license page
*/
function test09() {
ok(true, "Entering test09 - license page");
var licenseContent = gWin.document.getElementById("licenseContent");
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(licenseContent.getAttribute("state"), "loaded",
"licenseContent state attribute value should equal loaded");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
gNextFunc = test10;
acceptDeclineLicense.addEventListener("select", nextFuncListener, false);
// decline the license agreement
gWin.document.getElementById("decline").click();
}
/**
* license page
*/
function test10() {
ok(true, "Entering test10 - license page");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
acceptDeclineLicense.removeEventListener("select", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(acceptDeclineLicense.selectedIndex, 1,
"acceptDeclineLicense selectedIndex should be 1");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test11;
acceptDeclineLicense.addEventListener("select", nextFuncListener, false);
// accept the license agreement
gWin.document.getElementById("accept").click();
}
/**
* license page
*/
function test11() {
ok(true, "Entering test11 - license page");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
acceptDeclineLicense.removeEventListener("select", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(acceptDeclineLicense.selectedIndex, 0,
"acceptDeclineLicense selectedIndex should be 0");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test12;
gPageId = PAGEID_DOWNLOADING;
addPageShowListener();
// go forward to the downloading page
gDocElem.getButton("next").click();
}
/**
* downloading page
*/
function test12() {
ok(true, "Entering test12 - downloading page");
is(gDocElem.currentPage.pageid, PAGEID_DOWNLOADING,
"Page ID should be " + PAGEID_DOWNLOADING);
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test13;
gPageId = PAGEID_FINISHED;
addPageShowListener();
// The downloading page will automatically go to the finish page.
}
/**
* finished page
*/
function test13() {
ok(true, "Entering test13 - finished page");
is(gDocElem.currentPage.pageid, PAGEID_FINISHED,
"Page ID should be " + PAGEID_FINISHED);
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(!gDocElem.getButton("finish").hidden, "finish button should not be hidden");
ok(!gDocElem.getButton("finish").disabled, "finish button should not be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = finishTestDefault;
// exit by clicking the extra1 (restart later) button
gDocElem.getButton("extra1").click();
}
]]>
</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,193 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var queryString = "?showDetails=1";
setUpdateURLOverride(URL_UPDATE + queryString);
gNextFunc = test02;
gPageId = PAGEID_CHECKING;
gUP.checkForUpdates();
}
/**
* updates checking page
*/
function test02() {
ok(true, "Entering test02 - updates checking page");
is(gDocElem.currentPage.pageid, PAGEID_CHECKING,
"Page ID should be " + PAGEID_CHECKING);
ok(gDocElem.getButton("extra1").hidden, "extra1 button should be hidden");
ok(gDocElem.getButton("extra1").disabled, "extra1 button should be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(!gDocElem.getButton("cancel").hidden, "cancel button should not be hidden");
ok(!gDocElem.getButton("cancel").disabled, "cancel button should not be disabled");
gNextFunc = test03;
gPageId = PAGEID_FOUND_BASIC;
// This page will automatically go to the incompatibility check page and the
// incompatibility check page will automatically go to the updates found page
addPageShowListener();
}
/**
* updates found basic page
*/
function test03() {
ok(true, "Entering test03 - updates found basic page");
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BASIC,
"Page ID should be " + PAGEID_FOUND_BASIC);
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test04;
gPageId = PAGEID_DOWNLOADING;
addPageShowListener();
// go forward to the downloading page
gDocElem.getButton("next").click();
}
/**
* downloading page
*/
function test04() {
ok(true, "Entering test04 - downloading page");
is(gDocElem.currentPage.pageid, PAGEID_DOWNLOADING,
"Page ID should be " + PAGEID_DOWNLOADING);
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test05;
gPageId = PAGEID_FINISHED;
addPageShowListener();
// The downloading page will automatically go to the finish page.
}
/**
* finished page
*/
function test05() {
ok(true, "Entering test05 - finished page");
is(gDocElem.currentPage.pageid, PAGEID_FINISHED,
"Page ID should be " + PAGEID_FINISHED);
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(!gDocElem.getButton("finish").hidden, "finish button should not be hidden");
ok(!gDocElem.getButton("finish").disabled, "finish button should not be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = finishTestDefault;
// exit by clicking the extra1 (restart later) button
gDocElem.getButton("extra1").click();
}
]]>
</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,428 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var queryString = "?showLicense=1&showDetails=1";
setUpdateURLOverride(URL_UPDATE + queryString);
gNextFunc = test02;
gPageId = PAGEID_CHECKING;
gUP.checkForUpdates();
}
/**
* updates checking page
*/
function test02() {
ok(true, "Entering test02 - updates checking page");
is(gDocElem.currentPage.pageid, PAGEID_CHECKING,
"Page ID should be " + PAGEID_CHECKING);
ok(gDocElem.getButton("extra1").hidden, "extra1 button should be hidden");
ok(gDocElem.getButton("extra1").disabled, "extra1 button should be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(!gDocElem.getButton("cancel").hidden, "cancel button should not be hidden");
ok(!gDocElem.getButton("cancel").disabled, "cancel button should not be disabled");
gNextFunc = test03;
gPageId = PAGEID_FOUND_BASIC;
// This page will automatically go to the incompatibility check page and the
// incompatibility check page will automatically go to the updates found page
addPageShowListener();
}
/**
* updates found basic page
*/
function test03() {
ok(true, "Entering test03 - updates found basic page");
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BASIC,
"Page ID should be " + PAGEID_FOUND_BASIC);
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test04;
gPageId = PAGEID_LICENSE;
addPageShowListener();
// go forward to the license page
gDocElem.getButton("next").click();
}
/**
* license page
*/
function test04() {
ok(true, "Entering test04 - license page");
var licenseContent = gWin.document.getElementById("licenseContent");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
isnot(licenseContent.getAttribute("state"), "loaded",
"licenseContent state attribute value should not equal loaded");
is(acceptDeclineLicense.selectedIndex, 1,
"acceptDeclineLicense selectedIndex should be 1");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test05;
// wait until the remote content has loaded
licenseContent.addEventListener("load", nextFuncListener, false);
}
/**
* license page
*/
function test05(aEvent) {
// Return early until licenseContent has loaded.
var licenseContent = gWin.document.getElementById("licenseContent");
if (licenseContent.getAttribute("state") != "loaded" ||
!aEvent.originalTarget.isSameNode(licenseContent))
return;
ok(true, "Entering test05 - license page");
var licenseContent = gWin.document.getElementById("licenseContent");
licenseContent.removeEventListener("load", nextFuncListener, false);
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(licenseContent.getAttribute("state"), "loaded",
"licenseContent state attribute value should equal loaded");
is(acceptDeclineLicense.selectedIndex, 1,
"acceptDeclineLicense selectedIndex should be 1");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test06;
acceptDeclineLicense.addEventListener("select", nextFuncListener, false);
// accept the license agreement
gWin.document.getElementById("accept").click();
}
/**
* license page
*/
function test06() {
ok(true, "Entering test06 - license page");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
acceptDeclineLicense.removeEventListener("select", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(acceptDeclineLicense.selectedIndex, 0,
"acceptDeclineLicense selectedIndex should be 0");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test07;
gPageId = PAGEID_FOUND_BASIC;
addPageShowListener();
// go back to the updates found page
gDocElem.getButton("extra1").click();
}
/**
* updates found basic page
*/
function test07() {
ok(true, "Entering test07 - updates found basic page");
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BASIC,
"Page ID should be " + PAGEID_FOUND_BASIC);
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test08;
gPageId = PAGEID_LICENSE;
addPageShowListener();
// go forward to the license page
gDocElem.getButton("next").click();
}
/**
* license page
*/
function test08() {
ok(true, "Entering test08 - license page");
var licenseContent = gWin.document.getElementById("licenseContent");
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(licenseContent.getAttribute("state"), "loaded",
"licenseContent state attribute value should equal loaded");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
gNextFunc = test09;
acceptDeclineLicense.addEventListener("select", nextFuncListener, false);
// decline the license agreement
gWin.document.getElementById("decline").click();
}
/**
* license page
*/
function test09() {
ok(true, "Entering test09 - license page");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
acceptDeclineLicense.removeEventListener("select", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(acceptDeclineLicense.selectedIndex, 1,
"acceptDeclineLicense selectedIndex should be 1");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test10;
acceptDeclineLicense.addEventListener("select", nextFuncListener, false);
// accept the license agreement
gWin.document.getElementById("accept").click();
}
/**
* license page
*/
function test10() {
ok(true, "Entering test10 - license page");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
acceptDeclineLicense.removeEventListener("select", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(acceptDeclineLicense.selectedIndex, 0,
"acceptDeclineLicense selectedIndex should be 0");
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test11;
gPageId = PAGEID_DOWNLOADING;
addPageShowListener();
// go forward to the downloading page
gDocElem.getButton("next").click();
}
/**
* downloading page
*/
function test11() {
ok(true, "Entering test11 - downloading page");
is(gDocElem.currentPage.pageid, PAGEID_DOWNLOADING,
"Page ID should be " + PAGEID_DOWNLOADING);
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test12;
gPageId = PAGEID_FINISHED;
addPageShowListener();
// The downloading page will automatically go to the finish page.
}
/**
* finished page
*/
function test12() {
ok(true, "Entering test12 - finished page");
is(gDocElem.currentPage.pageid, PAGEID_FINISHED,
"Page ID should be " + PAGEID_FINISHED);
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(!gDocElem.getButton("finish").hidden, "finish button should not be hidden");
ok(!gDocElem.getButton("finish").disabled, "finish button should not be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = finishTestDefault;
// exit by clicking the extra1 (restart later) button
gDocElem.getButton("extra1").click();
}
]]>
</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,158 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
gPref.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
var queryString = "?showBillboard=1&showDetails=1&showPrompt=1";
setUpdateURLOverride(URL_UPDATE + queryString);
gNextFunc = test02;
gPageId = PAGEID_FOUND_BILLBOARD;
gAUS.notify(null);
}
/**
* updates found billboard page
*/
function test02() {
ok(true, "Entering test02 - updates found billboard page");
var updateMoreInfoContent = gWin.document.getElementById("updateMoreInfoContent");
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BILLBOARD,
"Page ID should be " + PAGEID_FOUND_BILLBOARD);
isnot(updateMoreInfoContent.getAttribute("state"), "loaded",
"updateMoreInfoContent state attribute value should not equal loaded");
gNextFunc = test03;
// wait until the remote content has loaded
updateMoreInfoContent.addEventListener("load", nextFuncListener, false);
}
/**
* updates found billboard page
*/
function test03(aEvent) {
// Return early until updateMoreInfoContent has loaded.
var updateMoreInfoContent = gWin.document.getElementById("updateMoreInfoContent");
if (updateMoreInfoContent.getAttribute("state") != "loaded" ||
!aEvent.originalTarget.isSameNode(updateMoreInfoContent))
return;
ok(true, "Entering test03 - updates found billboard page");
updateMoreInfoContent.removeEventListener("load", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BILLBOARD,
"Page ID should be " + PAGEID_FOUND_BILLBOARD);
is(updateMoreInfoContent.getAttribute("state"), "loaded",
"updateMoreInfoContent state attribute value should not equal loaded");
gNextFunc = test04;
gPageId = PAGEID_DOWNLOADING;
addPageShowListener();
// go forward to the downloading page
gDocElem.getButton("next").click();
}
/**
* downloading page
*/
function test04() {
ok(true, "Entering test04 - downloading page");
is(gDocElem.currentPage.pageid, PAGEID_DOWNLOADING,
"Page ID should be " + PAGEID_DOWNLOADING);
gNextFunc = test05;
gPageId = PAGEID_FINISHED;
addPageShowListener();
// The downloading page will automatically go to the finish page.
}
/**
* finished page
*/
function test05() {
ok(true, "Entering test05 - finished page");
is(gDocElem.currentPage.pageid, PAGEID_FINISHED,
"Page ID should be " + PAGEID_FINISHED);
gNextFunc = finishTestDefault;
// exit by clicking the extra1 (restart later) button
gDocElem.getButton("extra1").click();
}
]]>
</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,229 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
gPref.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
var queryString = "?showBillboard=1&showLicense=1&showDetails=1&showPrompt=1";
setUpdateURLOverride(URL_UPDATE + queryString);
gNextFunc = test02;
gPageId = PAGEID_FOUND_BILLBOARD;
gAUS.notify(null);
}
/**
* updates found billboard page
*/
function test02() {
ok(true, "Entering test02 - updates found billboard page");
var updateMoreInfoContent = gWin.document.getElementById("updateMoreInfoContent");
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BILLBOARD,
"Page ID should be " + PAGEID_FOUND_BILLBOARD);
isnot(updateMoreInfoContent.getAttribute("state"), "loaded",
"updateMoreInfoContent state attribute value should not equal loaded");
gNextFunc = test03;
// wait until the remote content has loaded
updateMoreInfoContent.addEventListener("load", nextFuncListener, false);
}
/**
* updates found billboard page
*/
function test03(aEvent) {
// Return early until updateMoreInfoContent has loaded.
var updateMoreInfoContent = gWin.document.getElementById("updateMoreInfoContent");
if (updateMoreInfoContent.getAttribute("state") != "loaded" ||
!aEvent.originalTarget.isSameNode(updateMoreInfoContent))
return;
ok(true, "Entering test03 - updates found billboard page");
updateMoreInfoContent.removeEventListener("load", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BILLBOARD,
"Page ID should be " + PAGEID_FOUND_BILLBOARD);
is(updateMoreInfoContent.getAttribute("state"), "loaded",
"updateMoreInfoContent state attribute value should not equal loaded");
gNextFunc = test04;
gPageId = PAGEID_LICENSE;
addPageShowListener();
// go forward to the license page
gDocElem.getButton("next").click();
}
/**
* license page
*/
function test04() {
ok(true, "Entering test04 - license page");
var licenseContent = gWin.document.getElementById("licenseContent");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
isnot(licenseContent.getAttribute("state"), "loaded",
"licenseContent state attribute value should not equal loaded");
is(acceptDeclineLicense.selectedIndex, 1,
"acceptDeclineLicense selectedIndex should be 1");
gNextFunc = test05;
// wait until the remote content has loaded
licenseContent.addEventListener("load", nextFuncListener, false);
}
/**
* license page
*/
function test05(aEvent) {
// Return early until licenseContent has loaded.
var licenseContent = gWin.document.getElementById("licenseContent");
if (licenseContent.getAttribute("state") != "loaded" ||
!aEvent.originalTarget.isSameNode(licenseContent))
return;
ok(true, "Entering test05 - license page");
var licenseContent = gWin.document.getElementById("licenseContent");
licenseContent.removeEventListener("load", nextFuncListener, false);
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(licenseContent.getAttribute("state"), "loaded",
"licenseContent state attribute value should equal loaded");
is(acceptDeclineLicense.selectedIndex, 1,
"acceptDeclineLicense selectedIndex should be 1");
gNextFunc = test06;
acceptDeclineLicense.addEventListener("select", nextFuncListener, false);
// accept the license agreement
gWin.document.getElementById("accept").click();
}
/**
* license page
*/
function test06() {
ok(true, "Entering test06 - license page");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
acceptDeclineLicense.removeEventListener("select", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(acceptDeclineLicense.selectedIndex, 0,
"acceptDeclineLicense selectedIndex should be 0");
gNextFunc = test07;
gPageId = PAGEID_DOWNLOADING;
addPageShowListener();
// go forward to the downloading page
gDocElem.getButton("next").click();
}
/**
* downloading page
*/
function test07() {
ok(true, "Entering test07 - downloading page");
is(gDocElem.currentPage.pageid, PAGEID_DOWNLOADING,
"Page ID should be " + PAGEID_DOWNLOADING);
gNextFunc = test08;
gPageId = PAGEID_FINISHED;
addPageShowListener();
// The downloading page will automatically go to the finish page.
}
/**
* finished page
*/
function test08() {
ok(true, "Entering test08 - finished page");
is(gDocElem.currentPage.pageid, PAGEID_FINISHED,
"Page ID should be " + PAGEID_FINISHED);
gNextFunc = finishTestDefault;
// exit by clicking the extra1 (restart later) button
gDocElem.getButton("extra1").click();
}
]]>
</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,130 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
gPref.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
var queryString = "?showDetails=1&showPrompt=1";
setUpdateURLOverride(URL_UPDATE + queryString);
gNextFunc = test02;
gPageId = PAGEID_FOUND_BASIC;
gAUS.notify(null);
}
/**
* updates found basic page
*/
function test02() {
ok(true, "Entering test02 - updates found basic page");
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BASIC,
"Page ID should be " + PAGEID_FOUND_BASIC);
gNextFunc = test03;
gPageId = PAGEID_DOWNLOADING;
addPageShowListener();
// go forward to the downloading page
gDocElem.getButton("next").click();
}
/**
* downloading page
*/
function test03() {
ok(true, "Entering test03 - downloading page");
is(gDocElem.currentPage.pageid, PAGEID_DOWNLOADING,
"Page ID should be " + PAGEID_DOWNLOADING);
gNextFunc = test04;
gPageId = PAGEID_FINISHED;
addPageShowListener();
// The downloading page will automatically go to the finish page.
}
/**
* finished page
*/
function test04() {
ok(true, "Entering test04 - finished page");
is(gDocElem.currentPage.pageid, PAGEID_FINISHED,
"Page ID should be " + PAGEID_FINISHED);
gNextFunc = finishTestDefault;
// exit by clicking the extra1 (restart later) button
gDocElem.getButton("extra1").click();
}
]]>
</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,201 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
gPref.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
var queryString = "?showLicense=1&showDetails=1&showPrompt=1";
setUpdateURLOverride(URL_UPDATE + queryString);
gNextFunc = test02;
gPageId = PAGEID_FOUND_BASIC;
gAUS.notify(null);
}
/**
* updates found basic page
*/
function test02() {
ok(true, "Entering test02 - updates found basic page");
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BASIC,
"Page ID should be " + PAGEID_FOUND_BASIC);
gNextFunc = test03;
gPageId = PAGEID_LICENSE;
addPageShowListener();
// go forward to the license page
gDocElem.getButton("next").click();
}
/**
* license page
*/
function test03() {
ok(true, "Entering test03 - license page");
var licenseContent = gWin.document.getElementById("licenseContent");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
isnot(licenseContent.getAttribute("state"), "loaded",
"licenseContent state attribute value should not equal loaded");
is(acceptDeclineLicense.selectedIndex, 1,
"acceptDeclineLicense selectedIndex should be 1");
gNextFunc = test04;
// wait until the remote content has loaded
licenseContent.addEventListener("load", nextFuncListener, false);
}
/**
* license page
*/
function test04(aEvent) {
// Return early until licenseContent has loaded.
var licenseContent = gWin.document.getElementById("licenseContent");
if (licenseContent.getAttribute("state") != "loaded" ||
!aEvent.originalTarget.isSameNode(licenseContent))
return;
ok(true, "Entering test04 - license page");
var licenseContent = gWin.document.getElementById("licenseContent");
licenseContent.removeEventListener("load", nextFuncListener, false);
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(licenseContent.getAttribute("state"), "loaded",
"licenseContent state attribute value should equal loaded");
is(acceptDeclineLicense.selectedIndex, 1,
"acceptDeclineLicense selectedIndex should be 1");
gNextFunc = test05;
acceptDeclineLicense.addEventListener("select", nextFuncListener, false);
// accept the license agreement
gWin.document.getElementById("accept").click();
}
/**
* license page
*/
function test05() {
ok(true, "Entering test05 - license page");
var acceptDeclineLicense = gWin.document.getElementById("acceptDeclineLicense");
acceptDeclineLicense.removeEventListener("select", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_LICENSE,
"Page ID should be " + PAGEID_LICENSE);
is(acceptDeclineLicense.selectedIndex, 0,
"acceptDeclineLicense selectedIndex should be 0");
gNextFunc = test06;
gPageId = PAGEID_DOWNLOADING;
addPageShowListener();
// go forward to the downloading page
gDocElem.getButton("next").click();
}
/**
* downloading page
*/
function test06() {
ok(true, "Entering test06 - downloading page");
is(gDocElem.currentPage.pageid, PAGEID_DOWNLOADING,
"Page ID should be " + PAGEID_DOWNLOADING);
gNextFunc = test07;
gPageId = PAGEID_FINISHED;
addPageShowListener();
// The downloading page will automatically go to the finish page.
}
/**
* finished page
*/
function test07() {
ok(true, "Entering test07 - finished page");
is(gDocElem.currentPage.pageid, PAGEID_FINISHED,
"Page ID should be " + PAGEID_FINISHED);
gNextFunc = finishTestDefault;
// exit by clicking the extra1 (restart later) button
gDocElem.getButton("extra1").click();
}
]]>
</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,125 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var queryString = "?xmlMalformed=1";
setUpdateURLOverride(URL_UPDATE + queryString);
gNextFunc = test02;
gPageId = PAGEID_CHECKING;
gUP.checkForUpdates();
}
/**
* updates checking page
*/
function test02() {
ok(true, "Entering test02 - updates checking page");
is(gDocElem.currentPage.pageid, PAGEID_CHECKING,
"Page ID should be " + PAGEID_CHECKING);
gNextFunc = test03;
gPageId = PAGEID_ERRORS;
// This page will automatically go to the errors page
addPageShowListener();
}
/**
* finished page
*/
function test03() {
ok(true, "Entering test03 - finished page");
is(gDocElem.currentPage.pageid, PAGEID_ERRORS,
"Page ID should be " + PAGEID_ERRORS);
ok(gDocElem.getButton("extra1").hidden, "extra1 button should be hidden");
ok(gDocElem.getButton("extra1").disabled, "extra1 button should be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(!gDocElem.getButton("finish").hidden, "finish button should not be hidden");
ok(!gDocElem.getButton("finish").disabled, "finish button should not be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = finishTestDefault;
// exit by clicking the finish button
gDocElem.getButton("finish").click();
}
]]>
</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,125 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var queryString = "?noUpdates=1";
setUpdateURLOverride(URL_UPDATE + queryString);
gNextFunc = test02;
gPageId = PAGEID_CHECKING;
gUP.checkForUpdates();
}
/**
* updates checking page
*/
function test02() {
ok(true, "Entering test02 - updates checking page");
is(gDocElem.currentPage.pageid, PAGEID_CHECKING,
"Page ID should be " + PAGEID_CHECKING);
gNextFunc = test03;
gPageId = PAGEID_NO_UPDATES_FOUND;
// This page will automatically go to the no updates found check page
addPageShowListener();
}
/**
* finished page
*/
function test03() {
ok(true, "Entering test03 - finished page");
is(gDocElem.currentPage.pageid, PAGEID_NO_UPDATES_FOUND,
"Page ID should be " + PAGEID_NO_UPDATES_FOUND);
ok(gDocElem.getButton("extra1").hidden, "extra1 button should be hidden");
ok(gDocElem.getButton("extra1").disabled, "extra1 button should be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(!gDocElem.getButton("finish").hidden, "finish button should not be hidden");
ok(!gDocElem.getButton("finish").disabled, "finish button should not be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = finishTestDefault;
// exit by clicking the finish button
gDocElem.getButton("finish").click();
}
]]>
</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,114 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation:
*/
function test01() {
ok(true, "Entering test01 - test preparation");
var patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches, "Existing", "major");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_FAILED + ": " + CRC_ERROR);
reloadUpdateManagerData();
gNextFunc = test02;
gPageId = PAGEID_ERRORS;
initUpdateServiceStub();
}
/**
* errors page
*/
function test02() {
ok(true, "Entering test02 - errors page");
is(gDocElem.currentPage.pageid, PAGEID_ERRORS,
"Page ID should be " + PAGEID_ERRORS);
ok(gDocElem.getButton("extra1").hidden, "extra1 button should be hidden");
ok(gDocElem.getButton("extra1").disabled, "extra1 button should be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(!gDocElem.getButton("finish").hidden, "finish button should not be hidden");
ok(!gDocElem.getButton("finish").disabled, "finish button should not be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = finishTestDefault;
// exit by clicking the finish button
gDocElem.getButton("finish").click();
}
]]>
</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,114 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation:
*/
function test01() {
ok(true, "Entering test01 - test preparation");
var patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches, "Existing", "major");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_FAILED + ": " + CRC_ERROR);
reloadUpdateManagerData();
gNextFunc = test02;
gPageId = PAGEID_ERRORS;
initUpdateServiceStub();
}
/**
* errors page
*/
function test02() {
ok(true, "Entering test02 - errors page");
is(gDocElem.currentPage.pageid, PAGEID_ERRORS,
"Page ID should be " + PAGEID_ERRORS);
ok(gDocElem.getButton("extra1").hidden, "extra1 button should be hidden");
ok(gDocElem.getButton("extra1").disabled, "extra1 button should be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(!gDocElem.getButton("finish").hidden, "finish button should not be hidden");
ok(!gDocElem.getButton("finish").disabled, "finish button should not be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = finishTestDefault;
// exit by clicking the finish button
gDocElem.getButton("finish").click();
}
]]>
</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,134 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation:
*/
function test01() {
ok(true, "Entering test01 - test preparation");
var patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING) +
getLocalPatchString("complete");
var updates = getLocalUpdateString(patches);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_FAILED + ": " + CRC_ERROR);
reloadUpdateManagerData();
gNextFunc = test02;
gPageId = PAGEID_ERROR_PATCHING;
initUpdateServiceStub();
}
/**
* error patching page
*/
function test02() {
ok(true, "Entering test02 - error patching page");
is(gDocElem.currentPage.pageid, PAGEID_ERROR_PATCHING,
"Page ID should be " + PAGEID_ERROR_PATCHING);
ok(gDocElem.getButton("extra1").hidden, "extra1 button should be hidden");
ok(gDocElem.getButton("extra1").disabled, "extra1 button should be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test03;
gPageId = PAGEID_FINISHED;
addPageShowListener();
// Clicking next will immediately go forward to the finished page if the
// download has already finished or it will go to downloading page and then
// automatically go forward to the finished page after the download has
// finished.
gDocElem.getButton("next").click();
}
/**
* finished page
*/
function test03() {
ok(true, "Entering test03 - finished page");
is(gDocElem.currentPage.pageid, PAGEID_FINISHED,
"Page ID should be " + PAGEID_FINISHED);
gNextFunc = finishTestDefault;
// exit by clicking the extra1 (restart later) button
gDocElem.getButton("extra1").click();
}
]]>
</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,136 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation:
*/
function test01() {
ok(true, "Entering test01 - test preparation");
var patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING) +
getLocalPatchString("complete", null, "MD5",
"1234cd43a1c77e30191c53a329a3f99d");
var updates = getLocalUpdateString(patches);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_FAILED + ": " + CRC_ERROR);
reloadUpdateManagerData();
gNextFunc = test02;
gPageId = PAGEID_ERROR_PATCHING;
initUpdateServiceStub();
}
/**
* error patching page
*/
function test02() {
ok(true, "Entering test02 - error patching page");
is(gDocElem.currentPage.pageid, PAGEID_ERROR_PATCHING,
"Page ID should be " + PAGEID_ERROR_PATCHING);
ok(gDocElem.getButton("extra1").hidden, "extra1 button should be hidden");
ok(gDocElem.getButton("extra1").disabled, "extra1 button should be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(!gDocElem.getButton("next").hidden, "next button should not be hidden");
ok(!gDocElem.getButton("next").disabled, "next button should not be disabled");
ok(gDocElem.getButton("finish").hidden, "finish button should be hidden");
ok(gDocElem.getButton("finish").disabled, "finish button should be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = test03;
gPageId = PAGEID_ERRORS;
addPageShowListener();
// Clicking next will go forward to the finished page if the download has
// already finished or it will go to the downloading page and then
// automatically go forward to the finished page after the download has
// finished.
gDocElem.getButton("next").click();
}
/**
* errors page
*/
function test03() {
ok(true, "Entering test03 - errors page");
is(gDocElem.currentPage.pageid, PAGEID_ERRORS,
"Page ID should be " + PAGEID_ERRORS);
gNextFunc = finishTestDefault;
// exit by clicking the finish button
gDocElem.getButton("finish").click();
}
]]>
</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,114 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation:
*/
function test01() {
ok(true, "Entering test01 - test preparation");
gPref.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, true);
var patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_SUCCEEDED);
gNextFunc = test02;
gPageId = PAGEID_INSTALLED;
initUpdateServiceStub();
}
/**
* installed page
*/
function test02() {
ok(true, "Entering test02 - installed page");
gPref.clearUserPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI);
is(gDocElem.currentPage.pageid, PAGEID_INSTALLED,
"Page ID should be " + PAGEID_INSTALLED);
ok(gDocElem.getButton("extra1").hidden, "extra1 button should be hidden");
ok(gDocElem.getButton("extra1").disabled, "extra1 button should be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(!gDocElem.getButton("finish").hidden, "finish button should not be hidden");
ok(!gDocElem.getButton("finish").disabled, "finish button should not be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = finishTestDefault;
// exit by clicking the finish button
gDocElem.getButton("finish").click();
}
]]>
</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,116 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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"
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[
SimpleTest.waitForExplicitFinish();
/**
* test preparation:
*/
function test01() {
ok(true, "Entering test01 - test preparation");
var patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_SUCCEEDED);
reloadUpdateManagerData();
is(gUpdateManager.activeUpdate.state, "pending",
"The active update should have a state of pending");
gNextFunc = test02;
gPageId = PAGEID_FINISHED_BKGRD;
gUP.showUpdateDownloaded(gUpdateManager.activeUpdate);
}
/**
* finished background page
*/
function test02() {
ok(true, "Entering test02 - finished background page");
is(gDocElem.currentPage.pageid, PAGEID_FINISHED_BKGRD,
"Page ID should be " + PAGEID_FINISHED_BKGRD);
ok(!gDocElem.getButton("extra1").hidden, "extra1 button should not be hidden");
ok(!gDocElem.getButton("extra1").disabled, "extra1 button should not be disabled");
ok(gDocElem.getButton("extra2").hidden, "extra2 button should be hidden");
ok(gDocElem.getButton("extra2").disabled, "extra2 button should be disabled");
ok(gDocElem.getButton("back").hidden, "back button should be hidden");
ok(gDocElem.getButton("back").disabled, "back button should be disabled");
ok(gDocElem.getButton("next").hidden, "next button should be hidden");
ok(gDocElem.getButton("next").disabled, "next button should be disabled");
ok(!gDocElem.getButton("finish").hidden, "finish button should not be hidden");
ok(!gDocElem.getButton("finish").disabled, "finish button should not be disabled");
ok(gDocElem.getButton("cancel").hidden, "cancel button should be hidden");
ok(gDocElem.getButton("cancel").disabled, "cancel button should be disabled");
gNextFunc = finishTestDefault;
// exit by clicking the extra1 (restart later) button
gDocElem.getButton("extra1").click();
}
]]>
</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,142 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
const gNeverPref = PREF_APP_UPDATE_NEVER_BRANCH + "99.9";
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
ok(!gPref.prefHasUserValue(gNeverPref),
"preference " + gNeverPref + " should not have a user value");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var queryString = "?showBillboard=1&showNever=1";
setUpdateURLOverride(URL_UPDATE + queryString);
// add the never preference for this version to verify that checking for
// updates clears the preference.
gPref.setBoolPref(gNeverPref, true)
gNextFunc = test02;
gPageId = PAGEID_FOUND_BILLBOARD;
gUP.checkForUpdates();
}
/**
* updates found billboard page
*/
function test02() {
ok(true, "Entering test02 - updates found billboard page");
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BILLBOARD,
"Page ID should be " + PAGEID_FOUND_BILLBOARD);
ok(!gPref.prefHasUserValue(gNeverPref),
"preference " + gNeverPref + " should not have a user value");
gNextFunc = test03;
var updateMoreInfoContent = gWin.document.getElementById("updateMoreInfoContent");
updateMoreInfoContent.addEventListener("load", nextFuncListener, false);
}
/**
* updates found billboard page
*/
function test03(aEvent) {
var updateMoreInfoContent = gWin.document.getElementById("updateMoreInfoContent");
if (updateMoreInfoContent.getAttribute("state") != "loaded" ||
!aEvent.originalTarget.isSameNode(updateMoreInfoContent))
return;
ok(true, "Entering test03 - updates found billboard page");
updateMoreInfoContent.removeEventListener("load", nextFuncListener, false);
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BILLBOARD,
"Page ID should be " + PAGEID_FOUND_BILLBOARD);
gNextFunc = test04;
// exit by clicking the extra2 (No Thanks) button
gDocElem.getButton("extra2").click();
}
/**
* update prompt closed
*/
function test04(aEvent) {
ok(true, "Entering test04 - update prompt closed");
ok(gPref.prefHasUserValue(gNeverPref),
"preference " + gNeverPref + " should have a user value");
finishTestDefault();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</window>

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

@ -0,0 +1,121 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-->
<?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)"
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[
SimpleTest.waitForExplicitFinish();
const gNeverPref = PREF_APP_UPDATE_NEVER_BRANCH + "99.9";
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
ok(!gPref.prefHasUserValue(gNeverPref),
"preference " + gNeverPref + " should not have a user value");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var queryString = "?showNever=1&showDetails=1";
setUpdateURLOverride(URL_UPDATE + queryString);
// add the never preference for this version to verify that checking for
// updates clears the preference.
gPref.setBoolPref(gNeverPref, true)
gNextFunc = test02;
gPageId = PAGEID_FOUND_BASIC;
gUP.checkForUpdates();
}
/**
* updates found page without a biillboard
*/
function test02() {
ok(true, "Entering test02 - updates found page without a biillboard");
is(gDocElem.currentPage.pageid, PAGEID_FOUND_BASIC,
"Page ID should be " + PAGEID_FOUND_BASIC);
ok(!gPref.prefHasUserValue(gNeverPref),
"preference " + gNeverPref + " should not have a user value");
gNextFunc = test03;
// exit by clicking the extra2 (No Thanks) button
gDocElem.getButton("extra2").click();
}
/**
* update prompt closed
*/
function test03(aEvent) {
ok(true, "Entering test03 - update prompt closed");
ok(gPref.prefHasUserValue(gNeverPref),
"preference " + gNeverPref + " should have a user value");
finishTestDefault();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</window>

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

@ -0,0 +1,106 @@
<?xml version="1.0"?>
<!--
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* Removes files and preferences for previous application update tests in case
* any of them had a fatal error. The test name ensures that it will run after
* all other tests as long as the test naming uses the same format.
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Application Update test cleanup"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTest();">
<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[
/**
* If the application update tests left behind any of the files it uses it could
* be a very bad thing. This test purpose is to prevent that from ever
* happening.
*/
function runTest() {
ok(true, "Entering runTest - cleanup");
closeUpdateWindow();
resetPrefs();
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var dir = getCurrentProcessDir();
var file = dir.clone();
file.append(FILE_UPDATE_ACTIVE);
ok(!file.exists(), file.path + " should not exist");
file = dir.clone();
file.append(FILE_UPDATES_DB);
ok(!file.exists(), file.path + " should not exist");
dir.append("updates");
dir.append("0");
file = dir.clone();
file.append(FILE_UPDATE_STATUS);
ok(!file.exists(), file.path + " should not exist");
file = dir.clone();
file.append(FILE_UPDATE_ARCHIVE);
ok(!file.exists(), file.path + " should not exist");
}
]]>
</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,81 @@
#include ../shared.js
const URL_HOST = "http://example.com/";
const URL_PATH = "chrome/toolkit/mozapps/update/test/chrome/";
const URL_UPDATE = URL_HOST + URL_PATH + "update.sjs";
const SHA512_HASH = "1d2307e309587ddd04299423b34762639ce6af3ee17cfdaa8fdd4e6" +
"6b5a61bfb6555b6e40a82604908d6d68d3e42f318f82e22b6f5e111" +
"8b4222e3417a2fa2d0";
const SERVICE_URL = URL_HOST + URL_PATH + "empty.mar";
function handleRequest(request, response) {
response.setStatusLine(request.httpVersion, 200, "OK");
response.setHeader("Cache-Control", "no-cache", false);
if (request.queryString.match(/^uiURL=/)) {
var uiURL = decodeURIComponent(request.queryString.substring(6));
response.write("<html><head><meta http-equiv=\"content-type\" content=" +
"\"text/html; charset=utf-8\"></head><body>" + uiURL +
"<br><br>this is a test mar that will not affect your " +
"build.</body></html>");
return;
}
var params = { };
if (request.queryString)
params = parseQueryString(request.queryString);
if (params.xmlMalformed) {
response.write("xml error");
return;
}
if (params.noUpdates) {
response.write(getRemoteUpdatesXMLString(""));
return;
}
var patches = getRemotePatchString("complete", SERVICE_URL, "SHA512",
SHA512_HASH, "775");
if (!params.completePatchOnly)
patches += getRemotePatchString("partial", SERVICE_URL, "SHA512",
SHA512_HASH, "775");
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 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
// var detailsURL = params.showDetails ? URL_UPDATE + "?uiURL=DETAILS" : null;
var detailsURL = URL_UPDATE + "?uiURL=DETAILS";
var billboardURL = params.showBillboard ? URL_UPDATE + "?uiURL=BILLBOARD" : null;
var licenseURL = params.showLicense ? URL_UPDATE + "?uiURL=LICENSE" : null;
var showPrompt = params.showPrompt ? "true" : null;
var showNever = params.showNever ? "true" : null;
var showSurvey = params.showSurvey ? "true" : null;
var extra1 = params.extra1 ? params.extra1 : null;
var updates = getRemoteUpdateString(patches, type, "App Update Test",
displayVersion, appVersion,
platformVersion, buildID,
detailsURL, billboardURL,
licenseURL, showPrompt,
showNever, showSurvey, "test extra1");
response.write(getRemoteUpdatesXMLString(updates));
}
function parseQueryString(str) {
var paramArray = str.split("&");
var regex = /^([^=]+)=(.*)$/;
var params = {};
for (var i = 0, sz = paramArray.length; i < sz; i++) {
var match = regex.exec(paramArray[i]);
if (!match)
throw "Bad parameter in queryString! '" + paramArray[i] + "'";
params[decodeURIComponent(match[1])] = decodeURIComponent(match[2]);
}
return params;
}

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

@ -0,0 +1,192 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK *****
*/
// The tests have to use the pageid due to the wizard's access method being
// random.
const PAGEID_CHECKING = "checking"; // Done
const PAGEID_PLUGIN_UPDATES = "pluginupdatesfound";
const PAGEID_NO_UPDATES_FOUND = "noupdatesfound"; // Done
const PAGEID_MANUAL_UPDATE = "manualUpdate"; // Can't test? Requires restricted access
const PAGEID_INCOMPAT_CHECK = "incompatibleCheck"; // Bug 546595
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_DOWNLOADING = "downloading"; // Done
const PAGEID_ERRORS = "errors"; // Done
const PAGEID_ERROR_PATCHING = "errorpatching"; // Done
const PAGEID_FINISHED = "finished"; // Done
const PAGEID_FINISHED_BKGRD = "finishedBackground"; // Done
const PAGEID_INSTALLED = "installed"; // Done
const URL_HOST = "http://example.com/";
const URL_PATH = "chrome/toolkit/mozapps/update/test/chrome";
const URL_UPDATE = URL_HOST + URL_PATH + "/update.sjs";
const URI_UPDATE_PROMPT_DIALOG = "chrome://mozapps/content/update/updates.xul";
const CRC_ERROR = 4;
var qUpdateChannel;
var gWin;
var gDocElem;
var gPageId;
var gNextFunc;
#include ../shared.js
/**
* Default run function that can be used by most tests
*/
function runTestDefault() {
ok(true, "Entering runTestDefault");
closeUpdateWindow();
gWW.registerNotification(gWindowObserver);
setUpdateChannel();
test01();
}
/**
* Default finish function that can be used by most tests
*/
function finishTestDefault() {
ok(true, "Entering finishTestDefault");
gWW.unregisterNotification(gWindowObserver);
resetPrefs();
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
SimpleTest.finish();
}
__defineGetter__("gWW", function() {
delete this.gWW;
return this.gWW = AUS_Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(AUS_Ci.nsIWindowWatcher);
});
/**
* Closes the update window in case a previous test failed to do so.
*/
function closeUpdateWindow() {
var updateWindow = getUpdateWindow();
if (!updateWindow)
return;
ok(true, "Found Update Window!!! Attempting to close it.");
updateWindow.close();
}
/**
* Returns the update window if it is open.
*/
function getUpdateWindow() {
var wm = AUS_Cc["@mozilla.org/appshell/window-mediator;1"].
getService(AUS_Ci.nsIWindowMediator);
return wm.getMostRecentWindow("Update:Wizard");
}
var gWindowObserver = {
observe: function(aSubject, aTopic, aData) {
var win = aSubject.QueryInterface(AUS_Ci.nsIDOMEventTarget);
if (aTopic == "domwindowclosed") {
if (win.location == URI_UPDATE_PROMPT_DIALOG)
gNextFunc();
return;
}
win.addEventListener("load", function onLoad() {
if (win.location != URI_UPDATE_PROMPT_DIALOG)
return;
gWin = win;
gWin.removeEventListener("load", onLoad, false);
gDocElem = gWin.document.documentElement;
// If the page loaded is the same as the page to be tested call the next
// function (e.g. the page shown is the wizard page the test is interested
// in) otherwise add an event listener to run the next function (e.g. the
// page will automatically advance to the wizard page the test is
// interested in).
if (gDocElem.currentPage && gDocElem.currentPage.pageid == gPageId)
gNextFunc();
else
addPageShowListener();
}, false);
}
};
function nextFuncListener(aEvent) {
gNextFunc(aEvent);
}
function addPageShowListener() {
var page = gDocElem.getPageById(gPageId);
page.addEventListener("pageshow", function onPageShow(aEvent) {
page.removeEventListener("pageshow", onPageShow, false);
// Let the page initialize
SimpleTest.executeSoon(gNextFunc);
}, false);
}
function resetPrefs() {
if (qUpdateChannel)
setUpdateChannel(qUpdateChannel);
if (gPref.prefHasUserValue(PREF_APP_UPDATE_IDLETIME))
gPref.clearUserPref(PREF_APP_UPDATE_IDLETIME);
if (gPref.prefHasUserValue(PREF_APP_UPDATE_ENABLED))
gPref.clearUserPref(PREF_APP_UPDATE_ENABLED);
if (gPref.prefHasUserValue(PREF_APP_UPDATE_LOG))
gPref.clearUserPref(PREF_APP_UPDATE_LOG);
if (gPref.prefHasUserValue(PREF_APP_UPDATE_SHOW_INSTALLED_UI))
gPref.clearUserPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI);
if (gPref.prefHasUserValue(PREF_APP_UPDATE_URL_DETAILS))
gPref.clearUserPref(PREF_APP_UPDATE_URL_DETAILS);
if (gPref.prefHasUserValue(PREF_APP_UPDATE_URL_OVERRIDE))
gPref.clearUserPref(PREF_APP_UPDATE_URL_OVERRIDE);
try {
gPref.deleteBranch(PREF_APP_UPDATE_NEVER_BRANCH);
}
catch(e) {
}
}

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

@ -45,6 +45,7 @@ const AUS_Cr = Components.results;
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
const PREF_APP_UPDATE_LOG = "app.update.log";
const PREF_APP_UPDATE_SHOW_INSTALLED_UI = "app.update.showInstalledUI";
const PREF_APP_UPDATE_URL_DETAILS = "app.update.url.details";
@ -99,6 +100,7 @@ __defineGetter__("gAUS", function() {
delete this.gAUS;
return this.gAUS = AUS_Cc["@mozilla.org/updates/update-service;1"].
getService(AUS_Ci.nsIApplicationUpdateService).
QueryInterface(AUS_Ci.nsITimerCallback).
QueryInterface(AUS_Ci.nsIObserver);
});