This commit is contained in:
Phil Ringnalda 2015-04-18 16:46:44 -07:00
Родитель 458d4b09c4 0430b12ca6
Коммит 8747c26535
113 изменённых файлов: 1699 добавлений и 1579 удалений

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

@ -198,6 +198,9 @@ const gXPInstallObserver = {
}
};
options.learnMoreURL = Services.urlFormatter.formatURLPref("app.support.baseURL") +
"find-and-install-add-ons";
messageString = gNavigatorBundle.getString("addonConfirmInstall.message");
messageString = PluralForm.get(installInfo.installs.length, messageString);
messageString = messageString.replace("#1", brandShortName);

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

@ -180,41 +180,65 @@ let gSubDialog = {
parseFloat(getComputedStyle(groupBoxTitle).borderBottomWidth);
let groupBoxBody = document.getAnonymousElementByAttribute(this._box, "class", "groupbox-body");
// These are deduced from styles which we don't change, so it's safe to get them now:
let boxVerticalPadding = 2 * parseFloat(getComputedStyle(groupBoxBody).paddingTop);
let boxHorizontalPadding = 2 * parseFloat(getComputedStyle(groupBoxBody).paddingLeft);
let boxHorizontalBorder = 2 * parseFloat(getComputedStyle(this._box).borderLeftWidth);
let boxVerticalBorder = 2 * parseFloat(getComputedStyle(this._box).borderTopWidth);
// The difference between the frame and box shouldn't change, either:
let boxRect = this._box.getBoundingClientRect();
let frameRect = this._frame.getBoundingClientRect();
let frameSizeDifference = (frameRect.top - boxRect.top) + (boxRect.bottom - frameRect.bottom);
// Then determine and set a bunch of width stuff:
let frameMinWidth = docEl.style.width || docEl.scrollWidth + "px";
let frameWidth = docEl.getAttribute("width") ? docEl.getAttribute("width") + "px" :
frameMinWidth;
this._frame.style.width = frameWidth;
this._box.style.minWidth = "calc(" +
(boxHorizontalBorder + boxHorizontalPadding) +
"px + " + frameMinWidth + ")";
// Now do the same but for the height. We need to do this afterwards because otherwise
// XUL assumes we'll optimize for height and gives us "wrong" values which then are no
// longer correct after we set the width:
let frameMinHeight = docEl.style.height || docEl.scrollHeight + "px";
let frameHeight = docEl.getAttribute("height") ? docEl.getAttribute("height") + "px" :
frameMinHeight;
let boxVerticalBorder = 2 * parseFloat(getComputedStyle(this._box).borderTopWidth);
let boxHorizontalBorder = 2 * parseFloat(getComputedStyle(this._box).borderLeftWidth);
let frameRect = this._frame.getBoundingClientRect();
let boxRect = this._box.getBoundingClientRect();
let frameSizeDifference = (frameRect.top - boxRect.top) + (boxRect.bottom - frameRect.bottom);
frameMinHeight;
// Now check if the frame height we calculated is possible at this window size,
// accounting for titlebar, padding/border and some spacing.
let maxHeight = window.innerHeight - frameSizeDifference - 30;
if (frameHeight > maxHeight) {
// If not, we should probably let the dialog scroll:
frameHeight = maxHeight;
// Do this with a frame height in pixels...
let comparisonFrameHeight;
if (frameHeight.endsWith("em")) {
let fontSize = parseFloat(getComputedStyle(this._frame).fontSize);
comparisonFrameHeight = parseFloat(frameHeight, 10) * fontSize;
} else if (frameHeight.endsWith("px")) {
comparisonFrameHeight = parseFloat(frameHeight, 10);
} else {
Cu.reportError("This dialog (" + this._frame.contentWindow.location.href + ") " +
"set a height in non-px-non-em units ('" + frameHeight + "'), " +
"which is likely to lead to bad sizing in in-content preferences. " +
"Please consider changing this.");
comparisonFrameHeight = parseFloat(frameHeight);
}
if (comparisonFrameHeight > maxHeight) {
// If the height is bigger than that of the window, we should let the contents scroll:
frameHeight = maxHeight + "px";
frameMinHeight = maxHeight + "px";
let containers = this._frame.contentDocument.querySelectorAll('.largeDialogContainer');
for (let container of containers) {
container.classList.add("doScroll");
}
}
this._frame.style.width = frameWidth;
this._frame.style.height = frameHeight;
this._box.style.minHeight = "calc(" +
(boxVerticalBorder + groupBoxTitleHeight + boxVerticalPadding) +
"px + " + frameMinHeight + ")";
this._box.style.minWidth = "calc(" +
(boxHorizontalBorder + boxHorizontalPadding) +
"px + " + frameMinWidth + ")";
this._overlay.style.visibility = "visible";
this._overlay.style.opacity = ""; // XXX: focus hack continued from _onContentLoaded

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

@ -158,12 +158,74 @@ let gTests = [{
let dialog = yield dialogPromise;
ise(content.gSubDialog._frame.style.width, "32em", "Width should be set on the frame from the dialog");
ise(content.gSubDialog._frame.style.height, "40em", "Height should be set on the frame from the dialog");
ise(content.gSubDialog._frame.style.height, "5em", "Height should be set on the frame from the dialog");
content.gSubDialog.close();
yield deferredClose.promise;
},
},
{
desc: "Check that a set width and content causing wrapping still lead to correct scrollHeight-implied height",
run: function* () {
let deferredClose = Promise.defer();
let dialogPromise = openAndLoadSubDialog(gDialogURL, null, null,
(aEvent) => dialogClosingCallback(deferredClose, aEvent));
let oldHeight;
content.addEventListener("DOMFrameContentLoaded", function frame2Loaded() {
content.removeEventListener("DOMFrameContentLoaded", frame2Loaded);
let doc = content.gSubDialog._frame.contentDocument;
oldHeight = doc.documentElement.scrollHeight;
doc.documentElement.style.removeProperty("height");
doc.getElementById("desc").textContent = `
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque
laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
voluptatem sequi nesciunt.`
doc = null;
});
let dialog = yield dialogPromise;
ise(content.gSubDialog._frame.style.width, "32em", "Width should be set on the frame from the dialog");
let docEl = content.gSubDialog._frame.contentDocument.documentElement;
ok(docEl.scrollHeight > oldHeight, "Content height increased (from " + oldHeight + " to " + docEl.scrollHeight + ").");
ise(content.gSubDialog._frame.style.height, docEl.scrollHeight + "px", "Height on the frame should be higher now");
content.gSubDialog.close();
yield deferredClose.promise;
},
},
{
desc: "Check that a dialog that is too high gets cut down to size",
run: function* () {
let deferredClose = Promise.defer();
let dialogPromise = openAndLoadSubDialog(gDialogURL, null, null,
(aEvent) => dialogClosingCallback(deferredClose, aEvent));
content.addEventListener("DOMFrameContentLoaded", function frame3Loaded() {
content.removeEventListener("DOMFrameContentLoaded", frame3Loaded);
content.gSubDialog._frame.contentDocument.documentElement.style.height = '100000px';
});
let dialog = yield dialogPromise;
ise(content.gSubDialog._frame.style.width, "32em", "Width should be set on the frame from the dialog");
let newHeight = content.gSubDialog._frame.contentDocument.documentElement.scrollHeight;
ok(parseInt(content.gSubDialog._frame.style.height) < window.innerHeight,
"Height on the frame should be smaller than window's innerHeight");
content.gSubDialog.close();
yield deferredClose.promise;
}
},
{
desc: "Check that scrollWidth and scrollHeight from the sub-dialog are used to size the <browser>",
run: function* () {
@ -173,16 +235,16 @@ let gTests = [{
content.addEventListener("DOMFrameContentLoaded", function frameLoaded() {
content.removeEventListener("DOMFrameContentLoaded", frameLoaded);
content.gSubDialog._frame.contentDocument.documentElement.style.height = "";
content.gSubDialog._frame.contentDocument.documentElement.style.width = "";
content.gSubDialog._frame.contentDocument.documentElement.style.removeProperty("height");
content.gSubDialog._frame.contentDocument.documentElement.style.removeProperty("width");
});
let dialog = yield dialogPromise;
ok(content.gSubDialog._frame.style.width.endsWith("px"),
"Width should be set to a px value of the scrollWidth from the dialog");
"Width (" + content.gSubDialog._frame.style.width + ") should be set to a px value of the scrollWidth from the dialog");
ok(content.gSubDialog._frame.style.height.endsWith("px"),
"Height should be set to a px value of the scrollHeight from the dialog");
"Height (" + content.gSubDialog._frame.style.height + ") should be set to a px value of the scrollHeight from the dialog");
gTeardownAfterClose = true;
content.gSubDialog.close();

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

@ -7,7 +7,7 @@
<dialog id="subDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Sample sub-dialog" style="width: 32em; height: 40em;"
title="Sample sub-dialog" style="width: 32em; height: 5em;"
onload="document.getElementById('textbox').focus();"
ondialogaccept="acceptSubdialog();">
<script>
@ -16,7 +16,7 @@
}
</script>
<description>A sample sub-dialog for testing</description>
<description id="desc">A sample sub-dialog for testing</description>
<textbox id="textbox" value="Default text" />

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

@ -673,19 +673,27 @@ InspectorPanel.prototype = {
deleteNode.setAttribute("disabled", "true");
}
// Disable / enable "Copy Unique Selector", "Copy inner HTML" &
// "Copy outer HTML" as appropriate
// Disable / enable "Copy Unique Selector", "Copy inner HTML",
// "Copy outer HTML" & "Scroll Into View" as appropriate
let unique = this.panelDoc.getElementById("node-menu-copyuniqueselector");
let copyInnerHTML = this.panelDoc.getElementById("node-menu-copyinner");
let copyOuterHTML = this.panelDoc.getElementById("node-menu-copyouter");
let scrollIntoView = this.panelDoc.getElementById("node-menu-scrollnodeintoview");
this._target.actorHasMethod("domnode", "scrollIntoView").then(value => {
scrollIntoView.hidden = !value;
});
if (isSelectionElement) {
unique.removeAttribute("disabled");
copyInnerHTML.removeAttribute("disabled");
copyOuterHTML.removeAttribute("disabled");
scrollIntoView.removeAttribute("disabled");
} else {
unique.setAttribute("disabled", "true");
copyInnerHTML.setAttribute("disabled", "true");
copyOuterHTML.setAttribute("disabled", "true");
scrollIntoView.setAttribute("disabled", "true");
}
if (!this.canGetUniqueSelector) {
unique.hidden = true;
@ -999,6 +1007,18 @@ InspectorPanel.prototype = {
}).then(null, console.error);
},
/**
* Scroll the node into view.
*/
scrollNodeIntoView: function InspectorPanel_scrollNodeIntoView()
{
if (!this.selection.isNode()) {
return;
}
this.selection.nodeFront.scrollIntoView();
},
/**
* Delete the selected node.
*/

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

@ -90,6 +90,11 @@
</menupopup>
</menu>
<menuseparator/>
<menuitem id="node-menu-scrollnodeintoview"
label="&inspectorScrollNodeIntoView.label;"
accesskey="&inspectorScrollNodeIntoView.accesskey;"
oncommand="inspector.scrollNodeIntoView()"/>
<menuseparator/>
<menuitem id="node-menu-delete"
label="&inspectorHTMLDelete.label;"
accesskey="&inspectorHTMLDelete.accesskey;"

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

@ -26,7 +26,8 @@ const ALL_MENU_ITEMS = [
"node-menu-delete",
"node-menu-pseudo-hover",
"node-menu-pseudo-active",
"node-menu-pseudo-focus"
"node-menu-pseudo-focus",
"node-menu-scrollnodeintoview"
].concat(PASTE_MENU_ITEMS);
const ITEMS_WITHOUT_SHOWDOMPROPS =

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

@ -13,6 +13,7 @@ add_task(function* () {
yield testShowDOMProperties();
yield testDeleteNode();
yield testDeleteRootNode();
yield testScrollIntoView();
function* testShowDOMProperties() {
info("Testing 'Show DOM Properties' menu item.");
@ -63,6 +64,11 @@ add_task(function* () {
});
}
function* testScrollIntoView() {
// Follow up bug to add this test - https://bugzilla.mozilla.org/show_bug.cgi?id=1154107
todo(false, "Verify that node is scrolled into the viewport.");
}
function dispatchCommandEvent(node) {
info("Dispatching command event on " + node);
let commandEvent = document.createEvent("XULCommandEvent");

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

@ -68,6 +68,11 @@
<!ENTITY inspectorHTMLPasteLastChild.label "As Last Child">
<!ENTITY inspectorHTMLPasteLastChild.accesskey "L">
<!-- LOCALIZATION NOTE (inspectorScrollNodeIntoView.label): This is the label
shown in the inspector contextual-menu for the item that lets users scroll
the current node into view -->
<!ENTITY inspectorScrollNodeIntoView.label "Scroll Into View">
<!ENTITY inspectorScrollNodeIntoView.accesskey "S">
<!-- LOCALIZATION NOTE (inspectorHTMLDelete.label): This is the label shown in
the inspector contextual-menu for the item that lets users delete the

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

@ -1430,7 +1430,12 @@ public class BrowserApp extends GeckoApp
public void run() {
final float translationY = marginTop - browserChrome.getHeight();
ViewHelper.setTranslationY(browserChrome, translationY);
ViewHelper.setTranslationY(progressView, translationY);
// Stop the progressView from moving all the way up so that we can still see a good chunk of it
// when the chrome is offscreen.
final float offset = getResources().getDimensionPixelOffset(R.dimen.progress_bar_scroll_offset);
final float progressTranslationY = Math.max(marginTop - browserChrome.getHeight(), offset - browserChrome.getHeight());
ViewHelper.setTranslationY(progressView, progressTranslationY);
if (mDoorHangerPopup.isShowing()) {
mDoorHangerPopup.updatePopup();

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

@ -5,9 +5,6 @@
package org.mozilla.gecko;
import android.app.Presentation;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.media.MediaControlIntent;
@ -15,29 +12,21 @@ import android.support.v7.media.MediaRouteSelector;
import android.support.v7.media.MediaRouter;
import android.support.v7.media.MediaRouter.RouteInfo;
import android.util.Log;
import android.view.Display;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import com.google.android.gms.cast.CastMediaControlIntent;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.mozglue.JNITarget;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.NativeEventListener;
import org.mozilla.gecko.util.NativeJSObject;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/* Manages a list of GeckoMediaPlayers methods (i.e. Chromecast/Miracast). Routes messages
/**
* Manages a list of GeckoMediaPlayers methods (i.e. Chromecast/Miracast). Routes messages
* from Gecko to the correct caster based on the id of the display
*/
public class MediaPlayerManager extends Fragment implements NativeEventListener {
@ -47,7 +36,11 @@ public class MediaPlayerManager extends Fragment implements NativeEventListener
*/
@JNITarget
public static MediaPlayerManager newInstance() {
return new MediaPlayerManager();
if (Versions.feature17Plus) {
return new PresentationMediaPlayerManager();
} else {
return new MediaPlayerManager();
}
}
private static final String LOGTAG = "GeckoMediaPlayerManager";
@ -69,9 +62,8 @@ public class MediaPlayerManager extends Fragment implements NativeEventListener
}
}
private MediaRouter mediaRouter = null;
private final Map<String, GeckoMediaPlayer> displays = new HashMap<String, GeckoMediaPlayer>();
private GeckoPresentation presentation = null;
protected MediaRouter mediaRouter = null;
protected final Map<String, GeckoMediaPlayer> displays = new HashMap<String, GeckoMediaPlayer>();
@Override
public void onCreate(Bundle savedInstanceState) {
@ -239,85 +231,5 @@ public class MediaPlayerManager extends Fragment implements NativeEventListener
mediaRouter.addCallback(selectorBuilder, callback, MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);
}
@Override
public void onStop() {
super.onStop();
if (presentation != null) {
presentation.dismiss();
presentation = null;
}
}
private void updatePresentation() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
return;
}
if (mediaRouter == null) {
return;
}
MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute();
Display display = route != null ? route.getPresentationDisplay() : null;
if (display != null) {
if ((presentation != null) && (presentation.getDisplay() != display)) {
presentation.dismiss();
presentation = null;
}
if (presentation == null) {
presentation = new GeckoPresentation(getActivity(), display);
try {
presentation.show();
} catch (WindowManager.InvalidDisplayException ex) {
Log.w(LOGTAG, "Couldn't show presentation! Display was removed in "
+ "the meantime.", ex);
presentation = null;
}
}
} else if (presentation != null) {
presentation.dismiss();
presentation = null;
}
}
private static class SurfaceListener implements SurfaceHolder.Callback {
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// Surface changed so force a composite
GeckoAppShell.scheduleComposite();
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
GeckoAppShell.addPresentationSurface(holder.getSurface());
GeckoAppShell.scheduleComposite();
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
GeckoAppShell.removePresentationSurface(holder.getSurface());
}
}
private final static class GeckoPresentation extends Presentation {
private SurfaceView mView;
public GeckoPresentation(Context context, Display display) {
super(context, display);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mView = new SurfaceView(getContext());
setContentView(mView, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mView.getHolder().addCallback(new SurfaceListener());
}
}
protected void updatePresentation() { /* Overridden in sub-classes. */ }
}

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

@ -0,0 +1,117 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
import android.annotation.TargetApi;
import android.app.Presentation;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.media.MediaRouter;
import android.util.Log;
import android.view.Display;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewGroup;
import android.view.WindowManager;
import org.mozilla.gecko.AppConstants.Versions;
/**
* A MediaPlayerManager with API 17+ Presentation support.
*/
@TargetApi(17)
public class PresentationMediaPlayerManager extends MediaPlayerManager {
private static final String LOGTAG = "Gecko" + PresentationMediaPlayerManager.class.getSimpleName();
private GeckoPresentation presentation;
public PresentationMediaPlayerManager() {
if (!Versions.feature17Plus) {
throw new IllegalStateException(PresentationMediaPlayerManager.class.getSimpleName() +
" does not support < API 17");
}
}
@Override
public void onStop() {
super.onStop();
if (presentation != null) {
presentation.dismiss();
presentation = null;
}
}
@Override
protected void updatePresentation() {
if (mediaRouter == null) {
return;
}
MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute();
Display display = route != null ? route.getPresentationDisplay() : null;
if (display != null) {
if ((presentation != null) && (presentation.getDisplay() != display)) {
presentation.dismiss();
presentation = null;
}
if (presentation == null) {
presentation = new GeckoPresentation(getActivity(), display);
try {
presentation.show();
} catch (WindowManager.InvalidDisplayException ex) {
Log.w(LOGTAG, "Couldn't show presentation! Display was removed in "
+ "the meantime.", ex);
presentation = null;
}
}
} else if (presentation != null) {
presentation.dismiss();
presentation = null;
}
}
private final static class GeckoPresentation extends Presentation {
private SurfaceView mView;
public GeckoPresentation(Context context, Display display) {
super(context, display);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mView = new SurfaceView(getContext());
setContentView(mView, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mView.getHolder().addCallback(new SurfaceListener());
}
}
private static class SurfaceListener implements SurfaceHolder.Callback {
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// Surface changed so force a composite
GeckoAppShell.scheduleComposite();
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
GeckoAppShell.addPresentationSurface(holder.getSurface());
GeckoAppShell.scheduleComposite();
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
GeckoAppShell.removePresentationSurface(holder.getSurface());
}
}
}

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

@ -72,7 +72,7 @@ public class FirstrunPager extends ViewPager {
@Override
public Fragment getItem(int i) {
final Fragment fragment = Fragment.instantiate(context, panels.get(i).getResource());
final Fragment fragment = Fragment.instantiate(context, panels.get(i).getClassname());
((FirstrunPanel) fragment).setOnFinishListener(listener);
return fragment;
}
@ -84,7 +84,7 @@ public class FirstrunPager extends ViewPager {
@Override
public CharSequence getPageTitle(int i) {
return panels.get(i).getTitle().toUpperCase();
return context.getString(panels.get(i).getTitleRes()).toUpperCase();
}
}
}

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

@ -11,25 +11,25 @@ import java.util.List;
public class FirstrunPagerConfig {
public static List<FirstrunPanel> getDefault() {
final List<FirstrunPanel> panels = new LinkedList<>();
panels.add(new FirstrunPanel(WelcomePanel.class.getName(), "Welcome"));
panels.add(new FirstrunPanel(WelcomePanel.class.getName(), WelcomePanel.TITLE_RES));
return panels;
}
public static class FirstrunPanel {
private String resource;
private String title;
private String classname;
private int titleRes;
public FirstrunPanel(String resource, String title) {
this.resource = resource;
this.title = title;
public FirstrunPanel(String resource, int titleRes) {
this.classname= resource;
this.titleRes = titleRes;
}
public String getResource() {
return this.resource;
public String getClassname() {
return this.classname;
}
public String getTitle() {
return this.title;
public int getTitleRes() {
return this.titleRes;
}
}

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

@ -9,6 +9,7 @@ import android.support.v4.app.Fragment;
public class FirstrunPanel extends Fragment {
public static final int TITLE_RES = -1;
protected FirstrunPane.OnFinishListener onFinishListener;
public void setOnFinishListener(FirstrunPane.OnFinishListener listener) {

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

@ -16,6 +16,8 @@ import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.fxa.activities.FxAccountGetStartedActivity;
public class WelcomePanel extends FirstrunPanel {
public static final int TITLE_RES = R.string.firstrun_panel_title_welcome;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
final ViewGroup root = (ViewGroup) inflater.inflate(R.layout.firstrun_welcome_fragment, container, false);

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

@ -448,6 +448,8 @@ size. -->
<!ENTITY button_clear "Clear">
<!ENTITY button_remember "Remember">
<!ENTITY firstrun_panel_title_welcome "Welcome">
<!ENTITY home_top_sites_title "Top Sites">
<!-- Localization note (home_top_sites_add): This string is used as placeholder
text underneath empty thumbnails in the Top Sites page on about:home. -->

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

@ -595,6 +595,7 @@ moz_native_devices_sources = [
'ChromeCast.java',
'GeckoMediaPlayer.java',
'MediaPlayerManager.java',
'PresentationMediaPlayerManager.java',
]
if CONFIG['MOZ_NATIVE_DEVICES']:
gbjar.extra_jars += moz_native_devices_jars

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

@ -218,6 +218,8 @@
so we dynamically add padding to compensate. To be removed in bug 1122752. -->
<dimen name="ab_share_padding">12dp</dimen>
<dimen name="progress_bar_scroll_offset">1.5dp</dimen>
<!-- This is a 4:7 ratio (as per UX decision). -->
<item name="thumbnail_aspect_ratio" format="float" type="dimen">0.571</item>

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

@ -380,6 +380,8 @@
<string name="button_no">&button_no;</string>
<string name="button_remember">&button_remember;</string>
<string name="firstrun_panel_title_welcome">&firstrun_panel_title_welcome;</string>
<string name="home_title">&home_title;</string>
<string name="home_top_sites_title">&home_top_sites_title;</string>
<string name="home_top_sites_add">&home_top_sites_add;</string>

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

@ -581,6 +581,16 @@ var NodeActor = exports.NodeActor = protocol.ActorClass({
}
}),
/**
* Scroll the selected node into view.
*/
scrollIntoView: method(function() {
this.rawNode.scrollIntoView(true);
}, {
request: {},
response: {}
}),
/**
* Get the node's image data if any (for canvas and img nodes).
* Returns an imageData object with the actual data being a LongStringActor

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

@ -53,6 +53,7 @@ skip-if = buildapp == 'mulet'
[test_inspector-reload.html]
[test_inspector-remove.html]
[test_inspector-retain.html]
[test_inspector-scroll-into-view.html]
[test_inspector-traversal.html]
[test_makeGlobalObjectReference.html]
[test_styles-applied.html]

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

@ -86,5 +86,6 @@
<object>
<div id="1"></div>
</object>
<div id="scroll-into-view" style="margin-top: 1000px;">scroll</div>
</body>
</html>

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

@ -0,0 +1,90 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=901250
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 901250</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
<script type="application/javascript;version=1.8" src="inspector-helpers.js"></script>
<script type="application/javascript;version=1.8">
Components.utils.import("resource://gre/modules/devtools/Loader.jsm");
const {Promise: promise} = Components.utils.import("resource://gre/modules/Promise.jsm", {});
const Ci = Components.interfaces;
const inspector = devtools.require("devtools/server/actors/inspector");
window.onload = function() {
SimpleTest.waitForExplicitFinish();
runNextTest();
}
var gInspectee = null;
var gClient = null;
var gWalker = null;
function assertOwnership() {
assertOwnershipTrees(gWalker);
}
addTest(function setup() {
let url = document.getElementById("inspectorContent").href;
attachURL(url, function(err, client, tab, doc) {
gInspectee = doc;
let {InspectorFront} = devtools.require("devtools/server/actors/inspector");
let inspector = InspectorFront(client, tab);
promiseDone(inspector.getWalker().then(walker => {
ok(walker, "getWalker() should return an actor.");
gClient = client;
gWalker = walker;
}).then(runNextTest));
});
});
addTest(Task.async(function* testScrollIntoView() {
let id = "#scroll-into-view";
let rect = gInspectee.querySelector(id).getBoundingClientRect();
let nodeFront = yield gWalker.querySelector(gWalker.rootNode, id);
let inViewport = rect.x >= 0 &&
rect.y >= 0 &&
rect.y <= gInspectee.defaultView.innerHeight &&
rect.x <= gInspectee.defaultView.innerWidth;
ok(!inViewport, "Element is not in viewport.");
yield nodeFront.scrollIntoView();
SimpleTest.executeSoon(() => {
rect = gInspectee.querySelector(id).getBoundingClientRect();
inViewport = rect.x >= 0 &&
rect.y >= 0 &&
rect.y <= gInspectee.defaultView.innerHeight &&
rect.x <= gInspectee.defaultView.innerWidth;
ok(inViewport, "Element is in viewport.");
runNextTest();
});
}));
addTest(function cleanup() {
delete gWalker;
delete gInspectee;
delete gClient;
runNextTest();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=901250">Mozilla Bug 901250</a>
<a id="inspectorContent" target="_blank" href="inspector-traversal-data.html">Test Document</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

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

@ -77,6 +77,11 @@ const ERR_BACKUP_DISCARD = "backup_discard: unable to remove";
const LOG_SVC_SUCCESSFUL_LAUNCH = "Process was started... waiting on result.";
// Typical end of a message when calling assert
const MSG_SHOULD_EQUAL = " should equal the expected value";
const MSG_SHOULD_EXIST = "the file or directory should exist";
const MSG_SHOULD_NOT_EXIST = "the file or directory should not exist";
// All we care about is that the last modified time has changed so that Mac OS
// X Launch Services invalidates its cache so the test allows up to one minute
// difference in the last modified time.
@ -757,8 +762,9 @@ function setupTestCommon() {
do_test_pending();
Assert.strictEqual(gTestID, undefined, "gTestID should be 'undefined' (" +
"setupTestCommon should only be called once)");
Assert.strictEqual(gTestID, undefined,
"gTestID should be 'undefined' (setupTestCommon should " +
"only be called once)");
let caller = Components.stack.caller;
gTestID = caller.filename.toString().split("/").pop().split(".")[0];
@ -775,7 +781,7 @@ function setupTestCommon() {
}
do_throw("The parallel run of this test failed. Failing non-parallel " +
"test so the log from the parallel run can be displayed in " +
"non-parallel log.")
"non-parallel log.");
} else {
gRealDump = dump;
dump = dumpOverride;
@ -1045,6 +1051,56 @@ function preventDistributionFiles() {
});
}
/**
* On Mac OS X this sets the last modified time for the app bundle directory to
* a date in the past to test that the last modified time is updated when an
* update has been successfully applied (bug 600098).
*/
function setAppBundleModTime() {
if (!IS_MACOSX) {
return;
}
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
/**
* On Mac OS X this checks that the last modified time for the app bundle
* directory has been updated when an update has been successfully applied
* (bug 600098).
*/
function checkAppBundleModTime() {
if (!IS_MACOSX) {
return;
}
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
Assert.ok(timeDiff < MAC_MAX_TIME_DIFFERENCE,
"the last modified time on the apply to directory should " +
"change after a successful update");
}
/**
* On Mac OS X and Windows this checks if the post update '.running' file exists
* to determine if the post update binary was launched.
*
* @param aShouldExist
* Whether the post update '.running' file should exist.
*/
function checkPostUpdateRunningFile(aShouldExist) {
if (!IS_WIN && !IS_MACOSX) {
return;
}
let postUpdateRunningFile = getPostUpdateFile(".running");
if (aShouldExist) {
Assert.ok(postUpdateRunningFile.exists(), MSG_SHOULD_EXIST);
} else {
Assert.ok(!postUpdateRunningFile.exists(), MSG_SHOULD_NOT_EXIST);
}
}
/**
* Initializes the most commonly used settings and creates an instance of the
@ -1086,7 +1142,7 @@ function getAppVersion() {
iniFile = gGREBinDirOrig.clone();
iniFile.append(FILE_APPLICATION_INI);
}
Assert.ok(iniFile.exists(), "the application.ini file should exist");
Assert.ok(iniFile.exists(), MSG_SHOULD_EXIST);
let iniParser = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
getService(Ci.nsIINIParserFactory).
createINIParser(iniFile);
@ -1171,7 +1227,7 @@ function getStageDirFile(aRelPath, aAllowNonexistent) {
}
}
if (!aAllowNonexistent) {
Assert.ok(file.exists(), file.path + " should exist");
Assert.ok(file.exists(), MSG_SHOULD_EXIST);
}
return file;
}
@ -1425,9 +1481,9 @@ function lockDirectory(aDir) {
file.QueryInterface(Ci.nsILocalFileWin);
file.fileAttributesWin |= file.WFA_READONLY;
file.fileAttributesWin &= ~file.WFA_READWRITE;
debugDump("testing the successful creation of the lock file");
do_check_true(file.exists());
do_check_false(file.isWritable());
Assert.ok(file.exists(), MSG_SHOULD_EXIST);
Assert.ok(!file.isWritable(),
"the lock file should not be writeable");
}
/**
* Helper function for unlocking a directory on Windows.
@ -1444,9 +1500,8 @@ function unlockDirectory(aDir) {
file.QueryInterface(Ci.nsILocalFileWin);
file.fileAttributesWin |= file.WFA_READWRITE;
file.fileAttributesWin &= ~file.WFA_READONLY;
debugDump("removing and testing the successful removal of the lock file");
file.remove(false);
do_check_false(file.exists());
Assert.ok(!file.exists(), MSG_SHOULD_NOT_EXIST);
}
/**
@ -1470,10 +1525,10 @@ function runUpdate(aExpectedExitValue, aExpectedStatus, aCallback) {
if (!updater.exists()) {
updater = getTestDirFile(FILE_UPDATER_BIN);
if (!updater.exists()) {
do_throw("Unable to find updater binary!");
do_throw("Unable to find the updater binary!");
}
}
Assert.ok(updater.exists(), "updater or updater.app should exist");
Assert.ok(updater.exists(), MSG_SHOULD_EXIST);
let updatesDir = getUpdatesPatchDir();
updater.copyToFollowingLinks(updatesDir, updater.leafName);
@ -1483,7 +1538,7 @@ function runUpdate(aExpectedExitValue, aExpectedStatus, aCallback) {
updateBin.append("Contents");
updateBin.append("MacOS");
updateBin.append("updater");
Assert.ok(updateBin.exists(), updateBin.path + " should exist");
Assert.ok(updateBin.exists(), MSG_SHOULD_EXIST);
}
let applyToDir = getApplyDirFile(null, true);
@ -1553,11 +1608,10 @@ function runUpdate(aExpectedExitValue, aExpectedStatus, aCallback) {
logTestInfo(aLine);
});
}
debugDump("testing updater binary process exitValue against expected " +
"exit value");
do_check_eq(process.exitValue, aExpectedExitValue);
debugDump("testing update status against expected status");
do_check_eq(status, aExpectedStatus);
Assert.equal(process.exitValue, aExpectedExitValue,
"the process exit value" + MSG_SHOULD_EQUAL);
Assert.equal(status, aExpectedStatus,
"the update status" + MSG_SHOULD_EQUAL);
if (aCallback !== null) {
if (typeof(aCallback) == typeof(Function)) {
@ -1597,7 +1651,7 @@ function shouldRunServiceTest(aFirstTest) {
let binDir = getGREBinDir();
let updaterBin = binDir.clone();
updaterBin.append(FILE_UPDATER_BIN);
Assert.ok(updaterBin.exists(), updaterBin.path + " should exist");
Assert.ok(updaterBin.exists(), MSG_SHOULD_EXIST);
let updaterBinPath = updaterBin.path;
if (/ /.test(updaterBinPath)) {
@ -1618,9 +1672,10 @@ function shouldRunServiceTest(aFirstTest) {
// in which case we should fail the test if the updater binary is signed so
// the build system can be fixed by adding the registry key.
if (IS_AUTHENTICODE_CHECK_ENABLED) {
Assert.ok(!isBinSigned, "the updater.exe binary should not be signed " +
"when the test registry key doesn't exist (if it is, build " +
"system configuration bug?)");
Assert.ok(!isBinSigned,
"the updater.exe binary should not be signed when the test " +
"registry key doesn't exist (if it is, build system " +
"configuration bug?)");
}
logTestInfo("this test can only run on the buildbot build system at this " +
@ -1634,7 +1689,6 @@ function shouldRunServiceTest(aFirstTest) {
let process = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
process.init(helperBin);
debugDump("checking if the service exists on this machine.");
process.run(true, args, args.length);
Assert.notEqual(process.exitValue, 0xEE, "the maintenance service should " +
"be installed (if not, build system configuration bug?)");
@ -1643,16 +1697,17 @@ function shouldRunServiceTest(aFirstTest) {
// service should be anything but stopped, so be strict here and fail the
// test.
if (aFirstTest) {
Assert.equal(process.exitValue, 0, "service should not be running for " +
"the first test");
Assert.equal(process.exitValue, 0,
"the service should not be running for the first test");
}
if (IS_AUTHENTICODE_CHECK_ENABLED) {
// The test registry key exists and IS_AUTHENTICODE_CHECK_ENABLED is true
// so the binaries should be signed. To run the test locally
// DISABLE_UPDATER_AUTHENTICODE_CHECK can be defined.
Assert.ok(isBinSigned, "the updater.exe binary should be signed (if not, " +
"build system configuration bug?)");
Assert.ok(isBinSigned,
"the updater.exe binary should be signed (if not, build system " +
"configuration bug?)");
}
// In case the machine is running an old maintenance service or if it
@ -1768,10 +1823,10 @@ function setupAppFiles() {
if (!updater.exists()) {
updater = getTestDirFile(FILE_UPDATER_BIN);
if (!updater.exists()) {
do_throw("Unable to find updater binary!");
do_throw("Unable to find the updater binary!");
}
}
let testBinDir = getGREBinDir()
let testBinDir = getGREBinDir();
updater.copyToFollowingLinks(testBinDir, updater.leafName);
debugDump("finish - copying or creating symlinks to application files " +
@ -1822,7 +1877,7 @@ function copyFileToTestAppDir(aFileRelPath, aInGreDir) {
fileRelPath = fileRelPath + ".app";
}
Assert.ok(srcFile.exists(), srcFile.path + " should exist");
Assert.ok(srcFile.exists(), MSG_SHOULD_EXIST);
// Symlink libraries. Note that the XUL library on Mac OS X doesn't have a
// file extension and shouldSymlink will always be false on Windows.
@ -1858,8 +1913,8 @@ function copyFileToTestAppDir(aFileRelPath, aInGreDir) {
process.init(ln);
let args = ["-s", srcFile.path, destFile.path];
process.run(true, args, args.length);
debugDump("verifying symlink. Path: " + destFile.path);
do_check_true(destFile.isSymlink());
Assert.ok(destFile.isSymlink(),
"the file should be a symlink");
} catch (e) {
do_throw("Unable to create symlink for file! Path: " + srcFile.path +
", Exception: " + e);
@ -1891,14 +1946,13 @@ function attemptServiceInstall() {
"directory path: " + maintSvcDir.path);
}
}
Assert.ok(!!maintSvcDir, "maintenance service install directory should " +
"exist");
Assert.ok(maintSvcDir.exists(), "maintenance service install directory " +
"should exist");
if (!maintSvcDir) {
do_throw("Unable to find the maintenance service install directory");
}
Assert.ok(maintSvcDir.exists(), MSG_SHOULD_EXIST);
let oldMaintSvcBin = maintSvcDir.clone();
oldMaintSvcBin.append(FILE_MAINTENANCE_SERVICE_BIN);
Assert.ok(oldMaintSvcBin.exists(), "maintenance service install directory " +
"binary should exist. Path: " + oldMaintSvcBin.path);
Assert.ok(oldMaintSvcBin.exists(), MSG_SHOULD_EXIST);
let buildMaintSvcBin = getGREBinDir();
buildMaintSvcBin.append(FILE_MAINTENANCE_SERVICE_BIN);
if (readFileBytes(oldMaintSvcBin) == readFileBytes(buildMaintSvcBin)) {
@ -1926,7 +1980,7 @@ function attemptServiceInstall() {
}
Assert.ok(false, "should be able copy the test maintenance service to " +
"the maintenance service directory (if not, build system " +
"configuration bug?). Path: " + maintSvcDir.path);
"configuration bug?), path: " + maintSvcDir.path);
}
return true;
@ -1947,9 +2001,12 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, aCheckSvcLog) {
// Check the service logs for a successful update
function checkServiceLogs(aOriginalContents) {
let contents = readServiceLogFile();
debugDump("the contents of maintenanceservice.log:\n" + contents + "\n");
do_check_neq(contents, aOriginalContents);
do_check_neq(contents.indexOf(LOG_SVC_SUCCESSFUL_LAUNCH), -1);
Assert.notEqual(contents, aOriginalContents,
"the contents of the maintenanceservice.log should not " +
"be the same as the original contents");
Assert.notEqual(contents.indexOf(LOG_SVC_SUCCESSFUL_LAUNCH), -1,
"the contents of the maintenanceservice.log should " +
"contain the successful launch string");
}
function readServiceLogFile() {
let file = Cc["@mozilla.org/file/directory_service;1"].
@ -1982,17 +2039,17 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, aCheckSvcLog) {
helperBinProcess.init(helperBin);
debugDump("stopping service...");
helperBinProcess.run(true, helperBinArgs, helperBinArgs.length);
Assert.notEqual(helperBinProcess.exitValue, 0xEE, "the maintenance " +
"service should exist");
Assert.notEqual(helperBinProcess.exitValue, 0xEE,
"the maintenance service should exist");
if (helperBinProcess.exitValue != 0) {
if (aFailTest) {
Assert.ok(false, "maintenance service should stop! Process " +
"exitValue: " + helperBinProcess.exitValue);
Assert.ok(false, "the maintenance service should stop, process exit " +
"value: " + helperBinProcess.exitValue);
}
logTestInfo("maintenance service did not stop which may cause test " +
"failures later. Process exitValue: " +
"failures later, process exit value: " +
helperBinProcess.exitValue);
} else {
debugDump("service stopped");
@ -2011,8 +2068,9 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, aCheckSvcLog) {
createInstance(Ci.nsIProcess);
helperBinProcess.init(helperBin);
helperBinProcess.run(true, helperBinArgs, helperBinArgs.length);
Assert.equal(helperBinProcess.exitValue, 0, "the process for " +
aApplication + " should stop");
Assert.equal(helperBinProcess.exitValue, 0,
"the process should have stopped, process name: " +
aApplication);
}
// Make sure the service from the previous test is already stopped.
@ -2047,7 +2105,8 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, aCheckSvcLog) {
writeStatusFile(aInitialStatus);
// sanity check
do_check_eq(readStatusState(), aInitialStatus);
Assert.equal(readStatusState(), aInitialStatus,
"the update status state" + MSG_SHOULD_EQUAL);
writeVersionFile(DEFAULT_UPDATE_VERSION);
@ -2067,9 +2126,9 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, aCheckSvcLog) {
let updater = getTestDirFile(FILE_UPDATER_BIN);
if (!updater.exists()) {
do_throw("Unable to find updater binary!");
do_throw("Unable to find the updater binary!");
}
let testBinDir = getGREBinDir()
let testBinDir = getGREBinDir();
updater.copyToFollowingLinks(testBinDir, updater.leafName);
updater.copyToFollowingLinks(updatesDir, updater.leafName);
@ -2129,8 +2188,8 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, aCheckSvcLog) {
logTestInfo(aLine);
});
}
debugDump("testing update status against expected status");
do_check_eq(status, aExpectedStatus);
Assert.equal(status, aExpectedStatus,
"the update status" + MSG_SHOULD_EQUAL);
if (aCheckSvcLog) {
checkServiceLogs(svcOriginalLog);
@ -2162,7 +2221,7 @@ function getLaunchBin() {
createInstance(Ci.nsILocalFile);
launchBin.initWithPath("/bin/sh");
}
Assert.ok(launchBin.exists(), launchBin.path + " should exist");
Assert.ok(launchBin.exists(), MSG_SHOULD_EXIST);
return launchBin;
}
@ -2289,8 +2348,8 @@ function setupUpdaterTest(aMarFile) {
writeFile(testFile, aTestFile.originalContents);
}
// Skip these tests on Windows and OS/2 since their
// implementaions of chmod doesn't really set permissions.
// Skip these tests on Windows since chmod doesn't really set permissions
// on Windows.
if (!IS_WIN && aTestFile.originalPerms) {
testFile.permissions = aTestFile.originalPerms;
// Store the actual permissions on the file for reference later after
@ -2490,10 +2549,9 @@ function checkUpdateLogContents(aCompareLogFile, aExcludeDistributionDir) {
// Don't write the contents of the file to the log to reduce log spam
// unless there is a failure.
if (compareLogContents == updateLogContents) {
debugDump("log contents are correct");
do_check_true(true);
Assert.ok(true, "the update log contents" + MSG_SHOULD_EQUAL);
} else {
logTestInfo("log contents are not correct");
logTestInfo("the update log contents are not correct");
let aryLog = updateLogContents.split("\n");
let aryCompare = compareLogContents.split("\n");
// Pushing an empty string to both arrays makes it so either array's length
@ -2503,13 +2561,15 @@ function checkUpdateLogContents(aCompareLogFile, aExcludeDistributionDir) {
// xpcshell tests won't display the entire contents so log the incorrect
// line.
for (let i = 0; i < aryLog.length; ++i) {
if (aryCompare[i] != aryLog[i]) {
logTestInfo("the first incorrect line in the log is: " + aryLog[i]);
do_check_eq(aryCompare[i], aryLog[i]);
if (aryLog[i] != aryCompare[i]) {
logTestInfo("the first incorrect line in the update log is: " +
aryLog[i]);
Assert.equal(aryLog[i], aryCompare[i],
"the update log contents" + MSG_SHOULD_EQUAL);
}
}
// This should never happen!
do_throw("Unable to find incorrect log contents!");
do_throw("Unable to find incorrect update log contents!");
}
}
@ -2523,13 +2583,9 @@ function checkUpdateLogContains(aCheckString) {
let updateLog = getUpdatesPatchDir();
updateLog.append(FILE_UPDATE_LOG);
let updateLogContents = readFileBytes(updateLog);
if (updateLogContents.indexOf(aCheckString) != -1) {
debugDump("log file does contain: " + aCheckString);
do_check_true(true);
} else {
logTestInfo("log file does not contain: " + aCheckString);
do_check_true(false);
}
Assert.notEqual(updateLogContents.indexOf(aCheckString), -1,
"the update log contents" + MSG_SHOULD_EQUAL + ", value: " +
aCheckString);
}
/**
@ -2554,21 +2610,15 @@ function checkFilesAfterUpdateSuccess(aGetFileFunc, aStageDirExists,
let testFile = aGetFileFunc(aTestFile.relPathDir + aTestFile.fileName, true);
debugDump("testing file: " + testFile.path);
if (aTestFile.compareFile || aTestFile.compareContents) {
do_check_true(testFile.exists());
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
// Skip these tests on Windows and OS/2 since their
// implementaions of chmod doesn't really set permissions.
// Skip these tests on Windows since chmod doesn't really set permissions
// on Windows.
if (!IS_WIN && aTestFile.comparePerms) {
// Check if the permssions as set in the complete mar file are correct.
let logPerms = "testing file permissions - ";
if (aTestFile.originalPerms) {
logPerms += "original permissions: " +
aTestFile.originalPerms.toString(8) + ", ";
}
debugDump("compare permissions : " +
aTestFile.comparePerms.toString(8) + ", " +
"updated permissions : " + testFile.permissions.toString(8));
do_check_eq(testFile.permissions & 0xfff, aTestFile.comparePerms & 0xfff);
Assert.equal(testFile.permissions & 0xfff,
aTestFile.comparePerms & 0xfff,
"the file permissions" + MSG_SHOULD_EQUAL);
}
let fileContents1 = readFileBytes(testFile);
@ -2578,14 +2628,13 @@ function checkFilesAfterUpdateSuccess(aGetFileFunc, aStageDirExists,
// Don't write the contents of the file to the log to reduce log spam
// unless there is a failure.
if (fileContents1 == fileContents2) {
debugDump("file contents are correct");
do_check_true(true);
Assert.ok(true, "the file contents" + MSG_SHOULD_EQUAL);
} else {
logTestInfo("file contents are not correct");
do_check_eq(fileContents1, fileContents2);
Assert.equal(fileContents1, fileContents2,
"the file contents" + MSG_SHOULD_EQUAL);
}
} else {
do_check_false(testFile.exists());
Assert.ok(!testFile.exists(), MSG_SHOULD_NOT_EXIST);
}
});
@ -2595,18 +2644,17 @@ function checkFilesAfterUpdateSuccess(aGetFileFunc, aStageDirExists,
let testDir = aGetFileFunc(aTestDir.relPathDir, true);
debugDump("testing directory: " + testDir.path);
if (aTestDir.dirRemoved) {
do_check_false(testDir.exists());
Assert.ok(!testDir.exists(), MSG_SHOULD_NOT_EXIST);
} else {
do_check_true(testDir.exists());
Assert.ok(testDir.exists(), MSG_SHOULD_EXIST);
if (aTestDir.files) {
aTestDir.files.forEach(function CFAUS_TD_F_FE(aTestFile) {
let testFile = aGetFileFunc(aTestDir.relPathDir + aTestFile, true);
debugDump("testing directory file: " + testFile.path);
if (aTestDir.filesRemoved) {
do_check_false(testFile.exists());
Assert.ok(!testFile.exists(), MSG_SHOULD_NOT_EXIST);
} else {
do_check_true(testFile.exists());
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
}
});
}
@ -2614,14 +2662,12 @@ function checkFilesAfterUpdateSuccess(aGetFileFunc, aStageDirExists,
if (aTestDir.subDirs) {
aTestDir.subDirs.forEach(function CFAUS_TD_SD_FE(aSubDir) {
let testSubDir = aGetFileFunc(aTestDir.relPathDir + aSubDir, true);
debugDump("testing sub-directory: " + testSubDir.path);
do_check_true(testSubDir.exists());
Assert.ok(testSubDir.exists(), MSG_SHOULD_EXIST);
if (aTestDir.subDirFiles) {
aTestDir.subDirFiles.forEach(function CFAUS_TD_SDF_FE(aTestFile) {
let testFile = aGetFileFunc(aTestDir.relPathDir +
aSubDir + aTestFile, true);
debugDump("testing sub-directory file: " + testFile.path);
do_check_true(testFile.exists());
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
});
}
});
@ -2655,21 +2701,15 @@ function checkFilesAfterUpdateFailure(aGetFileFunc, aStageDirExists,
let testFile = aGetFileFunc(aTestFile.relPathDir + aTestFile.fileName, true);
debugDump("testing file: " + testFile.path);
if (aTestFile.compareFile || aTestFile.compareContents) {
do_check_true(testFile.exists());
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
// Skip these tests on Windows and OS/2 since their
// implementaions of chmod doesn't really set permissions.
// Skip these tests on Windows since chmod doesn't really set permissions
// on Windows.
if (!IS_WIN && aTestFile.comparePerms) {
// Check the original permssions are retained on the file.
let logPerms = "testing file permissions - ";
if (aTestFile.originalPerms) {
logPerms += "original permissions: " +
aTestFile.originalPerms.toString(8) + ", ";
}
debugDump("compare permissions : " +
aTestFile.comparePerms.toString(8) + ", " +
"updated permissions : " + testFile.permissions.toString(8));
do_check_eq(testFile.permissions & 0xfff, aTestFile.comparePerms & 0xfff);
Assert.equal(testFile.permissions & 0xfff,
aTestFile.comparePerms & 0xfff,
"the file permissions" + MSG_SHOULD_EQUAL);
}
let fileContents1 = readFileBytes(testFile);
@ -2679,14 +2719,13 @@ function checkFilesAfterUpdateFailure(aGetFileFunc, aStageDirExists,
// Don't write the contents of the file to the log to reduce log spam
// unless there is a failure.
if (fileContents1 == fileContents2) {
debugDump("file contents are correct");
do_check_true(true);
Assert.ok(true, "the file contents" + MSG_SHOULD_EQUAL);
} else {
logTestInfo("file contents are not correct");
do_check_eq(fileContents1, fileContents2);
Assert.equal(fileContents1, fileContents2,
"the file contents" + MSG_SHOULD_EQUAL);
}
} else {
do_check_false(testFile.exists());
Assert.ok(!testFile.exists(), MSG_SHOULD_NOT_EXIST);
}
});
@ -2694,28 +2733,24 @@ function checkFilesAfterUpdateFailure(aGetFileFunc, aStageDirExists,
"performed after a failed update");
gTestDirs.forEach(function CFAUF_TD_FE(aTestDir) {
let testDir = aGetFileFunc(aTestDir.relPathDir, true);
debugDump("testing directory: " + testDir.path);
do_check_true(testDir.exists());
Assert.ok(testDir.exists(), MSG_SHOULD_EXIST);
if (aTestDir.files) {
aTestDir.files.forEach(function CFAUS_TD_F_FE(aTestFile) {
let testFile = aGetFileFunc(aTestDir.relPathDir + aTestFile, true);
debugDump("testing directory file: " + testFile.path);
do_check_true(testFile.exists());
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
});
}
if (aTestDir.subDirs) {
aTestDir.subDirs.forEach(function CFAUS_TD_SD_FE(aSubDir) {
let testSubDir = aGetFileFunc(aTestDir.relPathDir + aSubDir, true);
debugDump("testing sub-directory: " + testSubDir.path);
do_check_true(testSubDir.exists());
Assert.ok(testSubDir.exists(), MSG_SHOULD_EXIST);
if (aTestDir.subDirFiles) {
aTestDir.subDirFiles.forEach(function CFAUS_TD_SDF_FE(aTestFile) {
let testFile = aGetFileFunc(aTestDir.relPathDir +
aSubDir + aTestFile, true);
debugDump("testing sub-directory file: " + testFile.path);
do_check_true(testFile.exists());
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
});
}
});
@ -2744,31 +2779,28 @@ function checkFilesAfterUpdateFailure(aGetFileFunc, aStageDirExists,
function checkFilesAfterUpdateCommon(aGetFileFunc, aStageDirExists,
aToBeDeletedDirExists) {
debugDump("testing extra directories");
let stageDir = getStageDirFile(null, true);
debugDump("testing directory should " +
(aStageDirExists ? "" : "not ") +
"exist: " + stageDir.path);
do_check_eq(stageDir.exists(), aStageDirExists);
if (aStageDirExists) {
Assert.ok(stageDir.exists(), MSG_SHOULD_EXIST);
} else {
Assert.ok(!stageDir.exists(), MSG_SHOULD_NOT_EXIST);
}
let toBeDeletedDirExists = IS_WIN ? aToBeDeletedDirExists : false;
let toBeDeletedDir = getApplyDirFile(DIR_TOBEDELETED, true);
debugDump("testing directory should " +
(toBeDeletedDirExists ? "" : "not ") +
"exist: " + toBeDeletedDir.path);
do_check_eq(toBeDeletedDir.exists(), toBeDeletedDirExists);
if (toBeDeletedDirExists) {
Assert.ok(toBeDeletedDir.exists(), MSG_SHOULD_EXIST);
} else {
Assert.ok(!toBeDeletedDir.exists(), MSG_SHOULD_NOT_EXIST);
}
debugDump("testing updating directory doesn't exist in the application " +
"directory");
let updatingDir = getApplyDirFile("updating", true);
do_check_false(updatingDir.exists());
Assert.ok(!updatingDir.exists(), MSG_SHOULD_NOT_EXIST);
if (stageDir.exists()) {
debugDump("testing updating directory doesn't exist in the staging " +
"directory");
updatingDir = stageDir.clone();
updatingDir.append("updating");
do_check_false(updatingDir.exists());
Assert.ok(!updatingDir.exists(), MSG_SHOULD_NOT_EXIST);
}
debugDump("testing backup files should not be left behind in the " +
@ -2788,7 +2820,8 @@ function checkFilesAfterUpdateCommon(aGetFileFunc, aStageDirExists,
let entries = updatesDir.QueryInterface(Ci.nsIFile).directoryEntries;
while (entries.hasMoreElements()) {
let entry = entries.getNext().QueryInterface(Ci.nsIFile);
do_check_neq(getFileExtension(entry), "patch");
Assert.notEqual(getFileExtension(entry), "patch",
"the file's extension should not equal patch");
}
}
@ -2809,19 +2842,35 @@ function checkCallbackAppLog() {
// It is possible for the log file contents check to occur before the log file
// contents are completely written so wait until the contents are the expected
// value. If the contents are never the expected value then the test will
// fail by timing out.
// fail by timing out after gTimeoutRuns is greater than MAX_TIMEOUT_RUNS or
// the test harness times out the test.
if (logContents != expectedLogContents) {
gTimeoutRuns++;
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
logTestInfo("callback log contents are not correct");
let aryLog = logContents.split("\n");
let aryCompare = expectedLogContents.split("\n");
// Pushing an empty string to both arrays makes it so either array's length
// can be used in the for loop below without going out of bounds.
aryLog.push("");
aryCompare.push("");
// xpcshell tests won't display the entire contents so log the incorrect
// line.
for (let i = 0; i < aryLog.length; ++i) {
if (aryLog[i] != aryCompare[i]) {
logTestInfo("the first incorrect line in the callback log is: " +
aryLog[i]);
Assert.equal(aryLog[i], aryCompare[i],
"the callback log contents" + MSG_SHOULD_EQUAL);
}
}
// This should never happen!
do_throw("Unable to find incorrect callback log contents!");
}
do_timeout(TEST_HELPER_TIMEOUT, checkCallbackAppLog);
return;
}
if (logContents == expectedLogContents) {
debugDump("callback log file contents are correct");
do_check_true(true);
} else {
debugDump("callback log file contents are not correct");
do_check_eq(logContents, expectedLogContents);
}
Assert.ok(true, "the callback log contents" + MSG_SHOULD_EQUAL);
waitForFilesInUse();
}
@ -2860,7 +2909,8 @@ function checkPostUpdateAppLog() {
// It is possible for the log file contents check to occur before the log file
// contents are completely written so wait until the contents are the expected
// value. If the contents are never the expected value then the test will
// fail by timing out.
// fail by timing out after gTimeoutRuns is greater than MAX_TIMEOUT_RUNS or
// the test harness times out the test.
if (logContents != "post-update\n") {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the post update " +
@ -2870,9 +2920,7 @@ function checkPostUpdateAppLog() {
do_timeout(TEST_HELPER_TIMEOUT, checkPostUpdateAppLog);
return;
}
debugDump("post update app log file contents are correct");
do_check_true(true);
Assert.ok(true, "the post update log contents" + MSG_SHOULD_EQUAL);
gCheckFunc();
}
@ -2883,7 +2931,8 @@ function checkPostUpdateAppLog() {
* the callback application.
*/
function checkCallbackServiceLog() {
do_check_neq(gServiceLaunchedCallbackLog, null);
Assert.ok(!!gServiceLaunchedCallbackLog,
"gServiceLaunchedCallbackLog should be defined");
let expectedLogContents = gServiceLaunchedCallbackArgs.join("\n") + "\n";
let logFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
@ -2892,16 +2941,35 @@ function checkCallbackServiceLog() {
// It is possible for the log file contents check to occur before the log file
// contents are completely written so wait until the contents are the expected
// value. If the contents are never the expected value then the test will
// fail by timing out.
// fail by timing out after gTimeoutRuns is greater than MAX_TIMEOUT_RUNS or
// the test harness times out the test.
if (logContents != expectedLogContents) {
debugDump("callback service log not expected value, waiting longer");
gTimeoutRuns++;
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
logTestInfo("callback service log contents are not correct");
let aryLog = logContents.split("\n");
let aryCompare = expectedLogContents.split("\n");
// Pushing an empty string to both arrays makes it so either array's length
// can be used in the for loop below without going out of bounds.
aryLog.push("");
aryCompare.push("");
// xpcshell tests won't display the entire contents so log the incorrect
// line.
for (let i = 0; i < aryLog.length; ++i) {
if (aryLog[i] != aryCompare[i]) {
logTestInfo("the first incorrect line in the service callback log " +
"is: " + aryLog[i]);
Assert.equal(aryLog[i], aryCompare[i],
"the service callback log contents" + MSG_SHOULD_EQUAL);
}
}
// This should never happen!
do_throw("Unable to find incorrect service callback log contents!");
}
do_timeout(TEST_HELPER_TIMEOUT, checkCallbackServiceLog);
return;
}
debugDump("testing that the callback application successfully launched " +
"and the expected command line arguments were passed to it");
do_check_eq(logContents, expectedLogContents);
Assert.ok(true, "the callback service log contents" + MSG_SHOULD_EQUAL);
waitForFilesInUse();
}
@ -2961,7 +3029,8 @@ function waitForFilesInUse() {
* An nsIFile to check if it has moz-backup for its extension.
*/
function checkForBackupFiles(aFile) {
do_check_neq(getFileExtension(aFile), "moz-backup");
Assert.notEqual(getFileExtension(aFile), "moz-backup",
"the file's extension should not equal moz-backup");
}
/**
@ -3195,7 +3264,7 @@ function start_httpserver() {
* The callback to call after stopping the http server.
*/
function stop_httpserver(aCallback) {
do_check_true(!!aCallback);
Assert.ok(!!aCallback, "the aCallback parameter should be defined");
gTestserver.stop(aCallback);
}
@ -3464,10 +3533,11 @@ const gProcessObserver = {
gAppTimer.cancel();
gAppTimer = null;
}
Assert.equal(gProcess.exitValue, 0, "the exitValue for the application " +
"process should be '0'");
Assert.equal(aTopic, "process-finished", "the application process " +
"observer topic should be 'process-finished'");
Assert.equal(gProcess.exitValue, 0,
"the application process exit value should be 0");
Assert.equal(aTopic, "process-finished",
"the application process observer topic should be " +
"process-finished");
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
@ -3480,10 +3550,10 @@ const gTimerCallback = {
notify: function TC_notify(aTimer) {
gAppTimer = null;
if (gProcess.isRunning) {
logTestInfo("attempt to kill process");
logTestInfo("attempting to kill process");
gProcess.kill();
}
Assert.ok(false, "Launch application timer expired")
Assert.ok(false, "launch application timer expired");
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};

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

@ -11,9 +11,9 @@ function run_test() {
let testFile = getCurrentProcessDir();
testFile.append("update_write_access_test");
testFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_FILE);
do_check_true(testFile.exists());
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
testFile.remove(false);
do_check_false(testFile.exists());
Assert.ok(!testFile.exists(), MSG_SHOULD_NOT_EXIST);
standardInit();
@ -21,32 +21,26 @@ function run_test() {
// Create a mutex to prevent being able to check for or apply updates.
debugDump("attempting to create mutex");
let handle = createMutex(getPerInstallationMutexName());
debugDump("testing that the mutex was successfully created");
do_check_true(!!handle);
Assert.ok(!!handle, "the update mutex should have been created");
// Check if available updates cannot be checked for when there is a mutex
// for this installation.
debugDump("testing nsIApplicationUpdateService:canCheckForUpdates is " +
"false when there is a mutex");
do_check_false(gAUS.canCheckForUpdates);
Assert.ok(!gAUS.canCheckForUpdates, "should not be able to check for " +
"updates when there is an update mutex");
// Check if updates cannot be applied when there is a mutex for this
// installation.
debugDump("testing nsIApplicationUpdateService:canApplyUpdates is " +
"false when there is a mutex");
do_check_false(gAUS.canApplyUpdates);
Assert.ok(!gAUS.canApplyUpdates, "should not be able to apply updates " +
"when there is an update mutex");
debugDump("destroying mutex");
closeHandle(handle)
closeHandle(handle);
}
// Check if available updates can be checked for
debugDump("testing nsIApplicationUpdateService:canCheckForUpdates is true");
do_check_true(gAUS.canCheckForUpdates);
Assert.ok(gAUS.canCheckForUpdates, "should be able to check for updates");
// Check if updates can be applied
debugDump("testing nsIApplicationUpdateService:canApplyUpdates is true");
do_check_true(gAUS.canApplyUpdates);
Assert.ok(gAUS.canApplyUpdates, "should be able to apply updates");
if (IS_WIN) {
// Attempt to create a mutex when application update has already created one
@ -54,8 +48,8 @@ function run_test() {
debugDump("attempting to create mutex");
let handle = createMutex(getPerInstallationMutexName());
debugDump("testing that the mutex was not successfully created");
do_check_eq(handle, null);
Assert.ok(!handle, "should not be able to create the update mutex when " +
"the application has created the update mutex");
}
doTestFinish();

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

@ -28,16 +28,19 @@ function run_test() {
standardInit();
do_check_eq(gUpdateManager.updateCount, 1);
Assert.equal(gUpdateManager.updateCount, 1,
"the update manager update count" + MSG_SHOULD_EQUAL);
let update = gUpdateManager.getUpdateAt(0);
do_check_eq(update.name, "Existing");
Assert.equal(update.name, "Existing",
"the update's name" + MSG_SHOULD_EQUAL);
do_check_eq(gUpdateManager.activeUpdate, null);
Assert.ok(!gUpdateManager.activeUpdate,
"there should not be an active update");
// Verify that the active-update.xml file has had the update from the old
// channel removed.
let file = getUpdatesXMLFile(true);
debugDump("verifying contents of " + FILE_UPDATE_ACTIVE);
do_check_eq(readFile(file), getLocalUpdatesXMLString(""));
Assert.equal(readFile(file), getLocalUpdatesXMLString(""),
"the contents of active-update.xml" + MSG_SHOULD_EQUAL);
doTestFinish();
}

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

@ -24,11 +24,14 @@ function run_test() {
// Gonk doesn't resume downloads at boot time, so the update
// will remain active until the user chooses a new one, at
// which point, the old update will be removed.
do_check_neq(gUpdateManager.activeUpdate, null);
Assert.ok(!!gUpdateManager.activeUpdate,
"there should be an active update");
} else {
do_check_eq(gUpdateManager.activeUpdate, null);
Assert.ok(!gUpdateManager.activeUpdate,
"there should not be an active update");
}
do_check_eq(gUpdateManager.updateCount, 0);
Assert.equal(gUpdateManager.updateCount, 0,
"the update manager update count" + MSG_SHOULD_EQUAL);
doTestFinish();
}

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

@ -25,11 +25,14 @@ function run_test() {
// Gonk doesn't resume downloads at boot time, so the update
// will remain active until the user chooses a new one, at
// which point, the old update will be removed.
do_check_neq(gUpdateManager.activeUpdate, null);
Assert.ok(!!gUpdateManager.activeUpdate,
"there should be an active update");
} else {
do_check_eq(gUpdateManager.activeUpdate, null);
Assert.ok(!gUpdateManager.activeUpdate,
"there should not be an active update");
}
do_check_eq(gUpdateManager.updateCount, 0);
Assert.equal(gUpdateManager.updateCount, 0,
"the update manager update count" + MSG_SHOULD_EQUAL);
doTestFinish();
}

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

@ -19,19 +19,17 @@ function run_test() {
standardInit();
let dir = getUpdatesDir();
dir.append("0");
debugDump("testing " + dir.path + " should exist");
do_check_true(dir.exists());
dir.append(DIR_PATCH);
Assert.ok(dir.exists(), MSG_SHOULD_EXIST);
let statusFile = dir.clone();
statusFile.append(FILE_UPDATE_STATUS);
debugDump("testing " + statusFile.path + " should not exist");
do_check_false(statusFile.exists());
Assert.ok(!statusFile.exists(), MSG_SHOULD_NOT_EXIST);
debugDump("testing activeUpdate == null");
do_check_eq(gUpdateManager.activeUpdate, null);
debugDump("testing updateCount == 0");
do_check_eq(gUpdateManager.updateCount, 0);
Assert.ok(!gUpdateManager.activeUpdate,
"there should not be an active update");
Assert.equal(gUpdateManager.updateCount, 0,
"the update manager update count" + MSG_SHOULD_EQUAL);
doTestFinish();
}

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

@ -20,20 +20,18 @@ function run_test() {
// Check that there is no activeUpdate first so the updates directory is
// cleaned up by the UpdateManager before the remaining tests.
debugDump("testing activeUpdate == null");
do_check_eq(gUpdateManager.activeUpdate, null);
debugDump("testing updateCount == 0");
do_check_eq(gUpdateManager.updateCount, 0);
Assert.ok(!gUpdateManager.activeUpdate,
"there should not be an active update");
Assert.equal(gUpdateManager.updateCount, 0,
"the update manager update count" + MSG_SHOULD_EQUAL);
let dir = getUpdatesDir();
dir.append("0");
debugDump("testing " + dir.path + " should exist");
do_check_true(dir.exists());
dir.append(DIR_PATCH);
Assert.ok(dir.exists(), MSG_SHOULD_EXIST);
let versionFile = dir.clone();
versionFile.append(FILE_UPDATE_VERSION);
debugDump("testing " + versionFile.path + " should not exist");
do_check_false(versionFile.exists());
Assert.ok(!versionFile.exists(), MSG_SHOULD_NOT_EXIST);
doTestFinish();
}

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

@ -17,31 +17,26 @@ function run_test() {
let dir = getUpdatesDir();
let log = dir.clone();
log.append("0");
log.append(DIR_PATCH);
log.append(FILE_UPDATE_LOG);
writeFile(log, "Last Update Log");
standardInit();
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = dir.clone();
log.append(FILE_LAST_LOG);
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
debugDump("testing " + log.path + " contents");
do_check_eq(readFile(log), "Last Update Log");
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
Assert.equal(readFile(log), "Last Update Log",
"the last update log contents" + MSG_SHOULD_EQUAL);
log = dir.clone();
log.append(FILE_BACKUP_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
dir.append("0");
debugDump("testing " + dir.path + " should exist (bug 512994)");
do_check_true(dir.exists());
dir.append(DIR_PATCH);
Assert.ok(dir.exists(), MSG_SHOULD_EXIST);
doTestFinish();
}

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

@ -25,34 +25,28 @@ function run_test() {
writeFile(log, "To Be Deleted Backup Update Log");
log = dir.clone();
log.append("0");
log.append(DIR_PATCH);
log.append(FILE_UPDATE_LOG);
writeFile(log, "Last Update Log");
standardInit();
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = dir.clone();
log.append(FILE_LAST_LOG);
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
debugDump("testing " + log.path + " contents");
do_check_eq(readFile(log), "Last Update Log");
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
Assert.equal(readFile(log), "Last Update Log",
"the last update log contents" + MSG_SHOULD_EQUAL);
log = dir.clone();
log.append(FILE_BACKUP_LOG);
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
Assert.equal(readFile(log), "Backup Update Log",
"the backup update log contents" + MSG_SHOULD_EQUAL);
debugDump("testing " + log.path + " contents (bug 470979)");
do_check_eq(readFile(log), "Backup Update Log");
dir.append("0");
debugDump("testing " + dir.path + " should exist (bug 512994)");
do_check_true(dir.exists());
dir.append(DIR_PATCH);
Assert.ok(dir.exists(), MSG_SHOULD_EXIST);
doTestFinish();
}

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

@ -60,7 +60,8 @@ function run_test_helper_pt1(aMsg, aExpectedStatusResult, aNextRunFunc) {
}
function check_test_helper_pt1_1() {
do_check_eq(gUpdateCount, 1);
Assert.equal(gUpdateCount, 1,
"the update count" + MSG_SHOULD_EQUAL);
gCheckFunc = check_test_helper_pt1_2;
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
let state = gAUS.downloadUpdate(bestUpdate, false);
@ -71,7 +72,8 @@ function check_test_helper_pt1_1() {
}
function check_test_helper_pt1_2() {
do_check_eq(gStatusResult, gExpectedStatusResult);
Assert.equal(gStatusResult, gExpectedStatusResult,
"the download status result" + MSG_SHOULD_EQUAL);
gAUS.removeDownloadListener(downloadListener);
gNextRunFunc();
}
@ -91,7 +93,8 @@ function run_test_helper_bug828858_pt1(aMsg, aExpectedStatusResult, aNextRunFunc
}
function check_test_helper_bug828858_pt1_1() {
do_check_eq(gUpdateCount, 1);
Assert.equal(gUpdateCount, 1,
"the update count" + MSG_SHOULD_EQUAL);
gCheckFunc = check_test_helper_bug828858_pt1_2;
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
let state = gAUS.downloadUpdate(bestUpdate, false);
@ -103,9 +106,11 @@ function check_test_helper_bug828858_pt1_1() {
function check_test_helper_bug828858_pt1_2() {
if (gStatusResult == Cr.NS_ERROR_CONTENT_CORRUPTED) {
do_check_eq(gStatusResult, Cr.NS_ERROR_CONTENT_CORRUPTED);
Assert.ok(true,
"the status result should equal NS_ERROR_CONTENT_CORRUPTED");
} else {
do_check_eq(gStatusResult, gExpectedStatusResult);
Assert.equal(gStatusResult, gExpectedStatusResult,
"the download status result" + MSG_SHOULD_EQUAL);
}
gAUS.removeDownloadListener(downloadListener);
gNextRunFunc();

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

@ -43,16 +43,19 @@ function run_test() {
}
const WindowWatcher = {
getNewPrompter: function(aParent) {
do_check_eq(aParent, null);
getNewPrompter: function WW_getNewPrompter(aParent) {
Assert.ok(!aParent,
"the aParent parameter should not be defined");
return {
alert: function(aTitle, aText) {
alert: function WW_GNP_alert(aTitle, aText) {
let title = getString("updaterIOErrorTitle");
do_check_eq(aTitle, title);
Assert.equal(aTitle, title,
"the ui string for title" + MSG_SHOULD_EQUAL);
let text = gUpdateBundle.formatStringFromName("updaterIOErrorMsg",
[Services.appinfo.name,
Services.appinfo.name], 2);
do_check_eq(aText, text);
Assert.equal(aText, text,
"the ui string for message" + MSG_SHOULD_EQUAL);
doTestFinish();
}

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

@ -70,14 +70,18 @@ function run_test_pt1() {
}
function check_test_pt1() {
do_check_eq(gUpdateCount, 1);
Assert.equal(gUpdateCount, 1,
"the update count" + MSG_SHOULD_EQUAL);
gActiveUpdate = gUpdates[0];
do_check_neq(gActiveUpdate, null);
Assert.ok(!!gActiveUpdate,
"there should be an active update");
let state = gAUS.downloadUpdate(gActiveUpdate, true);
do_check_eq(state, "null");
do_check_eq(gActiveUpdate.errorCode >>> 0 , Cr.NS_ERROR_FILE_TOO_BIG);
Assert.equal(state, STATE_NONE,
"the update state" + MSG_SHOULD_EQUAL);
Assert.equal(gActiveUpdate.errorCode >>> 0 , Cr.NS_ERROR_FILE_TOO_BIG,
"the update error code" + MSG_SHOULD_EQUAL);
doTestFinish();
}
@ -94,7 +98,7 @@ function end_test() {
function FakeDirProvider() {}
FakeDirProvider.prototype = {
getFile: function(prop, persistent) {
getFile: function FP_getFile(prop, persistent) {
if (prop == KEY_UPDATE_ARCHIVE_DIR) {
if (gActiveUpdate) {
gActiveUpdate.errorCode = Cr.NS_ERROR_FILE_TOO_BIG;

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

@ -35,8 +35,10 @@ function xhr_pt1(aXHR) {
}
function check_test_pt1(request, update) {
do_check_eq(gStatusCode, Cr.NS_ERROR_OFFLINE);
do_check_eq(update.errorCode, NETWORK_ERROR_OFFLINE);
Assert.equal(gStatusCode, Cr.NS_ERROR_OFFLINE,
"the download status code" + MSG_SHOULD_EQUAL);
Assert.equal(update.errorCode, NETWORK_ERROR_OFFLINE,
"the update error code" + MSG_SHOULD_EQUAL);
// Forward the error to AUS, which should register the online observer
gAUS.onError(request, update);
@ -70,8 +72,9 @@ function xhr_pt2(aXHR) {
function check_test_pt2(update) {
// We just verify that there are updates to know the check succeeded.
do_check_neq(update, null);
do_check_eq(update.name, "App Update Test");
Assert.ok(!!update, "there should be an update");
Assert.equal(update.name, "App Update Test",
"the update name" + MSG_SHOULD_EQUAL);
doTestFinish();
}

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

@ -65,7 +65,8 @@ function run_test_helper_pt1(aMsg, aExpectedStatusResult, aNextRunFunc) {
}
function check_test_helper_pt1_1() {
do_check_eq(gUpdateCount, 1);
Assert.equal(gUpdateCount, 1,
"the update count" + MSG_SHOULD_EQUAL);
gCheckFunc = check_test_helper_pt1_2;
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
let state = gAUS.downloadUpdate(bestUpdate, false);
@ -76,7 +77,8 @@ function check_test_helper_pt1_1() {
}
function check_test_helper_pt1_2() {
do_check_eq(gStatusResult, gExpectedStatusResult);
Assert.equal(gStatusResult, gExpectedStatusResult,
"the download status result" + MSG_SHOULD_EQUAL);
gAUS.removeDownloadListener(downloadListener);
gNextRunFunc();
}

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

@ -22,11 +22,15 @@ function run_test() {
if (IS_TOOLKIT_GONK) {
// GONK doesn't resume downloads at boot time, so the updateCount will
// always be zero.
do_check_eq(gUpdateManager.updateCount, 0);
Assert.equal(gUpdateManager.updateCount, 0,
"the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
} else {
do_check_eq(gUpdateManager.updateCount, 1);
Assert.equal(gUpdateManager.updateCount, 1,
"the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
}
do_check_eq(gUpdateManager.activeUpdate.state, STATE_DOWNLOADING);
Assert.equal(gUpdateManager.activeUpdate.state, STATE_DOWNLOADING,
"the update manager activeUpdate state attribute" +
MSG_SHOULD_EQUAL);
// Pause the download and reload the Update Manager with an empty update so
// the Application Update Service doesn't write the update xml files during

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

@ -31,7 +31,8 @@ function run_test_helper_pt1(aMsg, aExpectedCount, aNextRunFunc) {
}
function check_test_helper_pt1() {
do_check_eq(gUpdateCount, gExpectedCount);
Assert.equal(gUpdateCount, gExpectedCount,
"the update count" + MSG_SHOULD_EQUAL);
gNextRunFunc();
}
@ -100,60 +101,100 @@ function check_test_pt02() {
// defaultDetailsURL = "";
// }
do_check_eq(gUpdateCount, 1);
Assert.equal(gUpdateCount, 1,
"the update count" + MSG_SHOULD_EQUAL);
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount).QueryInterface(Ci.nsIPropertyBag);
do_check_eq(bestUpdate.type, "minor");
do_check_eq(bestUpdate.name, "Minor Test");
do_check_eq(bestUpdate.displayVersion, "version 2.1a1pre");
do_check_eq(bestUpdate.appVersion, "2.1a1pre");
do_check_eq(bestUpdate.platformVersion, "3.1a1pre");
do_check_eq(bestUpdate.buildID, "20080811053724");
do_check_eq(bestUpdate.detailsURL, "http://details/");
do_check_eq(bestUpdate.billboardURL, "http://billboard/");
do_check_eq(bestUpdate.licenseURL, "http://license/");
do_check_true(bestUpdate.showPrompt);
do_check_true(bestUpdate.showNeverForVersion);
do_check_eq(bestUpdate.promptWaitTime, "345600");
do_check_eq(bestUpdate.serviceURL, URL_HOST + "/update.xml?force=1");
do_check_eq(bestUpdate.channel, "test_channel");
do_check_false(bestUpdate.isCompleteUpdate);
do_check_false(bestUpdate.isSecurityUpdate);
Assert.equal(bestUpdate.type, "minor",
"the update type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.name, "Minor Test",
"the update name attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.displayVersion, "version 2.1a1pre",
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.appVersion, "2.1a1pre",
"the update appVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.platformVersion, "3.1a1pre",
"the update platformVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.buildID, "20080811053724",
"the update buildID attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.detailsURL, "http://details/",
"the update detailsURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.billboardURL, "http://billboard/",
"the update billboardURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.licenseURL, "http://license/",
"the update licenseURL attribute" + MSG_SHOULD_EQUAL);
Assert.ok(bestUpdate.showPrompt,
"the update showPrompt attribute" + MSG_SHOULD_EQUAL);
Assert.ok(bestUpdate.showNeverForVersion,
"the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.promptWaitTime, "345600",
"the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.serviceURL, URL_HOST + "/update.xml?force=1",
"the update serviceURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.channel, "test_channel",
"the update channel attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!bestUpdate.isCompleteUpdate,
"the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!bestUpdate.isSecurityUpdate,
"the update isSecurityUpdate attribute" + MSG_SHOULD_EQUAL);
// Check that installDate is within 10 seconds of the current date.
do_check_true((Date.now() - bestUpdate.installDate) < 10000);
do_check_eq(bestUpdate.statusText, null);
Assert.ok((Date.now() - bestUpdate.installDate) < 10000,
"the update installDate attribute should be within 10 seconds of " +
"the current time");
Assert.ok(!bestUpdate.statusText,
"the update statusText attribute" + MSG_SHOULD_EQUAL);
// nsIUpdate:state returns an empty string when no action has been performed
// on an available update
do_check_eq(bestUpdate.state, "");
do_check_eq(bestUpdate.errorCode, 0);
do_check_eq(bestUpdate.patchCount, 2);
Assert.equal(bestUpdate.state, "",
"the update state attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.errorCode, 0,
"the update errorCode attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.patchCount, 2,
"the update patchCount attribute" + MSG_SHOULD_EQUAL);
//XXX TODO - test nsIUpdate:serialize
do_check_eq(bestUpdate.getProperty("custom1_attr"), "custom1 value");
do_check_eq(bestUpdate.getProperty("custom2_attr"), "custom2 value");
Assert.equal(bestUpdate.getProperty("custom1_attr"), "custom1 value",
"the update custom1_attr property" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.getProperty("custom2_attr"), "custom2 value",
"the update custom2_attr property" + MSG_SHOULD_EQUAL);
let patch = bestUpdate.getPatchAt(0);
do_check_eq(patch.type, "complete");
do_check_eq(patch.URL, "http://complete/");
do_check_eq(patch.hashFunction, "SHA1");
do_check_eq(patch.hashValue, "98db9dad8e1d80eda7e1170d0187d6f53e477059");
do_check_eq(patch.size, 9856459);
Assert.equal(patch.type, "complete",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.URL, "http://complete/",
"the update patch URL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashFunction, "SHA1",
"the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashValue, "98db9dad8e1d80eda7e1170d0187d6f53e477059",
"the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.size, 9856459,
"the update patch size attribute" + MSG_SHOULD_EQUAL);
// The value for patch.state can be the string 'null' as a valid value. This
// is confusing if it returns null which is an invalid value since the test
// failure output will show a failure for null == null. To lessen the
// confusion first check that the typeof for patch.state is string.
do_check_eq(typeof(patch.state), "string");
do_check_eq(patch.state, STATE_NONE);
do_check_false(patch.selected);
Assert.equal(typeof(patch.state), "string",
"the update patch state typeof value should equal |string|");
Assert.equal(patch.state, STATE_NONE,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!patch.selected,
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
//XXX TODO - test nsIUpdatePatch:serialize
patch = bestUpdate.getPatchAt(1);
do_check_eq(patch.type, "partial");
do_check_eq(patch.URL, "http://partial/");
do_check_eq(patch.hashFunction, "SHA1");
do_check_eq(patch.hashValue, "e6678ca40ae7582316acdeddf3c133c9c8577de4");
do_check_eq(patch.size, 1316138);
do_check_eq(patch.state, STATE_NONE);
do_check_false(patch.selected);
Assert.equal(patch.type, "partial",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.URL, "http://partial/",
"the update patch URL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashFunction, "SHA1",
"the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashValue, "e6678ca40ae7582316acdeddf3c133c9c8577de4",
"the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.size, 1316138,
"the update patch size attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.state, STATE_NONE,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!patch.selected,
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
//XXX TODO - test nsIUpdatePatch:serialize
run_test_pt03();
@ -180,47 +221,78 @@ function run_test_pt03() {
}
function check_test_pt03() {
do_check_eq(gUpdateCount, 1);
Assert.equal(gUpdateCount, 1,
"the update count" + MSG_SHOULD_EQUAL);
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
do_check_eq(bestUpdate.type, "major");
do_check_eq(bestUpdate.name, "Major Test");
do_check_eq(bestUpdate.displayVersion, "version 4.1a1pre");
do_check_eq(bestUpdate.appVersion, "4.1a1pre");
do_check_eq(bestUpdate.platformVersion, "5.1a1pre");
do_check_eq(bestUpdate.buildID, "20080811053724");
do_check_eq(bestUpdate.detailsURL, "http://details/");
do_check_eq(bestUpdate.billboardURL, "http://details/");
do_check_eq(bestUpdate.licenseURL, null);
do_check_true(bestUpdate.showPrompt);
do_check_true(bestUpdate.showNeverForVersion);
do_check_eq(bestUpdate.promptWaitTime, "691200");
do_check_eq(bestUpdate.serviceURL, URL_HOST + "/update.xml?force=1");
do_check_eq(bestUpdate.channel, "test_channel");
do_check_false(bestUpdate.isCompleteUpdate);
do_check_false(bestUpdate.isSecurityUpdate);
Assert.equal(bestUpdate.type, "major",
"the update type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.name, "Major Test",
"the update name attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.displayVersion, "version 4.1a1pre",
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.appVersion, "4.1a1pre",
"the update appVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.platformVersion, "5.1a1pre",
"the update platformVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.buildID, "20080811053724",
"the update buildID attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.detailsURL, "http://details/",
"the update detailsURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.billboardURL, "http://details/",
"the update billboardURL attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!bestUpdate.licenseURL,
"the update licenseURL attribute" + MSG_SHOULD_EQUAL);
Assert.ok(bestUpdate.showPrompt,
"the update showPrompt attribute" + MSG_SHOULD_EQUAL);
Assert.ok(bestUpdate.showNeverForVersion,
"the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.promptWaitTime, "691200",
"the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.serviceURL, URL_HOST + "/update.xml?force=1",
"the update serviceURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.channel, "test_channel",
"the update channel attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!bestUpdate.isCompleteUpdate,
"the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!bestUpdate.isSecurityUpdate,
"the update isSecurityUpdate attribute" + MSG_SHOULD_EQUAL);
// Check that installDate is within 10 seconds of the current date.
do_check_true((Date.now() - bestUpdate.installDate) < 10000);
do_check_eq(bestUpdate.statusText, null);
Assert.ok((Date.now() - bestUpdate.installDate) < 10000,
"the update installDate attribute should be within 10 seconds of " +
"the current time");
Assert.ok(!bestUpdate.statusText,
"the update statusText attribute" + MSG_SHOULD_EQUAL);
// nsIUpdate:state returns an empty string when no action has been performed
// on an available update
do_check_eq(bestUpdate.state, "");
do_check_eq(bestUpdate.errorCode, 0);
do_check_eq(bestUpdate.patchCount, 1);
Assert.equal(bestUpdate.state, "",
"the update state attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.errorCode, 0,
"the update errorCode attribute" + MSG_SHOULD_EQUAL);
Assert.equal(bestUpdate.patchCount, 1,
"the update patchCount attribute" + MSG_SHOULD_EQUAL);
//XXX TODO - test nsIUpdate:serialize
let patch = bestUpdate.getPatchAt(0);
do_check_eq(patch.type, "complete");
do_check_eq(patch.URL, "http://complete/");
do_check_eq(patch.hashFunction, "SHA1");
do_check_eq(patch.hashValue, "98db9dad8e1d80eda7e1170d0187d6f53e477059");
do_check_eq(patch.size, 9856459);
Assert.equal(patch.type, "complete",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.URL, "http://complete/",
"the update patch URL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashFunction, "SHA1",
"the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashValue, "98db9dad8e1d80eda7e1170d0187d6f53e477059",
"the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.size, 9856459,
"the update patch size attribute" + MSG_SHOULD_EQUAL);
// The value for patch.state can be the string 'null' as a valid value. This
// is confusing if it returns null which is an invalid value since the test
// failure output will show a failure for null == null. To lessen the
// confusion first check that the typeof for patch.state is string.
do_check_eq(typeof(patch.state), "string");
do_check_eq(patch.state, STATE_NONE);
do_check_false(patch.selected);
Assert.equal(typeof(patch.state), "string",
"the update patch state typeof value should equal |string|");
Assert.equal(patch.state, STATE_NONE,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!patch.selected,
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
//XXX TODO - test nsIUpdatePatch:serialize
run_test_pt04();
@ -304,7 +376,7 @@ function run_test_pt11() {
function check_test_pt11() {
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
do_check_eq(bestUpdate, null);
Assert.ok(!bestUpdate);
run_test_pt12();
}
@ -320,8 +392,9 @@ function run_test_pt12() {
function check_test_pt12() {
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
do_check_neq(bestUpdate, null);
do_check_eq(bestUpdate.displayVersion, "version 1.0");
Assert.ok(!!bestUpdate);
Assert.equal(bestUpdate.displayVersion, "version 1.0",
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
doTestFinish();
}

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

@ -41,7 +41,7 @@ function run_test() {
function check_status() {
let status = readStatusFile();
Assert.notEqual(status, STATE_DOWNLOADING,
"the update should not be downloading");
"the update state" + MSG_SHOULD_EQUAL);
// Pause the download and reload the Update Manager with an empty update so
// the Application Update Service doesn't write the update xml files during

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

@ -37,7 +37,8 @@ function run_test() {
gUP.showUpdateInstalled();
// Report a successful check after the call to showUpdateInstalled since it
// didn't throw and otherwise it would report no tests run.
do_check_true(true);
Assert.ok(true,
"calling showUpdateInstalled should not attempt to open a window");
debugDump("testing showUpdateAvailable should not call openWindow");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
@ -53,7 +54,8 @@ function run_test() {
gUP.showUpdateAvailable(update);
// Report a successful check after the call to showUpdateAvailable since it
// didn't throw and otherwise it would report no tests run.
do_check_true(true);
Assert.ok(true,
"calling showUpdateAvailable should not attempt to open a window");
doTestFinish();
}

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

@ -34,7 +34,8 @@ function run_test() {
gUP.showUpdateInstalled();
// Report a successful check after the call to showUpdateInstalled since it
// didn't throw and otherwise it would report no tests run.
do_check_true(true);
Assert.ok(true,
"calling showUpdateInstalled should not attempt to open a window");
debugDump("testing showUpdateAvailable should not call openWindow");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
@ -50,7 +51,8 @@ function run_test() {
gUP.showUpdateAvailable(update);
// Report a successful check after the call to showUpdateAvailable since it
// didn't throw and otherwise it would report no tests run.
do_check_true(true);
Assert.ok(true,
"calling showUpdateAvailable should not attempt to open a window");
debugDump("testing showUpdateError should not call getNewPrompter");
gCheckFunc = check_showUpdateError;
@ -58,7 +60,8 @@ function run_test() {
gUP.showUpdateError(update);
// Report a successful check after the call to showUpdateError since it
// didn't throw and otherwise it would report no tests run.
do_check_true(true);
Assert.ok(true,
"calling showUpdateError should not attempt to open a window");
doTestFinish();
}

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

@ -48,7 +48,8 @@ function check_test() {
do_execute_soon(check_test);
return;
}
do_check_true(true);
Assert.ok(true,
PREF_APP_UPDATE_BACKGROUNDERRORS + " preference should not exist");
doTestFinish();
}

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

@ -29,7 +29,7 @@ function run_test() {
// call the nsIDOMEventListener's handleEvent method for onload.
function callHandleEvent(aXHR) {
aXHR.status = gExpectedStatusCode;
var e = { target: aXHR };
let e = { target: aXHR };
aXHR.onload(e);
}
@ -45,9 +45,11 @@ function run_test_helper(aNextRunFunc, aExpectedStatusCode, aMsg) {
}
function check_test_helper() {
do_check_eq(gStatusCode, gExpectedStatusCode);
Assert.equal(gStatusCode, gExpectedStatusCode,
"the download status code" + MSG_SHOULD_EQUAL);
let expectedStatusText = getStatusText(gExpectedStatusCode);
do_check_eq(gStatusText, expectedStatusText);
Assert.equal(gStatusText, expectedStatusText,
"the update status text" + MSG_SHOULD_EQUAL);
gNextRunFunc();
}
@ -66,9 +68,11 @@ function run_test_pt1() {
}
function check_test_pt1() {
do_check_eq(gStatusCode, gExpectedStatusCode);
Assert.equal(gStatusCode, gExpectedStatusCode,
"the download status code" + MSG_SHOULD_EQUAL);
let expectedStatusText = getStatusText(404);
do_check_eq(gStatusText, expectedStatusText);
Assert.equal(gStatusText, expectedStatusText,
"the update status text" + MSG_SHOULD_EQUAL);
run_test_pt2();
}

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

@ -45,75 +45,133 @@ function run_test() {
standardInit();
do_check_eq(gUpdateManager.activeUpdate, null);
do_check_eq(gUpdateManager.updateCount, 2);
Assert.ok(!gUpdateManager.activeUpdate,
"the update manager activeUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(gUpdateManager.updateCount, 2,
"the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
let update = gUpdateManager.getUpdateAt(0).QueryInterface(Ci.nsIPropertyBag);
do_check_eq(update.state, STATE_SUCCEEDED);
do_check_eq(update.type, "major");
do_check_eq(update.name, "New");
do_check_eq(update.displayVersion, "version 4");
do_check_eq(update.appVersion, "4.0");
do_check_eq(update.platformVersion, "4.0");
do_check_eq(update.buildID, "20070811053724");
do_check_eq(update.detailsURL, "http://details1/");
do_check_eq(update.billboardURL, "http://billboard1/");
do_check_eq(update.licenseURL, "http://license1/");
do_check_eq(update.serviceURL, "http://service1/");
do_check_eq(update.installDate, "1238441300314");
Assert.equal(update.state, STATE_SUCCEEDED,
"the update state attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.type, "major",
"the update type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.name, "New",
"the update name attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.displayVersion, "version 4",
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.appVersion, "4.0",
"the update appVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.platformVersion, "4.0",
"the update platformVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.buildID, "20070811053724",
"the update buildID attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.detailsURL, "http://details1/",
"the update detailsURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.billboardURL, "http://billboard1/",
"the update billboardURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.licenseURL, "http://license1/",
"the update licenseURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.serviceURL, "http://service1/",
"the update serviceURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.installDate, "1238441300314",
"the update installDate attribute" + MSG_SHOULD_EQUAL);
// statusText is updated
do_check_eq(update.statusText, getString("installSuccess"));
do_check_false(update.isCompleteUpdate);
do_check_eq(update.channel, "test_channel");
do_check_true(update.showPrompt);
do_check_true(update.showNeverForVersion);
do_check_eq(update.promptWaitTime, "345600");
do_check_eq(update.previousAppVersion, "3.0");
Assert.equal(update.statusText, getString("installSuccess"),
"the update statusText attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!update.isCompleteUpdate,
"the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.channel, "test_channel",
"the update channel attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.showPrompt,
"the update showPrompt attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.showNeverForVersion,
"the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.promptWaitTime, "345600",
"the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.previousAppVersion, "3.0",
"the update previousAppVersion attribute" + MSG_SHOULD_EQUAL);
// Custom attributes
do_check_eq(update.getProperty("custom1_attr"), "custom1 value");
do_check_eq(update.getProperty("custom2_attr"), "custom2 value");
Assert.equal(update.getProperty("custom1_attr"), "custom1 value",
"the update custom1_attr property" + MSG_SHOULD_EQUAL);
Assert.equal(update.getProperty("custom2_attr"), "custom2 value",
"the update custom2_attr property" + MSG_SHOULD_EQUAL);
let patch = update.selectedPatch;
do_check_eq(patch.type, "partial");
do_check_eq(patch.URL, "http://partial/");
do_check_eq(patch.hashFunction, "SHA256");
do_check_eq(patch.hashValue, "cd43");
do_check_eq(patch.size, "86");
do_check_true(patch.selected);
do_check_eq(patch.state, STATE_SUCCEEDED);
Assert.equal(patch.type, "partial",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.URL, "http://partial/",
"the update patch URL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashFunction, "SHA256",
"the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashValue, "cd43",
"the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.size, "86",
"the update patch size attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!patch.selected,
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.state, STATE_SUCCEEDED,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
update = gUpdateManager.getUpdateAt(1).QueryInterface(Ci.nsIPropertyBag);
do_check_eq(update.state, STATE_FAILED);
do_check_eq(update.name, "Existing");
do_check_eq(update.type, "major");
do_check_eq(update.displayVersion, "version 3");
do_check_eq(update.appVersion, "3.0");
do_check_eq(update.platformVersion, "3.0");
do_check_eq(update.detailsURL, "http://details2/");
do_check_eq(update.billboardURL, "http://details2/");
do_check_eq(update.licenseURL, null);
do_check_eq(update.serviceURL, "http://service2/");
do_check_eq(update.installDate, "1238441400314");
do_check_eq(update.statusText, getString("patchApplyFailure"));
do_check_eq(update.buildID, "20080811053724");
do_check_true(update.isCompleteUpdate);
do_check_eq(update.channel, "test_channel");
do_check_true(update.showPrompt);
do_check_true(update.showNeverForVersion);
do_check_eq(update.promptWaitTime, "691200");
do_check_eq(update.previousAppVersion, null);
Assert.equal(update.state, STATE_FAILED,
"the update state attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.name, "Existing",
"the update name attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.type, "major",
"the update type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.displayVersion, "version 3",
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.appVersion, "3.0",
"the update appVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.platformVersion, "3.0",
"the update platformVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.detailsURL, "http://details2/",
"the update detailsURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.billboardURL, "http://details2/",
"the update billboardURL attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!update.licenseURL,
"the update licenseURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.serviceURL, "http://service2/",
"the update serviceURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.installDate, "1238441400314",
"the update installDate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.statusText, getString("patchApplyFailure"),
"the update statusText attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.buildID, "20080811053724",
"the update buildID attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.isCompleteUpdate,
"the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.channel, "test_channel",
"the update channel attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.showPrompt,
"the update showPrompt attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.showNeverForVersion,
"the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.promptWaitTime, "691200",
"the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.previousAppVersion, null,
"the update previousAppVersion attribute" + MSG_SHOULD_EQUAL);
// Custom attributes
do_check_eq(update.getProperty("custom3_attr"), "custom3 value");
do_check_eq(update.getProperty("custom4_attr"), "custom4 value");
Assert.equal(update.getProperty("custom3_attr"), "custom3 value",
"the update custom3_attr property" + MSG_SHOULD_EQUAL);
Assert.equal(update.getProperty("custom4_attr"), "custom4 value",
"the update custom4_attr property" + MSG_SHOULD_EQUAL);
patch = update.selectedPatch;
do_check_eq(patch.type, "complete");
do_check_eq(patch.URL, "http://complete/");
do_check_eq(patch.hashFunction, "SHA1");
do_check_eq(patch.hashValue, "6232");
do_check_eq(patch.size, "75");
do_check_true(patch.selected);
do_check_eq(patch.state, STATE_FAILED);
Assert.equal(patch.type, "complete",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.URL, "http://complete/",
"the update patch URL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashFunction, "SHA1",
"the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashValue, "6232",
"the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.size, "75",
"the update patch size attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!patch.selected,
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.state, STATE_FAILED,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
removeUpdateDirsAndFiles();
@ -145,68 +203,122 @@ function run_test() {
reloadUpdateManagerData();
initUpdateServiceStub();
do_check_eq(gUpdateManager.activeUpdate, null);
do_check_eq(gUpdateManager.updateCount, 2);
Assert.ok(!gUpdateManager.activeUpdate,
"the update manager activeUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(gUpdateManager.updateCount, 2,
"the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
update = gUpdateManager.getUpdateAt(0);
do_check_eq(update.state, STATE_SUCCEEDED);
do_check_eq(update.type, "major");
do_check_eq(update.name, "New");
do_check_eq(update.displayVersion, "version 4.0");
do_check_eq(update.appVersion, "4.0");
do_check_eq(update.platformVersion, "4.0");
do_check_eq(update.detailsURL, "http://details/");
do_check_eq(update.billboardURL, "http://billboard/");
do_check_eq(update.licenseURL, "http://license/");
do_check_eq(update.serviceURL, "http://service/");
do_check_eq(update.installDate, "1238441400314");
do_check_eq(update.statusText, getString("installSuccess"));
do_check_eq(update.buildID, "20080811053724");
do_check_true(update.isCompleteUpdate);
do_check_eq(update.channel, "test_channel");
do_check_true(update.showPrompt);
do_check_true(update.showNeverForVersion);
do_check_eq(update.promptWaitTime, "100");
do_check_eq(update.previousAppVersion, "3.0");
Assert.equal(update.state, STATE_SUCCEEDED,
"the update state attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.type, "major",
"the update type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.name, "New",
"the update name attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.displayVersion, "version 4.0",
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.appVersion, "4.0",
"the update appVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.platformVersion, "4.0",
"the update platformVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.detailsURL, "http://details/",
"the update detailsURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.billboardURL, "http://billboard/",
"the update billboardURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.licenseURL, "http://license/",
"the update licenseURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.serviceURL, "http://service/",
"the update serviceURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.installDate, "1238441400314",
"the update installDate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.statusText, getString("installSuccess"),
"the update statusText attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.buildID, "20080811053724",
"the update buildID attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.isCompleteUpdate,
"the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.channel, "test_channel",
"the update channel attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.showPrompt,
"the update showPrompt attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.showNeverForVersion,
"the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.promptWaitTime, "100",
"the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.previousAppVersion, "3.0",
"the update previousAppVersion attribute" + MSG_SHOULD_EQUAL);
patch = update.selectedPatch;
do_check_eq(patch.type, "complete");
do_check_eq(patch.URL, URL_HOST + "/" + FILE_SIMPLE_MAR);
do_check_eq(patch.hashFunction, "MD5");
do_check_eq(patch.hashValue, MD5_HASH_SIMPLE_MAR);
do_check_eq(patch.size, SIZE_SIMPLE_MAR);
do_check_true(patch.selected);
do_check_eq(patch.state, STATE_SUCCEEDED);
Assert.equal(patch.type, "complete",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.URL, URL_HOST + "/" + FILE_SIMPLE_MAR,
"the update patch URL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashFunction, "MD5",
"the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashValue, MD5_HASH_SIMPLE_MAR,
"the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.size, SIZE_SIMPLE_MAR,
"the update patch size attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!patch.selected,
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.state, STATE_SUCCEEDED,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
update = gUpdateManager.getUpdateAt(1);
do_check_eq(update.state, STATE_FAILED);
do_check_eq(update.name, "Existing");
do_check_eq(update.type, "major");
do_check_eq(update.displayVersion, "version 3.0");
do_check_eq(update.appVersion, "3.0");
do_check_eq(update.platformVersion, "3.0");
do_check_eq(update.detailsURL, "http://details/");
do_check_eq(update.billboardURL, null);
do_check_eq(update.licenseURL, null);
do_check_eq(update.serviceURL, "http://service/");
do_check_eq(update.installDate, "1238441400314");
do_check_eq(update.statusText, getString("patchApplyFailure"));
do_check_eq(update.buildID, "20080811053724");
do_check_true(update.isCompleteUpdate);
do_check_eq(update.channel, "test_channel");
do_check_false(update.showPrompt);
do_check_false(update.showNeverForVersion);
do_check_eq(update.promptWaitTime, "200");
do_check_eq(update.previousAppVersion, null);
Assert.equal(update.state, STATE_FAILED,
"the update state attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.name, "Existing",
"the update name attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.type, "major",
"the update type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.displayVersion, "version 3.0",
"the update displayVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.appVersion, "3.0",
"the update appVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.platformVersion, "3.0",
"the update platformVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.detailsURL, "http://details/",
"the update detailsURL attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!update.billboardURL,
"the update billboardURL attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!update.licenseURL,
"the update licenseURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.serviceURL, "http://service/",
"the update serviceURL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.installDate, "1238441400314",
"the update installDate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.statusText, getString("patchApplyFailure"),
"the update statusText attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.buildID, "20080811053724",
"the update buildID attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!update.isCompleteUpdate,
"the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.channel, "test_channel",
"the update channel attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!update.showPrompt,
"the update showPrompt attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!update.showNeverForVersion,
"the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
Assert.equal(update.promptWaitTime, "200",
"the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!update.previousAppVersion,
"the update previousAppVersion attribute" + MSG_SHOULD_EQUAL);
patch = update.selectedPatch;
do_check_eq(patch.type, "complete");
do_check_eq(patch.URL, URL_HOST + "/" + FILE_SIMPLE_MAR);
do_check_eq(patch.hashFunction, "MD5");
do_check_eq(patch.hashValue, MD5_HASH_SIMPLE_MAR);
do_check_eq(patch.size, SIZE_SIMPLE_MAR);
do_check_true(patch.selected);
do_check_eq(patch.state, STATE_FAILED);
Assert.equal(patch.type, "complete",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.URL, URL_HOST + "/" + FILE_SIMPLE_MAR,
"the update patch URL attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashFunction, "MD5",
"the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.hashValue, MD5_HASH_SIMPLE_MAR,
"the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.size, SIZE_SIMPLE_MAR,
"the update patch size attribute" + MSG_SHOULD_EQUAL);
Assert.ok(!!patch.selected,
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.state, STATE_FAILED,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
doTestFinish();
}

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

@ -5,8 +5,6 @@
/* General URL Construction Tests */
Cu.import("resource://gre/modules/ctypes.jsm")
const URL_PREFIX = URL_HOST + "/";
var gAppInfo;
@ -32,7 +30,7 @@ function callHandleEvent(aXHR) {
// The mock xmlhttprequest needs a status code to return to the consumer and
// the value is not important for this test.
aXHR.status = 404;
var e = { target: aXHR };
let e = { target: aXHR };
aXHR.onload(e);
}
@ -51,7 +49,8 @@ function run_test_pt1() {
}
function check_test_pt1() {
do_check_eq(getResult(gRequestURL), gAppInfo.name);
Assert.equal(getResult(gRequestURL), gAppInfo.name,
"the url param for %PRODUCT%" + MSG_SHOULD_EQUAL);
run_test_pt2();
}
@ -65,7 +64,8 @@ function run_test_pt2() {
}
function check_test_pt2() {
do_check_eq(getResult(gRequestURL), gAppInfo.version);
Assert.equal(getResult(gRequestURL), gAppInfo.version,
"the url param for %VERSION%" + MSG_SHOULD_EQUAL);
run_test_pt3();
}
@ -79,7 +79,8 @@ function run_test_pt3() {
}
function check_test_pt3() {
do_check_eq(getResult(gRequestURL), gAppInfo.appBuildID);
Assert.equal(getResult(gRequestURL), gAppInfo.appBuildID,
"the url param for %BUILD_ID%" + MSG_SHOULD_EQUAL);
run_test_pt4();
}
@ -113,7 +114,8 @@ function check_test_pt4() {
}
}
do_check_eq(getResult(gRequestURL), gAppInfo.OS + "_" + abi);
Assert.equal(getResult(gRequestURL), gAppInfo.OS + "_" + abi,
"the url param for %BUILD_TARGET%" + MSG_SHOULD_EQUAL);
run_test_pt5();
}
@ -139,7 +141,8 @@ function run_test_pt5() {
}
function check_test_pt5() {
do_check_eq(getResult(gRequestURL), INSTALL_LOCALE);
Assert.equal(getResult(gRequestURL), INSTALL_LOCALE,
"the url param for %LOCALE%" + MSG_SHOULD_EQUAL);
run_test_pt6();
}
@ -154,7 +157,8 @@ function run_test_pt6() {
}
function check_test_pt6() {
do_check_eq(getResult(gRequestURL), "test_channel");
Assert.equal(getResult(gRequestURL), "test_channel",
"the url param for %CHANNEL%" + MSG_SHOULD_EQUAL);
run_test_pt7();
}
@ -164,13 +168,17 @@ function run_test_pt7() {
let url = URL_PREFIX + "%CHANNEL%/";
debugDump("testing url constructed with %CHANNEL% - " + url);
setUpdateURLOverride(url);
gDefaultPrefBranch.setCharPref(PREF_APP_PARTNER_BRANCH + "test_partner1", "test_partner1");
gDefaultPrefBranch.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);
}
function check_test_pt7() {
do_check_eq(getResult(gRequestURL), "test_channel-cck-test_partner1-test_partner2");
Assert.equal(getResult(gRequestURL),
"test_channel-cck-test_partner1-test_partner2",
"the url param for %CHANNEL%" + MSG_SHOULD_EQUAL);
run_test_pt8();
}
@ -184,7 +192,8 @@ function run_test_pt8() {
}
function check_test_pt8() {
do_check_eq(getResult(gRequestURL), gAppInfo.platformVersion);
Assert.equal(getResult(gRequestURL), gAppInfo.platformVersion,
"the url param for %PLATFORM_VERSION%" + MSG_SHOULD_EQUAL);
run_test_pt9();
}
@ -332,7 +341,8 @@ function check_test_pt9() {
osVersion = encodeURIComponent(osVersion);
}
do_check_eq(getResult(gRequestURL), osVersion);
Assert.equal(getResult(gRequestURL), osVersion,
"the url param for %OS_VERSION%" + MSG_SHOULD_EQUAL);
run_test_pt10();
}
@ -347,7 +357,8 @@ function run_test_pt10() {
}
function check_test_pt10() {
do_check_eq(getResult(gRequestURL), "test_distro");
Assert.equal(getResult(gRequestURL), "test_distro",
"the url param for %DISTRIBUTION%" + MSG_SHOULD_EQUAL);
run_test_pt11();
}
@ -362,7 +373,8 @@ function run_test_pt11() {
}
function check_test_pt11() {
do_check_eq(getResult(gRequestURL), "test_distro_version");
Assert.equal(getResult(gRequestURL), "test_distro_version",
"the url param for %DISTRIBUTION_VERSION%" + MSG_SHOULD_EQUAL);
run_test_pt12();
}
@ -377,7 +389,8 @@ function run_test_pt12() {
}
function check_test_pt12() {
do_check_eq(getResult(gRequestURL), "?force=1");
Assert.equal(getResult(gRequestURL), "?force=1",
"the url query string for force" + MSG_SHOULD_EQUAL);
run_test_pt13();
}
@ -391,7 +404,9 @@ function run_test_pt13() {
}
function check_test_pt13() {
do_check_eq(getResult(gRequestURL), "?extra=param&force=1");
Assert.equal(getResult(gRequestURL), "?extra=param&force=1",
"the url query string for force with an extra string" +
MSG_SHOULD_EQUAL);
run_test_pt14();
}
@ -405,6 +420,8 @@ function run_test_pt14() {
}
function check_test_pt14() {
do_check_eq(getResult(gRequestURL), "?custom=custom&force=1");
Assert.equal(getResult(gRequestURL), "?custom=custom&force=1",
"the url query string for force with a custom string" +
MSG_SHOULD_EQUAL);
doTestFinish();
}

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

@ -7,6 +7,9 @@
* apply it.
*/
const START_STATE = STATE_PENDING;
const END_STATE = STATE_PENDING;
function run_test() {
if (MOZ_APP_NAME == "xulrunner") {
logTestInfo("Unable to run this test on xulrunner");
@ -27,16 +30,17 @@ function run_test() {
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
let patches = getLocalPatchString(null, null, null, null, null, "true",
STATE_PENDING);
START_STATE);
let updates = getLocalUpdateString(patches, null, null, null, null, null,
null, null, null, null, null, null,
null, "true", channel);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeVersionFile(getAppVersion());
writeStatusFile(STATE_PENDING);
writeStatusFile(START_STATE);
reloadUpdateManagerData();
do_check_true(!!gUpdateManager.activeUpdate);
Assert.ok(!!gUpdateManager.activeUpdate,
"the active update should be defined");
lockDirectory(getAppBaseDir());
@ -44,16 +48,6 @@ function run_test() {
}
function setupAppFilesFinished() {
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
stageUpdate();
}
@ -66,14 +60,14 @@ function end_test() {
*/
function checkUpdateApplied() {
// Don't proceed until the update has failed, and reset to pending.
if (gUpdateManager.activeUpdate.state != STATE_PENDING) {
if (gUpdateManager.activeUpdate.state != END_STATE) {
if (++gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to equal: " +
STATE_PENDING +
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"active update status state to equal: " +
END_STATE +
", current state: " + gUpdateManager.activeUpdate.state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
@ -81,12 +75,9 @@ function checkUpdateApplied() {
}
function finishTest() {
if (IS_WIN || IS_MACOSX) {
// Check that the post update process was not launched.
do_check_false(getPostUpdateFile(".running").exists());
}
do_check_eq(readStatusState(), STATE_PENDING);
checkPostUpdateRunningFile(false);
Assert.equal(readStatusState(), END_STATE,
"the status state" + MSG_SHOULD_EQUAL);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
unlockDirectory(getAppBaseDir());
standardInit();

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

@ -7,7 +7,8 @@
* apply it.
*/
Cu.import("resource://gre/modules/ctypes.jsm");
const START_STATE = STATE_PENDING;
const END_STATE = STATE_APPLIED;
function run_test() {
if (MOZ_APP_NAME == "xulrunner") {
@ -28,31 +29,23 @@ function run_test() {
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
let patches = getLocalPatchString(null, null, null, null, null, "true",
STATE_PENDING);
START_STATE);
let updates = getLocalUpdateString(patches, null, null, null, null, null,
null, null, null, null, null, null,
null, "true", channel);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeVersionFile(getAppVersion());
writeStatusFile(STATE_PENDING);
writeStatusFile(START_STATE);
reloadUpdateManagerData();
do_check_true(!!gUpdateManager.activeUpdate);
Assert.ok(!!gUpdateManager.activeUpdate,
"the active update should be defined");
setupAppFilesAsync();
}
function setupAppFilesFinished() {
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
setAppBundleModTime();
stageUpdate();
}
@ -74,7 +67,8 @@ function customLaunchAppToApplyUpdate() {
gHandle = CreateFile(getAppBaseDir().path, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, LPVOID(0),
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, LPVOID(0));
do_check_neq(gHandle.toString(), INVALID_HANDLE_VALUE.toString());
Assert.notEqual(gHandle.toString(), INVALID_HANDLE_VALUE.toString(),
"the handle should not equal INVALID_HANDLE_VALUE");
kernel32.close();
debugDump("finish - locking installation directory");
}
@ -85,28 +79,27 @@ function customLaunchAppToApplyUpdate() {
function checkUpdateApplied() {
gTimeoutRuns++;
// Don't proceed until the active update's state is the expected value.
if (gUpdateManager.activeUpdate.state != STATE_APPLIED) {
if (gUpdateManager.activeUpdate.state != END_STATE) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to equal: " +
STATE_APPLIED +
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"active update status state to equal: " +
END_STATE +
", current state: " + gUpdateManager.activeUpdate.state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
// Don't proceed until the update's status state is the expected value.
let state = readStatusState();
if (state != STATE_APPLIED) {
if (state != END_STATE) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal: " +
STATE_APPLIED +
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update" +
"status file state to equal: " +
END_STATE +
", current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
@ -123,60 +116,42 @@ function checkUpdateApplied() {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
"to be created. Path: " + log.path);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
if (IS_WIN || IS_MACOSX) {
// Check that the post update process was not launched when staging an
// update.
do_check_false(getPostUpdateFile(".running").exists());
}
checkPostUpdateRunningFile(false);
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
log = getUpdatesPatchDir();
log.append(FILE_UPDATE_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = getUpdatesDir();
log.append(FILE_LAST_LOG);
if (IS_WIN || IS_MACOSX) {
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
} else {
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
}
log = getUpdatesDir();
log.append(FILE_BACKUP_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
let updatesDir = getStageDirFile(DIR_UPDATES + "/0", true);
debugDump("testing " + updatesDir.path + " shouldn't exist");
do_check_false(updatesDir.exists());
log = getStageDirFile(DIR_UPDATES + "/0/" + FILE_UPDATE_LOG, true);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
let updatesDir = getStageDirFile(DIR_UPDATES + "/" + DIR_PATCH, true);
Assert.ok(!updatesDir.exists(), MSG_SHOULD_NOT_EXIST);
log = getStageDirFile(DIR_UPDATES + "/" + FILE_LAST_LOG, true);
if (IS_WIN || IS_MACOSX) {
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
} else {
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
}
log = getStageDirFile(DIR_UPDATES + "/" + FILE_BACKUP_LOG, true);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
// Switch the application to the staged application that was updated by
// launching the application.
@ -206,13 +181,12 @@ function finishCheckUpdateFinished() {
let state = readStatusState();
if (state != STATE_SUCCEEDED) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal: " +
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"update status file state to equal: " +
STATE_SUCCEEDED +
", current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
@ -221,11 +195,10 @@ function finishCheckUpdateFinished() {
let updatedDir = getStageDirFile(null, true);
if (updatedDir.exists()) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updated dir to not exist. Path: " +
updatedDir.path);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the updated " +
"directory to not exist. Path: " + updatedDir.path);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
@ -235,28 +208,20 @@ function finishCheckUpdateFinished() {
updater.append(FILE_UPDATER_BIN);
if (updater.exists()) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updater binary to no longer be " +
"in use");
} else {
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"updater binary to no longer be in use");
}
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
}
}
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
checkPostUpdateRunningFile(true);
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
checkCallbackAppLog();
@ -264,26 +229,23 @@ function finishCheckUpdateFinished() {
standardInit();
let update = gUpdateManager.getUpdateAt(0);
do_check_eq(update.state, STATE_SUCCEEDED);
Assert.equal(update.state, STATE_SUCCEEDED,
"the update state" + MSG_SHOULD_EQUAL);
let updatesDir = getUpdatesPatchDir();
debugDump("testing " + updatesDir.path + " should exist");
do_check_true(updatesDir.exists());
Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
let log = getUpdatesPatchDir();
log.append(FILE_UPDATE_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = getUpdatesDir();
log.append(FILE_LAST_LOG);
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
log = getUpdatesDir();
log.append(FILE_BACKUP_LOG);
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
waitForFilesInUse();
}

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

@ -7,6 +7,9 @@
* apply it.
*/
const START_STATE = STATE_PENDING;
const END_STATE = STATE_APPLIED;
function run_test() {
if (MOZ_APP_NAME == "xulrunner") {
logTestInfo("Unable to run this test on xulrunner");
@ -26,31 +29,23 @@ function run_test() {
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
let patches = getLocalPatchString(null, null, null, null, null, "true",
STATE_PENDING);
START_STATE);
let updates = getLocalUpdateString(patches, null, null, null, null, null,
null, null, null, null, null, null,
null, "true", channel);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeVersionFile(getAppVersion());
writeStatusFile(STATE_PENDING);
writeStatusFile(START_STATE);
reloadUpdateManagerData();
do_check_true(!!gUpdateManager.activeUpdate);
Assert.ok(!!gUpdateManager.activeUpdate,
"the active update should be defined");
setupAppFilesAsync();
}
function setupAppFilesFinished() {
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
setAppBundleModTime();
stageUpdate();
}
@ -60,28 +55,27 @@ function setupAppFilesFinished() {
function checkUpdateApplied() {
gTimeoutRuns++;
// Don't proceed until the active update's state is the expected value.
if (gUpdateManager.activeUpdate.state != STATE_APPLIED) {
if (gUpdateManager.activeUpdate.state != END_STATE) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to equal: " +
STATE_APPLIED +
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"active update status state to equal: " +
END_STATE +
", current state: " + gUpdateManager.activeUpdate.state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
// Don't proceed until the update's status state is the expected value.
let state = readStatusState();
if (state != STATE_APPLIED) {
if (state != END_STATE) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal: " +
STATE_APPLIED +
END_STATE +
", current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
@ -98,60 +92,42 @@ function checkUpdateApplied() {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
"to be created. Path: " + log.path);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
if (IS_WIN || IS_MACOSX) {
// Check that the post update process was not launched when staging an
// update.
do_check_false(getPostUpdateFile(".running").exists());
}
checkPostUpdateRunningFile(false);
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
log = getUpdatesPatchDir();
log.append(FILE_UPDATE_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = getUpdatesDir();
log.append(FILE_LAST_LOG);
if (IS_WIN || IS_MACOSX) {
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
} else {
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
}
log = getUpdatesDir();
log.append(FILE_BACKUP_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
let updatesDir = getStageDirFile(DIR_UPDATES + "/0", true);
debugDump("testing " + updatesDir.path + " shouldn't exist");
do_check_false(updatesDir.exists());
log = getStageDirFile(DIR_UPDATES + "/0/" + FILE_UPDATE_LOG, true);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
let updatesDir = getStageDirFile(DIR_UPDATES + "/" + DIR_PATCH, true);
Assert.ok(!updatesDir.exists(), MSG_SHOULD_NOT_EXIST);
log = getStageDirFile(DIR_UPDATES + "/" + FILE_LAST_LOG, true);
if (IS_WIN || IS_MACOSX) {
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
} else {
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
}
log = getStageDirFile(DIR_UPDATES + "/" + FILE_BACKUP_LOG, true);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
// Switch the application to the staged application that was updated by
// launching the application.
@ -181,12 +157,12 @@ function finishCheckUpdateApplied() {
let state = readStatusState();
if (state != STATE_SUCCEEDED) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal: " + STATE_SUCCEEDED +
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"update status file state to equal: " +
STATE_SUCCEEDED +
", current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
@ -195,11 +171,10 @@ function finishCheckUpdateApplied() {
let updatedDir = getStageDirFile(null, true);
if (updatedDir.exists()) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updated dir to not exist. Path: " +
updatedDir.path);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the updated " +
"directory to not exist. Path: " + updatedDir.path);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
@ -209,28 +184,20 @@ function finishCheckUpdateApplied() {
updater.append(FILE_UPDATER_BIN);
if (updater.exists()) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updater binary to no longer be " +
"in use");
} else {
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"updater binary to no longer be in use");
}
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
}
}
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
checkPostUpdateRunningFile(true);
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
gSwitchApp = true;
checkUpdateLogContents();
@ -240,30 +207,26 @@ function finishCheckUpdateApplied() {
standardInit();
let update = gUpdateManager.getUpdateAt(0);
do_check_eq(update.state, STATE_SUCCEEDED);
Assert.equal(update.state, STATE_SUCCEEDED,
"the update state" + MSG_SHOULD_EQUAL);
let updatesDir = getUpdatesPatchDir();
debugDump("testing " + updatesDir.path + " should exist");
do_check_true(updatesDir.exists());
Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
let log = getUpdatesPatchDir();
log.append(FILE_UPDATE_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = getUpdatesDir();
log.append(FILE_LAST_LOG);
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
log = getUpdatesDir();
log.append(FILE_BACKUP_LOG);
if (IS_WIN || IS_MACOSX) {
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
} else {
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
}
waitForFilesInUse();

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

@ -7,6 +7,9 @@
* apply it.
*/
const START_STATE = STATE_PENDING;
const END_STATE = STATE_SUCCEEDED;
function run_test() {
if (MOZ_APP_NAME == "xulrunner") {
logTestInfo("Unable to run this test on xulrunner");
@ -19,26 +22,17 @@ function run_test() {
setupUpdaterTest(FILE_COMPLETE_MAR);
createUpdaterINI();
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
setAppBundleModTime();
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
let patches = getLocalPatchString(null, null, null, null, null, "true",
STATE_PENDING);
START_STATE);
let updates = getLocalUpdateString(patches, null, null, null, null, null,
null, null, null, null, null, null,
null, "true", channel);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeVersionFile(getAppVersion());
writeStatusFile(STATE_PENDING);
writeStatusFile(START_STATE);
setupAppFilesAsync();
}
@ -68,10 +62,10 @@ function finishCheckUpdateFinished() {
gTimeoutRuns++;
// Don't proceed until the update's status state is the expected value.
let state = readStatusState();
if (state != STATE_SUCCEEDED) {
if (state != END_STATE) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal: " + STATE_SUCCEEDED +
"status state to equal: " + END_STATE +
", current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
@ -86,9 +80,8 @@ function finishCheckUpdateFinished() {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
"to be created. Path: " + log.path);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
@ -100,26 +93,17 @@ function finishCheckUpdateFinished() {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updater binary to no longer be " +
"in use");
} else {
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
}
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
}
}
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
checkCallbackAppLog();
@ -127,26 +111,23 @@ function finishCheckUpdateFinished() {
standardInit();
let update = gUpdateManager.getUpdateAt(0);
do_check_eq(update.state, STATE_SUCCEEDED);
Assert.equal(update.state, END_STATE,
"the update state" + MSG_SHOULD_EQUAL);
let updatesPatchDir = getUpdatesPatchDir();
debugDump("testing " + updatesPatchDir.path + " should exist");
do_check_true(updatesPatchDir.exists());
let updatesDir = getUpdatesPatchDir();
Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
log = getUpdatesPatchDir();
log.append(FILE_UPDATE_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = getUpdatesDir();
log.append(FILE_LAST_LOG);
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
log = getUpdatesDir();
log.append(FILE_BACKUP_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
waitForFilesInUse();
}

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

@ -4,6 +4,9 @@
/* Application in use complete MAR file staged patch apply failure fallback test */
const START_STATE = STATE_APPLIED;
const END_STATE = STATE_PENDING;
function run_test() {
gStageUpdate = true;
setupTestCommon();
@ -25,12 +28,12 @@ function run_test() {
}
function doUpdate() {
runUpdate(0, STATE_APPLIED, null);
runUpdate(0, START_STATE, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING);
runUpdate(1, END_STATE, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -4,6 +4,9 @@
/* Application in use complete MAR file staged patch apply failure test */
const START_STATE = STATE_APPLIED;
const END_STATE = STATE_FAILED_WRITE_ERROR;
function run_test() {
gStageUpdate = true;
setupTestCommon();
@ -25,13 +28,13 @@ function run_test() {
}
function doUpdate() {
runUpdate(0, STATE_APPLIED, null);
runUpdate(0, START_STATE, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR);
runUpdate(1, END_STATE, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -15,16 +15,7 @@ function run_test() {
setupUpdaterTest(FILE_COMPLETE_MAR);
createUpdaterINI(false);
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
setAppBundleModTime();
if (IS_UNIX) {
removeSymlink();
@ -62,18 +53,13 @@ function doUpdate() {
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
if (IS_WIN || IS_MACOSX) {
// Check that the post update process was not launched when staging an
// update.
do_check_false(getPostUpdateFile(".running").exists());
}
checkPostUpdateRunningFile(false);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
do_timeout(TEST_CHECK_TIMEOUT, function() {
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
});
}
@ -95,15 +81,7 @@ function checkUpdateApplied() {
* the test.
*/
function finishCheckUpdateApplied() {
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
setupHelperFinish();
}
@ -124,7 +102,8 @@ function runHelperProcess(args) {
process.init(helperBin);
debugDump("Running " + helperBin.path + " " + args.join(" "));
process.run(true, args, args.length);
do_check_eq(process.exitValue, 0);
Assert.equal(process.exitValue, 0,
"the helper process exit value should be 0");
}
function createSymlink() {

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

@ -24,33 +24,16 @@ function run_test() {
}
function doUpdate() {
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let applyToDir = getApplyDirFile();
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
applyToDir.lastModifiedTime = yesterday;
}
runUpdate(0, STATE_SUCCEEDED);
setAppBundleModTime();
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
}
function checkUpdateApplied() {
function checkUpdateFinished() {
setupHelperFinish();
}
function checkUpdate() {
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
standardInit();

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

@ -18,7 +18,7 @@ function run_test() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -18,7 +18,7 @@ function run_test() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -12,10 +12,10 @@ function run_test() {
gCallbackBinFile = "exe0.exe";
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
}
function checkUpdateApplied() {
function checkUpdateFinished() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
checkCallbackAppLog();

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

@ -12,10 +12,10 @@ function run_test() {
gCallbackBinFile = "exe0.exe";
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
}
function checkUpdateApplied() {
function checkUpdateFinished() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
checkCallbackAppLog();

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

@ -14,40 +14,20 @@ function run_test() {
setupUpdaterTest(FILE_PARTIAL_MAR);
createUpdaterINI();
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on all updates since
// the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
setAppBundleModTime();
// Note that on platforms where we use execv, we cannot trust the return code.
runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE);
runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE,
checkUpdateFinished);
}
/**
* Checks if the update has finished and if it has finished performs checks for
* the test.
*/
function checkUpdateApplied() {
if (IS_WIN || IS_MACOSX) {
// Check that the post update process was not launched.
do_check_false(getPostUpdateFile(".running").exists());
}
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
function checkUpdateFinished() {
checkPostUpdateRunningFile(false);
checkAppBundleModTime();
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
standardInit();

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

@ -31,7 +31,7 @@ function doUpdate() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -31,7 +31,7 @@ function doUpdate() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -32,7 +32,7 @@ function doUpdate() {
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR);
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -32,7 +32,7 @@ function doUpdate() {
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR);
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -24,10 +24,10 @@ function run_test() {
}
function doUpdate() {
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
}
function checkUpdateApplied() {
function checkUpdateFinished() {
setupHelperFinish();
}

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

@ -24,10 +24,10 @@ function run_test() {
}
function doUpdate() {
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
}
function checkUpdateApplied() {
function checkUpdateFinished() {
setupHelperFinish();
}

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

@ -34,10 +34,10 @@ function run_test() {
}
function doUpdate() {
runUpdate(1, STATE_FAILED_WRITE_ERROR);
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateFinished);
}
function checkUpdateApplied() {
function checkUpdateFinished() {
setupHelperFinish();
}

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

@ -34,10 +34,10 @@ function run_test() {
}
function doUpdate() {
runUpdate(1, STATE_FAILED_READ_ERROR);
runUpdate(1, STATE_FAILED_READ_ERROR, checkUpdateFinished);
}
function checkUpdateApplied() {
function checkUpdateFinished() {
setupHelperFinish();
}

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

@ -40,7 +40,7 @@ function doUpdate() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -40,7 +40,7 @@ function doUpdate() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -41,7 +41,7 @@ function doUpdate() {
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR);
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -41,7 +41,7 @@ function doUpdate() {
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR);
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -42,7 +42,7 @@ function doUpdate() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -40,7 +40,7 @@ function doUpdate() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -43,7 +43,7 @@ function doUpdate() {
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR);
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -41,7 +41,7 @@ function doUpdate() {
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR);
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -34,10 +34,10 @@ function run_test() {
}
function doUpdate() {
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
}
function checkUpdateApplied() {
function checkUpdateFinished() {
setupHelperFinish();
}

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

@ -32,10 +32,10 @@ function run_test() {
}
function doUpdate() {
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
}
function checkUpdateApplied() {
function checkUpdateFinished() {
setupHelperFinish();
}

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

@ -16,29 +16,15 @@ function run_test() {
createUpdaterINI(true);
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on all updates since
// the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
runUpdate(1, STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE);
runUpdate(1, STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE, checkUpdateFinished);
}
/**
* Checks if the update has finished and if it has finished performs checks for
* the test.
*/
function checkUpdateApplied() {
if (IS_WIN || IS_MACOSX) {
// Check that the post update process was not launched.
do_check_false(getPostUpdateFile(".running").exists());
}
function checkUpdateFinished() {
checkPostUpdateRunningFile(false);
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
standardInit();

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

@ -25,16 +25,7 @@ function run_test() {
}
createUpdaterINI(false);
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
setAppBundleModTime();
// Don't test symlinks on Mac OS X in this test since it tends to timeout.
// It is tested on Mac OS X in marAppInUseStageSuccessComplete_unix.js
@ -60,18 +51,13 @@ function run_test() {
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
if (IS_WIN || IS_MACOSX) {
// Check that the post update process was not launched when staging an
// update.
do_check_false(getPostUpdateFile(".running").exists());
}
checkPostUpdateRunningFile(false);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
do_timeout(TEST_CHECK_TIMEOUT, function() {
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
});
}
@ -93,29 +79,18 @@ function checkUpdateApplied() {
* the test.
*/
function finishCheckUpdateApplied() {
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
checkPostUpdateRunningFile(true);
if (IS_MACOSX) {
debugDump("testing that the distribution directory is removed from the " +
"old location when there is a distribution directory in the " +
"new location");
let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
debugDump("testing " + distributionDir.path + " shouldn't exist");
do_check_false(distributionDir.exists());
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
checkUpdateLogContains("removing old distribution directory");
}
if (IS_UNIX && !IS_MACOSX) {
checkSymlink();
}
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
standardInit();
@ -129,7 +104,8 @@ function runHelperProcess(args) {
process.init(helperBin);
debugDump("Running " + helperBin.path + " " + args.join(" "));
process.run(true, args, args.length);
do_check_eq(process.exitValue, 0);
Assert.equal(process.exitValue, 0,
"the helper process exit value should be 0");
}
function createSymlink() {

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

@ -25,33 +25,19 @@ function run_test() {
}
createUpdaterINI(false);
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on all updates since
// the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
setAppBundleModTime();
runUpdate(0, STATE_APPLIED, null);
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true);
if (IS_WIN || IS_MACOSX) {
// Check that the post update process was not launched when staging an
// update.
do_check_false(getPostUpdateFile(".running").exists());
}
checkPostUpdateRunningFile(false);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
do_timeout(TEST_CHECK_TIMEOUT, function() {
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
});
}
@ -73,42 +59,29 @@ function checkUpdateApplied() {
* the test.
*/
function finishCheckUpdateApplied() {
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
checkPostUpdateRunningFile(true);
let distributionDir = getApplyDirFile(DIR_RESOURCES + "distribution", true);
if (IS_MACOSX) {
debugDump("testing that the distribution directory is moved from the " +
"old location to the new location");
debugDump("testing " + distributionDir.path + " should exist");
do_check_true(distributionDir.exists());
Assert.ok(distributionDir.exists(), MSG_SHOULD_EXIST);
let testFile = getApplyDirFile(DIR_RESOURCES + "distribution/testFile", true);
debugDump("testing " + testFile.path + " should exist");
do_check_true(testFile.exists());
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
testFile = getApplyDirFile(DIR_RESOURCES + "distribution/test/testFile", true);
debugDump("testing " + testFile.path + " should exist");
do_check_true(testFile.exists());
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
debugDump("testing " + distributionDir.path + " shouldn't exist");
do_check_false(distributionDir.exists());
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
checkUpdateLogContains("Moving old distribution directory to new location");
} else {
debugDump("testing that files aren't added with an add-if instruction " +
"when the file's destination directory doesn't exist");
debugDump("testing " + distributionDir.path + " shouldn't exist");
do_check_false(distributionDir.exists());
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
}
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true);
standardInit();

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

@ -21,30 +21,21 @@ function run_test() {
}
createUpdaterINI();
setAppBundleModTime();
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
}
/**
* Checks if the post update binary was properly launched for the platforms that
* support launching post update process.
*/
function checkUpdateApplied() {
function checkUpdateFinished() {
if (IS_WIN || IS_MACOSX) {
gCheckFunc = finishCheckUpdateApplied;
gCheckFunc = finishCheckUpdateFinished;
checkPostUpdateAppLog();
} else {
finishCheckUpdateApplied();
finishCheckUpdateFinished();
}
}
@ -52,43 +43,28 @@ function checkUpdateApplied() {
* Checks if the update has finished and if it has finished performs checks for
* the test.
*/
function finishCheckUpdateApplied() {
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
function finishCheckUpdateFinished() {
let distributionDir = getApplyDirFile(DIR_RESOURCES + "distribution", true);
if (IS_MACOSX) {
debugDump("testing that the distribution directory is moved from the " +
"old location to the new location");
debugDump("testing " + distributionDir.path + " should exist");
do_check_true(distributionDir.exists());
Assert.ok(distributionDir.exists(), MSG_SHOULD_EXIST);
let testFile = getApplyDirFile(DIR_RESOURCES + "distribution/testFile", true);
debugDump("testing " + testFile.path + " should exist");
do_check_true(testFile.exists());
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
testFile = getApplyDirFile(DIR_RESOURCES + "distribution/test/testFile", true);
debugDump("testing " + testFile.path + " should exist");
do_check_true(testFile.exists());
Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
debugDump("testing " + distributionDir.path + " shouldn't exist");
do_check_false(distributionDir.exists());
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
checkUpdateLogContains("Moving old distribution directory to new location");
} else {
debugDump("testing that files aren't added with an add-if instruction " +
"when the file's destination directory doesn't exist");
debugDump("testing " + distributionDir.path + " shouldn't exist");
do_check_false(distributionDir.exists());
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
}
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true);
standardInit();

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

@ -27,30 +27,21 @@ function run_test() {
}
createUpdaterINI(true);
setAppBundleModTime();
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on all updates since
// the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
}
/**
* Checks if the post update binary was properly launched for the platforms that
* support launching post update process.
*/
function checkUpdateApplied() {
function checkUpdateFinished() {
if (IS_WIN || IS_MACOSX) {
gCheckFunc = finishCheckUpdateApplied;
gCheckFunc = finishCheckUpdateFinished;
checkPostUpdateAppLog();
} else {
finishCheckUpdateApplied();
finishCheckUpdateFinished();
}
}
@ -58,27 +49,14 @@ function checkUpdateApplied() {
* Checks if the update has finished and if it has finished performs checks for
* the test.
*/
function finishCheckUpdateApplied() {
function finishCheckUpdateFinished() {
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
if (IS_MACOSX) {
debugDump("testing that the distribution directory is removed from the " +
"old location when there is a distribution directory in the " +
"new location");
let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
debugDump("testing " + distributionDir.path + " shouldn't exist");
do_check_false(distributionDir.exists());
Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
checkUpdateLogContains("removing old distribution directory");
}
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
standardInit();

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

@ -23,7 +23,8 @@ function run_test() {
// Note that if execv is used, the updater process will turn into the
// callback process, so its return code will be that of the callback
// app.
runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_VERSION_DOWNGRADE_ERROR);
runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_VERSION_DOWNGRADE_ERROR,
checkUpdateApplied);
}
/**
@ -31,11 +32,7 @@ function run_test() {
* the test.
*/
function checkUpdateApplied() {
if (IS_WIN || IS_MACOSX) {
// Check that the post update process was not launched.
do_check_false(getPostUpdateFile(".running").exists());
}
checkPostUpdateRunningFile(false);
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
doTestFinish();

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

@ -23,7 +23,8 @@ function run_test() {
// Note that if execv is used, the updater process will turn into the
// callback process, so its return code will be that of the callback
// app.
runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_CHANNEL_MISMATCH_ERROR);
runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_CHANNEL_MISMATCH_ERROR,
checkUpdateApplied);
}
/**
@ -31,11 +32,7 @@ function run_test() {
* the test.
*/
function checkUpdateApplied() {
if (IS_WIN || IS_MACOSX) {
// Check that the post update process was not launched.
do_check_false(getPostUpdateFile(".running").exists());
}
checkPostUpdateRunningFile(false);
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
doTestFinish();

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

@ -19,9 +19,9 @@ function run_test() {
let updaterBin = binDir.clone();
updaterBin.append(FILE_UPDATER_BIN);
logTestInfo("Launching maintenance service bin: " +
maintenanceServiceBin.path + " to check updater: " +
updaterBin.path + " signature.");
debugDump("Launching maintenance service bin: " +
maintenanceServiceBin.path + " to check updater: " +
updaterBin.path + " signature.");
// Bypass the manifest and run as invoker
let env = Cc["@mozilla.org/process/environment;1"].
@ -36,5 +36,6 @@ function run_test() {
maintenanceServiceBinProcess.init(maintenanceServiceBin);
maintenanceServiceBinProcess.run(true, maintenanceServiceBinArgs,
maintenanceServiceBinArgs.length);
do_check_eq(maintenanceServiceBinProcess.exitValue, 0);
Assert.equal(maintenanceServiceBinProcess.exitValue, 0,
"the maintenance service exit value should be 0");
}

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

@ -7,6 +7,9 @@
* apply it.
*/
const START_STATE = STATE_PENDING_SVC;
const END_STATE = STATE_PENDING;
function run_test() {
if (MOZ_APP_NAME == "xulrunner") {
logTestInfo("Unable to run this test on xulrunner");
@ -31,16 +34,17 @@ function run_test() {
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
let patches = getLocalPatchString(null, null, null, null, null, "true",
STATE_PENDING_SVC);
START_STATE);
let updates = getLocalUpdateString(patches, null, null, null, null, null,
null, null, null, null, null, null,
null, "true", channel);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeVersionFile(getAppVersion());
writeStatusFile(STATE_PENDING_SVC);
writeStatusFile(START_STATE);
reloadUpdateManagerData();
do_check_true(!!gUpdateManager.activeUpdate);
Assert.ok(!!gUpdateManager.activeUpdate,
"the active update should be defined");
lockDirectory(getAppBaseDir());
@ -48,16 +52,6 @@ function run_test() {
}
function setupAppFilesFinished() {
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
stageUpdate();
}
@ -70,14 +64,14 @@ function end_test() {
*/
function checkUpdateApplied() {
// Don't proceed until the update has failed, and reset to pending.
if (gUpdateManager.activeUpdate.state != STATE_PENDING) {
if (gUpdateManager.activeUpdate.state != END_STATE) {
if (++gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to equal: " +
STATE_PENDING +
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"active update status state to equal: " +
END_STATE +
", current state: " + gUpdateManager.activeUpdate.state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
@ -85,14 +79,9 @@ function checkUpdateApplied() {
}
function finishTest() {
if (IS_WIN || IS_MACOSX) {
let running = getPostUpdateFile(".running");
debugDump("checking that the post update process running file doesn't " +
"exist. Path: " + running.path);
do_check_false(running.exists());
}
do_check_eq(readStatusState(), STATE_PENDING);
checkPostUpdateRunningFile(false);
Assert.equal(readStatusState(), END_STATE,
"the status state" + MSG_SHOULD_EQUAL);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
unlockDirectory(getAppBaseDir());
standardInit();

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

@ -7,7 +7,8 @@
* apply it.
*/
Cu.import("resource://gre/modules/ctypes.jsm");
const START_STATE = STATE_PENDING_SVC;
const END_STATE = STATE_APPLIED_SVC;
function run_test() {
if (MOZ_APP_NAME == "xulrunner") {
@ -32,31 +33,23 @@ function run_test() {
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
let patches = getLocalPatchString(null, null, null, null, null, "true",
STATE_PENDING_SVC);
START_STATE);
let updates = getLocalUpdateString(patches, null, null, null, null, null,
null, null, null, null, null, null,
null, "true", channel);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeVersionFile(getAppVersion());
writeStatusFile(STATE_PENDING_SVC);
writeStatusFile(START_STATE);
reloadUpdateManagerData();
do_check_true(!!gUpdateManager.activeUpdate);
Assert.ok(!!gUpdateManager.activeUpdate,
"the active update should be defined");
setupAppFilesAsync();
}
function setupAppFilesFinished() {
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
setAppBundleModTime();
stageUpdate();
}
@ -78,7 +71,8 @@ function customLaunchAppToApplyUpdate() {
gHandle = CreateFile(getAppBaseDir().path, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, LPVOID(0),
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, LPVOID(0));
do_check_neq(gHandle.toString(), INVALID_HANDLE_VALUE.toString());
Assert.notEqual(gHandle.toString(), INVALID_HANDLE_VALUE.toString(),
"the handle should not equal INVALID_HANDLE_VALUE");
kernel32.close();
debugDump("finish - locking installation directory");
}
@ -89,28 +83,27 @@ function customLaunchAppToApplyUpdate() {
function checkUpdateApplied() {
gTimeoutRuns++;
// Don't proceed until the active update's state is the expected value.
if (gUpdateManager.activeUpdate.state != STATE_APPLIED_SVC) {
if (gUpdateManager.activeUpdate.state != END_STATE) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to equal: " +
STATE_APPLIED_SVC +
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"active update status state to equal: " +
END_STATE +
", current state: " + gUpdateManager.activeUpdate.state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
// Don't proceed until the update's status state is the expected value.
let state = readStatusState();
if (state != STATE_APPLIED_SVC) {
if (state != END_STATE) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal: " +
STATE_APPLIED_SVC +
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update" +
"status file state to equal: " +
END_STATE +
", current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
@ -127,61 +120,42 @@ function checkUpdateApplied() {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
"to be created. Path: " + log.path);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
if (IS_WIN || IS_MACOSX) {
let running = getPostUpdateFile(".running");
debugDump("checking that the post update process running file doesn't " +
"exist. Path: " + running.path);
do_check_false(running.exists());
}
checkPostUpdateRunningFile(false);
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
log = getUpdatesPatchDir();
log.append(FILE_UPDATE_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = getUpdatesDir();
log.append(FILE_LAST_LOG);
if (IS_WIN || IS_MACOSX) {
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
} else {
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
}
log = getUpdatesDir();
log.append(FILE_BACKUP_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
let updatesDir = getStageDirFile(DIR_UPDATES + "/0", true);
debugDump("testing " + updatesDir.path + " shouldn't exist");
do_check_false(updatesDir.exists());
log = getStageDirFile(DIR_UPDATES + "/0/" + FILE_UPDATE_LOG, true);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
let updatesDir = getStageDirFile(DIR_UPDATES + "/" + DIR_PATCH, true);
Assert.ok(!updatesDir.exists(), MSG_SHOULD_NOT_EXIST);
log = getStageDirFile(DIR_UPDATES + "/" + FILE_LAST_LOG, true);
if (IS_WIN || IS_MACOSX) {
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
} else {
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
}
log = getStageDirFile(DIR_UPDATES + "/" + FILE_BACKUP_LOG, true);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
// Switch the application to the staged application that was updated by
// launching the application.
@ -211,13 +185,12 @@ function finishCheckUpdateFinished() {
let state = readStatusState();
if (state != STATE_SUCCEEDED) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal: " +
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"update status file state to equal: " +
STATE_SUCCEEDED +
", current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
@ -226,11 +199,10 @@ function finishCheckUpdateFinished() {
let updatedDir = getStageDirFile(null, true);
if (updatedDir.exists()) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updated dir to not exist. Path: " +
updatedDir.path);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the updated " +
"directory to not exist. Path: " + updatedDir.path);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
@ -240,35 +212,20 @@ function finishCheckUpdateFinished() {
updater.append(FILE_UPDATER_BIN);
if (updater.exists()) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updater binary to no longer be " +
"in use");
} else {
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"updater binary to no longer be in use");
}
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
}
}
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
if (IS_WIN || IS_MACOSX) {
let running = getPostUpdateFile(".running");
debugDump("checking that the post update process running file exists. " +
"Path: " + running.path);
do_check_true(running.exists());
}
checkPostUpdateRunningFile(true);
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
checkCallbackAppLog();
@ -276,26 +233,23 @@ function finishCheckUpdateFinished() {
standardInit();
let update = gUpdateManager.getUpdateAt(0);
do_check_eq(update.state, STATE_SUCCEEDED);
Assert.equal(update.state, STATE_SUCCEEDED,
"the update state" + MSG_SHOULD_EQUAL);
let updatesDir = getUpdatesPatchDir();
debugDump("testing " + updatesDir.path + " should exist");
do_check_true(updatesDir.exists());
Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
let log = getUpdatesPatchDir();
log.append(FILE_UPDATE_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = getUpdatesDir();
log.append(FILE_LAST_LOG);
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
log = getUpdatesDir();
log.append(FILE_BACKUP_LOG);
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
waitForFilesInUse();
}

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

@ -7,6 +7,9 @@
* apply it.
*/
const START_STATE = STATE_PENDING_SVC;
const END_STATE = STATE_APPLIED_SVC;
function run_test() {
if (MOZ_APP_NAME == "xulrunner") {
logTestInfo("Unable to run this test on xulrunner");
@ -30,31 +33,23 @@ function run_test() {
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
let patches = getLocalPatchString(null, null, null, null, null, "true",
STATE_PENDING_SVC);
START_STATE);
let updates = getLocalUpdateString(patches, null, null, null, null, null,
null, null, null, null, null, null,
null, "true", channel);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeVersionFile(getAppVersion());
writeStatusFile(STATE_PENDING_SVC);
writeStatusFile(START_STATE);
reloadUpdateManagerData();
do_check_true(!!gUpdateManager.activeUpdate);
Assert.ok(!!gUpdateManager.activeUpdate,
"the active update should be defined");
setupAppFilesAsync();
}
function setupAppFilesFinished() {
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
setAppBundleModTime();
stageUpdate();
}
@ -64,28 +59,27 @@ function setupAppFilesFinished() {
function checkUpdateApplied() {
gTimeoutRuns++;
// Don't proceed until the active update's state is the expected value.
if (gUpdateManager.activeUpdate.state != STATE_APPLIED_SVC) {
if (gUpdateManager.activeUpdate.state != END_STATE) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to equal: " +
STATE_APPLIED_SVC +
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"active update status state to equal: " +
END_STATE +
", current state: " + gUpdateManager.activeUpdate.state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
// Don't proceed until the update's status state is the expected value.
let state = readStatusState();
if (state != STATE_APPLIED_SVC) {
if (state != END_STATE) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal: " +
STATE_APPLIED_SVC +
END_STATE +
", current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
@ -102,61 +96,42 @@ function checkUpdateApplied() {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
"to be created. Path: " + log.path);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
return;
}
if (IS_WIN || IS_MACOSX) {
let running = getPostUpdateFile(".running");
debugDump("checking that the post update process running file doesn't " +
"exist. Path: " + running.path);
do_check_false(running.exists());
}
checkPostUpdateRunningFile(false);
checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
log = getUpdatesPatchDir();
log.append(FILE_UPDATE_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = getUpdatesDir();
log.append(FILE_LAST_LOG);
if (IS_WIN || IS_MACOSX) {
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
} else {
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
}
log = getUpdatesDir();
log.append(FILE_BACKUP_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
let updatesDir = getStageDirFile(DIR_UPDATES + "/0", true);
debugDump("testing " + updatesDir.path + " shouldn't exist");
do_check_false(updatesDir.exists());
log = getStageDirFile(DIR_UPDATES + "/0/" + FILE_UPDATE_LOG, true);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
let updatesDir = getStageDirFile(DIR_UPDATES + "/" + DIR_PATCH, true);
Assert.ok(!updatesDir.exists(), MSG_SHOULD_NOT_EXIST);
log = getStageDirFile(DIR_UPDATES + "/" + FILE_LAST_LOG, true);
if (IS_WIN || IS_MACOSX) {
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
} else {
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
}
log = getStageDirFile(DIR_UPDATES + "/" + FILE_BACKUP_LOG, true);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
// Switch the application to the staged application that was updated by
// launching the application.
@ -186,12 +161,12 @@ function finishCheckUpdateApplied() {
let state = readStatusState();
if (state != STATE_SUCCEEDED) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal: " + STATE_SUCCEEDED +
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"update status file state to equal: " +
STATE_SUCCEEDED +
", current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
@ -200,11 +175,10 @@ function finishCheckUpdateApplied() {
let updatedDir = getStageDirFile(null, true);
if (updatedDir.exists()) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updated dir to not exist. Path: " +
updatedDir.path);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the updated " +
"directory to not exist. Path: " + updatedDir.path);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
@ -214,35 +188,20 @@ function finishCheckUpdateApplied() {
updater.append(FILE_UPDATER_BIN);
if (updater.exists()) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updater binary to no longer be " +
"in use");
} else {
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
"updater binary to no longer be in use");
}
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
}
}
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
if (IS_WIN || IS_MACOSX) {
let running = getPostUpdateFile(".running");
debugDump("checking that the post update process running file exists. " +
"Path: " + running.path);
do_check_true(running.exists());
}
checkPostUpdateRunningFile(true);
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
gSwitchApp = true;
checkUpdateLogContents();
@ -252,30 +211,26 @@ function finishCheckUpdateApplied() {
standardInit();
let update = gUpdateManager.getUpdateAt(0);
do_check_eq(update.state, STATE_SUCCEEDED);
Assert.equal(update.state, STATE_SUCCEEDED,
"the update state" + MSG_SHOULD_EQUAL);
let updatesDir = getUpdatesPatchDir();
debugDump("testing " + updatesDir.path + " should exist");
do_check_true(updatesDir.exists());
Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
let log = getUpdatesPatchDir();
log.append(FILE_UPDATE_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = getUpdatesDir();
log.append(FILE_LAST_LOG);
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
log = getUpdatesDir();
log.append(FILE_BACKUP_LOG);
if (IS_WIN || IS_MACOSX) {
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
} else {
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
}
waitForFilesInUse();

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

@ -7,6 +7,9 @@
* apply it.
*/
const START_STATE = STATE_PENDING_SVC;
const END_STATE = STATE_SUCCEEDED;
function run_test() {
if (MOZ_APP_NAME == "xulrunner") {
logTestInfo("Unable to run this test on xulrunner");
@ -23,32 +26,23 @@ function run_test() {
setupUpdaterTest(FILE_COMPLETE_MAR);
createUpdaterINI();
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
setAppBundleModTime();
let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
let patches = getLocalPatchString(null, null, null, null, null, "true",
STATE_PENDING);
START_STATE);
let updates = getLocalUpdateString(patches, null, null, null, null, null,
null, null, null, null, null, null,
null, "true", channel);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeVersionFile(getAppVersion());
writeStatusFile(STATE_PENDING_SVC);
writeStatusFile(START_STATE);
setupAppFilesAsync();
}
function setupAppFilesFinished() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
runUpdateUsingService(START_STATE, END_STATE);
}
/**
@ -72,10 +66,10 @@ function finishCheckUpdateFinished() {
gTimeoutRuns++;
// Don't proceed until the update's status state is the expected value.
let state = readStatusState();
if (state != STATE_SUCCEEDED) {
if (state != END_STATE) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
"status state to equal: " + STATE_SUCCEEDED +
"status state to equal: " + END_STATE +
", current status state: " + state);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
@ -90,9 +84,8 @@ function finishCheckUpdateFinished() {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
"to be created. Path: " + log.path);
} else {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
}
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
@ -104,26 +97,17 @@ function finishCheckUpdateFinished() {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updater binary to no longer be " +
"in use");
} else {
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
}
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
}
}
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
checkCallbackAppLog();
@ -131,26 +115,23 @@ function finishCheckUpdateFinished() {
standardInit();
let update = gUpdateManager.getUpdateAt(0);
do_check_eq(update.state, STATE_SUCCEEDED);
Assert.equal(update.state, END_STATE,
"the update state" + MSG_SHOULD_EQUAL);
let updatesPatchDir = getUpdatesPatchDir();
debugDump("testing " + updatesPatchDir.path + " should exist");
do_check_true(updatesPatchDir.exists());
let updatesDir = getUpdatesPatchDir();
Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
log = getUpdatesPatchDir();
log.append(FILE_UPDATE_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = getUpdatesDir();
log.append(FILE_LAST_LOG);
debugDump("testing " + log.path + " should exist");
do_check_true(log.exists());
Assert.ok(log.exists(), MSG_SHOULD_EXIST);
log = getUpdatesDir();
log.append(FILE_BACKUP_LOG);
debugDump("testing " + log.path + " shouldn't exist");
do_check_false(log.exists());
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
waitForFilesInUse();
}

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

@ -4,6 +4,9 @@
/* Application in use complete MAR file staged patch apply failure fallback test */
const START_STATE = STATE_PENDING_SVC;
const END_STATE = STATE_PENDING;
function run_test() {
if (!shouldRunServiceTest()) {
return;
@ -33,14 +36,14 @@ function setupAppFilesFinished() {
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
runUpdateUsingService(START_STATE, STATE_APPLIED);
}
function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING);
runUpdate(1, END_STATE, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -4,6 +4,9 @@
/* Application in use complete MAR file staged patch apply failure test */
const START_STATE = STATE_PENDING_SVC;
const END_STATE = STATE_FAILED_WRITE_ERROR;
function run_test() {
if (!shouldRunServiceTest()) {
return;
@ -33,7 +36,7 @@ function setupAppFilesFinished() {
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
runUpdateUsingService(START_STATE, STATE_APPLIED);
}
function checkUpdateFinished() {
@ -41,7 +44,7 @@ function checkUpdateFinished() {
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR);
runUpdate(1, END_STATE, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -32,16 +32,7 @@ function setupAppFilesFinished() {
}
function doUpdate() {
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on a successful
// update (bug 600098).
if (IS_MACOSX) {
let applyToDir = getApplyDirFile();
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
applyToDir.lastModifiedTime = yesterday;
}
setAppBundleModTime();
runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
}
@ -50,15 +41,7 @@ function checkUpdateFinished() {
}
function checkUpdate() {
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
checkAppBundleModTime();
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
standardInit();

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

@ -28,7 +28,7 @@ function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -28,7 +28,7 @@ function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(0, STATE_SUCCEEDED);
runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -18,16 +18,7 @@ function run_test() {
setupUpdaterTest(FILE_PARTIAL_MAR);
createUpdaterINI();
// For Mac OS X set the last modified time for the root directory to a date in
// the past to test that the last modified time is updated on all updates since
// the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
if (IS_MACOSX) {
let now = Date.now();
let yesterday = now - (1000 * 60 * 60 * 24);
let applyToDir = getApplyDirFile();
applyToDir.lastModifiedTime = yesterday;
}
setAppBundleModTime();
setupAppFilesAsync();
}
@ -42,22 +33,8 @@ function setupAppFilesFinished() {
* the test.
*/
function checkUpdateFinished() {
if (IS_MACOSX) {
debugDump("testing last modified time on the apply to directory has " +
"changed after a successful update (bug 600098)");
let now = Date.now();
let applyToDir = getApplyDirFile();
let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
}
if (IS_WIN || IS_MACOSX) {
let running = getPostUpdateFile(".running");
debugDump("checking that the post update process running file doesn't " +
"exist. Path: " + running.path);
do_check_false(running.exists());
}
checkPostUpdateRunningFile(false);
checkAppBundleModTime();
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
standardInit();

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

@ -41,7 +41,7 @@ function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -41,7 +41,7 @@ function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -42,7 +42,7 @@ function checkUpdateFinished() {
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR);
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
}
function checkUpdateApplied() {

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

@ -42,7 +42,7 @@ function checkUpdateFinished() {
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR);
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
}
function checkUpdateApplied() {

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше