add some sample JavaScript tests

This commit is contained in:
alecf%netscape.com 1999-06-06 22:37:16 +00:00
Родитель bf275d9579
Коммит a87959f18b
3 изменённых файлов: 91 добавлений и 0 удалений

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

@ -0,0 +1,30 @@
function displayAccounts() {
dump("Here come the accounts: \n");
var msg = Components.classes["component://netscape/messenger/services/session"].getService(Components.interfaces.nsIMsgMailSession);
var am = msg.accountManager;
var servers = am.allServers;
for (var i=0; i< servers.Count(); i++) {
var serverSupports = servers.GetElementAt(i);
var server = serverSupports.QueryInterface(Components.interfaces.nsIMsgIncomingServer);
dump("Account: " + server.key + "\n");
describe(server, "\t" + server.key);
}
}
function describe(object, name) {
for (var i in object) {
var value = object[i];
if (typeof(object[i]) == "function")
value = "[function]";
dump(name + "." + i + " = " + value + "\n");
}
}

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

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/" type="text/css"?>
<!DOCTYPE window>
<window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:html>
<html:script language="JavaScript" src="AccountManagerTest.js"/>
<html:script>
displayAccounts();
</html:script>
After JS.
</html:html>
</window>

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

@ -0,0 +1,42 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../../..
topsrcdir = @top_srcdir@
VPATH = @srcdir@
srcdir = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk
SAMPLES_DIR = $(DIST)/bin/res/mailnews/tests
EXPORT_RESOURCE_SAMPLES = \
AccountManagerTest.xul \
AccountManagerTest.js \
$(NULL)
EXPORT_RESOURCE_SAMPLES_TO_REMOVE := $(addprefix $(SAMPLES_DIR)/, $(EXPORT_RESOURCE_SAMPLES))
install::
$(INSTALL) $(EXPORT_RESOURCE_SAMPLES) $(SAMPLES_DIR)
clobber::
$(RM) $(EXPORT_RESOURCE_SAMPLES_TO_REMOVE)