dding new files for Java Plugins

This commit is contained in:
rpallath%eng.sun.com 2000-03-17 00:17:17 +00:00
Родитель 1448dfcab2
Коммит f53326f27d
548 изменённых файлов: 25203 добавлений и 0 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,62 @@
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=../../../../../..
BUILD_DIR=$(DEPTH)/build
BUILD_DIR_CLASSES=$(BUILD_DIR)/classes
JAVAC=javac
BASIC_PATH=org/mozilla/pluglet/test/basic
CLASSPATH=$(MOZILLA_FIVE_HOME)/../classes:$(BUILD_DIR_CLASSES)
TEST_DIRS=api params security returns scenario
all: basic tests
tests:
@if [ -z $(HTML_ROOT_DIR) ] ; then \
echo "======================================"; \
echo "Error. You MUST specify \$HTML_ROOT_DIR"; \
echo "variable for make in test dirs."; \
echo "======================================"; \
exit -1; \
fi
@for i in $(TEST_DIRS) ;do \
cd $$i;$(MAKE) $(MAKE_ARGS); cd ..;\
done
basic: classes TestLoaderPluglet.jar
classes:
@echo "Building .basic classes ..."
@$(JAVAC) -d $(BUILD_DIR_CLASSES) *.java
@echo done
#$(JDKHOME)/bin/jar cfm
TestLoaderPluglet.jar: classes add_files
@cd $(BUILD_DIR_CLASSES);$(JDKHOME)/bin/jar cfm \
$(BASIC_PATH)/TestLoaderPluglet.jar \
$(BASIC_PATH)/manifest \
$(BASIC_PATH)/*.class
add_files:
@cp -f manifest $(BUILD_DIR_CLASSES)/$(BASIC_PATH)
clobber:
@cd $(BUILD_DIR_CLASSES)/$(BASIC_PATH);rm -f *.class *.jar manifest
@$(MAKE) tests MAKE_ARGS=$@

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,92 @@
basic/scenario/1
basic/scenario/2
basic/scenario/3
basic/scenario/4
basic/scenario/5
basic/scenario/8
basic/scenario/9
basic/scenario/fr1
basic/scenario/fr2
basic/scenario/fr3
basic/params/Pluglet_createPlugletInstance_mimeType_1
basic/params/Pluglet_createPlugletInstance_mimeType_2
basic/params/Pluglet_createPlugletInstance_mimeType_3
basic/params/Pluglet_createPlugletInstance_mimeType_4
basic/params/Pluglet_createPlugletInstance_mimeType_5
basic/params/Pluglet_createPlugletInstance_mimeType_6
basic/params/PlugletStreamListener_onDataAvailable_input_1
basic/params/PlugletStreamListener_onDataAvailable_input_2
basic/params/PlugletStreamListener_onDataAvailable_input_3
basic/params/PlugletStreamListener_onDataAvailable_input_4
basic/params/PlugletStreamListener_onDataAvailable_input_5
basic/params/PlugletStreamListener_onDataAvailable_input_6
basic/params/PlugletStreamListener_onDataAvailable_input_7
basic/params/PlugletStreamListener_onDataAvailable_input_8
basic/params/PlugletStreamListener_onDataAvailable_input_9
basic/params/PlugletStreamListener_onDataAvailable_input_10
basic/returns/Pluglet_createPlugletInstance
basic/returns/PlugletInstance_newStream
basic/security/DeleteFileTest
basic/security/GetClipboardTest
basic/security/GetSysPropsTest
basic/security/OpenWinTest
basic/security/PrintTest
basic/security/ReadFileTest
basic/security/RemoteConnectTest
basic/security/RunProgramTest
basic/security/WriteFileTest
basic/security/automation/SecTestCanRead
basic/security/automation/SecTestCanWrite
basic/security/automation/SecTestClipboard
basic/security/automation/SecTestDelete
basic/security/automation/SecTestEnv
basic/security/automation/SecTestExists
basic/security/automation/SecTestFileDescriptorIn
basic/security/automation/SecTestFileDescriptorOut
basic/security/automation/SecTestFileInputStream
basic/security/automation/SecTestFileOutputStream
basic/security/automation/SecTestGetAbsolutePath
basic/security/automation/SecTestGetCanonicalPath
basic/security/automation/SecTestGetContent
basic/security/automation/SecTestGetParent
basic/security/automation/SecTestGetPath
basic/security/automation/SecTestGetProps
basic/security/automation/SecTestGetSecMgr
basic/security/automation/SecTestIsDirectory
basic/security/automation/SecTestIsFile
basic/security/automation/SecTestLastModified
basic/security/automation/SecTestLength
basic/security/automation/SecTestList
basic/security/automation/SecTestListJSFilter
basic/security/automation/SecTestMkdir
basic/security/automation/SecTestMkdirs
basic/security/automation/SecTestOpenConx
basic/security/automation/SecTestPrintStream
basic/security/automation/SecTestRandomAccess
basic/security/automation/SecTestRandomAccessRW
basic/security/automation/SecTestRenameTo
basic/security/automation/SecTestRunExec
basic/security/automation/SecTestRunExit
basic/security/automation/SecTestRunLoad
basic/security/automation/SecTestRunLoadLib
basic/security/automation/SecTestSetSecMgr
basic/security/automation/SecTestSocket
basic/security/automation/SecTestSysExit
basic/security/automation/SecTestURLFac
basic/security/automation/SecTestXAccept
basic/security/automation/SecTestXAccess
basic/security/automation/SecTestXAccessTG
basic/security/automation/SecTestXAccessTop
basic/security/automation/SecTestXCCL
basic/security/automation/SecTestXConn
basic/security/automation/SecTestXDelete
basic/security/automation/SecTestXExec
basic/security/automation/SecTestXExit
basic/security/automation/SecTestXLink
basic/security/automation/SecTestXListen
basic/security/automation/SecTestXPakAcc
basic/security/automation/SecTestXPakDef
basic/security/automation/SecTestXPropAcc
basic/security/automation/SecTestXRead
basic/security/automation/SecTestXSetFac
basic/security/automation/SecTestXWrite

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

@ -0,0 +1,27 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic;
public interface Test {
public void execute(TestContext context);
}

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

@ -0,0 +1,334 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic;
import java.util.*;
import java.io.*;
import org.mozilla.pluglet.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.util.*;
public class TestContext {
public static String TEST_PARAMETERS_FILE_NAME = "TestProperties";
public static String COMMON_PROPERTIES_FILE_NAME = "CommonProperties";
public static String START_PROPERTIES_FILE_NAME = "StartProperties";
public static String LOG_FILE_NAME_PROP_NAME = "LOG_FILE";
public static String RESULT_FILE_NAME_PROP_NAME = "RESULT_FILE";
public static String TEST_TOP_DIR_PROP_NAME = "TEST_TOP_DIR";
public static String TEST_DIR_PROP_NAME = "TEST_DIR";
public static int FAILED = 0;
public static int NOT_DEF = 1;
public static int PASSED = 3;
private static String logFile;
private static String resFile;
private static int result = NOT_DEF;
private static String tmpString;
private static String tmpFile;
private static boolean tmpFromStart;
TestLoaderPluglet plugletFactory = null;
String mimeType = null;
Pluglet plugletInstance = null;
PlugletStreamListener plugletStreamListener = null;
PlugletManager pm = null;
PlugletPeer peer = null;
PlugletStreamInfo plugletStreamInfo = null;
InputStream is = null;
int length;
String fileName = null;
int status;
int streamType;
TestStage stage = null;
TestDescr descr = null;
Vector parameters = null;
Properties props = new Properties();
public TestContext() {
}
public void initialize() {
try {
File propsFile = new File(START_PROPERTIES_FILE_NAME);
props.load(new FileInputStream(propsFile));
propsFile = new File(getTopDir() + "/config/" + COMMON_PROPERTIES_FILE_NAME);
props.load(new FileInputStream(propsFile));
logFile = props.getProperty(LOG_FILE_NAME_PROP_NAME);
resFile = props.getProperty(RESULT_FILE_NAME_PROP_NAME);
propsFile = new File(getTestDir() + "/" + TEST_PARAMETERS_FILE_NAME);
props.load(new FileInputStream(propsFile));
} catch (Exception e) {
printLog("Cann't load properties file - exception:");
printLog(e.getMessage());
e.printStackTrace();
}
descr = new TestDescr();
descr.initialize(props, this);
}
public TestContext getCopy() {
TestContext tc = new TestContext();
tc.plugletFactory = this.plugletFactory;
tc.plugletInstance = this.plugletInstance;
tc.plugletStreamListener = this.plugletStreamListener;
tc.pm = this.pm;
tc.peer = this.peer;
tc.plugletStreamInfo = this.plugletStreamInfo;
tc.is = this.is;
tc.length = this.length;
tc.status = this.status;
tc.stage = this.stage;
tc.descr = this.descr;
tc.parameters = this.parameters;
tc.props = props;
return tc;
}
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public String getMimeType() {
return mimeType;
}
public void setPlugletFactory(TestLoaderPluglet plugletFactory) {
this.plugletFactory = plugletFactory;
}
public PlugletFactory getPlugletFactory() {
return plugletFactory;
}
public void setPlugletManager(PlugletManager pm) {
this.pm = pm;
}
public PlugletManager getPlugletManager() {
return pm;
}
public void setPluglet(Pluglet plugletInstance) {
this.plugletInstance = plugletInstance;
}
public Pluglet getPluglet() {
return plugletInstance;
}
public void setPlugletStreamListener(PlugletStreamListener plugletStreamListener) {
this.plugletStreamListener = plugletStreamListener;
}
public PlugletStreamListener getPlugletStreamListener() {
return plugletStreamListener;
}
public void setPlugletPeer(PlugletPeer peer) {
this.peer = peer;
}
public PlugletPeer getPlugletPeer() {
return peer;
}
public void setTestStage(TestStage stage) {
this.stage = stage;
}
public TestStage getTestStage() {
return stage;
}
public TestDescr getTestDescr() {
return descr;
}
public void setPlugletStreamInfo(PlugletStreamInfo plugletStreamInfo){
this.plugletStreamInfo = plugletStreamInfo;
}
public PlugletStreamInfo getPlugletStreamInfo(){
return plugletStreamInfo;
}
public void setStatus(int status){
this.status = status;
}
public int getStatus(){
return status;
}
public void setInputStream(InputStream is) {
this.is = is;
}
public InputStream getInputStream() {
return is;
}
public void setLength(int length) {
this.length = length;
}
public int getLength() {
return length;
}
public void setFileName(String fileName){
this.fileName = fileName;
}
public String getFileName(){
return fileName;
}
public void setStreamType(int streamType) {
this.streamType = streamType;
}
public int getStreamType() {
return streamType;
}
// nb: move to TestDescr
public void setParameters(Vector parameters){
this.parameters = parameters;
}
public Vector getParameters(){
return parameters;
}
public static Pluglet getOtherPluglet(){
return null;
}
public String getTopDir() {
return props.getProperty(TEST_TOP_DIR_PROP_NAME);
}
public String getTestDir() {
return props.getProperty(TEST_DIR_PROP_NAME);
}
public String getProperty(String propName){
return props.getProperty(propName);
}
public TestStage getStageByPropertyName(String propName) {
String stageName = props.getProperty(propName);
if (stageName == null) {
printLog(propName + " isn't set");
return null;
} else {
TestStage stage = TestStage.getStageByName(stageName);
if (stage == null) {
printLog(propName +" is set into non-existent value");
return null;
}
return stage;
}
}
public static void registerIfNotRegistered(int res) {
if (result == NOT_DEF){
if (res == FAILED) {
registerFAILED("By checking thread");
} else {
registerPASSED("By checking thread");
}
}
}
public static void registerFAILED(String comment) {
result = FAILED;
appendToFile(logFile, "FAILED: "+comment+"\n", false);
appendToFile(resFile, "FAILED\n", true);
}
public static void registerPASSED(String comment) {
if (result == NOT_DEF) {
result = PASSED;
appendToFile(logFile, "PASSED: "+comment+"\n", false);
appendToFile(resFile, "PASSED\n", true);
}
}
public static boolean failedIsRegistered(){
return (result == FAILED);
}
public static void printLog(String logStr) {
appendToFile(logFile, logStr+"\n", false);
}
private static void appendToFile(String file, String str, boolean fromStart) {
tmpString = str;
tmpFile = file;
tmpFromStart = fromStart;
java.security.AccessController
.doPrivileged(new java.security.PrivilegedAction(){
public Object run(){
try {
RandomAccessFile f = new RandomAccessFile(tmpFile, "rw");
if (tmpFromStart) {
f.seek(0);
} else {
long length = f.length();
f.seek(length);
}
f.writeBytes(tmpString);
f.close();
} catch (IOException e) {
DebugPluglet.print("IOException appending to file "+tmpFile);
DebugPluglet.print(e.toString());
}
return null;
}
});
}
}

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

@ -0,0 +1,110 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic;
import java.util.*;
import org.mozilla.pluglet.*;
import org.mozilla.pluglet.mozilla.*;
import java.awt.*;
import java.awt.print.*;
import java.io.*;
import java.net.URL;
public class TestInstance implements Pluglet{
TestContext context = null;
public TestInstance(TestContext context){
this.context = context;
context.setPluglet(this);
}
public void initialize(PlugletPeer peer) {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_INSTANCE_INITIALIZE));
context.setPlugletPeer(peer);
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
}
public void start() {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_INSTANCE_START));
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
}
public void stop() {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_INSTANCE_STOP));
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
}
public void destroy() {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_INSTANCE_DESTROY));
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
}
public PlugletStreamListener newStream() {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_INSTANCE_NEW_STREAM));
context.setPlugletStreamListener(new TestStreamListener(context.getCopy()));
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
return context.getPlugletStreamListener();
}
public void setWindow(Frame frame) {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_INSTANCE_SET_WINDOW));
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
}
public void print(PrinterJob printerJob) {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_INSTANCE_PRINT));
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
}
}

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

@ -0,0 +1,33 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic;
public interface TestListIterator {
public boolean initialize(TestContext context);
public boolean next();
}

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

@ -0,0 +1,110 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic;
import java.util.*;
import org.mozilla.pluglet.*;
import org.mozilla.pluglet.mozilla.*;
import java.awt.*;
import java.awt.print.*;
import java.io.*;
import java.net.URL;
public class TestLoaderPluglet implements PlugletFactory {
public static String DELAY_INTERNAL_PROP_NAME = "DELAY_INTERNAL";
public static int defaultResult = TestContext.FAILED;
public TestContext context = new TestContext();
public TestLoaderPluglet(){
System.out.println("--TestLoaderPluglet()");
context.initialize();
context.setPlugletFactory(this);
try {
PlugletCheckingThread checkingThread =
new PlugletCheckingThread((new Integer(context.getProperty(DELAY_INTERNAL_PROP_NAME))).intValue()*1000);
checkingThread.start();
} catch (Exception e) {
TestContext.printLog(DELAY_INTERNAL_PROP_NAME+" props isn't correctly set");
}
}
public void initialize(PlugletManager manager) {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_INITIALIZE));
context.setPlugletManager(manager);
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
}
public Pluglet createPluglet(String mimeType) {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_CREATE_PLUGLET_INSTANCE));
context.setMimeType(mimeType);
context.setPluglet(new TestInstance(context.getCopy()));
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
return context.getPluglet();
}
public void shutdown() {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_SHUTDOWN));
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
}
}
class PlugletCheckingThread extends Thread {
int timeout = Integer.MAX_VALUE;
PlugletCheckingThread(int timeout){
this.timeout = timeout;
}
public void run(){
System.out.println("started thread to sleep "+timeout);
try {
sleep(timeout);
} catch (Exception e) {
TestContext.printLog("Checking thread had been interrupted");
}
TestContext.registerIfNotRegistered(TestLoaderPluglet.defaultResult);
}
}

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

@ -0,0 +1,3 @@
RUN_STAGES=PLUGLET_INITIALIZE
TEST_CLASS=org.mozilla.pluglet.test.basic.api.PlugletManager_postURL_9216
ITERATOR_CLASS=org.mozilla.pluglet.test.basic.api.PlugletManager_postURL_Iterator

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

@ -0,0 +1,115 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic;
import java.util.*;
import org.mozilla.pluglet.*;
import org.mozilla.pluglet.mozilla.*;
public class TestStage {
public static String NO_ANY_STAGE = "NO_ANY_STAGE";
public static String PLUGLET_INITIALIZE = "PLUGLET_INITIALIZE";
public static String PLUGLET_CREATE_PLUGLET_INSTANCE = "PLUGLET_CREATE_PLUGLET_INSTANCE";
public static String PLUGLET_SHUTDOWN = "PLUGLET_SHUTDOWN";
public static String PLUGLET_INSTANCE_INITIALIZE = "PLUGLET_INSTANCE_INITIALIZE";
public static String PLUGLET_INSTANCE_START = "PLUGLET_INSTANCE_START" ;
public static String PLUGLET_INSTANCE_NEW_STREAM = "PLUGLET_INSTANCE_NEW_STREAM";
public static String PLUGLET_INSTANCE_SET_WINDOW = "PLUGLET_INSTANCE_SET_WINDOW";
public static String PLUGLET_INSTANCE_PRINT = "PLUGLET_INSTANCE_PRINT";
public static String PLUGLET_INSTANCE_STOP = "PLUGLET_INSTANCE_STOP";
public static String PLUGLET_INSTANCE_DESTROY = "PLUGLET_INSTANCE_DESTROY";
public static String PLUGLET_STREAM_LISTENER_ON_START_BINDING = "PLUGLET_STREAM_LISTENER_ON_START_BINDING";
public static String PLUGLET_STREAM_LISTENER_ON_DATA_AVAILABLE = "PLUGLET_STREAM_LISTENER_ON_DATA_AVAILABLE";
public static String PLUGLET_STREAM_LISTENER_ON_FILE_AVAILABLE = "PLUGLET_STREAM_LISTENER_ON_FILE_AVAILABLE";
public static String PLUGLET_STREAM_LISTENER_GET_STREAM_TYPE = "PLUGLET_STREAM_LISTENER_GET_STREAM_TYPE";
public static String PLUGLET_STREAM_LISTENER_ON_STOP_BINDING = "PLUGLET_STREAM_LISTENER_ON_STOP_BINDING";
public static String ANY = "ANY";
static Hashtable names = new Hashtable();
static {
names.put(NO_ANY_STAGE, new TestStage(NO_ANY_STAGE));
names.put(PLUGLET_INITIALIZE, new TestStage(PLUGLET_INITIALIZE));
names.put(PLUGLET_CREATE_PLUGLET_INSTANCE, new TestStage(PLUGLET_CREATE_PLUGLET_INSTANCE));
names.put(PLUGLET_SHUTDOWN, new TestStage(PLUGLET_SHUTDOWN));
names.put(PLUGLET_INSTANCE_INITIALIZE, new TestStage(PLUGLET_INSTANCE_INITIALIZE));
names.put(PLUGLET_INSTANCE_START, new TestStage(PLUGLET_INSTANCE_START));
names.put(PLUGLET_INSTANCE_NEW_STREAM, new TestStage(PLUGLET_INSTANCE_NEW_STREAM));
names.put(PLUGLET_INSTANCE_SET_WINDOW, new TestStage(PLUGLET_INSTANCE_SET_WINDOW));
names.put(PLUGLET_INSTANCE_PRINT, new TestStage(PLUGLET_INSTANCE_PRINT));
names.put(PLUGLET_INSTANCE_STOP, new TestStage(PLUGLET_INSTANCE_STOP));
names.put(PLUGLET_INSTANCE_DESTROY, new TestStage(PLUGLET_INSTANCE_DESTROY));
names.put(PLUGLET_STREAM_LISTENER_ON_START_BINDING, new TestStage(PLUGLET_STREAM_LISTENER_ON_START_BINDING));
names.put(PLUGLET_STREAM_LISTENER_ON_DATA_AVAILABLE, new TestStage(PLUGLET_STREAM_LISTENER_ON_DATA_AVAILABLE));
names.put(PLUGLET_STREAM_LISTENER_ON_FILE_AVAILABLE, new TestStage(PLUGLET_STREAM_LISTENER_ON_FILE_AVAILABLE));
names.put(PLUGLET_STREAM_LISTENER_ON_FILE_AVAILABLE, new TestStage(PLUGLET_STREAM_LISTENER_ON_FILE_AVAILABLE));
names.put(PLUGLET_STREAM_LISTENER_GET_STREAM_TYPE, new TestStage(PLUGLET_STREAM_LISTENER_GET_STREAM_TYPE));
names.put(PLUGLET_STREAM_LISTENER_ON_STOP_BINDING, new TestStage(PLUGLET_STREAM_LISTENER_ON_STOP_BINDING));
names.put(ANY, new TestStage(ANY));
}
private String id;
private TestStage(String id) {
this.id = id;
}
private String getId() {
return id;
}
public String getName() {
return id;
}
public static TestStage getStageById(String id) {
return (TestStage)names.get(id);
}
public static TestStage getStageByName(String name) {
return (TestStage)names.get(name.toUpperCase());
}
public boolean consist(TestStage stage) {
if (stage.getId().equals(this.id)) {
return true;
}
if (stage.getId().equals(TestStage.ANY)) {
return true;
}
return false;
}
public boolean equals(Object stage) {
//System.out.println("to test "+this.id+" and "+((TestStage)stage).getId());
if (stage != null) {
if (((TestStage)stage).getId().equals(this.id)) {
return true;
}
}
return false;
}
}

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

@ -0,0 +1,98 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic;
import java.util.*;
import org.mozilla.util.*;
import org.mozilla.pluglet.*;
import org.mozilla.pluglet.mozilla.*;
import java.awt.*;
import java.awt.print.*;
import java.io.*;
import java.net.URL;
public class TestStreamListener implements PlugletStreamListener {
TestContext context = null;
public TestStreamListener(TestContext context){
this.context = context;
context.setPlugletStreamListener(this);
}
public void onStartBinding(PlugletStreamInfo streamInfo) {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_STREAM_LISTENER_ON_START_BINDING));
context.setPlugletStreamInfo(streamInfo);
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
}
public void onDataAvailable(PlugletStreamInfo streamInfo, InputStream input,int length) {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_STREAM_LISTENER_ON_DATA_AVAILABLE));
context.setPlugletStreamInfo(streamInfo);
context.setInputStream(input);
context.setLength(length);
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
}
public void onFileAvailable(PlugletStreamInfo streamInfo, String fileName) {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_STREAM_LISTENER_ON_FILE_AVAILABLE));
context.setPlugletStreamInfo(streamInfo);
context.setFileName(fileName);
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
}
public void onStopBinding(PlugletStreamInfo streamInfo,int status) {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_STREAM_LISTENER_ON_STOP_BINDING));
context.setPlugletStreamInfo(streamInfo);
context.setStatus(status);
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
}
public int getStreamType() {
context.setTestStage(TestStage.getStageById(TestStage.PLUGLET_STREAM_LISTENER_GET_STREAM_TYPE));
context.setStreamType(STREAM_TYPE_NORMAL);
Test test = null;
test = context.getTestDescr().getTestInstance(context.getTestStage());
if (test !=null) {
test.execute(context);
}
return context.getStreamType();
}
}

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

@ -0,0 +1,130 @@
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=../../../../../../..
UTIL_DIR=$(DEPTH)/utils
BUILD_DIR=$(DEPTH)/build
CONFIG_FILE=$(DEPTH)/config/CommonProperties
LST_FILE=test/basic/api/BWTest.lst.ORIG
BUILD_DIR_CLASSES=$(BUILD_DIR)/classes
BASIC_PATH=org/mozilla/pluglet/test/basic
TEST_DIRS=test/basic/api
CLASSES_LOCATION=$(BUILD_DIR_CLASSES)/$(BASIC_PATH)/api
API_HTML_ROOT_DIR=$(HTML_ROOT_DIR)/api
JSRC= *.java
JAVAC=$(JDKHOME)/bin/javac
JAVA=$(JDKHOME)/bin/java
CLASSPATH=$(MOZILLA_FIVE_HOME)/../classes:$(BUILD_DIR_CLASSES):$$(CLASSPATH)
#All tests list
#PlugletManager_getValue was excluded from test list, method removed
#PlugletStreamInfo_requestRead commented,method doesn't work
TESTS = PlugletPeer_getMIMEType \
PlugletPeer_getMode \
PlugletPeer_getValue \
PlugletPeer_setWindowSize \
PlugletPeer_showStatus \
PlugletPeer_getTagInfo \
PlugletManager_reloadPluglets \
PlugletManager_userAgent \
PlugletStreamInfo_getContentType \
PlugletStreamInfo_getLastModified \
PlugletStreamInfo_getLength \
PlugletStreamInfo_getURL \
PlugletStreamInfo_isSeekable \
PlugletStreamInfo_requestRead \
PlugletTagInfo2_getAlignment \
PlugletTagInfo_getAttribute \
PlugletTagInfo_getAttributes \
PlugletTagInfo2_getParameter \
PlugletTagInfo2_getParameters \
PlugletTagInfo2_getParameters_1 \
PlugletTagInfo2_getAttribute \
PlugletTagInfo2_getDOMElement \
PlugletTagInfo2_getAttributes \
PlugletTagInfo2_getBorderHorizSpace \
PlugletTagInfo2_getBorderHorizSpace_1 \
PlugletTagInfo2_getBorderVertSpace \
PlugletTagInfo2_getBorderVertSpace_1 \
PlugletTagInfo2_getDocumentBase \
PlugletTagInfo2_getDocumentEncoding \
PlugletTagInfo2_getHeight \
PlugletTagInfo2_getHeight_1 \
PlugletTagInfo2_getTagText \
PlugletTagInfo2_getTagType \
PlugletTagInfo2_getTagType_1 \
PlugletTagInfo2_getUniqueID \
PlugletTagInfo2_getWidth \
PlugletTagInfo2_getWidth_1 \
PlugletManager_getURL \
PlugletManager_getURL_1 \
PlugletManager_postURL \
PlugletPeer_newStream_0 \
PlugletPeer_newStream_1
default: classes tests test_pluglet
classes:
@echo Compile classes ..
@$(JAVAC) -d $(BUILD_DIR_CLASSES) Pluglet*.java
test_pluglet:
@mkdir -p $(BUILD_DIR_CLASSES)/$(BASIC_PATH)/api
@cp -f manifest $(BUILD_DIR_CLASSES)/$(BASIC_PATH)/api
@cd $(BUILD_DIR_CLASSES); \
$(JDKHOME)/bin/jar cfm $(BASIC_PATH)/api/TestAPIPluglet.jar $(BASIC_PATH)/api/manifest $(BASIC_PATH)/*.class $(BASIC_PATH)/api/*.class
tests:
@$(MAKE) tests_rec MAKE_ARGS=all
combinations:
@echo Make combinations ..
@echo -- NOTE: You need to do combinations only if you change
@echo -- ParamCombination files in test dirs.
@echo -- For rest cases defult LST files exists in test dirs
@mkdir -p $(BUILD_DIR)/$(TEST_DIRS)
@$(MAKE) tests_rec MAKE_ARGS=$@ COMMON_LST_FILE=$(LST_FILE)
clobber:
@if [ -e $(CLASSES_LOCATION) ]; then \
rm -rf $(CLASSES_LOCATION)/* ; \
fi
@$(MAKE) tests_rec MAKE_ARGS=$@
tests_rec:
@for i in $(TESTS);do \
echo Making $(MAKE_ARGS) in $${i}; \
cd $${i}; \
$(MAKE) $(MAKE_ARGS) HTML_DEST_DIR=$(API_HTML_ROOT_DIR); \
cd ..; \
done

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

@ -0,0 +1,171 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic.api;
import java.util.*;
import java.io.*;
import java.net.*;
import org.mozilla.pluglet.test.basic.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.pluglet.*;
public class PlugletManager_getURL_128 implements Test
{
private static Pluglet plugletInstance = null;
private static URL url = null;
private static String target = null;
private static PlugletStreamListener listener = null;
private static String altHost = null;
private static URL referer = null;
private static Boolean JSEnabled = null;
/**
*
***********************************************************
* Constructor
***********************************************************
*
*/
public PlugletManager_getURL_128()
{
}
/**
*
***********************************************************
* Starting point of application
*
* @param args Array of command line arguments
*
***********************************************************
*/
public static void main(String[] args)
{
}
/**
***********************************************************
*
* Execute Method
*
* @param contex TestContext reference with properties and parameters
* @return void, the result set to true or false via context
*
***********************************************************
*/
public void execute(TestContext context)
{
Properties paramProps = null;
PlugletManager PlugletManager_obj = null;
if( context == null ) {
TestContext.registerFAILED("ERROR:null context passed in execute(TestContext) of PlugletManager_getURL_128");
System.err.println("ERROR:null context passed in execute(TestContext) of PlugletManager_getURL_128");
return;
}
if ( context.failedIsRegistered()) {
return;
}
Vector vectorOfParameters = context.getParameters();
PlugletManager_obj = context.getPlugletManager();
if( PlugletManager_obj == null ) {
TestContext.registerFAILED("ERROR:null PlugletManager passed in execute(TestContext) of PlugletManager_getURL_128");
System.err.println("ERROR:null PlugletManager passed in execute(TestContext) of PlugletManager_getURL_128");
return;
}
//Initialization of parameters
plugletInstance = (Pluglet)vectorOfParameters.elementAt(0);
url = (URL)vectorOfParameters.elementAt(1);
target = (String)vectorOfParameters.elementAt(2);
listener = (PlugletStreamListener)vectorOfParameters.elementAt(3);
altHost = (String)vectorOfParameters.elementAt(4);
referer = (URL)vectorOfParameters.elementAt(5);
JSEnabled = (Boolean)vectorOfParameters.elementAt(6);
//Call tested method
PlugletManager_obj.getURL(plugletInstance,url,target,listener,altHost,referer,JSEnabled.booleanValue());
TestContext.printLog("DEBUG: Void method PlugletManager_getURL(" +
plugletInstance + "," +
url + "," +
target + "," +
listener + "," +
altHost + "," +
referer + "," +
JSEnabled + ")");
}
public static void checkResult_target(String winName, boolean isTop)
{
if (target.equals("_top")&&isTop) {
TestContext.registerPASSED("All data was posted in _top window.");
return;
}
if (target.equals(winName)) {
TestContext.registerPASSED("All data was posted in right window with name: " + winName);
} else {
TestContext.registerFAILED("Data was posted to the wrong window with name: " + winName +
" instead of: " + target);
}
}
public static void checkResult_referer(String ref)
{
if (ref.equals(referer)) {
TestContext.registerPASSED("Right HTTP_REFERER passed to CGI script: " + ref);
} else {
TestContext.registerFAILED("Wrong HTTP_REFERER: \"" + ref +
"\" instead of: \"" + referer + "\"");
}
}
public static void setResult(boolean res,String comment)
{
if(res) {
TestContext.registerPASSED("Result from JavaScript: " + comment);
} else {
TestContext.registerFAILED("Result from JavaScript: " + comment);
}
}
/**
*
***********************************************************
* Routine where OS specific checks are made.
*
* @param os OS Name (SunOS/Linus/MacOS/...)
***********************************************************
*
*/
private void osRoutine(String os)
{
if(os == null) return;
os = os.trim();
if(os.compareTo("SunOS") == 0) {}
else if(os.compareTo("Linux") == 0) {}
else if(os.compareTo("Windows") == 0) {}
else if(os.compareTo("MacOS") == 0) {}
else {}
}
}

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

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

@ -0,0 +1,7 @@
this_PlugletInstance'0
null'1, HTTP_URL_FOR_GET'0, FTP_URL_FOR_GET'0, MAILTO_URL_FOR_GET'0, FILE_URL_FOR_GET'0, FILE_WIN_URL_FOR_GET'0, JAVASCRIPT_URL_FOR_GET'0
EXISTING_TARGET_FOR_GET'0
null_streamListener'0
null'0
null'0
false'0

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

@ -0,0 +1,6 @@
<html>
<frameset rows=100,*>
<frame src=PlugletManager_getURL_empty.html>
<frame src=PlugletManager_getURL_plugletFrameset.html>
</frameset>
</hmtl>

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

@ -0,0 +1,24 @@
<html>
<head>
This HTML used for getURL call of PlugletManager
<SCRIPT Language="JavaScript">
<!--
function registerResults()
{
//Note that we verify only loading of document,
if document was loaded succesfully via protocol http, ftp, file then JavaScript says: "All OK"
Packages.org.mozilla.pluglet.test.basic.api.PlugletManaget_getURL_128.setResult(true,'Document was succesfully loaded');
}
//-->
</script>
</head>
<body onLoad="registerResults()">
This is first line of this HTML<BR>
<blockquote>
PlugletManager_getURL test.
Results will be passed to test via JavaScript.</blockquote>
This is last line of this HTML<BR>
</body>
</hmtl>

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

@ -0,0 +1,6 @@
<html>
<body>
<center><H1>Depth 0</H1></center>
<blockquote>This a empty winow. Just for making depth 1 for pluglet frame.</blockquote>
</body>
</hmtl>

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

@ -0,0 +1,7 @@
<html>
<body>
<center><H1>Depth 1</H1></center>
<blockquote>This window has a name "exist_target_for_get" that eguivalent a value specified
in properties file. So it's really existing target for PlugletManager_getURL test</blockquote>
</body>
</hmtl>

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

@ -0,0 +1,7 @@
<html>
<body>
<center><H1>Depth 1</H1></center>
<blockquote>This window contains a pluglet with PlugletManager_getURL test.</blockquote>
<EMBED type="application/x-api-pluglet" name="test" width=100 height=100>
</body>
</hmtl>

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

@ -0,0 +1,6 @@
<html>
<frameset cols=*,*>
<frame src=PlugletManager_getURL_pluglet.html name=pluglet_window>
<frame src=PlugletManager_getURL_exist_target.html> name=exist_target_for_get
</frameset>
</hmtl>

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

@ -0,0 +1,21 @@
PlugletManager_getURL Information.
Test name: PlugletManager_getURL
Synopsis: getURL method of class PlugletManager
Goals: this test case test possible URL types.
<ftp_root_dir>, <html_root> and <html_root_dir> should be specified.
Pre-Conditions: Build mozilla, setup enviroment as for running mozilla
and see api tests README for setup enviroment for run tests.
Description: This test call the getURL method of the PlugletManager object
at runstages, specified at TestProperties file. With parameters,
specified in PlugletManager_getURL.lst file. Each line in PlugletManager_getURL.lst file describes
one test of this method. See the test number and corresponding
line in LST file for viewing partameters of you test.
Results: See the PlugletTest.log and PlugletTest.res in
the $MOZILLA_FIVE_HOME/bin directory and additional logs in the
PLUGLET_TEST_DIR/log directory

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

@ -0,0 +1,7 @@
EXISTING_TARGET_FOR_GET=exist_target_for_get
FILE_WIN_URL_FOR_GET=file:///<html_root_dir>/api/PlugletManager_getURL_2/PlugletManager_getURL_default_getData.html
MAILTO_URL_FOR_GET=mailto:avm@sparc.spb.su
HTTP_URL_FOR_GET=http://<html_root>/api/PlugletManager_getURL_2/PlugletManager_getURL_default_getData.html
FILE_URL_FOR_GET=file:///<html_root_dir>/api/PlugletManager_getURL_2/PlugletManager_getURL_default_getData.html
FTP_URL_FOR_GET=ftp://anonymous@localhost/<ftp_root_dir>/api/PlugletManager_getURL_2/PlugletManager_getURL_default_getData.html
JAVASCRIPT_URL_FOR_GET=javascript:Packages.org.mozilla.pluglet.test.basic.api.PlugletManaget_getURL_128.setResult(true,'JAVASCRIPT_URL_WORKS');

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

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

@ -0,0 +1,7 @@
this_PlugletInstance'0
null'1, HTTP_URL_FOR_GET'0
EXISTING_TARGET_FOR_GET'0
null_streamListener'0
null'0
null'0, CURRENT_REFERER_URL'0, HTTP_OTHER_REFERER_URL'0
true'0

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

@ -0,0 +1,6 @@
<html>
<frameset rows=100,*>
<frame src=PlugletManager_getURL_empty.html>
<frame src=PlugletManager_getURL_plugletFrameset.html>
</frameset>
</hmtl>

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

@ -0,0 +1,6 @@
<html>
<body>
<center><H1>Depth 0</H1></center>
<blockquote>This a empty winow. Just for making depth 1 for pluglet frame.</blockquote>
</body>
</hmtl>

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

@ -0,0 +1,7 @@
<html>
<body>
<center><H1>Depth 1</H1></center>
<blockquote>This window has a name "exist_target_for_get" that eguivalent a value specified
in properties file. So it's really existing target for PlugletManager_getURL test</blockquote>
</body>
</hmtl>

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

@ -0,0 +1,7 @@
<html>
<body>
<center><H1>Depth 1</H1></center>
<blockquote>This window contains a pluglet with PlugletManager_getURL test.</blockquote>
<EMBED type="application/x-api-pluglet" name="test" width=100 height=100>
</body>
</hmtl>

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

@ -0,0 +1,6 @@
<html>
<frameset cols=*,*>
<frame src=PlugletManager_getURL_pluglet.html name=pluglet_window>
<frame src=PlugletManager_getURL_exist_target.html> name=exist_target_for_get
</frameset>
</hmtl>

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

@ -0,0 +1,18 @@
PlugletManager_getURL Information.
Test name: PlugletManager_getURL
Synopsis: getURL method of class PlugletManager
Pre-Conditions: Build mozilla, setup enviroment as for running mozilla
and see api tests README for setup enviroment for run tests.
Description: This test call the getURL method of the PlugletManager object
at runstages, specified at TestProperties file. With parameters,
specified in PlugletManager_getURL.lst file. Each line in PlugletManager_getURL.lst file describes
one test of this method. See the test number and corresponding
line in LST file for viewing partameters of you test.
Results: See the PlugletTest.log and PlugletTest.res in
the $MOZILLA_FIVE_HOME/bin directory and additional logs in the
PLUGLET_TEST_DIR/log directory

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

@ -0,0 +1,4 @@
EXISTING_TARGET_FOR_GET=exist_target_for_get
HTTP_OTHER_REFERER_URL=http://www.mozilla.org/index.html
CURRENT_REFERER_URL=<html_root>/api/PlugletManager_getURL_3/PlugletManager_getURL.html
HTTP_URL_FOR_GET=<cgi_root>/api/PlugletManager_getURL_3/verify_referer.cgi

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

@ -0,0 +1,47 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s):
TEST_NAME=PlugletManager_getURL_3
DEPTH=..\..\..\..\..\..\..\..
UTIL_DIR=$(DEPTH)\utils
BUILD_DIR=$(DEPTH)\build
CONFIG_FILE=$(DEPTH)\config\CommonProperties
BASIC_PATH=test\basic\api
DEST_DIR=$(BUILD_DIR)\$(BASIC_PATH)\$(TEST_NAME)
MAKE_PARAM=..\makeParameters.pl
MAKE_COMB=..\makeCombinations.pl
default: all
all: html properties parameters
html:
@xcopy *.html $(HTML_DEST_DIR)\$(TEST_NAME) /I
properties:
@-1 mkdir $(DEST_DIR)
@perl $(UTIL_DIR)\configurator.pl $(CONFIG_FILE) $(DEST_DIR)\TestProperties TestProperties
parameters:
@$(MAKE_PARAM) TestParameters $(TEST_NAME).lst $(DEST_DIR)\$(TEST_NAME).lst
combinations:
@$(MAKE_COMB) ParamCombinations $(TEST_NAME).lst $(BUILD_DIR)\$(BASIC_PATH)\BWTest.lst.ORIG
clobber:
@del $(HTML_DEST_DIR)\$(TEST_NAME)\*.html
@del $(DEST_DIR)\$(TEST_NAME).lst
@del $(DEST_DIR)\TestProperties

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

@ -0,0 +1,11 @@
#!/usr/local/bin/perl
$referer = $ENV{HTTP_REFERER};
print "Content-Type: text/html\n\n";
print "<html><head><script Language=\"JavaScript\">\n<!--\n";
print "function registerResults() \n{\n";
print "Packages.org.mozilla.pluglet.test.basic.api.PlugletManager_getURL_128.checkResult_referer(\"$referer\")\;\n";
print "}\n";
print "//-->\n";
print "</script></head><body onLoad=\"registerResults()\">\n";
print "This script make verification of HTTP_REFERER variable and tranfer it to pluglet\n";
print "</body></html>";

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

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

@ -0,0 +1,7 @@
this_PlugletInstance'0
GOOD_HTTP_URL_FOR_GET'0, BAD_HOST_HTTP_URL_FOR_GET'1
EXISTING_TARGET_FOR_GET'0
null_streamListener'0
null'1, GOOD_ALT_HOST'0, BAD_ALT_HOST'1, OTHER_GOOD_ALT_HOST'0
null'0
true'0

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

@ -0,0 +1,6 @@
<html>
<frameset rows=100,*>
<frame src=PlugletManager_getURL_empty.html>
<frame src=PlugletManager_getURL_plugletFrameset.html>
</frameset>
</hmtl>

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

@ -0,0 +1,6 @@
<html>
<body>
<center><H1>Depth 0</H1></center>
<blockquote>This a empty winow. Just for making depth 1 for pluglet frame.</blockquote>
</body>
</hmtl>

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

@ -0,0 +1,7 @@
<html>
<body>
<center><H1>Depth 1</H1></center>
<blockquote>This window has a name "exist_target_for_get" that eguivalent a value specified
in properties file. So it's really existing target for PlugletManager_getURL test</blockquote>
</body>
</hmtl>

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

@ -0,0 +1,7 @@
<html>
<body>
<center><H1>Depth 1</H1></center>
<blockquote>This window contains a pluglet with PlugletManager_getURL test.</blockquote>
<EMBED type="application/x-api-pluglet" name="test" width=100 height=100>
</body>
</hmtl>

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

@ -0,0 +1,6 @@
<html>
<frameset cols=*,*>
<frame src=PlugletManager_getURL_pluglet.html name=pluglet_window>
<frame src=PlugletManager_getURL_exist_target.html> name=exist_target_for_get
</frameset>
</hmtl>

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

@ -0,0 +1,18 @@
PlugletManager_getURL Information.
Test name: PlugletManager_getURL
Synopsis: getURL method of class PlugletManager
Pre-Conditions: Build mozilla, setup enviroment as for running mozilla
and see api tests README for setup enviroment for run tests.
Description: This test call the getURL method of the PlugletManager object
at runstages, specified at TestProperties file. With parameters,
specified in PlugletManager_getURL.lst file. Each line in PlugletManager_getURL.lst file describes
one test of this method. See the test number and corresponding
line in LST file for viewing partameters of you test.
Results: See the PlugletTest.log and PlugletTest.res in
the $MOZILLA_FIVE_HOME/bin directory and additional logs in the
PLUGLET_TEST_DIR/log directory

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

@ -0,0 +1,6 @@
EXISTING_TARGET_FOR_GET=exist_target_for_get
GOOD_HTTP_URL_FOR_GET=<cgi_root>/good_host.cgi
BAD_HOST_HTTP_URL_FOR_GET=<cgi_root_bad_host>/bad_host.cgi
BAD_ALT_HOST=111.111.222.222
GOOD_ALT_HOST=192.168.205.165
OTHER_GOOD_ALT_HOST=192.168.205.182

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

@ -0,0 +1,48 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s):
TEST_NAME=PlugletManager_getURL_4
DEPTH=..\..\..\..\..\..\..\..
UTIL_DIR=$(DEPTH)\utils
BUILD_DIR=$(DEPTH)\build
CONFIG_FILE=$(DEPTH)\config\CommonProperties
BASIC_PATH=test\basic\api
DEST_DIR=$(BUILD_DIR)\$(BASIC_PATH)\$(TEST_NAME)
MAKE_PARAM=..\makeParameters.pl
MAKE_COMB=..\makeCombinations.pl
default: all
all: html properties parameters
html:
@xcopy *.html $(HTML_DEST_DIR)\$(TEST_NAME) /I
properties:
@-1 mkdir $(DEST_DIR)
@perl $(UTIL_DIR)\configurator.pl $(CONFIG_FILE) $(DEST_DIR)\TestProperties TestProperties
parameters:
@$(MAKE_PARAM) TestParameters $(TEST_NAME).lst $(DEST_DIR)\$(TEST_NAME).lst
combinations:
@$(MAKE_COMB) ParamCombinations $(TEST_NAME).lst $(BUILD_DIR)\$(BASIC_PATH)\BWTest.lst.ORIG
clobber:
@del $(HTML_DEST_DIR)\$(TEST_NAME)\*.html
@del $(DEST_DIR)\$(TEST_NAME).lst
@del $(DEST_DIR)\TestProperties

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

@ -0,0 +1,240 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic.api;
import java.util.*;
import java.io.*;
import java.net.*;
import org.mozilla.pluglet.test.basic.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.pluglet.*;
public class PlugletManager_getURL_Iterator implements TestListIterator
{
Vector combstr = new Vector();
int curElement = 0;
Properties testProps = null;
TestContext context = null;
/**
*
***********************************************************
* Constructor
***********************************************************
*
*/
public PlugletManager_getURL_Iterator()
{
}
/**
*
***********************************************************
* Starting point of application
*
* @param args Array of command line arguments
*
***********************************************************
*/
public static void main(String[] args)
{
}
/**
***********************************************************
*
* Initialize Method
*
* This method initialize parameters array and prepare for
* access parameters via nextParams method
*
* @param contex TestContext reference with properties and parameters
* @return nothing
*
***********************************************************
*/
public boolean initialize(TestContext context)
{
this.context = context;
BufferedReader br = null;
String paramString = new String("");
String fileName = context.getProperty("LST_FILE_NAME");
String separator = System.getProperty("file.separator");
String paramFile = context.getTestDir() + separator + fileName;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(paramFile)));
} catch (Exception e) {
TestContext.registerFAILED("Can't open parameters file: " + paramFile);
return false;
}
try{
while((paramString = br.readLine())!= null)
{
combstr.addElement(paramString);
}
} catch (Exception e) {
TestContext.registerFAILED("Can't read from parameters file: " + paramFile);
return false;
}
try {
br.close();
} catch (Exception e) {
TestContext.registerFAILED("Can't close parameters file: " + paramFile);
return false;
}
return true;
}
public boolean next()
{
String[] paramValue = new String[7];
Vector vectorOfParameters = new Vector();
if (context == null)
{
System.err.println("context not initialized" );
TestContext.registerFAILED("context not initialized");
return false;
}
if(curElement <combstr.size())
{
int i = 0;
int last = 0;
int cur = 0;
String pstr = (String)combstr.elementAt(curElement++);
while((cur = pstr.indexOf(",",last)) != -1) {
paramValue[i] = pstr.substring(last,cur);
paramValue[i] = paramValue[i].trim();
//testProps.setProperty("param" + (new Integer(i)).toString(),pstr.substring(last,cur));
i++;
last = cur +1;
}
//For add last value
paramValue[i] = pstr.substring(last,pstr.length());
paramValue[i] = paramValue[i].trim();
Object result = null;
//Please hack this block.
// Parameter number 0,parameter type is Pluglet
//result = (Object)(paramValue[0].equals("null") ? null : context.getPluglet());
if (paramValue[0].equals("null_Pluglet"))
{
result = (Object)(null);
} else if (paramValue[0].equals("this_Pluglet"))
{
result = (Object)(context.getPluglet());
} else if (paramValue[0].equals("other_Pluglet"))
{
result = (Object)(context.getOtherPluglet());
} else
{
System.err.println("PlugletManager_getURL_Iterator can't parse value \"" + paramValue[0] + "\" for Pluglet\n");
}
vectorOfParameters.addElement(result);
// Parameter number 1,parameter type is URL
try {
if (paramValue[1].equals("null"))
{
result = (Object)(null);
} else if (paramValue[1].equals("NOTNULL"))
{
System.err.println("Value NOTNULL not used NOW.Please change parameters file.\n");
TestContext.registerFAILED("Value NOTNULL not used NOW.Please change parameters file.\n");
//result = (Object)(new URL("http://www.mozilla.org"));
} else
{
result = (Object)(new URL(paramValue[1]));
}
}catch(MalformedURLException e)
{
System.err.println("MalformedURLException thrown when compiling URL from \"" + paramValue[1] + "\" String value ");
TestContext.registerFAILED("MalformedURLException thrown when compiling URL from \"" + paramValue[1] + "\" .Wrong parameters file? ");
}
vectorOfParameters.addElement(result);
// Parameter number 2,parameter type is String
result = (Object)(paramValue[2].equals("null") ? null : paramValue[2] );
vectorOfParameters.addElement(result);
//Please hack this block.
// Parameter number 3,parameter type is PlugletStreamListener
//result = (Object)(paramValue[3].equals("null") ? null : context.getPlugletStreamListener());
if (paramValue[3].equals("null_streamListener"))
{
result = (Object)(null);
} else if (paramValue[3].equals("current_streamListener")||paramValue[3].equals("NOTNULL"))
{
result = (Object)(context.getPlugletStreamListener());
} else if (paramValue[3].equals("new_streamListener"))
{
PlugletStreamListener newPlugletStreamListener = new TestStreamListener(context);
//context.addNewPlugletStreamListener(newPlugletStreamListener);
result = (Object)(newPlugletStreamListener);
System.err.println("WARNING: Currently test doesn't know how work with newPlugletStreamListener\n");
//TestContext.registerFAILED("Currently test doesn't know how work with newPlugletStreamListener\n");
} else
{
System.err.println("PlugletManager_getURL_Iterator can't parse \"" + paramValue[3] + "\" value for PlugletStreamListener\n");
TestContext.registerFAILED("PlugletManager_getURL_Iterator can't parse \"" + paramValue[3] + "\" value for PlugletStreamListener\n");
}
vectorOfParameters.addElement(result);
// Parameter number 4,parameter type is String
result = (Object)(paramValue[4].equals("null") ? null : paramValue[4] );
vectorOfParameters.addElement(result);
// Parameter number 5,parameter type is URL
try {
if (paramValue[5].equals("null"))
{
result = (Object)(null);
} else if (paramValue[5].equals("NOTNULL"))
{
System.err.println("Value NOTNULL not used NOW.Please change parameters file.\n");
TestContext.registerFAILED("Value NOTNULL not used NOW.Please change parameters file.\n");
//result = (Object)(new URL("http://www.mozilla.org"));
} else
{
result = (Object)(new URL(paramValue[5]));
}
}catch(MalformedURLException e)
{
System.err.println("MalformedURLException thrown when compiling URL from \"" + paramValue[5] + "\" value");
TestContext.registerFAILED("MalformedURLException thrown when compiling URL from \"" + paramValue[5] + "\".Wrong parameters file? ");
}
vectorOfParameters.addElement(result);
// Parameter number 6,parameter type is boolean
result = (Object)(new Boolean(paramValue[6]));
vectorOfParameters.addElement(result);
context.setParameters(vectorOfParameters);
return true;
}
return false;
}
}

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

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

@ -0,0 +1,11 @@
null'1, this_Pluglet'0, other_Pluglet'0
null'1, HTTP_TARGET_URL_FOR_POST'0, FTP_TARGET_URL_FOR_POST'1, MAILTO_TARGET_URL_FOR_POST'0, FILE_TARGET_URL_FOR_POST'1
DATA_LEN_FOR_POST'0, LESS_THEN_DATA_LEN_FOR_POST'1, MORE_THEN_DATA_LEN_FOR_POST'1
null'0, FILE_NAME_WITH_CORRECT_FULL_BUF'0, FILE_NAME_WITH_CORRECT_NOT_FULL_BUF'1, FILE_NAME_WITH_EXISTING_FULL_PATH_FOR_POST'0, FILE_NAME_WITH_NONEXISTING_FULL_PATH_FOR_POST'1, FILE_NAME_WITH_INCORRECT_PATH'1
true'0, false'0
null'0, _self'0, _parent'1, EXISTING_TARGET_FOR_POST'0, NONEXISTING_TARGET_FOR_POST'1
null'1, current_streamListener'0, new_streamListener'1
null'1, CURRENT_ALT_HOST'0, OTHER_ALT_HOST'1, INCORRECT_ALT_HOST'1
null'0, CURRENT_REFERER_URL'1, HTTP_OTHER_REFERER_URL'1
true'1, false'0
HEADER_BUF_LENGTH'0, MORE_THEN_HEADER_BUF_LENGTH'1, LESS_THEN_HEADER_BUF_LENGTH'1

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

@ -0,0 +1,6 @@
<html>
<frameset rows=100,*>
<frame src=PlugletManager_postURL_empty.html>
<frame src=PlugletManager_postURL_plugletFrameset.html>
</frameset>
</hmtl>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,6 @@
<html>
<body>
<center><H1>Depth 0</H1></center>
<blockquote>This a empty winow. Just for making depth 1 for pluglet frame.</blockquote>
</body>
</hmtl>

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

@ -0,0 +1,7 @@
<html>
<body>
<center><H1>Depth 1</H1></center>
<blockquote>This window has a name "exist_target_for_post" that eguivalent a value specified
in properties file. So it's really existing target for PlugletManager_postURL test</blockquote>
</body>
</hmtl>

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

@ -0,0 +1,7 @@
<html>
<body>
<center><H1>Depth 1</H1></center>
<blockquote>This window contains a pluglet with PlugletManager_postURL test.</blockquote>
<EMBED type="application/x-api-pluglet" name="test" width=100 height=100>
</body>
</hmtl>

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

@ -0,0 +1,6 @@
<html>
<frameset cols=*,*>
<frame src=PlugletManager_postURL_pluglet.html name=pluglet_window>
<frame src=PlugletManager_postURL_exist_target.html> name=exist_target_for_post
</frameset>
</hmtl>

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

@ -0,0 +1,18 @@
PlugletManager_postURL Information.
Test name: PlugletManager_postURL
Synopsis: postURL method of class PlugletManager
Pre-Conditions: Build mozilla, setup enviroment as for running mozilla
and see api tests README for setup enviroment for run tests.
Description: This test call the postURL method of the PlugletManager object
at runstages, specified at TestProperties file. With parameters,
specified in PlugletManager_postURL.lst file. Each line in PlugletManager_postURL.lst file describes
one test of this method. See the test number and corresponding
line in LST file for viewing partameters of you test.
Results: See the PlugletTest.log and PlugletTest.res in
the $MOZILLA_FIVE_HOME/bin directory and additional logs in the
PLUGLET_TEST_DIR/log directory

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

@ -0,0 +1,6 @@
RUN_STAGES=PLUGLET_INSTANCE_INITIALIZE
TEST_CLASS=org.mozilla.pluglet.test.basic.api.PlugletManager_postURL_9216
ITERATOR_CLASS=org.mozilla.pluglet.test.basic.api.PlugletManager_postURL_Iterator
TEST_HTML=api/PlugletManager_postURL/PlugletManager_postURL.html
LST_FILE_NAME=PlugletManager_postURL.lst.TEMP
PLUGLET=<TEST_TOP_DIR><FSEP>build<FSEP>classes<FSEP>org<FSEP>mozilla<FSEP>pluglet<FSEP>test<FSEP>basic<FSEP>api<FSEP>TestAPIPluglet.jar

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

@ -0,0 +1,48 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s):
TEST_NAME=PlugletManager_postURL
DEPTH=..\..\..\..\..\..\..\..
UTIL_DIR=$(DEPTH)\utils
BUILD_DIR=$(DEPTH)\build
CONFIG_FILE=$(DEPTH)\config\CommonProperties
BASIC_PATH=test\basic\api
DEST_DIR=$(BUILD_DIR)\$(BASIC_PATH)\$(TEST_NAME)
MAKE_PARAM=..\makeParameters.pl
MAKE_COMB=..\makeCombinations.pl
default: all
all: html properties parameters
html:
@xcopy *.html $(HTML_DEST_DIR)\$(TEST_NAME) /I
properties:
@-1 mkdir $(DEST_DIR)
@perl $(UTIL_DIR)\configurator.pl $(CONFIG_FILE) $(DEST_DIR)\TestProperties TestProperties
parameters:
@$(MAKE_PARAM) TestParameters $(TEST_NAME).lst $(DEST_DIR)\$(TEST_NAME).lst
combinations:
@$(MAKE_COMB) ParamCombinations $(TEST_NAME).lst $(BUILD_DIR)\$(BASIC_PATH)\BWTest.lst.ORIG
clobber:
@del $(HTML_DEST_DIR)\$(TEST_NAME)\*.html
@del $(DEST_DIR)\$(TEST_NAME).lst
@del $(DEST_DIR)\TestProperties

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

@ -0,0 +1,126 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic.api;
import java.util.*;
import java.io.*;
import java.net.*;
import org.mozilla.pluglet.test.basic.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.pluglet.*;
public class PlugletManager_postURL_9216 implements Test
{
/**
*
***********************************************************
* Constructor
***********************************************************
*
*/
public PlugletManager_postURL_9216()
{
}
/**
*
***********************************************************
* Starting point of application
*
* @param args Array of command line arguments
*
***********************************************************
*/
public static void main(String[] args)
{
}
/**
***********************************************************
*
* Execute Method
*
* @param contex TestContext reference with properties and parameters
* @return void, the result set to true or false via context
*
***********************************************************
*/
public void execute(TestContext context)
{
Properties paramProps = null;
PlugletManager PlugletManager_obj = null;
if( context == null ) {
TestContext.registerFAILED("ERROR:null context passed in execute(TestContext) of PlugletManager_postURL_9216");
System.err.println("ERROR:null context passed in execute(TestContext) of PlugletManager_postURL_9216");
return;
}
if ( context.failedIsRegistered()) {
return;
}
Vector vectorOfParameters = context.getParameters();
PlugletManager_obj = context.getPlugletManager();
if( PlugletManager_obj == null ) {
TestContext.registerFAILED("ERROR:null PlugletManager passed in execute(TestContext) of PlugletManager_postURL_9216");
System.err.println("ERROR:null PlugletManager passed in execute(TestContext) of PlugletManager_postURL_9216");
return;
}
PlugletManager_obj.postURL((Pluglet)vectorOfParameters.elementAt(0),(URL)vectorOfParameters.elementAt(1),((Integer)vectorOfParameters.elementAt(2)).intValue(),(byte[])vectorOfParameters.elementAt(3),((Boolean)vectorOfParameters.elementAt(4)).booleanValue(),(String)vectorOfParameters.elementAt(5),(PlugletStreamListener)vectorOfParameters.elementAt(6),(String)vectorOfParameters.elementAt(7),(URL)vectorOfParameters.elementAt(8),((Boolean)vectorOfParameters.elementAt(9)).booleanValue(),((Integer)vectorOfParameters.elementAt(10)).intValue(),(byte[])vectorOfParameters.elementAt(11));
System.err.println("DEBUG: Void method PlugletManager_postURL(" + "," +
(Pluglet)vectorOfParameters.elementAt(0) + "," +
(URL)vectorOfParameters.elementAt(1) + "," +
((Integer)vectorOfParameters.elementAt(2)).intValue() + "," +
(byte[])vectorOfParameters.elementAt(3) + "," +
((Boolean)vectorOfParameters.elementAt(4)).booleanValue() + "," +
(String)vectorOfParameters.elementAt(5) + "," +
(PlugletStreamListener)vectorOfParameters.elementAt(6) + "," +
(String)vectorOfParameters.elementAt(7) + "," +
(URL)vectorOfParameters.elementAt(8) + "," +
((Boolean)vectorOfParameters.elementAt(9)).booleanValue() + "," +
((Integer)vectorOfParameters.elementAt(10)).intValue() + "," +
(byte[])vectorOfParameters.elementAt(11) + ")");
}
/**
*
***********************************************************
* Routine where OS specific checks are made.
*
* @param os OS Name (SunOS/Linus/MacOS/...)
***********************************************************
*
*/
private void osRoutine(String os)
{
if(os == null) return;
os = os.trim();
if(os.compareTo("SunOS") == 0) {}
else if(os.compareTo("Linux") == 0) {}
else if(os.compareTo("Windows") == 0) {}
else if(os.compareTo("MacOS") == 0) {}
else {}
}
}

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

@ -0,0 +1,332 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic.api;
import java.util.*;
import java.io.*;
import java.net.*;
import org.mozilla.pluglet.test.basic.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.pluglet.*;
public class PlugletManager_postURL_Iterator implements TestListIterator
{
Vector combstr = new Vector();
int curElement = 0;
Properties testProps = null;
TestContext context = null;
/**
*
***********************************************************
* Constructor
***********************************************************
*
*/
public PlugletManager_postURL_Iterator()
{
}
/**
*
***********************************************************
* Starting point of application
*
* @param args Array of command line arguments
*
***********************************************************
*/
public static void main(String[] args)
{
}
/**
***********************************************************
*
* Initialize Method
*
* This method initialize parameters array and prepare for
* access parameters via nextParams method
*
* @param contex TestContext reference with properties and parameters
* @return nothing
*
***********************************************************
*/
public boolean initialize(TestContext context)
{
this.context = context;
BufferedReader br = null;
String paramString = new String("");
String fileName = context.getProperty("LST_FILE_NAME");
String separator = System.getProperty("file.separator");
String paramFile = context.getTestDir() + separator + fileName;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(paramFile)));
} catch (Exception e) {
TestContext.registerFAILED("Can't open parameters file: " + paramFile);
return false;
}
try{
while((paramString = br.readLine())!= null)
{
combstr.addElement(paramString);
}
} catch (Exception e) {
TestContext.registerFAILED("Can't read from parameters file: " + paramFile);
return false;
}
try {
br.close();
} catch (Exception e) {
TestContext.registerFAILED("Can't close parameters file: " + paramFile);
return false;
}
return true;
}
public boolean next()
{
String[] paramValue = new String[12];
Vector vectorOfParameters = new Vector();
if (context == null)
{
System.err.println("context not initialized" );
TestContext.registerFAILED("context not initialized");
return false;
}
if(curElement <combstr.size())
{
int i = 0;
int last = 0;
int cur = 0;
String pstr = (String)combstr.elementAt(curElement++);
while((cur = pstr.indexOf(",",last)) != -1) {
paramValue[i] = pstr.substring(last,cur);
paramValue[i] = paramValue[i].trim();
//testProps.setProperty("param" + (new Integer(i)).toString(),pstr.substring(last,cur));
i++;
last = cur +1;
}
//For add last value
paramValue[i] = pstr.substring(last,pstr.length());
paramValue[i] = paramValue[i].trim();
Object result = null;
//Please hack this block.
// Parameter number 0,parameter type is Pluglet
//result = (Object)(paramValue[0].equals("null") ? null : context.getPluglet());
if (paramValue[0].equals("null"))
{
result = (Object)(null);
} else if (paramValue[0].equals("this_Pluglet"))
{
result = (Object)(context.getPluglet());
} else if (paramValue[0].equals("other_Pluglet"))
{
result = (Object)(context.getOtherPluglet());
} else
{
System.err.println("PlugletManager_postURL_Iterator can't parse value \"" + paramValue[0] + "\" for Pluglet\n");
TestContext.registerFAILED("PlugletManager_postURL_Iterator can't parse value \"" + paramValue[0] + "\" for Pluglet\n");
}
vectorOfParameters.addElement(result);
// Parameter number 1,parameter type is URL
try {
if (paramValue[1].equals("null"))
{
result = (Object)(null);
} else if (paramValue[1].equals("NOTNULL"))
{
System.err.println("Value NOTNULL not used NOW.Please change parameters file.\n");
TestContext.registerFAILED("Value NOTNULL not used NOW.Please change parameters file.\n");
//result = (Object)(new URL("http://www.mozilla.org"));
} else
{
result = (Object)(new URL(paramValue[1]));
}
}catch(MalformedURLException e)
{
System.err.println("MalformedURLException thrown when compiling URL from \"" + paramValue[1] + "\" value");
TestContext.registerFAILED("MalformedURLException thrown when compiling URL from \"" + paramValue[1] + "\".Wrong parameters file? ");
}
vectorOfParameters.addElement(result);
// Parameter number 2,parameter type is int
try {
if (paramValue[2].equals("Integer.MIN_VALUE"))
{
result = (Object)(new Integer(Integer.MIN_VALUE));
} else if (paramValue[2].equals("Integer.MAX_VALUE"))
{
result = (Object)(new Integer(Integer.MAX_VALUE));
} else if (paramValue[2].equals("0"))
{
result = (Object)(new Integer(0));
} else
{
result = (Object)(new Integer(paramValue[2]));
}
}catch(NumberFormatException e)
{
System.err.println("NumberFormatException thrown when compiling Integer value. Wrong parameter");
TestContext.registerFAILED("NumberFormatException thrown.Wrong parameters file?");
}
vectorOfParameters.addElement(result);
//Please hack this block.
// Parameter number 3,parameter type is Arr1byte
result = (Object)(paramValue[3].equals("null") ? null : readByteArray(paramValue[3]));
vectorOfParameters.addElement(result);
// Parameter number 4,parameter type is boolean
result = (Object)(new Boolean(paramValue[4]));
vectorOfParameters.addElement(result);
// Parameter number 5,parameter type is String
result = (Object)(paramValue[5].equals("null") ? null : paramValue[5] );
vectorOfParameters.addElement(result);
//Please hack this block.
// Parameter number 6,parameter type is PlugletStreamListener
//result = (Object)(paramValue[6].equals("null") ? null : context.getPlugletStreamListener());
if (paramValue[6].equals("null"))
{
result = (Object)(null);
} else if (paramValue[6].equals("current_streamListener")||paramValue[3].equals("NOTNULL"))
{
result = (Object)(context.getPlugletStreamListener());
} else if (paramValue[6].equals("new_streamListener"))
{
PlugletStreamListener newPlugletStreamListener = new TestStreamListener(context);
//context.addNewPlugletStreamListener(newPlugletStreamListener);
System.err.println("WARNING:Currently test doesn't know how work with newPlugletStreamListener\n");
// TestContext.registerFAILED("Currently test doesn't know how work with newPlugletStreamListener\n");
result = (Object)(newPlugletStreamListener);
} else
{
System.err.println("PlugletManager_postURL_Iterator can't parse \"" + paramValue[6] + "\" value for PlugletStreamListener\n");
TestContext.registerFAILED("PlugletManager_postURL_Iterator can't parse \"" + paramValue[6] + "\" value for PlugletStreamListener\n");
}
vectorOfParameters.addElement(result);
// Parameter number 7,parameter type is String
result = (Object)(paramValue[7].equals("null") ? null : paramValue[7] );
vectorOfParameters.addElement(result);
// Parameter number 8,parameter type is URL
try {
if (paramValue[8].equals("null"))
{
result = (Object)(null);
} else if (paramValue[8].equals("NOTNULL"))
{
System.err.println("Value NOTNULL not used NOW.Please change parameters file.\n");
TestContext.registerFAILED("Value NOTNULL not used NOW.Please change parameters file.\n");
//result = (Object)(new URL("http://www.mozilla.org"));
} else
{
result = (Object)(new URL(paramValue[8]));
}
}catch(MalformedURLException e)
{
System.err.println("MalformedURLException thrown when compiling URL from \"" + paramValue[8] + "\" value");
TestContext.registerFAILED("MalformedURLException thrown when compiling URL from \"" + paramValue[8] + "\".Wrong parameters file? ");
}
vectorOfParameters.addElement(result);
// Parameter number 9,parameter type is boolean
result = (Object)(new Boolean(paramValue[9]));
vectorOfParameters.addElement(result);
// Parameter number 10,parameter type is int
try {
if (paramValue[10].equals("Integer.MIN_VALUE"))
{
result = (Object)(new Integer(Integer.MIN_VALUE));
} else if (paramValue[10].equals("Integer.MAX_VALUE"))
{
result = (Object)(new Integer(Integer.MAX_VALUE));
} else if (paramValue[10].equals("0"))
{
result = (Object)(new Integer(0));
} else
{
result = (Object)(new Integer(paramValue[10]));
}
}catch(NumberFormatException e)
{
TestContext.registerFAILED("NumberFormatException thrown.Wrong parameters file?");
return false;
}
vectorOfParameters.addElement(result);
//Please hack this block.
// Parameter number 11,parameter type is Arr1byte
result = (Object)(paramValue[11].equals("null") ? null : readByteArray(paramValue[11]));
vectorOfParameters.addElement(result);
context.setParameters(vectorOfParameters);
return true;
}
return false;
}
private byte[] readByteArray(String fileName)
{
FileInputStream fis = null;
byte cur;
String separator = System.getProperty("file.separator");
String fullName = context.getTestDir() + separator + fileName;
Vector arrVect = new Vector();
try {
fis = new FileInputStream(fullName);
} catch (Exception e) {
TestContext.registerFAILED("Can't open file with Byte Array: " + fullName);
return null;
}
try{
while((cur = (byte)fis.read())!=-1)
{
arrVect.addElement((Object)(new Byte(cur)));
}
} catch (Exception e) {
TestContext.registerFAILED("Can't read from file with Byte Array: " + fullName);
return null;
}
try {
fis.close();
} catch (Exception e) {
TestContext.registerFAILED("Can't close file with Byte Array: " + fullName);
return null;
}
byte[] byteArr = new byte[arrVect.size()];
for(int i=0;i<arrVect.size();i++)
{
byteArr[i] = ((Byte)arrVect.elementAt(i)).byteValue();
}
return byteArr;
}
}

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

@ -0,0 +1,152 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
*/
import org.mozilla.pluglet.*;
import org.mozilla.pluglet.mozilla.*;
import java.io.*;
import java.awt.print.*;
import java.awt.Frame;
import org.mozilla.pluglet.test.basic.TestContext;
import org.mozilla.pluglet.test.basic.api.PlugletManager_reloadPluglets_2;
public class SecondPluglet implements PlugletFactory {
public SecondPluglet() {
}
/**
* Creates a new pluglet instance, based on a MIME type. This
* allows different impelementations to be created depending on
* the specified MIME type.
*/
public Pluglet createPluglet(String mimeType) {
return new TestInstance();
}
/**
* Initializes the pluglet and will be called before any new instances are
* created.
*/
public void initialize(PlugletManager manager) {
}
/**
* Called when the browser is done with the pluglet factory, or when
* the pluglet is disabled by the user.
*/
public void shutdown() {
}
}
class TestInstance implements Pluglet {
PlugletPeer peer;
public TestInstance() {
TestContext.registerPASSED("Second pluglet loaded");
}
/**
* Initializes a newly created pluglet instance, passing to it the pluglet
* instance peer which it should use for all communication back to the browser.
*
* @param peer the corresponding pluglet instance peer
*/
public void initialize(PlugletPeer peer) {
this.peer = peer;
}
/**
* Called to instruct the pluglet instance to start. This will be called after
* the pluglet is first created and initialized, and may be called after the
* pluglet is stopped (via the Stop method) if the pluglet instance is returned
* to in the browser window's history.
*/
public void start() {
}
/**
* Called to instruct the pluglet instance to stop, thereby suspending its state.
* This method will be called whenever the browser window goes on to display
* another page and the page containing the pluglet goes into the window's history
* list.
*/
public void stop() {
}
/**
* Called to instruct the pluglet instance to destroy itself. This is called when
* it become no longer possible to return to the pluglet instance, either because
* the browser window's history list of pages is being trimmed, or because the
* window containing this page in the history is being closed.
*/
public void destroy() {
}
/**
* Called to tell the pluglet that the initial src/data stream is
* ready.
*
* @result PlugletStreamListener
*/
public PlugletStreamListener newStream() {
return new TestStreamListener();
}
/**
* Called when the window containing the pluglet instance changes.
*
* @param frame the pluglet panel
*/
public void setWindow(Frame frame) {
}
/**
* Called to instruct the pluglet instance to print itself to a printer.
*
* @param print printer information.
*/
public void print(PrinterJob printerJob) {
}
}
class TestStreamListener implements PlugletStreamListener {
public TestStreamListener() {
}
/**
* Notify the observer that the URL has started to load. This method is
* called only once, at the beginning of a URL load.<BR><BR>
*/
public void onStartBinding(PlugletStreamInfo streamInfo) {
}
/**
* Notify the client that data is available in the input stream. This
* method is called whenver data is written into the input stream by the
* networking library...<BR><BR>
*
* @param input The input stream containing the data. This stream can
* be either a blocking or non-blocking stream.
* @param length The amount of data that was just pushed into the stream.
*/
public void onDataAvailable(PlugletStreamInfo plugletInfo, InputStream input,int length) {
}
public void onFileAvailable(PlugletStreamInfo plugletInfo, String fileName) {
}
/**
* Notify the observer that the URL has finished loading.
*/
public void onStopBinding(PlugletStreamInfo plugletInfo,int status) {
}
public int getStreamType() {
return 1; //:)
}
}

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

@ -0,0 +1,2 @@
MIMEDescription: application/x-second-pluglet::Second Pluglet
Pluglet-Class: SecondPluglet

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

@ -0,0 +1,179 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic.api;
import java.util.*;
import java.io.*;
import java.net.*;
import java.security.*;
import org.mozilla.pluglet.test.basic.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.pluglet.*;
import java.lang.reflect.*;
public class PlugletManager_reloadPluglets_2 implements Test
{
private static String destPluglet = "unset";
public static Vector msgVect = new Vector();
/**
*
***********************************************************
* Constructor
***********************************************************
*
*/
public PlugletManager_reloadPluglets_2()
{
}
/**
*
***********************************************************
* Starting point of application
*
* @param args Array of command line arguments
*
***********************************************************
*/
public static void main(String[] args)
{
}
/**
***********************************************************
*
* Execute Method
*
* @param contex TestContext reference with properties and parameters
* @return void, the result set to true or false via context
*
***********************************************************
*/
public void execute(TestContext context)
{
Properties paramProps = null;
PlugletManager PlugletManager_obj = null;
if( context == null ) {
TestContext.registerFAILED("ERROR:null context passed in execute(TestContext) of PlugletManager_reloadPluglets_2");
return;
}
if ( context.failedIsRegistered()) {
return;
}
Vector vectorOfParameters = context.getParameters();
PlugletManager_obj = context.getPlugletManager();
if( PlugletManager_obj == null ) {
TestContext.registerFAILED("ERROR:null PlugletManager passed in execute(TestContext) of PlugletManager_reloadPluglets_2");
return;
}
String destDir = context.getProperty("PLUGLET_DIR");
String sourceDir = context.getTestDir();
String fileName = context.getProperty("SECOND_PLUGLET_FILE");
TestContext.printLog("Delete Applet says{ " );
for(int i=0;i<msgVect.size();i++) {
TestContext.printLog((String)msgVect.elementAt(i));
}
TestContext.printLog("}");
if(((Boolean)copySecondPluglet(sourceDir,destDir,fileName)).booleanValue()) {
context.printLog("Second pluglet library was succesfully copied..");
PlugletManager_obj.reloadPluglets(((Boolean)vectorOfParameters.elementAt(0)).booleanValue());
System.err.println("DEBUG: Void method PlugletManager_reloadPluglets(" + ((Boolean)vectorOfParameters.elementAt(0)).booleanValue() + ")");
return;
}
TestContext.registerFAILED("Something wrong when copying new pluglet library.\n" +
" Possible second pluglet jar file already exist. \n" +
"Remove it and restart test\n");
}
/**
*
***********************************************************
* Routine where OS specific checks are made.
*
* @param os OS Name (SunOS/Linus/MacOS/...)
***********************************************************
*
*/
private void osRoutine(String os)
{
if(os == null) return;
os = os.trim();
if(os.compareTo("SunOS") == 0) {}
else if(os.compareTo("Linux") == 0) {}
else if(os.compareTo("Windows") == 0) {}
else if(os.compareTo("MacOS") == 0) {}
else {}
}
private Object copySecondPluglet(String sDir, String dDir, String fName)
{
final String sourceDir = sDir;
final String destDir = dDir;
final String fileName = fName;
return AccessController.doPrivileged(
new PrivilegedAction() {
public Object run() {
String separator = System.getProperty("file.separator");
try {
File outputFile = new File(destDir + separator + fileName);
File inputFile = new File(sourceDir + separator + fileName);
int bl = (int)inputFile.length();
if (outputFile.exists()) {
TestContext.printLog("SecondPluglet already exist in %PLUGLET% dir");
return (Object)(new Boolean(false));
}
// outputFile.deleteOnExit();
byte buf[] = new byte[bl];
System.err.println(destDir + separator + fileName);
FileInputStream fr = new FileInputStream(inputFile);
FileOutputStream fw = new FileOutputStream(outputFile);
if(fr.read(buf)<bl) {
TestContext.printLog("WARNING: Not all data copied to new jar");
}
fw.write(buf);
fw.flush();
fr.close();
fw.close();
return (Object)(new Boolean(true));
} catch (IOException e) {
e.printStackTrace();
return (Object)(new Boolean(false));
}
}
});
}
}

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

@ -0,0 +1,143 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic.api;
import java.util.*;
import java.io.*;
import java.net.*;
import org.mozilla.pluglet.test.basic.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.pluglet.*;
public class PlugletManager_reloadPluglets_Iterator implements TestListIterator
{
Vector combstr = new Vector();
int curElement = 0;
Properties testProps = null;
TestContext context = null;
/**
*
***********************************************************
* Constructor
***********************************************************
*
*/
public PlugletManager_reloadPluglets_Iterator()
{
}
/**
*
***********************************************************
* Starting point of application
*
* @param args Array of command line arguments
*
***********************************************************
*/
public static void main(String[] args)
{
}
/**
***********************************************************
*
* Initialize Method
*
* This method initialize parameters array and prepare for
* access parameters via nextParams method
*
* @param contex TestContext reference with properties and parameters
* @return nothing
*
***********************************************************
*/
public boolean initialize(TestContext context)
{
this.context = context;
BufferedReader br = null;
String paramString = new String("");
String fileName = context.getProperty("LST_FILE_NAME");
String separator = System.getProperty("file.separator");
String paramFile = context.getTestDir() + separator + fileName;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(paramFile)));
} catch (Exception e) {
TestContext.registerFAILED("Can't open parameters file: " + paramFile);
return false;
}
try{
while((paramString = br.readLine())!= null)
{
combstr.addElement(paramString);
}
} catch (Exception e) {
TestContext.registerFAILED("Can't read from parameters file: " + paramFile);
return false;
}
try {
br.close();
} catch (Exception e) {
TestContext.registerFAILED("Can't close parameters file: " + paramFile);
return false;
}
return true;
}
public boolean next()
{
String[] paramValue = new String[1];
Vector vectorOfParameters = new Vector();
if (context == null)
{
System.err.println("context not initialized" );
TestContext.registerFAILED("context not initialized");
return false;
}
if(curElement <combstr.size())
{
int i = 0;
int last = 0;
int cur = 0;
String pstr = (String)combstr.elementAt(curElement++);
while((cur = pstr.indexOf(",",last)) != -1) {
paramValue[i] = pstr.substring(last,cur);
paramValue[i] = paramValue[i].trim();
//testProps.setProperty("param" + (new Integer(i)).toString(),pstr.substring(last,cur));
i++;
last = cur +1;
}
//For add last value
paramValue[i] = pstr.substring(last,pstr.length());
paramValue[i] = paramValue[i].trim();
Object result = null;
// Parameter number 0,parameter type is boolean
result = (Object)(new Boolean(paramValue[0]));
vectorOfParameters.addElement(result);
context.setParameters(vectorOfParameters);
return true;
}
return false;
}
}

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

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

@ -0,0 +1,30 @@
<html>
<head>
<script language="JavaScript">
<!--
var iID;
function init(timeout)
{
iId = window.setInterval('verifyUserAgent()',timeout);
}
function verifyUserAgent()
{
java.lang.System.err.println("Verify ..");
if (Packages.org.mozilla.pluglet.test.basic.api.PlugletManager_userAgent_0.actionPerformed) {
var userAgent = window.navigator.userAgent;
Packages.org.mozilla.pluglet.test.basic.api.PlugletManager_userAgent_0.verifyUserAgent(userAgent);
window.clearInterval(iId);
}
}
//-->
</script>
</head>
<body onLoad="init(1000)">
<center><H1>Depth 0</H1></center>
<blockquote>
This window contains a pluglet with PlugletManager_userAgent test.
UserAgent value will be passed to pluglet via JavaScript
</blockquote>
<EMBED type="application/x-api-pluglet" name="test" width=100 height=100>
</body>
</hmtl>

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

@ -0,0 +1,18 @@
PlugletManager_userAgent Information.
Test name: PlugletManager_userAgent
Synopsis: userAgent method of class PlugletManager
Pre-Conditions: Build mozilla, setup enviroment as for running mozilla
and see api tests README for setup enviroment for run tests.
Description: This test call the userAgent method of the PlugletManager object
at runstages, specified at TestProperties file. With parameters,
specified in PlugletManager_userAgent.lst file. Each line in PlugletManager_userAgent.lst file describes
one test of this method. See the test number and corresponding
line in LST file for viewing partameters of you test.
Results: See the PlugletTest.log and PlugletTest.res in
the $MOZILLA_FIVE_HOME/bin directory and additional logs in the
PLUGLET_TEST_DIR/log directory

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

@ -0,0 +1,6 @@
RUN_STAGES=PLUGLET_INSTANCE_INITIALIZE
TEST_CLASS=org.mozilla.pluglet.test.basic.api.PlugletManager_userAgent_0
ITERATOR_CLASS=org.mozilla.pluglet.test.basic.api.PlugletManager_userAgent_Iterator
TEST_HTML=api/PlugletManager_userAgent/PlugletManager_userAgent.html
#CURRENT_USER_AGENT=Mozilla/5.0 [en] (Windows;I)
PLUGLET=<TEST_TOP_DIR><FSEP>build<FSEP>classes<FSEP>org<FSEP>mozilla<FSEP>pluglet<FSEP>test<FSEP>basic<FSEP>api<FSEP>TestAPIPluglet.jar

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

@ -0,0 +1,46 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s):
TEST_NAME=PlugletManager_userAgent
DEPTH=..\..\..\..\..\..\..\..
UTIL_DIR=$(DEPTH)\utils
BUILD_DIR=$(DEPTH)\build
CONFIG_FILE=$(DEPTH)\config\CommonProperties
BASIC_PATH=test\basic\api
DEST_DIR=$(BUILD_DIR)\$(BASIC_PATH)\$(TEST_NAME)
MAKE_PARAM=..\makeParameters.pl
MAKE_COMB=..\makeCombinations.pl
default: all
all: html properties
html:
@xcopy *.html $(HTML_DEST_DIR)\$(TEST_NAME) /I
properties:
@-1 mkdir $(DEST_DIR)
@perl $(UTIL_DIR)\configurator.pl $(CONFIG_FILE) $(DEST_DIR)\TestProperties TestProperties
combinations:
echo basic/api/$(TEST_NAME)>>$(BUILD_DIR)\$(BASIC_PATH)\BWTest.lst.ORIG
clobber:
@del $(HTML_DEST_DIR)\$(TEST_NAME)\*.html
@del $(DEST_DIR)\TestProperties

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

@ -0,0 +1,127 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic.api;
import java.util.*;
import java.io.*;
import java.net.*;
import org.mozilla.pluglet.test.basic.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.pluglet.*;
public class PlugletManager_userAgent_0 implements Test
{
public static boolean actionPerformed = false;
private static String userAgent = null;
/**
*
***********************************************************
* Constructor
***********************************************************
*
*/
public PlugletManager_userAgent_0()
{
}
/**
*
***********************************************************
* Starting point of application
*
* @param args Array of command line arguments
*
***********************************************************
*/
public static void main(String[] args)
{
}
/**
***********************************************************
*
* Execute Method
*
* @param contex TestContext reference with properties and parameters
* @return void, the result set to true or false via context
*
***********************************************************
*/
public void execute(TestContext context)
{
Properties paramProps = null;
PlugletManager PlugletManager_obj = null;
if( context == null ) {
TestContext.registerFAILED("ERROR:null context passed in execute(TestContext)" +
" of PlugletManager_userAgent_0");
return;
}
if (context.failedIsRegistered()) {
return;
}
PlugletManager_obj = context.getPlugletManager();
if( PlugletManager_obj == null ) {
TestContext.registerFAILED("ERROR:null PlugletManager passed in execute(TestContext)" +
" of PlugletManager_userAgent_0");
return;
}
userAgent = PlugletManager_obj.userAgent();
actionPerformed = true;
System.err.println("DEBUG: PlugletManager_userAgent returns \"" + userAgent + "\" value");
}
public static void verifyUserAgent(String curUserAgent)
{
if (userAgent == null) {
TestContext.registerFAILED("PlugletManager_userAgent returns null value");
return;
}
if ( curUserAgent.equals(userAgent)) {
TestContext.registerPASSED("PlugletManager_userAgent returns \"" + userAgent + "\" value");
} else {
TestContext.registerFAILED("PlugletManager_userAgent returns \"" + userAgent +
"\" value. Legal value is \"" + curUserAgent + "\"");
}
}
/**
*
***********************************************************
* Routine where OS specific checks are made.
*
* @param os OS Name (SunOS/Linus/MacOS/...)
***********************************************************
*
*/
private void osRoutine(String os)
{
if(os == null) return;
os = os.trim();
if(os.compareTo("SunOS") == 0) {}
else if(os.compareTo("Linux") == 0) {}
else if(os.compareTo("Windows") == 0) {}
else if(os.compareTo("MacOS") == 0) {}
else {}
}
}

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

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

@ -0,0 +1,26 @@
<html>
<head>
<script language="JavaScript">
<!--
var iID;
function init(timeout)
{
iId = window.setInterval('verifyMIMEType("application/x-api-pluglet")',timeout);
}
function verifyMIMEType(MIMEType)
{
java.lang.System.err.println("Verify ..");
if (Packages.org.mozilla.pluglet.test.basic.api.PlugletPeer_getMIMEType_0.actionPerformed) {
Packages.org.mozilla.pluglet.test.basic.api.PlugletPeer_getMIMEType_0.verifyMIMEType(MIMEType);
window.clearInterval(iId);
}
}
//-->
</script>
</head>
<body onLoad=init(1000)>
<center><H1>Depth 0</H1></center>
<blockquote>This window contains a pluglet with PlugletPeer_getMIMEType test.</blockquote>
<EMBED type="application/x-api-pluglet" name="test" width=100 height=100 id=121>
</body>
</hmtl>

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

@ -0,0 +1,18 @@
PlugletPeer_getMIMEType Information.
Test name: PlugletPeer_getMIMEType
Synopsis: getMIMEType method of class PlugletPeer
Pre-Conditions: Build mozilla, setup enviroment as for running mozilla
and see api tests README for setup enviroment for run tests.
Description: This test call the getMIMEType method of the PlugletPeer object
at runstages, specified at TestProperties file. With parameters,
specified in PlugletPeer_getMIMEType.lst file. Each line in PlugletPeer_getMIMEType.lst file describes
one test of this method. See the test number and corresponding
line in LST file for viewing partameters of you test.
Results: See the PlugletTest.log and PlugletTest.res in
the $MOZILLA_FIVE_HOME/bin directory and additional logs in the
PLUGLET_TEST_DIR/log directory

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

@ -0,0 +1,8 @@
#TestProperties file
#At PLUGLET_INSTANCE_INITIALIZE good value isn't passed from JS, so should use START or later
RUN_STAGES=PLUGLET_INSTANCE_START
TEST_CLASS=org.mozilla.pluglet.test.basic.api.PlugletPeer_getMIMEType_0
ITERATOR_CLASS=org.mozilla.pluglet.test.basic.api.PlugletPeer_getMIMEType_Iterator
TEST_HTML=api/PlugletPeer_getMIMEType/PlugletPeer_getMIMEType.html
#TEST_PLUGLET_MIME_TYPE=application/x-simple-pluglet
PLUGLET=<TEST_TOP_DIR><FSEP>build<FSEP>classes<FSEP>org<FSEP>mozilla<FSEP>pluglet<FSEP>test<FSEP>basic<FSEP>api<FSEP>TestAPIPluglet.jar

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

@ -0,0 +1,44 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s):
TEST_NAME=PlugletPeer_getMIMEType
DEPTH=..\..\..\..\..\..\..\..
UTIL_DIR=$(DEPTH)\utils
BUILD_DIR=$(DEPTH)\build
CONFIG_FILE=$(DEPTH)\config\CommonProperties
BASIC_PATH=test\basic\api
DEST_DIR=$(BUILD_DIR)\$(BASIC_PATH)\$(TEST_NAME)
MAKE_PARAM=..\makeParameters.pl
MAKE_COMB=..\makeCombinations.pl
default: all
all: html properties
html:
@xcopy *.html $(HTML_DEST_DIR)\$(TEST_NAME) /I
properties:
@-1 mkdir $(DEST_DIR)
@perl $(UTIL_DIR)\configurator.pl $(CONFIG_FILE) $(DEST_DIR)\TestProperties TestProperties
combinations:
echo basic/api/$(TEST_NAME)>>$(BUILD_DIR)\$(BASIC_PATH)\BWTest.lst.ORIG
clobber:
@del $(HTML_DEST_DIR)\$(TEST_NAME)\*.html
@del $(DEST_DIR)\TestProperties

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

@ -0,0 +1,129 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic.api;
import java.util.*;
import java.io.*;
import java.net.*;
import org.mozilla.pluglet.test.basic.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.pluglet.*;
public class PlugletPeer_getMIMEType_0 implements Test
{
public static boolean actionPerformed = false;
private static String MIMEType = null;
/**
*
***********************************************************
* Constructor
***********************************************************
*
*/
public PlugletPeer_getMIMEType_0()
{
}
/**
*
***********************************************************
* Starting point of application
*
* @param args Array of command line arguments
*
***********************************************************
*/
public static void main(String[] args)
{
}
/**
***********************************************************
*
* Execute Method
*
* @param contex TestContext reference with properties and parameters
* @return void, the result set to true or false via context
*
***********************************************************
*/
public void execute(TestContext context)
{
PlugletPeer PlugletPeer_obj = null;
if( context == null ) {
TestContext.registerFAILED("ERROR:null context passed in execute(TestContext)" +
" of PlugletPeer_getMIMEType_0");
return;
}
PlugletPeer_obj = context.getPlugletPeer();
if( PlugletPeer_obj == null ) {
TestContext.registerFAILED("ERROR:null PlugletPeer passed in execute(TestContext)" +
" of PlugletPeer_getMIMEType_0");
return;
}
MIMEType = PlugletPeer_obj.getMIMEType();
actionPerformed = true;
System.err.println("DEBUG: PlugletPeer_obj.getMIMEType returns \"" + MIMEType + "\" value");
}
public static void verifyMIMEType(String type)
{
if (MIMEType == null) {
TestContext.registerFAILED("null MIME type returned instead of \"" + type +"\"");
}
if (type.equals(MIMEType)) {
TestContext.registerPASSED("PlugletPeer_obj.getMIMEType returns \"" + MIMEType + "\" value");
} else {
TestContext.registerFAILED("PlugletPeer_obj.getMIMEType returns \"" + MIMEType +
"\" value, different from \"" + type +"\"");
}
}
/**
*
***********************************************************
* Routine where OS specific checks are made.
*
* @param os OS Name (SunOS/Linus/MacOS/...)
***********************************************************
*
*/
private void osRoutine(String os)
{
if(os == null) return;
os = os.trim();
if(os.compareTo("SunOS") == 0) {}
else if(os.compareTo("Linux") == 0) {}
else if(os.compareTo("Windows") == 0) {}
else if(os.compareTo("MacOS") == 0) {}
else {}
}
}

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

@ -0,0 +1,98 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic.api;
import java.util.*;
import java.io.*;
import java.net.*;
import org.mozilla.pluglet.test.basic.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.pluglet.*;
public class PlugletPeer_getMIMEType_Iterator implements TestListIterator
{
TestContext context = null;
int flag = 0;
/**
*
***********************************************************
* Constructor
***********************************************************
*
*/
public PlugletPeer_getMIMEType_Iterator()
{
//Method has 0 parameters
//Constructor is empty
}
/**
*
***********************************************************
* Starting point of application
*
* @param args Array of command line arguments
*
***********************************************************
*/
public static void main(String[] args)
{
}
/**
***********************************************************
*
* Initialize Method
*
* This method initialize parameters array and prepare for
* access parameters via nextParams method
*
* @param contex TestContext reference with properties and parameters
* @return nothing
*
***********************************************************
*/
public boolean initialize(TestContext context)
{
this.context = context;
return true;
}
public boolean next()
{
if (context == null)
{
System.err.println("context not initialized" );
TestContext.registerFAILED("context not initialized");
return false;
}
if (flag == 0) //Only one time we should work(In future may be stress test for many calls :)
{
context.setParameters(new Vector());
flag = 1;
return true;
} else
{
return false;
}
}
}

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

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

@ -0,0 +1,7 @@
<html>
<body>
<center><H1>Depth 0</H1></center>
<blockquote>This window contains a pluglet with PlugletPeer_getMode test.</blockquote>
<EMBED type="application/x-api-pluglet" name="test" width=100 height=100>
</body>
</hmtl>

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

@ -0,0 +1,18 @@
PlugletPeer_getMode Information.
Test name: PlugletPeer_getMode
Synopsis: getMode method of class PlugletPeer
Pre-Conditions: Build mozilla, setup enviroment as for running mozilla
and see api tests README for setup enviroment for run tests.
Description: This test call the getMode method of the PlugletPeer object
at runstages, specified at TestProperties file. With parameters,
specified in PlugletPeer_getMode.lst file. Each line in PlugletPeer_getMode.lst file describes
one test of this method. See the test number and corresponding
line in LST file for viewing partameters of you test.
Results: See the PlugletTest.log and PlugletTest.res in
the $MOZILLA_FIVE_HOME/bin directory and additional logs in the
PLUGLET_TEST_DIR/log directory

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

@ -0,0 +1,6 @@
RUN_STAGES=PLUGLET_INSTANCE_INITIALIZE
TEST_CLASS=org.mozilla.pluglet.test.basic.api.PlugletPeer_getMode_0
ITERATOR_CLASS=org.mozilla.pluglet.test.basic.api.PlugletPeer_getMode_Iterator
TEST_HTML=api/PlugletPeer_getMode/PlugletPeer_getMode.html
EXPECTED_VALUE=1
PLUGLET=<TEST_TOP_DIR><FSEP>build<FSEP>classes<FSEP>org<FSEP>mozilla<FSEP>pluglet<FSEP>test<FSEP>basic<FSEP>api<FSEP>TestAPIPluglet.jar

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

@ -0,0 +1,44 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s):
TEST_NAME=PlugletPeer_getMode
DEPTH=..\..\..\..\..\..\..\..
UTIL_DIR=$(DEPTH)\utils
BUILD_DIR=$(DEPTH)\build
CONFIG_FILE=$(DEPTH)\config\CommonProperties
BASIC_PATH=test\basic\api
DEST_DIR=$(BUILD_DIR)\$(BASIC_PATH)\$(TEST_NAME)
MAKE_PARAM=..\makeParameters.pl
MAKE_COMB=..\makeCombinations.pl
default: all
all: html properties
html:
@xcopy *.html $(HTML_DEST_DIR)\$(TEST_NAME) /I
properties:
@-1 mkdir $(DEST_DIR)
@perl $(UTIL_DIR)\configurator.pl $(CONFIG_FILE) $(DEST_DIR)\TestProperties TestProperties
combinations:
echo basic/api/$(TEST_NAME)>>$(BUILD_DIR)\$(BASIC_PATH)\BWTest.lst.ORIG
clobber:
@del $(HTML_DEST_DIR)\$(TEST_NAME)\*.html

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

@ -0,0 +1,117 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic.api;
import java.util.*;
import java.io.*;
import java.net.*;
import org.mozilla.pluglet.test.basic.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.pluglet.*;
public class PlugletPeer_getMode_0 implements Test
{
/**
*
***********************************************************
* Constructor
***********************************************************
*
*/
public PlugletPeer_getMode_0()
{
}
/**
*
***********************************************************
* Starting point of application
*
* @param args Array of command line arguments
*
***********************************************************
*/
public static void main(String[] args)
{
}
/**
***********************************************************
*
* Execute Method
*
* @param contex TestContext reference with properties and parameters
* @return void, the result set to true or false via context
*
***********************************************************
*/
public void execute(TestContext context)
{
Properties paramProps = null;
PlugletPeer PlugletPeer_obj = null;
if( context == null ) {
TestContext.registerFAILED("ERROR:null context passed in execute(TestContext) of PlugletPeer_getMode_0");
return;
}
PlugletPeer_obj = context.getPlugletPeer();
if( PlugletPeer_obj == null ) {
TestContext.registerFAILED("ERROR:null PlugletPeer passed in execute(TestContext) of PlugletPeer_getMode_0");
return;
}
int rt = PlugletPeer_obj.getMode();
System.err.println("DEBUG: PlugletPeer_getMode returns \"" + rt + "\"value");
//Get expected value from properties, for embedded pluglets it equals 1
int expVal = (new Integer(context.getProperty("EXPECTED_VALUE"))).intValue();
TestContext.printLog("Expected value for this test is " + expVal + "\n");
if (rt == expVal) {
TestContext.registerPASSED("PlugletPeer_getMode returns \"" + rt + "\"value.");
} else {
TestContext.registerFAILED("PlugletPeer_getMode returns \"" + rt + "\"value.");
}
}
/**
*
***********************************************************
* Routine where OS specific checks are made.
*
* @param os OS Name (SunOS/Linus/MacOS/...)
***********************************************************
*
*/
private void osRoutine(String os)
{
if(os == null) return;
os = os.trim();
if(os.compareTo("SunOS") == 0) {}
else if(os.compareTo("Linux") == 0) {}
else if(os.compareTo("Windows") == 0) {}
else if(os.compareTo("MacOS") == 0) {}
else {}
}
}

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

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

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

@ -0,0 +1,39 @@
<html>
<head>
<script language="JavaScript">
<!--
var iID;
var allAttributes="";
function init(timeout)
{
for (j=0;j < window.document.body.childNodes.length;j++) {
if(window.document.body.childNodes[j].nodeName == "EMBED") {
for(i=0;i<window.document.body.childNodes[j].attributes.length;i++) {
allAttributes+=window.document.body.childNodes[j].attributes[i].name + " = " + window.document.body.childNodes[j].attributes[i].value + "\n";
}
break;
}
}
java.lang.System.err.println(allAttributes);
//String allAttributes now contains all attributes of EMBED tag, used in this HTML file
iId = window.setInterval('verifyAttr()',timeout);
}
function verifyAttr()
{
java.lang.System.err.println("Verify .." + allAttributes);
if (Packages.org.mozilla.pluglet.test.basic.api.PlugletPeer_getTagInfo_0.actionPerformed) {
Packages.org.mozilla.pluglet.test.basic.api.PlugletPeer_getTagInfo_0.verifyAttr(allAttributes);
window.clearInterval(iId);
}
}
//-->
</script>
</head>
<body onLoad=init(1000)>
<center><H1>Depth 0</H1></center>
<blockquote>This window contains a pluglet with PlugletPeer_getTagInfo test.</blockquote>
<EMBED type="application/x-api-pluglet" name="test" width=100 height=100>
</body>
</hmtl>

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

@ -0,0 +1,15 @@
PlugletPeer_getTagInfo Information.
Test name: PlugletPeer_getTagInfo
Synopsis: getTagInfo method of class PlugletPeer
Pre-Conditions: Build mozilla, setup enviroment as for running mozilla
and see api tests README for setup enviroment for run tests.
Description: This test call the getTagInfo method of the PlugletPeer object
at runstages, specified at TestProperties file.
Results: See the PlugletTest.log and PlugletTest.res in
the $MOZILLA_FIVE_HOME/bin directory and additional logs in the
PLUGLET_TEST_DIR/log directory

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

@ -0,0 +1,5 @@
RUN_STAGES=PLUGLET_INSTANCE_INITIALIZE
TEST_CLASS=org.mozilla.pluglet.test.basic.api.PlugletPeer_getTagInfo_0
ITERATOR_CLASS=org.mozilla.pluglet.test.basic.api.PlugletPeer_getTagInfo_Iterator
TEST_HTML=api/PlugletPeer_getTagInfo/PlugletPeer_getTagInfo.html
PLUGLET=<TEST_TOP_DIR><FSEP>build<FSEP>classes<FSEP>org<FSEP>mozilla<FSEP>pluglet<FSEP>test<FSEP>basic<FSEP>api<FSEP>TestAPIPluglet.jar

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

@ -0,0 +1,45 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s):
TEST_NAME=PlugletPeer_getTagInfo
DEPTH=..\..\..\..\..\..\..\..
UTIL_DIR=$(DEPTH)\utils
BUILD_DIR=$(DEPTH)\build
CONFIG_FILE=$(DEPTH)\config\CommonProperties
BASIC_PATH=test\basic\api
DEST_DIR=$(BUILD_DIR)\$(BASIC_PATH)\$(TEST_NAME)
MAKE_PARAM=..\makeParameters.pl
MAKE_COMB=..\makeCombinations.pl
default: all
all: html properties
html:
@xcopy *.html $(HTML_DEST_DIR)\$(TEST_NAME) /I
properties:
@-1 mkdir $(DEST_DIR)
@perl $(UTIL_DIR)\configurator.pl $(CONFIG_FILE) $(DEST_DIR)\TestProperties TestProperties
combinations:
echo basic/api/$(TEST_NAME)>>$(BUILD_DIR)\$(BASIC_PATH)\BWTest.lst.ORIG
clobber:
@del $(HTML_DEST_DIR)\$(TEST_NAME)\*.html
@del $(DEST_DIR)\TestProperties

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

@ -0,0 +1,139 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic.api;
import java.util.*;
import java.io.*;
import java.net.*;
import org.mozilla.pluglet.test.basic.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.pluglet.*;
public class PlugletPeer_getTagInfo_0 implements Test
{
public static boolean actionPerformed = false;
private static String TEST_ATTRIBUTE_NAME = "type";
private static PlugletTagInfo info = null;
/**
*
***********************************************************
* Constructor
***********************************************************
*
*/
public PlugletPeer_getTagInfo_0()
{
}
/**
*
***********************************************************
* Starting point of application
*
* @param args Array of command line arguments
*
***********************************************************
*/
public static void main(String[] args)
{
}
/**
***********************************************************
*
* Execute Method
*
* @param contex TestContext reference with properties and parameters
* @return void, the result set to true or false via context
*
***********************************************************
*/
public void execute(TestContext context)
{
PlugletPeer PlugletPeer_obj = null;
if( context == null ) {
TestContext.registerFAILED("ERROR:null context passed in execute(TestContext)" +
" of PlugletPeer_getTagInfo_0");
return;
}
PlugletPeer_obj = context.getPlugletPeer();
info = PlugletPeer_obj.getTagInfo();
actionPerformed = true;
System.err.println("DEBUG: PlugletPeer_getTagInfo returns \"" + info + "\"value");
}
public static void verifyAttr(String allAttrs)
{
if (info == null) {
TestContext.registerFAILED("PlugletPeer_getTagInfo returns null value");
return;
}
Properties attr = new Properties();
try {
attr.load((InputStream)new ByteArrayInputStream(allAttrs.getBytes()));
} catch (Exception e) {
TestContext.registerFAILED("Exception " + e + " ocurred");
return;
}
String attrValue = info.getAttribute(TEST_ATTRIBUTE_NAME);
if (attrValue == null) {
TestContext.registerFAILED("null value returned for attribute \"" + TEST_ATTRIBUTE_NAME +
"\" from PlugletTagInfo object");
return;
}
String goodAttrValue = attr.getProperty(TEST_ATTRIBUTE_NAME,null);
if (goodAttrValue == null) {
TestContext.registerFAILED("Attribute with name \"" + TEST_ATTRIBUTE_NAME + "\" isn't passed from JS");
return;
}
if (goodAttrValue.equals(attrValue)) {
TestContext.registerPASSED("Good TagInfo object returned");
return;
} else {
TestContext.registerFAILED("Strange TagInfo object returned, " + TEST_ATTRIBUTE_NAME + "=\"" +
attrValue + "\" instead of \"" + goodAttrValue + "\"");
return;
}
}
/**
*
***********************************************************
* Routine where OS specific checks are made.
*
* @param os OS Name (SunOS/Linus/MacOS/...)
***********************************************************
*
*/
private void osRoutine(String os)
{
if(os == null) return;
os = os.trim();
if(os.compareTo("SunOS") == 0) {}
else if(os.compareTo("Linux") == 0) {}
else if(os.compareTo("Windows") == 0) {}
else if(os.compareTo("MacOS") == 0) {}
else {}
}
}

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

@ -0,0 +1,97 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet.test.basic.api;
import java.util.*;
import java.io.*;
import java.net.*;
import org.mozilla.pluglet.test.basic.*;
import org.mozilla.pluglet.mozilla.*;
import org.mozilla.pluglet.*;
public class PlugletPeer_getTagInfo_Iterator implements TestListIterator
{
TestContext context = null;
public static int flag = 0;
/**
*
***********************************************************
* Constructor
***********************************************************
*
*/
public PlugletPeer_getTagInfo_Iterator()
{
//Method has 0 parameters
}
/**
*
***********************************************************
* Starting point of application
*
* @param args Array of command line arguments
*
***********************************************************
*/
public static void main(String[] args)
{
}
/**
***********************************************************
*
* Initialize Method
*
* This method initialize parameters array and prepare for
* access parameters via nextParams method
*
* @param contex TestContext reference with properties and parameters
* @return nothing
*
***********************************************************
*/
public boolean initialize(TestContext context)
{
this.context = context;
return true;
}
public boolean next()
{
if (context == null)
{
TestContext.registerFAILED("context not initialized");
return false;
}
if (flag == 0) //Only one time we should work(In future may be stress test for many calls :)
{
context.setParameters(new Vector());
flag = 1;
return true;
} else
{
return false;
}
}
}

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

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

@ -0,0 +1,7 @@
<html>
<body>
<center><H1>Depth 0</H1></center>
<blockquote>This window contains a pluglet with PlugletPeer_getValue test.</blockquote>
<EMBED type="application/x-api-pluglet" name="test" width=100 height=100>
</body>
</hmtl>

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

@ -0,0 +1,4 @@
0: 0
1: Integer.MIN_VALUE
2: Integer.MAX_VALUE
3: NETSCAPE_WINDOW_FOR_GET_VALUE

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

@ -0,0 +1,18 @@
PlugletPeer_getValue Information.
Test name: PlugletPeer_getValue
Synopsis: getValue method of class PlugletPeer
Pre-Conditions: Build mozilla, setup enviroment as for running mozilla
and see api tests README for setup enviroment for run tests.
Description: This test call the getValue method of the PlugletPeer object
at runstages, specified at TestProperties file. With parameters,
specified in PlugletPeer_getValue.lst file. Each line in PlugletPeer_getValue.lst file describes
one test of this method. See the test number and corresponding
line in LST file for viewing partameters of you test.
Results: See the PlugletTest.log and PlugletTest.res in
the $MOZILLA_FIVE_HOME/bin directory and additional logs in the
PLUGLET_TEST_DIR/log directory

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