Bug 566267 - Simplify app update mochitest-chrome tests (updated tests). r=dtownsend

This commit is contained in:
Robert Strong 2010-05-26 13:16:57 -07:00
parent 64332a58a3
commit 6c77573423
27 changed files with 1199 additions and 3030 deletions

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,134 +21,28 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var url = URL_UPDATE + "?showDetails=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
var queryString = "?showDetails=1" + getVersionParams();
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,369 +21,68 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_LICENSE,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "decline"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var url = URL_UPDATE + "?showLicense=1&showDetails=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
var queryString = "?showLicense=1&showDetails=1" + getVersionParams();
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,175 +21,35 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var url = URL_UPDATE + "?showBillboard=1&showDetails=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
var queryString = "?showBillboard=1&showDetails=1" + getVersionParams();
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,415 +21,78 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_LICENSE,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "decline"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1" +
getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
var queryString = "?showBillboard=1&showLicense=1&showDetails=1" +
getVersionParams();
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,71 +21,26 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var url = URL_UPDATE + "?showDetails=1&showPrompt=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
gPref.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
var queryString = "?showDetails=1&showPrompt=1" + getVersionParams();
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,143 +21,67 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_LICENSE,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "decline"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var url = URL_UPDATE + "?showLicense=1&showDetails=1&showPrompt=1" +
getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
gPref.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
var queryString = "?showLicense=1&showDetails=1&showPrompt=1" +
getVersionParams();
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,100 +21,34 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING,
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var url = URL_UPDATE + "?showBillboard=1&showDetails=1&showPrompt=1" +
getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
gPref.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
var queryString = "?showBillboard=1&showDetails=1&showPrompt=1" +
getVersionParams();
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,171 +21,76 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener
}, {
pageid: PAGEID_LICENSE,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "extra1"
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loaded",
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "decline"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 1,
extraDelayedFinishFunction: addRadioGroupSelectListenerAndClick,
radioClick: "accept"
}, {
pageid: PAGEID_LICENSE,
extraCheckFunction: checkRadioGroupSelectedIndex,
expectedRadioGroupSelectedIndex: 0,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1" +
"&showPrompt=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
gPref.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
var queryString = "?showBillboard=1&showLicense=1&showDetails=1" +
"&showPrompt=1" + getVersionParams();
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,66 +21,23 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_ERRORS,
buttonClick: "finish"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var url = URL_UPDATE + "?xmlMalformed=1";
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,66 +21,23 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_NO_UPDATES_FOUND,
buttonClick: "finish"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var url = URL_UPDATE + "?noUpdates=1";
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
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();
}
/**
* no updates found 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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,85 +21,35 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading"
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading"
}, {
pageid: PAGEID_MANUAL_UPDATE,
buttonClick: "finish"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var url = URL_UPDATE + "?showBillboard=1&showLicense=1&remoteNoTypeAttr=1" +
"&showDetails=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
var queryString = "?showBillboard=1&showLicense=1&remoteNoTypeAttr=1" +
"&showDetails=1" + getVersionParams();
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_FOUND_BASIC;
// This page will automatically go to the updates found basic page after the
// billboard without the billboard attribute loads.
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);
gNextFunc = test04;
gPageId = PAGEID_MANUAL_UPDATE;
addPageShowListener();
// go forward to the license page which will automatically go to the manual
// update page after the license without the license attribute loads.
gDocElem.getButton("next").click();
}
/**
* manual update page
*/
function test04(aEvent) {
ok(true, "Entering test04 - manual update page");
is(gDocElem.currentPage.pageid, PAGEID_MANUAL_UPDATE,
"Page ID should be " + PAGEID_MANUAL_UPDATE);
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,73 +21,35 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading"
}, {
pageid: PAGEID_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_LICENSE,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading"
}, {
pageid: PAGEID_MANUAL_UPDATE,
buttonClick: "finish"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var url = URL_UPDATE + "?billboard404=1&license404=1&showDetails=1" +
getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
var queryString = "?billboard404=1&license404=1&showDetails=1" +
getVersionParams();
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_FOUND_BASIC;
// This page will automatically go to the updates found basic page after the
// billboard without the billboard attribute loads.
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);
gNextFunc = test04;
gPageId = PAGEID_MANUAL_UPDATE;
addPageShowListener();
// go forward to the license page which will automatically go to the manual
// update page after the license without the license attribute loads.
gDocElem.getButton("next").click();
}
/**
* manual update page
*/
function test04(aEvent) {
ok(true, "Entering test04 - manual update page");
is(gDocElem.currentPage.pageid, PAGEID_MANUAL_UPDATE,
"Page ID should be " + PAGEID_MANUAL_UPDATE);
gNextFunc = finishTestDefault;
// exit by clicking the finish button
gDocElem.getButton("finish").click();
}
]]>
</script>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,18 +21,19 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_ERRORS,
buttonClick: "finish"
} ];
/**
* test preparation:
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
var patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches, null, null, null,
gApp.version, gApp.platformVersion);
Services.appinfo.version,
Services.appinfo.platformVersion);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
@ -73,37 +41,9 @@ function test01() {
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,18 +21,19 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_ERRORS,
buttonClick: "finish"
} ];
/**
* test preparation:
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
var patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches, null, null, null,
gApp.version, gApp.platformVersion);
Services.appinfo.version,
Services.appinfo.platformVersion);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
@ -73,37 +41,9 @@ function test01() {
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,13 +21,18 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_ERROR_PATCHING,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
/**
* test preparation:
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
// Specify the url to update.sjs with a slowDownloadMar param so the ui can
// load before the download completes.
@ -69,7 +41,8 @@ function test01() {
STATE_PENDING) +
getLocalPatchString("complete", slowDownloadURL);
var updates = getLocalUpdateString(patches, null, null, null,
gApp.version, gApp.platformVersion);
Services.appinfo.version,
Services.appinfo.platformVersion);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
@ -77,68 +50,9 @@ function test01() {
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_DOWNLOADING;
addPageShowListener();
// go forward to the downloading page
gDocElem.getButton("next").click();
}
/**
* downloading page
*/
function test03() {
ok(true, "Entering test12 - 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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,13 +21,18 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_ERROR_PATCHING,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_ERRORS,
buttonClick: "finish"
} ];
/**
* test preparation:
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
// Specify the url to update.sjs with a slowDownloadMar param so the ui can
// load before the download completes.
@ -70,7 +42,8 @@ function test01() {
getLocalPatchString("complete", slowDownloadURL, "MD5",
"1234cd43a1c77e30191c53a329a3f99d");
var updates = getLocalUpdateString(patches, null, null, null,
gApp.version, gApp.platformVersion);
Services.appinfo.version,
Services.appinfo.platformVersion);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
@ -78,68 +51,9 @@ function test01() {
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_DOWNLOADING;
addPageShowListener();
// go forward to the downloading page
gDocElem.getButton("next").click();
}
/**
* downloading page
*/
function test03() {
ok(true, "Entering test12 - downloading page");
is(gDocElem.currentPage.pageid, PAGEID_DOWNLOADING,
"Page ID should be " + PAGEID_DOWNLOADING);
gNextFunc = test04;
gPageId = PAGEID_ERRORS;
addPageShowListener();
// The downloading page will automatically go to the errors page.
}
/**
* errors page
*/
function test04() {
ok(true, "Entering test04 - 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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,56 +21,27 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_INSTALLED,
buttonClick: "finish"
} ];
/**
* test preparation:
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
gPref.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, true);
Services.prefs.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, true);
var patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches, null, null, null,
gApp.version, gApp.platformVersion);
Services.appinfo.version,
Services.appinfo.platformVersion);
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,18 +21,19 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
const gTests = [ {
pageid: PAGEID_FINISHED_BKGRD,
buttonClick: "extra1"
} ];
/**
* test preparation:
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
var patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches, null, null, null,
gApp.version, gApp.platformVersion);
Services.appinfo.version,
Services.appinfo.platformVersion);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_SUCCEEDED);
@ -75,37 +43,9 @@ function test01() {
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>

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,59 +21,34 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
gPrefToCheck = PREF_APP_UPDATE_NEVER_BRANCH + Services.appinfo.version;
const gNeverPref = PREF_APP_UPDATE_NEVER_BRANCH + gApp.version;
const gTests = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BASIC,
extraDelayedCheckFunction: checkPrefHasUserValue,
prefHasUserValue: false,
neverButton: true,
buttonClick: "extra2"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
ok(!gPref.prefHasUserValue(gNeverPref),
"preference " + gNeverPref + " should not have a user value");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var queryString = "?showNever=1&showDetails=1" + getVersionParams();
setUpdateURLOverride(URL_UPDATE + queryString);
var url = URL_UPDATE + "?showNever=1&showDetails=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
// add the never preference for this version to verify that checking for
// updates clears the preference.
gPref.setBoolPref(gNeverPref, true)
Services.prefs.setBoolPref(gPrefToCheck, 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");
function finishTest() {
checkPrefHasUserValue(true);
finishTestDefault();
}

View File

@ -1,41 +1,8 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
@ -54,80 +21,42 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
gPrefToCheck = PREF_APP_UPDATE_NEVER_BRANCH + Services.appinfo.version;
const gNeverPref = PREF_APP_UPDATE_NEVER_BRANCH + gApp.version;
const gTests = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraDelayedCheckFunction: checkRemoteContentState,
expectedRemoteContentState: "loading",
extraDelayedFinishFunction: addRemoteContentLoadListener,
neverButton: true
}, {
pageid: PAGEID_FOUND_BILLBOARD,
extraStartFunction: waitForRemoteContentLoaded,
expectedRemoteContentState: "loaded",
extraDelayedCheckFunction: checkPrefHasUserValue,
prefHasUserValue: false,
neverButton: true,
buttonClick: "extra2"
} ];
/**
* test preparation
*/
function test01() {
ok(true, "Entering test01 - test preparation");
function runTest() {
debugDump("Entering runTest");
ok(!gPref.prefHasUserValue(gNeverPref),
"preference " + gNeverPref + " should not have a user value");
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
var queryString = "?showBillboard=1&showNever=1" + getVersionParams();
setUpdateURLOverride(URL_UPDATE + queryString);
var url = URL_UPDATE + "?showBillboard=1&showNever=1" + getVersionParams();
setUpdateURLOverride(url);
debugDump("Update URL: " + url);
// add the never preference for this version to verify that checking for
// updates clears the preference.
gPref.setBoolPref(gNeverPref, true)
Services.prefs.setBoolPref(gPrefToCheck, 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");
function finishTest() {
checkPrefHasUserValue(true);
finishTestDefault();
}

View File

@ -1,46 +1,14 @@
<?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 ***** */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* 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.
* all other tests as long as the test naming uses the same format as the
* existing tests.
*/
-->
@ -62,7 +30,7 @@
/**
* 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
* be a very bad thing. The purpose of this test is to prevent that from
* happening.
*/
function runTest() {

View File

@ -8,6 +8,7 @@ const SHA512_HASH = "1d2307e309587ddd04299423b34762639ce6af3ee17cfdaa8fdd4e6" +
"8b4222e3417a2fa2d0";
const SERVICE_URL = URL_HOST + URL_PATH + "empty.mar";
const SLOW_MAR_DOWNLOAD_INTERVAL = 100;
function handleRequest(request, response) {
var params = { };
@ -40,7 +41,7 @@ function handleRequest(request, response) {
timer.initWithCallback(function() {
response.write(contents);
response.finish();
}, 2000, AUS_Ci.nsITimer.TYPE_ONE_SHOT);
}, SLOW_MAR_DOWNLOAD_INTERVAL, AUS_Ci.nsITimer.TYPE_ONE_SHOT);
return;
}

View File

@ -1,43 +1,80 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* Most tests can use an array named gTests that will perform most if not all of
* the necessary checks. Each element in the array must be an object with the
* following possible properties. Additional properties besides the ones listed
* below can be added as needed.
*
* 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/
* overrideCallback (optional)
* The function to call for the next test. This is typically called when the
* wizard page changes but can also be called for other events by the previous
* test. If this property isn't defined then the defailtCallback function will
* be called. If this property is defined then all other properties are
* optional.
*
* 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.
* pageid (required unless overrideCallback is specified)
* The expected pageid for the wizard. This property is required unless the
* overrideCallback property is defined.
*
* The Original Code is mozilla.org code.
* extraStartFunction (optional)
* The function to call at the beginning of the defaultCallback function. If
* the function returns true the defaultCallback function will return early
* which allows waiting for a specific condition to be evaluated in the
* function specified in the extraStartFunction property before continuing
* with the test.
*
* 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.
* extraCheckFunction (optional)
* The function to call to perform extra checks in the defaultCallback
* function.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.com> (Original Author)
* extraDelayedCheckFunction (optional)
* The function to call to perform extra checks in the delayedDefaultCallback
* function.
*
* 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.
* buttonStates (optional)
* A javascript object representing the expected hidden and disabled attribute
* values for the buttons of the current wizard page. The values are checked
* in the delayedDefaultCallback function. For information about the structure
* of this object refer to the getExpectedButtonStates and checkButtonStates
* functions.
*
* ***** END LICENSE BLOCK *****
* buttonClick (optional)
* The current wizard page button to click at the end of the
* delayedDefaultCallback function. If the buttonClick property is defined
* then the extraDelayedFinishFunction property can't be specified due to race
* conditions in some of the tests and if both of them are specified the test
* will intentionally throw.
*
* extraDelayedFinishFunction (optional)
* The function to call at the end of the delayedDefaultCallback function.
*
* ranTest (should not be specified)
* When delayedDefaultCallback is called a property named ranTest is added to
* the current test it is possible to verify that each test in the gTests
* array has ran.
*
* prefHasUserValue (optional)
* For comparing the expected value defined by this property with the return
* value of prefHasUserValue using gPrefToCheck for the preference name in the
* checkPrefHasUserValue function.
*
* expectedRadioGroupSelectedIndex (optional)
* For comparing the expected selectedIndex attribute value of the wizard's
* license page radiogroup selectedIndex attribute in the
* checkRadioGroupSelectedIndex function.
*
* expectedRemoteContentState (optional)
* For comparing the expected remotecontent state attribute value of the
* wizard's billboard and license pages in the checkRemoteContentState and
* waitForRemoteContentLoaded functions.
*/
// The tests have to use the pageid due to the wizard's access method being
// random.
const PAGEID_DUMMY = "dummy"; // Done
const PAGEID_CHECKING = "checking"; // Done
const PAGEID_PLUGIN_UPDATES = "pluginupdatesfound";
const PAGEID_NO_UPDATES_FOUND = "noupdatesfound"; // Done
@ -54,42 +91,118 @@ 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 UPDATE_WINDOW_NAME = "Update:Wizard";
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;
const DEBUG_DUMP = false;
const TEST_TIMEOUT = 30000; // 30 seconds
var gTimeoutTimer;
var gTestCounter = -1;
var gUpdateChannel;
var gDocElem;
var gPageId;
var gNextFunc;
var gWin;
var gPrefToCheck;
#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();
function debugDump(msg) {
if (DEBUG_DUMP) {
dump("*** " + msg + "\n");
}
}
/**
* Default finish function that can be used by most tests
* The current test in gTests array.
*/
__defineGetter__("gTest", function() {
return gTests[gTestCounter];
});
/**
* The current test's callback. This will either return the callback defined in
* the test's overrideCallback property or defaultCallback if the
* overrideCallback property is undefined.
*/
__defineGetter__("gCallback", function() {
return gTest.overrideCallback ? gTest.overrideCallback
: defaultCallback;
});
/**
* The remotecontent element for the current page if one exists or null if a
* remotecontent element doesn't exist.
*/
__defineGetter__("gRemoteContent", function() {
switch (gTest.pageid) {
case PAGEID_FOUND_BILLBOARD:
return gWin.document.getElementById("updateMoreInfoContent");
case PAGEID_LICENSE:
return gWin.document.getElementById("licenseContent");
}
return null;
});
/**
* The state for the remotecontent element if one exists or null if a
* remotecontent element doesn't exist.
*/
__defineGetter__("gRemoteContentState", function() {
if (gRemoteContent) {
return gRemoteContent.getAttribute("state");
}
return null;
});
/**
* The radiogroup for the license page.
*/
__defineGetter__("gAcceptDeclineLicense", function() {
return gWin.document.getElementById("acceptDeclineLicense");
});
/**
* Default test run function that can be used by most tests.
*/
function runTestDefault() {
debugDump("Entering runTestDefault");
SimpleTest.waitForExplicitFinish();
Services.ww.registerNotification(gWindowObserver);
setUpdateChannel();
Services.prefs.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
removeUpdateDirsAndFiles
reloadUpdateManagerData();
runTest();
}
/**
* Default test finish function that can be used by most tests.
*/
function finishTestDefault() {
ok(true, "Entering finishTestDefault");
debugDump("Entering finishTestDefault");
gWW.unregisterNotification(gWindowObserver);
gDocElem.removeEventListener("pageshow", onPageShowDefault, false);
if (gTimeoutTimer) {
gTimeoutTimer.cancel();
gTimeoutTimer = null;
}
verifyTestsRan();
Services.ww.unregisterNotification(gWindowObserver);
resetPrefs();
removeUpdateDirsAndFiles();
@ -97,108 +210,483 @@ function finishTestDefault() {
SimpleTest.finish();
}
__defineGetter__("gWW", function() {
delete this.gWW;
return this.gWW = AUS_Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(AUS_Ci.nsIWindowWatcher);
});
__defineGetter__("gApp", function() {
delete this.gApp;
return this.gApp = AUS_Cc["@mozilla.org/xre/app-info;1"].
getService(AUS_Ci.nsIXULAppInfo).
QueryInterface(AUS_Ci.nsIXULRuntime);
});
function getVersionParams() {
return "&appVersion=" + gApp.version +
"&platformVersion=" + gApp.platformVersion;
/**
* nsITimerCallback for the timeout timer to cleanly finish a test if the Update
* Window doesn't close for a test. This allows the next test to run properly if
* a previous test fails.
*
* @param aTimer
* The nsITimer that fired.
*/
function finishTestTimeout(aTimer) {
gTimeoutTimer = null;
ok(false, "Test timed out. Maximum time allowed is " + (TEST_TIMEOUT / 1000) +
" seconds");
gWin.close();
}
/**
* Closes the update window in case a previous test failed to do so.
* Default callback for the wizard's documentElement pageshow listener. This
* will return early for event's where the originalTarget's nodeName is not
* wizardpage.
*/
function closeUpdateWindow() {
var updateWindow = getUpdateWindow();
if (!updateWindow)
function onPageShowDefault(aEvent) {
// Return early if the event's original target isn't for a wizardpage element.
// This check is necessary due to the remotecontent element firing pageshow.
if (aEvent.originalTarget.nodeName != "wizardpage") {
debugDump("onPageShowDefault - only handles events with an " +
"originalTarget nodeName of |wizardpage|. " +
"aEvent.originalTarget.nodeName = " +
aEvent.originalTarget.nodeName + "... returning early");
return;
}
ok(true, "Found Update Window!!! Attempting to close it.");
updateWindow.close();
gTestCounter++;
gCallback(aEvent);
}
/**
* Returns the update window if it is open.
* Default callback that can be used by most tests.
*/
function getUpdateWindow() {
var wm = AUS_Cc["@mozilla.org/appshell/window-mediator;1"].
getService(AUS_Ci.nsIWindowMediator);
return wm.getMostRecentWindow("Update:Wizard");
}
function defaultCallback(aEvent) {
debugDump("Entering defaultCallback - gTests[" + gTestCounter + "], " +
"pageid: " + gTest.pageid + ", " +
"aEvent.originalTarget.nodeName: " + aEvent.originalTarget.nodeName);
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();
if (gTest && gTest.extraStartFunction) {
debugDump("defaultCallback - calling extraStartFunction " +
gTest.extraStartFunction.name);
if (gTest.extraStartFunction(aEvent)) {
debugDump("defaultCallback - extraStartFunction early return");
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);
is(gDocElem.currentPage.pageid, gTest.pageid,
"Checking currentPage.pageid equals " + gTest.pageid + " in onPageShow");
// Perform extra checks if specified by the test
if (gTest.extraCheckFunction) {
debugDump("delayedCallback - calling extraCheckFunction " +
gTest.extraCheckFunction.name);
gTest.extraCheckFunction();
}
// The wizard page buttons' disabled and hidden attributes are set after the
// pageshow event so use executeSoon to allow them to be set so their disabled
// and hidden attribute values can be checked.
SimpleTest.executeSoon(delayedDefaultCallback);
}
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);
/**
* Delayed default callback called using executeSoon in defaultCallback which
* allows the wizard page buttons' disabled and hidden attributes to be set
* before checking their values.
*/
function delayedDefaultCallback() {
debugDump("Entering delayedDefaultCallback - gTests[" + gTestCounter + "], " +
"pageid: " + gTest.pageid);
// Verify the pageid hasn't changed after executeSoon was called.
is(gDocElem.currentPage.pageid, gTest.pageid,
"Checking currentPage.pageid equals " + gTest.pageid + " after " +
"executeSoon");
checkButtonStates();
// Perform delayed extra checks if specified by the test
if (gTest.extraDelayedCheckFunction) {
debugDump("delayedDefaultCallback - calling extraDelayedCheckFunction " +
gTest.extraDelayedCheckFunction.name);
gTest.extraDelayedCheckFunction();
}
// Used to verify that this test has been performed
gTest.ranTest = true;
if (gTest.buttonClick) {
debugDump("delayedDefaultCallback - clicking " + gTest.buttonClick +
" button");
if(gTest.extraDelayedFinishFunction) {
throw("Tests cannot have a buttonClick and an extraDelayedFinishFunction property");
}
gDocElem.getButton(gTest.buttonClick).click();
}
else if (gTest.extraDelayedFinishFunction) {
debugDump("delayedDefaultCallback - calling extraDelayedFinishFunction " +
gTest.extraDelayedFinishFunction.name);
gTest.extraDelayedFinishFunction();
}
}
/**
* Checks the wizard page buttons' disabled and hidden attributes values are
* correct. If an expected button id is not specified then the expected disabled
* and hidden attribute value is true.
*/
function checkButtonStates() {
debugDump("Entering checkButtonStates - gTests[" + gTestCounter + "], " +
"pageid: " + gTest.pageid);
const buttonNames = ["extra1", "extra2", "back", "next", "finish", "cancel"];
let buttonStates = getExpectedButtonStates();
buttonNames.forEach(function(aButtonName) {
let button = gDocElem.getButton(aButtonName);
let hasHidden = aButtonName in buttonStates &&
"hidden" in buttonStates[aButtonName];
let hidden = hasHidden ? buttonStates[aButtonName].hidden : true;
let hasDisabled = aButtonName in buttonStates &&
"disabled" in buttonStates[aButtonName];
let disabled = hasDisabled ? buttonStates[aButtonName].disabled : true;
is(button.hidden, hidden, "Checking " + aButtonName + " button " +
"hidden attribute value equals " + (hidden ? "true" : "false"));
is(button.disabled, disabled, "Checking " + aButtonName + " button " +
"disabled attribute value equals " + (disabled ? "true" : "false"));
});
}
/**
* Returns the expected disabled and hidden attribute values for the buttons of
* the current wizard page.
*/
function getExpectedButtonStates() {
// Allow individual tests to override the expected button states.
if (gTest.buttonStates) {
return gTest.buttonStates;
}
switch (gTest.pageid) {
case PAGEID_CHECKING:
case PAGEID_INCOMPAT_CHECK:
return { cancel: { disabled: false, hidden: false } };
case PAGEID_FOUND_BASIC:
case PAGEID_FOUND_BILLBOARD:
if (gTest.neverButton) {
return { extra1: { disabled: false, hidden: false },
extra2: { disabled: false, hidden: false },
next : { disabled: false, hidden: false } }
}
return { extra1: { disabled: false, hidden: false },
next : { disabled: false, hidden: false } };
case PAGEID_LICENSE:
if (gRemoteContentState != "loaded" ||
gAcceptDeclineLicense.selectedIndex != 0) {
return { extra1: { disabled: false, hidden: false },
next : { disabled: true, hidden: false } };
}
return { extra1: { disabled: false, hidden: false },
next : { disabled: false, hidden: false } };
case PAGEID_INCOMPAT_LIST:
return { extra1: { disabled: false, hidden: false },
next : { disabled: false, hidden: false } };
case PAGEID_DOWNLOADING:
return { extra1: { disabled: false, hidden: false } };
case PAGEID_NO_UPDATES_FOUND:
case PAGEID_MANUAL_UPDATE:
case PAGEID_ERRORS:
case PAGEID_INSTALLED:
return { finish: { disabled: false, hidden: false } };
case PAGEID_ERROR_PATCHING:
return { next : { disabled: false, hidden: false } };
case PAGEID_FINISHED:
case PAGEID_FINISHED_BKGRD:
return { extra1: { disabled: false, hidden: false },
finish: { disabled: false, hidden: false } };
}
return null;
}
/**
* Adds a load event listener to the current remotecontent element.
*/
function addRemoteContentLoadListener() {
debugDump("Entering addRemoteContentLoadListener - gTests[" + gTestCounter +
"], pageid: " + gTest.pageid);
gRemoteContent.addEventListener("load", remoteContentLoadListener, false);
}
/**
* The nsIDOMEventListener for a remotecontent load event.
*/
function remoteContentLoadListener(aEvent) {
// Return early if the event's original target's nodeName isn't remotecontent.
if (aEvent.originalTarget.nodeName != "remotecontent") {
debugDump("remoteContentLoadListener - only handles events with an " +
"originalTarget nodeName of |remotecontent|. " +
"aEvent.originalTarget.nodeName = " +
aEvent.originalTarget.nodeName);
return;
}
gTestCounter++;
gCallback(aEvent);
}
/**
* Waits until a remotecontent element to finish loading which is determined
* by the current test's expectedRemoteContentState property and then removes
* the event listener.
*
* Note: tests that use this function should not test the state of the
* remotecontent since this will check the expected state.
*
* @return false if the remotecontent has loaded and its state is the state
* specified in the current test's expectedRemoteContentState
* property... otherwise true.
*/
function waitForRemoteContentLoaded(aEvent) {
// Return early until the remotecontent has loaded with the state that is
// expected or isn't the event's originalTarget.
if (gRemoteContentState != gTest.expectedRemoteContentState ||
!aEvent.originalTarget.isSameNode(gRemoteContent)) {
debugDump("waitForRemoteContentLoaded - returning early\n" +
"gRemoteContentState: " + gRemoteContentState + "\n" +
"expectedRemoteContentState: " +
gTest.expectedRemoteContentState + "\n" +
"aEvent.originalTarget.nodeName: " +
aEvent.originalTarget.nodeName);
return true;
}
gRemoteContent.removeEventListener("load", remoteContentLoadListener, false);
return false;
}
/**
* Compares the value of the remotecontent state attribute with the value
* specified in the test's expectedRemoteContentState property.
*/
function checkRemoteContentState() {
is(gRemoteContentState, gTest.expectedRemoteContentState, "Checking remote " +
"content state equals " + gTest.expectedRemoteContentState + " - pageid " +
gTest.pageid);
}
/**
* Adds a select event listener to the license radiogroup element and clicks
* the radio element specified in the current test's radioClick property.
*/
function addRadioGroupSelectListenerAndClick() {
debugDump("Entering addRadioGroupSelectListenerAndClick - gTests[" +
gTestCounter + "], pageid: " + gTest.pageid);
gAcceptDeclineLicense.addEventListener("select", radioGroupSelectListener,
false);
gWin.document.getElementById(gTest.radioClick).click();
}
/**
* The nsIDOMEventListener for the license radiogroup select event.
*/
function radioGroupSelectListener(aEvent) {
// Return early if the event's original target's nodeName isn't radiogroup.
if (aEvent.originalTarget.nodeName != "radiogroup") {
debugDump("remoteContentLoadListener - only handles events with an " +
"originalTarget nodeName of |radiogroup|. " +
"aEvent.originalTarget.nodeName = " +
aEvent.originalTarget.nodeName);
return;
}
gAcceptDeclineLicense.removeEventListener("select", radioGroupSelectListener,
false);
gTestCounter++;
gCallback(aEvent);
}
/**
* Compares the value of the License radiogroup's selectedIndex attribute with
* the value specified in the test's expectedRadioGroupSelectedIndex property.
*/
function checkRadioGroupSelectedIndex() {
is(gAcceptDeclineLicense.selectedIndex, gTest.expectedRadioGroupSelectedIndex,
"Checking license radiogroup selectedIndex equals " +
gTest.expectedRadioGroupSelectedIndex);
}
/**
* Compares the return value of prefHasUserValue for the preference specified in
* gPrefToCheck with the value passed in the aPrefHasValue param or the value
* specified in the current test's prefHasUserValue property if aPrefHasValue
* is undefined.
*
* @param aPrefHasValue
* The expected value returned from prefHasUserValue for the preference
* specified in gPrefToCheck. If aPrefHasValue is undefined the value
* of the current test's prefHasUserValue property will be used.
*/
function checkPrefHasUserValue(aPrefHasValue) {
var prefHasUserValue = aPrefHasValue === undefined ? gTest.prefHasUserValue
: aPrefHasValue;
is(Services.prefs.prefHasUserValue(gPrefToCheck), prefHasUserValue,
"Checking prefHasUserValue for preference " + gPrefToCheck + " equals " +
(prefHasUserValue ? "true" : "false"));
}
/**
* Gets the update version info for the update url params to send to update.sjs.
*
* @param aAppVersion
* The application version for the update snippet. If not specified the
* current application version will be used.
* @param aPlatformVersion
* The platform version for the update snippet. If not specified the
* current platform version will be used.
* @return The url params for the application and platform version to send to
* update.sjs.
*/
function getVersionParams(aAppVersion, aPlatformVersion) {
let appInfo = Services.appinfo;
return "&appVersion=" + (aAppVersion ? aAppVersion : appInfo.version) +
"&platformVersion=" + (aPlatformVersion ? aPlatformVersion
: appInfo.platformVersion);
}
/**
* Verifies that all tests ran.
*/
function verifyTestsRan() {
debugDump("Entering verifyTestsRan");
// Return early if there are no tests defined.
if (!gTests) {
return;
}
gTestCounter = -1;
for (let i = 0; i < gTests.length; ++i) {
gTestCounter++;
let test = gTests;
let msg = "Checking if gTests[" + i + "] test was performed... " +
"callback function name = " + gCallback.name + "," +
"pageid = " + (gTest.pageid ? gTest.pageid : "N/A");
ok(gTest.ranTest, msg);
}
}
/**
* Resets the most common preferences used by tests to their original value.
*/
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);
if (gUpdateChannel) {
setUpdateChannel(gUpdateChannel);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_IDLETIME)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_IDLETIME);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_ENABLED)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_ENABLED);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_LOG)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_LOG);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_SHOW_INSTALLED_UI)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_DETAILS)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_URL_DETAILS);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_OVERRIDE)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_URL_OVERRIDE);
}
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_IDLETIME)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_IDLETIME);
}
try {
gPref.deleteBranch(PREF_APP_UPDATE_NEVER_BRANCH);
Services.prefs.deleteBranch(PREF_APP_UPDATE_NEVER_BRANCH);
}
catch(e) {
}
}
/**
* Closes the update window if it is open.
*/
function closeUpdateWindow() {
let updateWindow = getUpdateWindow();
if (!updateWindow)
return;
ok(false, "Found an existing Update Window from a previous test... " +
"attempting to close it.");
updateWindow.close();
}
/**
* Gets the update window.
*
* @return The nsIDOMWindowInternal for the Update Window if it is open and null
* if it isn't.
*/
function getUpdateWindow() {
return Services.wm.getMostRecentWindow(UPDATE_WINDOW_NAME);
}
/**
* nsIObserver for receiving window open and close notifications.
*/
var gWindowObserver = {
loaded: false,
observe: function WO_observe(aSubject, aTopic, aData) {
let win = aSubject.QueryInterface(AUS_Ci.nsIDOMEventTarget);
if (aTopic == "domwindowclosed") {
if (win.location == URI_UPDATE_PROMPT_DIALOG) {
// Allow tests the ability to provide their own function (it must be
// named finishTest) for finishing the test.
try {
finishTest();
}
catch (e) {
finishTestDefault();
}
}
return;
}
// Defensive measure to prevent adding multiple listeners.
if (this.loaded) {
// This should never happen but if it does this will provide a clue for
// diagnosing the cause.
ok(false, "Unexpected gWindowObserver:observe - called with aTopic = " +
aTopic + "... returning early");
return;
}
win.addEventListener("load", function onLoad() {
// Defensive measure to prevent windows we shouldn't see from breaking
// a test.
if (win.location != URI_UPDATE_PROMPT_DIALOG) {
// This should never happen.
ok(false, "Unexpected load event - win.location got: " + location +
", expected: " + URI_UPDATE_PROMPT_DIALOG + "... returning early");
return;
}
// Defensive measure to prevent an unexpected wizard page from breaking
// a test.
let pageid = win.document.documentElement.currentPage.pageid;
if (pageid != PAGEID_DUMMY) {
// This should never happen but if it does this will provide a clue
// for diagnosing the cause.
ok(false, "Unexpected load event - pageid got: " + pageid +
", expected: " + PAGEID_DUMMY + "... returning early");
return;
}
win.removeEventListener("load", onLoad, false);
gTimeoutTimer = AUS_Cc["@mozilla.org/timer;1"].
createInstance(AUS_Ci.nsITimer);
gTimeoutTimer.initWithCallback(finishTestTimeout, TEST_TIMEOUT,
AUS_Ci.nsITimer.TYPE_ONE_SHOT);
gWin = win;
gDocElem = gWin.document.documentElement;
gDocElem.addEventListener("pageshow", onPageShowDefault, false);
}, false);
this.loaded = true;
}
};

View File

@ -42,12 +42,15 @@
const AUS_Cc = Components.classes;
const AUS_Ci = Components.interfaces;
const AUS_Cr = Components.results;
const AUS_Cu = Components.utils;
const PREF_APP_UPDATE_CERT_ATTR_BRANCH = "app.update.cert.attributes.";
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 = "app.update.url";
const PREF_APP_UPDATE_URL_DETAILS = "app.update.url.details";
const PREF_APP_UPDATE_URL_OVERRIDE = "app.update.url.override";
@ -88,13 +91,11 @@ const MODE_TRUNCATE = 0x20;
const PERMS_FILE = 0644;
const PERMS_DIRECTORY = 0755;
const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.properties";
const gUpdateBundle = AUS_Cc["@mozilla.org/intl/stringbundle;1"].
getService(AUS_Ci.nsIStringBundleService).
createBundle(URI_UPDATES_PROPERTIES);
AUS_Cu.import("resource://gre/modules/Services.jsm");
const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.properties";
const gUpdateBundle = Services.strings.createBundle(URI_UPDATES_PROPERTIES);
var gDirSvc = AUS_Cc["@mozilla.org/file/directory_service;1"].
getService(AUS_Ci.nsIProperties);
__defineGetter__("gAUS", function() {
delete this.gAUS;
@ -122,14 +123,11 @@ __defineGetter__("gUP", function() {
createInstance(AUS_Ci.nsIUpdatePrompt);
});
__defineGetter__("gPref", function() {
delete this.gPref;
return this.gPref = AUS_Cc["@mozilla.org/preferences-service;1"].
getService(AUS_Ci.nsIPrefBranch2).
QueryInterface(AUS_Ci.nsIPrefService);
__defineGetter__("gDefaultPrefBranch", function() {
delete this.gDefaultPrefBranch;
return this.gDefaultPrefBranch = Services.prefs.getDefaultBranch(null);
});
/* Initializes the update service stub */
function initUpdateServiceStub() {
AUS_Cc["@mozilla.org/updates/update-service-stub;1"].
@ -142,18 +140,14 @@ function reloadUpdateManagerData() {
observe(null, "um-reload-update-data", "");
}
function getDefaultPrefBranch() {
return gPref.QueryInterface(AUS_Ci.nsIPrefService).getDefaultBranch(null);
}
/**
* Sets the app.update.channel preference.
* @param aChannel
* The update channel. If not specified 'test_channel' will be used.
*/
function setUpdateChannel(aChannel) {
getDefaultPrefBranch().setCharPref(PREF_APP_UPDATE_CHANNEL,
aChannel ? aChannel : "test_channel");
gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_CHANNEL,
aChannel ? aChannel : "test_channel");
}
/**
@ -163,8 +157,8 @@ function setUpdateChannel(aChannel) {
* used.
*/
function setUpdateURLOverride(aURL) {
gPref.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE,
aURL ? aURL : URL_HOST + "update.xml");
Services.prefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE,
aURL ? aURL : URL_HOST + "update.xml");
}
/**
@ -691,7 +685,7 @@ function removeDirRecursive(aDir) {
* files.
*/
function getCurrentProcessDir() {
return gDirSvc.get(NS_XPCOM_CURRENT_PROCESS_DIR, AUS_Ci.nsIFile);
return Services.dirsvc.get(NS_XPCOM_CURRENT_PROCESS_DIR, AUS_Ci.nsIFile);
}
/**
@ -701,5 +695,5 @@ function getCurrentProcessDir() {
* directory.
*/
function getGREDir() {
return gDirSvc.get(NS_GRE_DIR, AUS_Ci.nsIFile);
return Services.dirsvc.get(NS_GRE_DIR, AUS_Ci.nsIFile);
}

View File

@ -71,7 +71,7 @@ function cleanUp() {
// tests to fail.
gAUS.observe(null, "xpcom-shutdown", "");
gDirSvc.unregisterProvider(gDirProvider);
Services.dirsvc.unregisterProvider(gDirProvider);
if (gXHR) {
gXHRCallback = null;
@ -94,9 +94,9 @@ function cleanUp() {
function setDefaultPrefs() {
// Don't display UI for a successful installation. Some apps may not set this
// pref to false like Firefox does.
gPref.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, false);
Services.prefs.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, false);
// Enable Update logging
gPref.setBoolPref(PREF_APP_UPDATE_LOG, true);
Services.prefs.setBoolPref(PREF_APP_UPDATE_LOG, true);
}
/**
@ -195,9 +195,7 @@ xhr.prototype = {
_url: null,
_method: null,
open: function (method, url) {
gXHR.channel.originalURI = AUS_Cc["@mozilla.org/network/io-service;1"].
getService(AUS_Ci.nsIIOService).
newURI(url, null, null);
gXHR.channel.originalURI = Services.io.newURI(url, null, null);
gXHR._method = method; gXHR._url = url;
},
responseXML: null,
@ -372,7 +370,7 @@ var gDirProvider = {
throw AUS_Cr.NS_ERROR_NO_INTERFACE;
}
};
gDirSvc.QueryInterface(AUS_Ci.nsIDirectoryService).registerProvider(gDirProvider);
Services.dirsvc.QueryInterface(AUS_Ci.nsIDirectoryService).registerProvider(gDirProvider);
const INSTALL_LOCALE = "@AB_CD@";

View File

@ -190,9 +190,8 @@ function run_test_pt7() {
var url = URL_PREFIX + "%CHANNEL%/";
dump("Testing: url constructed with %CHANNEL% - " + url + "\n");
setUpdateURLOverride(url);
var defaults = getDefaultPrefBranch();
defaults.setCharPref(PREF_APP_PARTNER_BRANCH + "test_partner1", "test_partner1");
defaults.setCharPref(PREF_APP_PARTNER_BRANCH + "test_partner2", "test_partner2");
gDefaultPrefBranch.setCharPref(PREF_APP_PARTNER_BRANCH + "test_partner1", "test_partner1");
gDefaultPrefBranch.setCharPref(PREF_APP_PARTNER_BRANCH + "test_partner2", "test_partner2");
gUpdateChecker.checkForUpdates(updateCheckListener, true);
}
@ -251,7 +250,7 @@ function run_test_pt10() {
var url = URL_PREFIX + "%DISTRIBUTION%/";
dump("Testing: url constructed with %DISTRIBUTION% - " + url + "\n");
setUpdateURLOverride(url);
getDefaultPrefBranch().setCharPref(PREF_DISTRIBUTION_ID, "test_distro");
gDefaultPrefBranch.setCharPref(PREF_DISTRIBUTION_ID, "test_distro");
gUpdateChecker.checkForUpdates(updateCheckListener, true);
}
@ -266,7 +265,7 @@ function run_test_pt11() {
var url = URL_PREFIX + "%DISTRIBUTION_VERSION%/";
dump("Testing: url constructed with %DISTRIBUTION_VERSION% - " + url + "\n");
setUpdateURLOverride(url);
getDefaultPrefBranch().setCharPref(PREF_DISTRIBUTION_VERSION, "test_distro_version");
gDefaultPrefBranch.setCharPref(PREF_DISTRIBUTION_VERSION, "test_distro_version");
gUpdateChecker.checkForUpdates(updateCheckListener, true);
}

View File

@ -64,8 +64,8 @@ function run_test() {
// Enable automatic app update so that after the failed partial is found the
// complete update will start to download automatically.
gPref.setBoolPref(PREF_APP_UPDATE_ENABLED, true);
gPref.setBoolPref("browser.privatebrowsing.autostart", true);
Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, true);
Services.prefs.setBoolPref("browser.privatebrowsing.autostart", true);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1.0", "2.0");
setDefaultPrefs();