This commit is contained in:
Mounir Lamouri 2010-09-30 17:10:19 -07:00
Родитель 6e8c289ac0
Коммит 3bbc0f30ac
84 изменённых файлов: 674 добавлений и 195 удалений

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

@ -120,9 +120,6 @@ export::
ifdef ENABLE_TESTS
# Additional makefile targets to call automated test suites
include $(topsrcdir)/testing/testsuite-targets.mk
else
# OS X Universal builds will want to call this, so stub it out
package-tests:
endif
include $(topsrcdir)/config/rules.mk

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

@ -73,10 +73,10 @@
var jar = getJar(rootDir);
if (jar) {
var tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path;
rootDir = "file://" + tmpdir.path + '/';
}
var url = rootDir + "/scroll.html#link1";
var url = rootDir + "scroll.html#link1";
var tabBrowser = document.getElementById("tabBrowser");
tabBrowser.loadURI(url);
}

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

@ -39,7 +39,7 @@
}
var rootDir = getRootDirectory(window.location.href);
var href = rootDir.path + "/foo";
var href = rootDir.path + "foo";
// roles that can't live as nsHTMLLinkAccessibles
testValue("aria_menuitem_link", "");

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

@ -355,7 +355,7 @@ function test9()
gBrowser.removeTab(tab, {animate: false});
// Next test
executeSoon(finish);
executeSoon(test10);
});
};
@ -372,3 +372,38 @@ function test9()
tab.linkedBrowser.loadURI(uri);
}
/**
* In this test, we check that the author defined error message is shown.
*/
function test10()
{
let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input x-moz-errormessage='foo' required id='i'><input id='s' type='submit'></form>";
let tab = gBrowser.addTab();
gInvalidFormPopup.addEventListener("popupshown", function() {
gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
let doc = gBrowser.contentDocument;
is(doc.activeElement, doc.getElementById('i'),
"First invalid element should be focused");
checkPopupShow();
is(gInvalidFormPopup.firstChild.nodeValue, "foo",
"The panel should show the author defined error message");
// Clean-up and next test.
gBrowser.removeTab(gBrowser.selectedTab, {animate: false});
executeSoon(finish);
}, false);
tab.linkedBrowser.addEventListener("load", function(aEvent) {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
gBrowser.contentDocument.getElementById('s').click();
}, true);
gBrowser.selectedTab = tab;
gBrowser.selectedTab.linkedBrowser.loadURI(uri);
}

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

@ -11,8 +11,8 @@ function test()
// Now run the tests again and then close C.
// The test results does not matter, all this is just to exercise some code to
// catch assertions or crashes.
var uri = "chrome://mochikit/content/browser/" +
"browser/base/content/test/browser_tab_dragdrop2_frame1.xul";
var chromeroot = getRootDirectory(gTestPath);
var uri = chromeroot + "browser_tab_dragdrop2_frame1.xul";
let window_B = openDialog(location, "_blank", "chrome,all,dialog=no,left=200,top=200,width=200,height=200", uri);
window_B.addEventListener("load", function(aEvent) {
window_B.removeEventListener("load", arguments.callee, false);

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

@ -43,9 +43,9 @@ function test() {
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path;
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "/privacypane_tests.js", this);
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_pane_visibility,

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

@ -43,9 +43,9 @@ function test() {
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path;
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "/privacypane_tests.js", this);
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_historymode_retention("remember", undefined),

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

@ -42,9 +42,9 @@ function test() {
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path;
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "/privacypane_tests.js", this);
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_custom_retention("rememberHistory", "remember"),

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

@ -42,9 +42,9 @@ function test() {
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path;
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "/privacypane_tests.js", this);
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_custom_retention("acceptCookies", "remember"),

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

@ -42,9 +42,9 @@ function test() {
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path;
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "/privacypane_tests.js", this);
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_locbar_suggestion_retention(-1, undefined),

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

@ -42,9 +42,9 @@ function test() {
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path;
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "/privacypane_tests.js", this);
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_privatebrowsing_toggle,

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

@ -42,9 +42,9 @@ function test() {
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path;
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "/privacypane_tests.js", this);
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
test_privatebrowsing_ui,

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

@ -41,9 +41,9 @@ function test() {
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path;
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "/privacypane_tests.js", this);
loader.loadSubScript(rootDir + "privacypane_tests.js", this);
run_test_subset([
// history mode should be initialized to remember

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

@ -121,8 +121,8 @@ postflight_all:
# A universal .dmg can now be produced by making in either architecture's
# INSTALLER_DIR.
# Now, repeat the process for the test package.
$(MAKE) -C $(OBJDIR_ARCH_1) UNIVERSAL_BINARY= package-tests
$(MAKE) -C $(OBJDIR_ARCH_2) UNIVERSAL_BINARY= package-tests
$(MAKE) -C $(OBJDIR_ARCH_1) UNIVERSAL_BINARY= CHROME_JAR= package-tests
$(MAKE) -C $(OBJDIR_ARCH_2) UNIVERSAL_BINARY= CHROME_JAR= package-tests
rm -rf $(DIST_UNI)/test-package-stage
# automation.py differs because it hardcodes a path to
# dist/bin. It doesn't matter which one we use.

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

@ -111,4 +111,12 @@ public class ASMozStub extends android.app.Service {
System.exit(0);
}
public void SendToDataChannel(String strToSend)
{
if (runDataThrd.isAlive())
{
runDataThrd.SendToDataChannel(strToSend);
}
}
}

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

@ -5,6 +5,7 @@
android:versionName="1.0" android:sharedUserId="org.mozilla.sharedID">
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
<activity android:name=".SUTAgentAndroid"
android:screenOrientation="nosensor"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -25,7 +26,7 @@
</application>
<uses-sdk android:minSdkVersion="5"/>
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="8"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
@ -59,4 +60,9 @@
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
<uses-permission android:name="android.permission.SET_TIME"></uses-permission>
</manifest>

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

@ -55,18 +55,34 @@ public class DataWorkerThread extends Thread
private RunDataThread theParent = null;
private Socket socket = null;
boolean bListening = true;
PrintWriter out = null;
SimpleDateFormat sdf = null;
public DataWorkerThread(RunDataThread theParent, Socket workerSocket)
{
super("DataWorkerThread");
this.theParent = theParent;
this.socket = workerSocket;
this.sdf = new SimpleDateFormat("yyyyMMdd-HH:mm:ss");
}
public void StopListening()
{
bListening = false;
}
public void SendString(String strToSend)
{
if (this.out != null)
{
Calendar cal = Calendar.getInstance();
String strOut = sdf.format(cal.getTime());
strOut += " " + strToSend + "\r\n";
out.write(strOut);
out.flush();
}
}
private String readLine(BufferedInputStream in)
{
@ -135,13 +151,12 @@ public class DataWorkerThread extends Thread
{
OutputStream cmdOut = socket.getOutputStream();
InputStream cmdIn = socket.getInputStream();
PrintWriter out = new PrintWriter(cmdOut, true);
this.out = new PrintWriter(cmdOut, true);
BufferedInputStream in = new BufferedInputStream(cmdIn);
String inputLine, outputLine;
DoCommand dc = new DoCommand(theParent.svc);
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd-HH:mm:ss");
sRet = sdf.format(cal.getTime());
sRet += " trace output";

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

@ -60,7 +60,9 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.TimeZone;
import java.util.Timer;
import java.util.zip.Adler32;
import java.util.zip.CheckedInputStream;
@ -95,6 +97,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Build;
import android.os.Debug;
import android.os.Environment;
import android.os.StatFs;
import android.os.SystemClock;
@ -113,9 +116,9 @@ public class DoCommand {
ContextWrapper contextWrapper = null;
String currentDir = "/";
String sErrorPrefix = "##AGENT-ERROR## ";
String sErrorPrefix = "##AGENT-WARNING## ";
private final String prgVersion = "SUTAgentAndroid Version 0.80";
private final String prgVersion = "SUTAgentAndroid Version 0.85";
public enum Command
{
@ -128,6 +131,7 @@ public class DoCommand {
OS ("os"),
ID ("id"),
UPTIME ("uptime"),
SETTIME ("settime"),
SYSTIME ("systime"),
SCREEN ("screen"),
MEMORY ("memory"),
@ -215,10 +219,18 @@ public class DoCommand {
strReturn = prgVersion;
break;
case CLOK:
strReturn = GetClok();
break;
case UPDT:
strReturn = StartUpdateOMatic(Argv[1], Argv[2]);
break;
case SETTIME:
strReturn = SetSystemTime(Argv[1], Argv[2], cmdOut);
break;
case CWD:
try {
strReturn = new java.io.File(currentDir).getCanonicalPath();
@ -244,7 +256,7 @@ public class DoCommand {
if (Argc == 2)
strReturn = GetAppRoot(Argv[1]);
else
strReturn = sErrorPrefix + "Wrong number of arguments for cd command!";
strReturn = sErrorPrefix + "Wrong number of arguments for getapproot command!";
break;
case TESTROOT:
@ -1929,6 +1941,84 @@ public class DoCommand {
return (sRet);
}
public String SetSystemTime(String sDate, String sTime, OutputStream out)
{
// Debug.waitForDebugger();
String sRet = "";
// Intent prgIntent = new Intent(android.provider.Settings.ACTION_DATE_SETTINGS);
// prgIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// contextWrapper.startActivity(prgIntent);
// 2010/09/22
// 15:41:00
// 0123456789012345678
if (((sDate != null) && (sTime != null)) &&
(sDate.contains("/") || sDate.contains(".")) &&
(sTime.contains(":")))
{
int year = Integer.parseInt(sDate.substring(0,4));
int month = Integer.parseInt(sDate.substring(5,7));
int day = Integer.parseInt(sDate.substring(8,10));
int hour = Integer.parseInt(sTime.substring(0,2));
int mins = Integer.parseInt(sTime.substring(3,5));
int secs = Integer.parseInt(sTime.substring(6,8));
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
cal.set(year, month - 1, day, hour, mins, secs);
long lMillisecs = cal.getTime().getTime();
// boolean bRet = SystemClock.setCurrentTimeMillis(lMillisecs);
String sM = Long.toString(lMillisecs);
// long lm = 1285175618316L;
String sTest = cal.getTime().toGMTString();
String sMillis = sM.substring(0, sM.length() - 3) + "." + sM.substring(sM.length() - 3);
String [] theArgs = new String [3];
theArgs[0] = "su";
theArgs[1] = "-c";
theArgs[2] = "date -u " + sMillis;
try
{
pProc = Runtime.getRuntime().exec(theArgs);
RedirOutputThread outThrd = new RedirOutputThread(pProc, null);
outThrd.start();
outThrd.join(10000);
sRet = GetSystemTime();
}
catch (IOException e)
{
sRet = e.getMessage();
e.printStackTrace();
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else
{
sRet = "Invalid argument(s)";
}
return (sRet);
}
public String GetClok()
{
long lMillisecs = System.currentTimeMillis();
String sRet = "";
if (lMillisecs > 0)
sRet = Long.toString(lMillisecs);
return(sRet);
}
public String GetUptime()
{
String sRet = "";
@ -2140,6 +2230,9 @@ public class DoCommand {
try
{
// Tell all of the data channels we are rebooting
((ASMozStub)this.contextWrapper).SendToDataChannel("Rebooting ...");
pProc = Runtime.getRuntime().exec(theArgs);
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
outThrd.start();
@ -2551,6 +2644,9 @@ public class DoCommand {
"rebt - reboot device\n" +
"inst /path/filename.apk - install the referenced apk file\n" +
"uninst packagename - uninstall the referenced package\n" +
"updt pkgname pkgfile - unpdate the referenced package\n" +
"clok - the current device time expressed as the number of millisecs since epoch\n" +
"settime date time - sets the device date and time (YYYY/MM/DD HH:MM:SS)\n" +
"rebt - reboot device\n" +
"quit - disconnect SUTAgent\n" +
"exit - close SUTAgent\n" +

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

@ -66,6 +66,19 @@ public class RunDataThread extends Thread
{
bListening = false;
}
public void SendToDataChannel(String strToSend)
{
int nNumWorkers = theWorkers.size();
for (int lcv = 0; lcv < nNumWorkers; lcv++)
{
if (theWorkers.get(lcv).isAlive())
{
theWorkers.get(lcv).SendString(strToSend);
}
}
return;
}
public void run() {
try {

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

@ -65,6 +65,7 @@ import android.net.wifi.WifiManager;
import android.net.wifi.WifiManager.WifiLock;
import android.os.BatteryManager;
import android.os.Bundle;
import android.os.Debug;
import android.os.PowerManager;
import android.telephony.TelephonyManager;
import android.util.Log;
@ -133,7 +134,9 @@ public class SUTAgentAndroid extends Activity
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Debug.waitForDebugger();
// long lHeapSize = VMRuntime.getRuntime().getMinimumHeapSize();
// lHeapSize = 16000000;
// VMRuntime.getRuntime().setMinimumHeapSize(lHeapSize);

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

@ -587,6 +587,7 @@ GK_ATOM(mouseover, "mouseover")
GK_ATOM(mousethrough, "mousethrough")
GK_ATOM(mouseup, "mouseup")
GK_ATOM(moz_opaque, "moz-opaque")
GK_ATOM(x_moz_errormessage, "x-moz-errormessage")
GK_ATOM(msthemecompatible, "msthemecompatible")
GK_ATOM(multicol, "multicol")
GK_ATOM(multiple, "multiple")

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

@ -78,7 +78,16 @@ nsIConstraintValidation::GetValidationMessage(nsAString& aValidationMessage)
aValidationMessage.Truncate();
if (IsCandidateForConstraintValidation() && !IsValid()) {
if (GetValidityState(VALIDITY_STATE_CUSTOM_ERROR)) {
nsCOMPtr<nsIContent> content = do_QueryInterface(this);
NS_ASSERTION(content, "This class should be inherited by HTML elements only!");
nsAutoString authorMessage;
content->GetAttr(kNameSpaceID_None, nsGkAtoms::x_moz_errormessage,
authorMessage);
if (!authorMessage.IsEmpty()) {
aValidationMessage.Assign(authorMessage);
} else if (GetValidityState(VALIDITY_STATE_CUSTOM_ERROR)) {
aValidationMessage.Assign(mCustomValidity);
} else if (GetValidityState(VALIDITY_STATE_TOO_LONG)) {
GetValidationMessage(aValidationMessage, VALIDITY_STATE_TOO_LONG);

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

@ -230,6 +230,7 @@ _TEST_FILES = \
test_bug557087-4.html \
test_bug557087-5.html \
test_bug557087-6.html \
test_bug600155.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=600155
-->
<head>
<title>Test for Bug 600155</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=600155">Mozilla Bug 600155</a>
<p id="display"></p>
<div id='content' style='display:none;'>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 600155 **/
var subjectForConstraintValidation = [ "button", "input", "select", "textarea" ];
var content = document.getElementById('content');
for each (var eName in subjectForConstraintValidation) {
var e = document.createElement(eName);
content.appendChild(e);
e.setAttribute("x-moz-errormessage", "foo");
if ("required" in e) {
e.required = true;
} else {
e.setCustomValidity("bar");
}
// At this point, the element is invalid.
is(e.validationMessage, "foo",
"the validation message should be the author one");
content.removeChild(e);
}
</script>
</pre>
</body>
</html>

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

@ -3,25 +3,32 @@
<head>
<title>postMessage chrome message receiver</title>
<script type="application/javascript">
var gPrePath = "";
function receiveMessage(evt)
{
// Content cannot post to chrome without privileges
window.parent.postMessage("SHOULD NOT GET THIS!", "*");
if (evt.data.substring(0,9) == "chrome://") {
gPrePath = evt.data;
respond("path-is-set");
} else {
// Content cannot post to chrome without privileges
window.parent.postMessage("SHOULD NOT GET THIS!", "*");
var msg = "post-to-content-response";
var msg = "post-to-content-response";
if (evt.source !== null)
msg += " wrong-source(" + evt.source + ")";
if (!evt.isTrusted)
msg += " unexpected-untrusted-event";
if (evt.type !== "message")
msg += " wrong-type(" + evt.type + ")";
if (evt.origin !== "chrome://mochikit")
msg += " wrong-origin(" + evt.origin + ")";
if (evt.data !== "post-to-content")
msg += " wrong-message(" + evt.data + ")";
if (evt.source !== null)
msg += " wrong-source(" + evt.source + ")";
if (!evt.isTrusted)
msg += " unexpected-untrusted-event";
if (evt.type !== "message")
msg += " wrong-type(" + evt.type + ")";
if (evt.origin !== gPrePath)
msg += " wrong-origin(" + evt.origin + ")";
if (evt.data !== "post-to-content")
msg += " wrong-message(" + evt.data + ")";
respond(msg);
respond(msg);
}
}
function respond(msg)

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

@ -45,6 +45,10 @@ function messageReceiver(evt)
switch (evt.data)
{
case "path-is-set":
chromePathIsSet(evt);
break;
case "post-to-self":
checkSelf(evt);
break;
@ -73,11 +77,16 @@ function checkSelf(evt)
is(evt.origin, prepath, "wrong origin for chrome: URL");
is(evt.source, null, "chrome posters get a null source, for security");
window.frames.contentDomain.postMessage(prepath, "*");
}
function chromePathIsSet(evt)
{
window.frames.contentDomain.postMessage("post-to-content",
"http://example.org");
}
/*************
* RECEIVERS *
*************/

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

@ -9,7 +9,7 @@
title="bug 514732 test">
<script type="application/javascript"
src="chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
src="chrome://mochikit/content/tests/SimpleTest/docshell_helpers.js">
</script>
<script type="application/javascript"><![CDATA[

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

@ -14,8 +14,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=514732
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
src= "chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
</script>
<body xmlns="http://www.w3.org/1999/xhtml">

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

@ -5,7 +5,9 @@ const Cu = Components.utils;
const RELATIVE_DIR = "modules/libpr0n/test/browser/";
const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
const TESTROOT2 = "http://example.org/browser/" + RELATIVE_DIR;
const CHROMEROOT = "chrome://mochikit/content/browser/" + RELATIVE_DIR;
var chrome_root = getRootDirectory(gTestPath);
const CHROMEROOT = chrome_root;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

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

@ -51,6 +51,19 @@ DIRS = MochiKit \
ssltunnel \
$(NULL)
NO_JS_MANIFEST = 1
MOZ_CHROME_FILE_FORMAT = jar
DIST_FILES = install.rdf
# Used in install.rdf
USE_EXTENSION_MANIFEST = 1
XPI_NAME = mochijar
# we turn this off for UNIVERSAL_BINARY
CHROME_JAR = 1
include $(topsrcdir)/config/rules.mk
# We're installing to _tests/testing/mochitest, so this is the depth
# necessary for relative objdir paths.
@ -108,6 +121,9 @@ _HANDSHAKE_FILES = \
_DEST_DIR = $(DEPTH)/_tests/$(relativesrcdir)
libs::
(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - mochijar) | (cd $(_DEST_DIR) && tar -xf -)
libs:: $(_PYWEBSOCKET_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(_DEST_DIR)/pywebsocket
@ -175,6 +191,25 @@ endif
PKG_STAGE = $(DIST)/test-package-stage
DIST_BIN = $(DIST)/bin
PKG_CHROMEJAR = $(PKG_STAGE)/mochitest/content/
ifdef CHROME_JAR
stage-chromejar:
$(NSINSTALL) -D $(PKG_CHROMEJAR)
cp -RL $(DEPTH)/_tests/testing/mochitest/browser $(PKG_CHROMEJAR)
cp -RL $(DEPTH)/_tests/testing/mochitest/chrome $(PKG_CHROMEJAR)
ifdef ACCESSIBILITY
cp -RL $(DEPTH)/_tests/testing/mochitest/a11y $(PKG_CHROMEJAR)
endif
@(cd $(PKG_STAGE)/mochitest && zip -r tests.jar content/)
@(rm -rf $(PKG_CHROMEJAR))
stage-package: stage-chromejar
endif
$(_DEST_DIR):
$(NSINSTALL) -D $@
stage-package:
$(NSINSTALL) -D $(PKG_STAGE)/mochitest && $(NSINSTALL) -D $(PKG_STAGE)/bin/plugins
@(cd $(DEPTH)/_tests/testing/mochitest/ && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/mochitest && tar -xf -)

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

@ -208,15 +208,31 @@
// Returns an array of browserTest objects for all the selected tests
function listTests() {
var baseURL = 'chrome://mochitests/content';
var testsURI = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("ProfD", Components.interfaces.nsILocalFile);
testsURI.append("tests.manifest");
var ioSvc = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
var manifestFile = ioSvc.newFileURI(testsURI)
.QueryInterface(Components.interfaces.nsIFileURL).file;
Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar).
autoRegister(manifestFile);
// load server.js in so we can share template functions
var scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
var srvScope = {};
var baseURL = 'chrome://mochikit/content';
scriptLoader.loadSubScript('chrome://mochikit/content/server.js', srvScope);
var [links, singleTestPath] = getFileListing(baseURL, gConfig.testPath, "browser", srvScope);
var jar = getJar(baseURL);
if (jar != null) {
var [links, singleTestPath] = getMochitestJarListing(baseURL, gConfig.testPath, "browser");
} else {
var [links, singleTestPath] = getFileListing(baseURL, gConfig.testPath, "browser", srvScope);
}
var fileNames = [];
var fileNameRegexp = /browser_.+\.js$/;

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

@ -108,6 +108,9 @@ function getMochitestJarListing(basePath, testPath, dir)
var fileName = fileHandler.getFileFromURLSpec(getResolvedURI(basePath).JARFile.spec);
zReader.open(fileName);
//hardcoded 'content' as that is the root dir in the mochikit.jar file
var idx = basePath.indexOf('/content');
var basePath = basePath.slice(0, idx);
var base = "content/" + dir + "/";
var singleTestPath;
@ -119,7 +122,7 @@ function getMochitestJarListing(basePath, testPath, dir)
if (pathEntry.isDirectory) {
base = pathToCheck;
} else {
singleTestPath = '/' + base + testPath;
singleTestPath = basePath + '/' + base + testPath;
var singleObject = {};
singleObject[singleTestPath] = true;
return [singleObject, singleTestPath];
@ -129,7 +132,7 @@ function getMochitestJarListing(basePath, testPath, dir)
base = pathToCheck + "/";
}
}
var [links, count] = zList(base, zReader, true);
var [links, count] = zList(base, zReader, basePath, true);
return [links, null];
}
@ -143,7 +146,7 @@ function getMochitestJarListing(basePath, testPath, dir)
* returns:
* [json object of {dir:{subdir:{file:true, file:true, ...}}}, count of tests]
*/
function zList(base, zReader, recurse) {
function zList(base, zReader, baseJarName, recurse) {
var dirs = zReader.findEntries(base + "*");
var links = {};
var count = 0;
@ -162,12 +165,12 @@ function zList(base, zReader, recurse) {
var myFile = fileArray[i];
if (myFile.substr(-1) === '/' && recurse) {
var childCount = 0;
[links[myFile], childCount] = zList(myFile, zReader, recurse);
[links[myFile], childCount] = zList(myFile, zReader, baseJarName, recurse);
count += childCount;
} else {
if (myFile.indexOf("SimpleTest") == -1) {
//we add the '/' so we don't try to run content/content/chrome
links['/' + myFile] = true;
links[baseJarName + '/' + myFile] = true;
}
}
}
@ -234,8 +237,14 @@ function getRootDirectory(path, chromeURI) {
chromeURI = getChromeURI(path);
}
var myURL = chromeURI.QueryInterface(Components.interfaces.nsIURL);
var mydir = myURL.directory;
return chromeURI.prePath + myURL.directory;
if (mydir.match('/$') != '/')
{
mydir += '/';
}
return chromeURI.prePath + mydir;
}
//used by tests to determine their directory based off window.location.path
@ -277,7 +286,7 @@ function extractJarToTmp(jar) {
tmpdir.append("mochikit.tmp");
// parseInt is used because octal escape sequences cause deprecation warnings
// in strict mode (which is turned on in debug builds)
tmpdir.createUnique(Components.interfaces.nsIFile.DIRECTORY_TYPE, parseInt("0777", 8));
tmpdir.createUnique(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777);
var zReader = Components.classes["@mozilla.org/libjar/zip-reader;1"].
createInstance(Components.interfaces.nsIZipReader);
@ -305,7 +314,7 @@ function extractJarToTmp(jar) {
var targetDir = buildRelativePath(dirs.getNext(), tmpdir, filepath);
// parseInt is used because octal escape sequences cause deprecation warnings
// in strict mode (which is turned on in debug builds)
targetDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, parseInt("0777", 8));
targetDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777);
}
//now do the files

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

@ -17,76 +17,59 @@
src="chrome://mochikit/content/tests/SimpleTest/quit.js" />
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/setup.js" />
<script type="application/javascript"
src="chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript;version=1.7"><![CDATA[
function loadTests()
{
window.removeEventListener("load", loadTests, false);
var dir = document.documentElement.getAttribute('directory');
var url = "chrome://mochikit/content/" + dir + "/";
// Find our chrome dir
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var chromeURI = ios.newURI("chrome://mochikit/content/",
null, null);
var resolvedURI = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry).
convertChromeURL(chromeURI);
var fileHandler = Cc["@mozilla.org/network/protocol;1?name=file"].
getService(Ci.nsIFileProtocolHandler);
var chromeDir = fileHandler.getFileFromURLSpec(resolvedURI.spec);
chromeDir = chromeDir.parent.QueryInterface(Ci.nsILocalFile);
chromeDir.appendRelativePath(dir);
function loadTests()
{
window.removeEventListener("load", loadTests, false);
var singleTestPath;
if ("testPath" in params && params.testPath) {
var extraPath = params.testPath;
var pathToCheck = chromeDir.clone().QueryInterface(Ci.nsILocalFile);
var pathIsFile = false;
try {
var pathParts = extraPath.toString().split("/");
for each (var part in pathParts) {
pathToCheck.append(part);
}
if (pathToCheck.isDirectory()) {
for each (var part in pathParts) {
chromeDir.append(part);
}
url += extraPath + "/";
}
else {
pathIsFile = true;
}
}
catch (e) {
pathIsFile = true;
}
if (pathIsFile) {
singleTestPath = url + params.testPath;
}
}
// load server.js in so we can share template functions
var scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
var srvScope = {};
scriptLoader.loadSubScript("chrome://mochikit/content/server.js",
srvScope);
var baseurl = 'chrome://mochitests/content';
var testsURI = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("ProfD", Components.interfaces.nsILocalFile);
testsURI.append("tests.manifest");
var ioSvc = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
var manifestFile = ioSvc.newFileURI(testsURI)
.QueryInterface(Components.interfaces.nsIFileURL).file;
// generate our test list
srvScope.makeTags();
var [links, count] = srvScope.list(url, chromeDir, true);
var tableContent = srvScope.linksToTableRows(links, 0);
function populate() {
$("test-table").innerHTML += tableContent;
}
gTestList = eval(srvScope.jsonArrayOfTestFiles(links));
populate();
hookup();
Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar).
autoRegister(manifestFile);
// if we got passed a test path, just run that single test
if (singleTestPath)
window.location.href = singleTestPath;
}
var dir = document.documentElement.getAttribute('directory');
// load server.js in so we can share template functions
var scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
var srvScope = {};
scriptLoader.loadSubScript('chrome://mochikit/content/server.js',
srvScope);
// generate our test list
srvScope.makeTags();
var singleTestPath;
var links;
if (getResolvedURI(baseurl).JARFile) {
[links, singleTestPath] = getMochitestJarListing(baseurl, params.testPath, dir);
} else {
[links, singleTestPath] = getFileListing(baseurl, params.testPath, dir, srvScope);
}
var tableContent = srvScope.linksToTableRows(links, 0);
function populate() {
$("test-table").innerHTML += tableContent;
}
gTestList = eval(srvScope.jsonArrayOfTestFiles(links));
populate();
hookup();
if (singleTestPath)
window.location.href = singleTestPath;
}
window.addEventListener("load", loadTests, false);
]]>

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

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>mochikit@mozilla.org</em:id>
<em:version>1.0</em:version>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
#expand <em:minVersion>__MOZILLA_VERSION_U__</em:minVersion>
#expand <em:maxVersion>__MOZILLA_VERSION_U__</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Mochitest</em:name>
<em:description>Mochikit test harness</em:description>
<em:creator>Joel Maher</em:creator>
</Description>
</RDF>

39
testing/mochitest/jar.mn Normal file
Просмотреть файл

@ -0,0 +1,39 @@
mochikit.jar:
% content mochikit %content/
content/browser-harness.xul (browser-harness.xul)
content/browser-test.js (browser-test.js)
content/browser-test-overlay.xul (browser-test-overlay.xul)
content/chrome-harness.js (chrome-harness.js)
content/harness-a11y.xul (harness-a11y.xul)
content/harness-overlay.xul (harness-overlay.xul)
content/harness.xul (harness.xul)
content/ipc.js (ipc.js)
content/ipc-overlay.xul (ipc-overlay.xul)
content/mozprefs.js (mozprefs.js)
content/redirect-a11y.html (redirect-a11y.html)
content/redirect.html (redirect.html)
content/redirect.js (redirect.js)
content/server.js (server.js)
content/dynamic/getMyDirectory.sjs (dynamic/getMyDirectory.sjs)
content/static/bug100533_iframe.html (static/bug100533_iframe.html)
content/static/bug100533_load.html (static/bug100533_load.html)
content/static/bug277724_iframe1.html (static/bug277724_iframe1.html)
content/static/bug277724_iframe2.xhtml (static/bug277724_iframe2.xhtml)
content/static/bug340800_iframe.txt (static/bug340800_iframe.txt)
content/static/bug344830_testembed.svg (static/bug344830_testembed.svg)
content/static/harness.css (static/harness.css)
content/static/nnc_lockup.gif (static/nnc_lockup.gif)
content/tests/SimpleTest/EventUtils.js (tests/SimpleTest/EventUtils.js)
content/tests/SimpleTest/MozillaFileLogger.js (tests/SimpleTest/MozillaFileLogger.js)
content/tests/SimpleTest/PluginUtils.js (tests/SimpleTest/PluginUtils.js)
content/tests/SimpleTest/quit.js (tests/SimpleTest/quit.js)
content/tests/SimpleTest/setup.js (tests/SimpleTest/setup.js)
content/tests/SimpleTest/SimpleTest.js (tests/SimpleTest/SimpleTest.js)
content/tests/SimpleTest/test.css (tests/SimpleTest/test.css)
content/tests/SimpleTest/TestRunner.js (tests/SimpleTest/TestRunner.js)
content/tests/SimpleTest/WindowSnapshot.js (tests/SimpleTest/WindowSnapshot.js)
content/tests/SimpleTest/mockObjects.js (../../toolkit/content/tests/browser/common/mockObjects.js)
content/tests/SimpleTest/docshell_helpers.js (../..//docshell/test/chrome/docshell_helpers.js)
content/MochiKit/packed.js (MochiKit/packed.js)

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

@ -42,6 +42,7 @@
Runs the Mochitest test harness.
"""
from __future__ import with_statement
from datetime import datetime
import optparse
import os
@ -343,7 +344,7 @@ class MochitestServer:
c.close()
rtncode = self._process.poll()
if (rtncode == None):
if rtncode is None:
self._process.terminate()
except:
self._process.kill()
@ -568,16 +569,18 @@ class Mochitest(object):
self.leak_report_file = os.path.join(options.profilePath, "runtests_leaks.log")
browserEnv = self.buildBrowserEnv(options)
if (browserEnv == None):
if browserEnv is None:
return 1
manifest = self.buildProfile(options)
if manifest is None:
return 1
self.startWebServer(options)
self.startWebSocketServer(options)
testURL = self.buildTestPath(options)
self.buildURLOptions(options)
if (len(self.urlOpts) > 0):
if len(self.urlOpts) > 0:
testURL += "?" + "&".join(self.urlOpts)
# Remove the leak detection file so it can't "leak" to the tests run.
@ -615,7 +618,8 @@ class Mochitest(object):
processLeakLog(self.leak_report_file, options.leakThreshold)
self.automation.log.info("\nINFO | runtests.py | Running tests: end.")
self.cleanup(manifest, options)
if manifest is not None:
self.cleanup(manifest, options)
return status
def makeTestConfig(self, options):
@ -673,27 +677,53 @@ toolbar#nav-bar {
temp_file = os.path.join(tempfile.mkdtemp(), "mochikit.manifest")
manifestFile = open(temp_file, "w")
manifestFile.write("content mochikit " + chrometestDir + " contentaccessible=yes\n")
browser_chrome = ""
if options.browserChrome:
manifestFile.write("""overlay chrome://navigator/content/navigator.xul chrome://mochikit/content/browser-test-overlay.xul
browser_chrome = """overlay chrome://navigator/content/navigator.xul chrome://mochikit/content/browser-test-overlay.xul
overlay chrome://browser/content/browser.xul chrome://mochikit/content/browser-test-overlay.xul
""")
elif ((options.chrome == False) and (options.a11y == False)):
"""
elif (options.chrome == False) and (options.a11y == False):
#only do the ipc-overlay.xul for mochitest-plain.
#Currently there are focus issues in chrome tests and issues with new windows and dialogs when using ipc
manifestFile.write("overlay chrome://browser/content/browser.xul chrome://mochikit/content/ipc-overlay.xul")
browser_chrome += "overlay chrome://browser/content/browser.xul chrome://mochikit/content/ipc-overlay.xul\n"
jarDir = 'mochijar'
if not os.path.exists(os.path.join(self.SCRIPT_DIRECTORY, jarDir)):
print "TEST-UNEXPECTED-FAIL | invalid setup: missing mochikit extension"
return None
if self.installTestsJar(options):
manifestFile.write("content mochitests jar:tests.jar!/content/\n");
else:
manifestFile.write("content mochitests %s contentaccessible=yes\n" % chrometestDir)
self.installChromeJar(jarDir, browser_chrome, options)
manifestFile.close()
return self.installChromeFile(temp_file, options)
def installChromeJar(self, jarDirName, browser_chrome, options):
"""
copy mochijar directory to profile as an extension so we have chrome://mochikit for all harness code
"""
jarDir = os.path.join(options.profilePath, 'extensions', 'mochikit@mozilla.org')
shutil.copytree(os.path.join(self.SCRIPT_DIRECTORY, jarDirName), jarDir)
with open(os.path.join(jarDir, "chrome.manifest"), 'a') as mfile:
mfile.write(browser_chrome)
return jarDir
def installTestsJar(self, options):
""" copy tests.jar to the profile directory so we can auto register it in the .xul harness """
if os.path.exists(os.path.join(self.SCRIPT_DIRECTORY, 'tests.jar')):
shutil.copy(os.path.join(self.SCRIPT_DIRECTORY, 'tests.jar'), options.profilePath)
return True
return False
def installChromeFile(self, filename, options):
(path, leaf) = os.path.split(options.app)
manifestdir = os.path.join(path, "distribution", "bundles", "mochitest")
if not os.path.exists(manifestdir):
os.makedirs(manifestdir)
manifest = os.path.join(manifestdir, "chrome.manifest")
""" copy tests.manifest to the profile directory so we can auto register with tests.jar """
manifest = os.path.join(options.profilePath, 'tests.manifest')
shutil.copy(filename, manifest)
return manifest

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

@ -458,7 +458,12 @@ function isTest(filename, pattern)
if (pattern)
return pattern.test(filename);
return filename.indexOf("test_") > -1 &&
// File name is a URL style path to a test file, make sure that we check for
// tests that start with test_.
testPattern = /^test_/;
pathPieces = filename.split('/');
return testPattern.test(pathPieces[pathPieces.length - 1]) &&
filename.indexOf(".js") == -1 &&
filename.indexOf(".css") == -1 &&
!/\^headers\^$/.test(filename);

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

@ -55,6 +55,7 @@ _SIMPLETEST_FILES = MozillaFileLogger.js \
WindowSnapshot.js \
PluginUtils.js \
$(DEPTH)/toolkit/content/tests/browser/common/mockObjects.js \
$(DEPTH)/docshell/test/chrome/docshell_helpers.js \
$(NULL)
libs:: $(_SIMPLETEST_FILES)

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

@ -142,8 +142,13 @@ PKG_STAGE = $(DIST)/universal/test-package-stage
endif
package-tests:
$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
@rm -f "$(DIST)/$(PKG_PATH)$(TEST_PACKAGE)"
ifndef UNIVERSAL_BINARY
$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
else
#building tests.jar (bug 543800) fails on unify, so we build tests.jar after unify is run
$(MAKE) -C $(DEPTH)/testing/mochitest stage-chromejar PKG_STAGE=$(DIST)/universal
endif
cd $(PKG_STAGE) && \
zip -r9D "$(call core_abspath,$(DIST)/$(PKG_PATH)$(TEST_PACKAGE))" *

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

@ -1,10 +1,5 @@
content rtlchrome /content
content rtlchrome /
# Override intl.css with our own CSS file
override chrome://global/locale/intl.css chrome://rtlchrome/rtl.css
override chrome://global/locale/global.dtd chrome://rtlchrome/rtl.dtd
# Override intl.css with our own CSS file
override chrome://global/locale/intl.css chrome://mochikit/content/chrome/toolkit/content/tests/chrome/rtlchrome/rtl.css
override chrome://global/locale/global.dtd chrome://mochikit/content/chrome/toolkit/content/tests/chrome/rtlchrome/rtl.dtd

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

@ -3,7 +3,7 @@ var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
var rootDir = getRootDirectory(gTestPath);
scriptLoader.loadSubScript(rootDir + "/aboutcrashes_utils.js", this);
scriptLoader.loadSubScript(rootDir + "aboutcrashes_utils.js", this);
function check_crash_list(tab, crashes) {
let doc = gBrowser.getBrowserForTab(tab).contentDocument;

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

@ -3,7 +3,7 @@ var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
var rootDir = getRootDirectory(gTestPath);
scriptLoader.loadSubScript(rootDir + "/aboutcrashes_utils.js", this);
scriptLoader.loadSubScript(rootDir + "aboutcrashes_utils.js", this);
function cleanup_and_finish() {
try {

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

@ -3,7 +3,7 @@ var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
var rootDir = getRootDirectory(gTestPath);
scriptLoader.loadSubScript(rootDir + "/aboutcrashes_utils.js", this);
scriptLoader.loadSubScript(rootDir + "aboutcrashes_utils.js", this);
function check_clear_visible(tab, aVisible) {
let doc = gBrowser.getBrowserForTab(tab).contentDocument;

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an install succeeds when authentication is required

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an install fails when authentication is required and bad

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an install fails when authentication is required and it is

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an install fails when an invalid hash is included

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an install fails when an unknown hash type is included

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests that calling InstallTrigger.installChrome works

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests that cancelling an in progress download works.

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests that starting a download from chrome works and bypasses the whitelist

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

@ -1,7 +1,10 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test that an install that requires cookies to be sent fails when no cookies

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

@ -1,7 +1,10 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test that an install that requires cookies to be sent succeeds when cookies

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test that an install that requires cookies to be sent succeeds when cookies

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test that an install that requires cookies to be sent fails when cookies

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an install fails when the xpi is corrupt.

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an install fails when there is no install script present.

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an InstallTrigger.enabled is working

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an InstallTrigger.enabled is working

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an InstallTrigger.install call fails when xpinstall is disabled

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an install succeeds when a valid hash is included

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests that calling InstallTrigger.installChrome works

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing an local file works when loading the url

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an install fails if the url is a local file when requested from

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests that navigating away from the initiating page during the install

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests that closing the initiating page during the install doesn't break the

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests that going offline cancels an in progress download.

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an install succeeds when the progress dialog is already open.

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing two signed add-ons in the same trigger works.

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests that the correct signer is presented for combinations of O and CN present.

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing a signed add-on that has been tampered with after signing.

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing an signed add-on through an InstallTrigger call in web

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing an add-on signed by an untrusted certificate through an

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing an signed add-on by navigating directly to the url

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests that calling InstallTrigger.startSoftwareUpdate works

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing an unsigned add-on through an InstallTrigger call in web

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing an unsigned add-on by navigating directly to the url

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing an unsigned add-on through an InstallTrigger call in web

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing an unsigned add-on through an InstallTrigger call in web

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing an unsigned add-on through a navigation. Should not be

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing an unsigned add-on through a navigation. Should be

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing an unsigned add-on through a startSoftwareUpdate call in web

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

@ -1,7 +1,9 @@
// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Tests installing an unsigned add-on through an installChrome call in web

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

@ -1,10 +1,20 @@
const TESTROOT = "http://example.com/browser/xpinstall/tests/";
const TESTROOT2 = "http://example.org/browser/xpinstall/tests/";
const CHROMEROOT = "chrome://mochikit/content/browser/xpinstall/tests/"
const XPINSTALL_URL = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
const PROMPT_URL = "chrome://global/content/commonDialog.xul";
const ADDONS_URL = "chrome://mozapps/content/extensions/extensions.xul";
var rootDir = getRootDirectory(gTestPath);
var path = rootDir.split('/');
var chromeName = path[0] + '//' + path[2];
var croot = chromeName + "/content/browser/xpinstall/tests/";
var jar = getJar(croot);
if (jar) {
var tmpdir = extractJarToTmp(jar);
croot = 'file://' + tmpdir.path + '/';
}
const CHROMEROOT = croot;
/**
* This is a test harness designed to handle responding to UI during the process
* of installing an XPI. A test can set callbacks to hear about specific parts