This commit was manufactured by cvs2svn to create branch

'JAVADEV_RTM_20001102'.

git-svn-id: svn://10.0.0.236/branches/JAVADEV_RTM_20001102@84613 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
(no author)
2001-01-08 23:24:12 +00:00
parent bf24f1b3d6
commit 28e7132c6d
959 changed files with 39151 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,95 @@
./config/CommonProperties
./build/test/basic/Makefile.win
./build/classes/Makefile.win
./build/Makefile.win
./docs/spec.txt
./docs/spec1.txt
./docs/tests_counts.txt
./docs/queried_interfaces_tests.txt
./docs/testdoc_template.html
./src/classes/org/mozilla/webclient/test/basic/api/History_back.java
./src/classes/org/mozilla/webclient/test/basic/api/History_getURLForIndex.java
./src/classes/org/mozilla/webclient/test/basic/api/History_canBack.java
./src/classes/org/mozilla/webclient/test/basic/api/WindowControl_createWindow.java
./src/classes/org/mozilla/webclient/test/basic/api/History_canForward.java
./src/classes/org/mozilla/webclient/test/basic/api/WindowControl_getNativeWebShell.java
./src/classes/org/mozilla/webclient/test/basic/api/History_clearHistory.java
./src/classes/org/mozilla/webclient/test/basic/api/History_getCurrentHistoryIndex.java
./src/classes/org/mozilla/webclient/test/basic/api/WindowControl_moveWindowTo.java
./src/classes/org/mozilla/webclient/test/basic/api/History_forward.java
./src/classes/org/mozilla/webclient/test/basic/api/WindowControl_setBounds.java
./src/classes/org/mozilla/webclient/test/basic/api/History_getBackList.java
./src/classes/org/mozilla/webclient/test/basic/api/History_getForwardList.java
./src/classes/org/mozilla/webclient/test/basic/api/History_getHistory.java
./src/classes/org/mozilla/webclient/test/basic/api/History_getHistoryEntry.java
./src/classes/org/mozilla/webclient/test/basic/api/History_getHistoryLength.java
./src/classes/org/mozilla/webclient/test/basic/api/History_setCurrentHistoryIndex.java
./src/classes/org/mozilla/webclient/test/basic/StartProperties
./src/classes/org/mozilla/webclient/test/basic/Test.java
./src/classes/org/mozilla/webclient/test/basic/TestContext.java
./src/classes/org/mozilla/webclient/test/basic/TestLoader.java
./src/classes/org/mozilla/webclient/test/basic/TestRunner.java
./src/test/basic/api/History_getURLForIndex/History_getURLForIndex.lst
./src/test/basic/api/History_getURLForIndex/TestProperties
./src/test/basic/api/History_getURLForIndex/Test.lst
./src/test/basic/api/WindowControl_createWindow/Test.lst
./src/test/basic/api/WindowControl_createWindow/TestProperties
./src/test/basic/api/WindowControl_getNativeWebShell/TestProperties
./src/test/basic/api/WindowControl_moveWindowTo/Test.lst
./src/test/basic/api/WindowControl_moveWindowTo/TestProperties
./src/test/basic/api/WindowControl_setBounds/Test.lst
./src/test/basic/api/WindowControl_setBounds/TestProperties
./src/test/basic/api/History_back_1/Test.lst
./src/test/basic/api/History_back_1/TestProperties
./src/test/basic/api/History_back_2/Test.lst
./src/test/basic/api/History_back_2/TestProperties
./src/test/basic/api/History_canBack_1/Test.lst
./src/test/basic/api/History_canBack_1/TestProperties
./src/test/basic/api/History_canBack_2/Test.lst
./src/test/basic/api/History_canBack_2/TestProperties
./src/test/basic/api/History_canForward_1/Test.lst
./src/test/basic/api/History_canForward_1/TestProperties
./src/test/basic/api/History_canForward_2/Test.lst
./src/test/basic/api/History_canForward_2/TestProperties
./src/test/basic/api/History_clearHistory_1/Test.lst
./src/test/basic/api/History_clearHistory_1/TestProperties
./src/test/basic/api/History_clearHistory_2/Test.lst
./src/test/basic/api/History_clearHistory_2/TestProperties
./src/test/basic/api/History_forward_1/Test.lst
./src/test/basic/api/History_forward_1/TestProperties
./src/test/basic/api/History_forward_2/Test.lst
./src/test/basic/api/History_forward_2/TestProperties
./src/test/basic/api/History_getBackList/Test.lst
./src/test/basic/api/History_getBackList/TestProperties
./src/test/basic/api/History_getCurrentHistoryIndex/Test.lst
./src/test/basic/api/History_getCurrentHistoryIndex/TestProperties
./src/test/basic/api/History_getForwardList/Test.lst
./src/test/basic/api/History_getForwardList/TestProperties
./src/test/basic/api/History_getHistoryEntry/Test.lst
./src/test/basic/api/History_getHistoryEntry/TestProperties
./src/test/basic/api/History_getHistoryLength/Test.lst
./src/test/basic/api/History_getHistoryLength/TestProperties
./src/test/basic/api/History_getHistory_1/Test.lst
./src/test/basic/api/History_getHistory_1/TestProperties
./src/test/basic/api/History_getHistory_2/Test.lst
./src/test/basic/api/History_getHistory_2/TestProperties
./src/test/basic/api/History_setCurrentHistoryIndex/Test.lst
./src/test/basic/api/History_setCurrentHistoryIndex/TestProperties
./src/test/basic/api/History_setCurrentHistoryIndex_1/Test.lst
./src/test/basic/api/History_setCurrentHistoryIndex_1/TestProperties
./src/test/basic/api/History_setCurrentHistoryIndex_2/Test.lst
./src/test/basic/api/History_setCurrentHistoryIndex_2/TestProperties
./src/test/basic/bastest1.html
./src/test/basic/bastest2.html
./src/test/basic/bastest3.html
./src/test/basic/bastest4.html
./src/test/basic/bastest5.html
./src/test/basic/bastest6.html
./src/test/basic/bastest7.html
./src/test/basic/bastest8.html
./src/test/basic/bastest9.html
./src/run/autorun.pl
./src/run/BWTest.lst
./src/run/BWTest.lst.sva
./utils/configurator.pl
./all_files

View File

@@ -0,0 +1,33 @@
#!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):
SRC=Killer.cpp
FLAGS=/link user32.lib
DEPTH=..\..
SRC_DIR=$(DEPTH)\src\Killer
EXE=Killer.exe
build:
@cl $(SRC_DIR)\$(SRC) $(FLAGS)
install: build
@copy $(EXE) $(DEPTH)\utils
clean:
@-del Killer.exe Killer.obj

View File

@@ -0,0 +1,45 @@
# 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):
#cd $(TEST_TOP_DIR)/build ;
DEPTH=..
BUILD_DIR=$(DEPTH)/build
SRC_DIR=$(DEPTH)/src
CLASSES_SRC=$(SRC_DIR)/classes
CLASSES_BUILD=$(BUILD_DIR)/classes
JAVAC=javac
include $(DEPTH)/config/CommonProperties
DIRS=classes test/basic
all:
MAKE_ARGS=$@ ;\
$(MAKE) dirs
clobber:
$(MAKE) dirs MAKE_ARGS=$@
dirs:
for i in $(DIRS);do \
cd $${i}; $(MAKE) $(MAKE_ARGS); \
cd $(TEST_TOP_DIR)/build ;\
done

View File

@@ -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):
DEPTH=..
BUILD_DIR=.
SRC_DIR=$(DEPTH)\src
CLASSES_SRC=$(SRC_DIR)\classes
CLASSES_BUILD=$(BUILD_DIR)\classes
JAVAC=javac
DIRS=classes test\basic
all:
@set MAKE_ARGS=$@
@$(MAKE) /NOLOGO -f Makefile.win $(DIRS)
clobber:
@set MAKE_ARGS=$@
@$(MAKE) /NOLOGO -f makefile.win $(DIRS)
$(DIRS)::
@echo Making $(MAKE_ARGS) in $@
@cd $@
@$(MAKE) /NOLOGO -f Makefile.win $(MAKE_ARGS)
@cd ..

View File

@@ -0,0 +1,49 @@
# 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
SRC_DIR=$(DEPTH)/src
CLASSES_SRC=$(SRC_DIR)/classes
CLASSES_BUILD=$(BUILD_DIR)/classes
JAVAC=javac
PACKAGE_SUFFIX=org/mozilla/webclient/test/basic
#CLASSPATH=$(CLASSES_BUILD);$(CLASSPATH)
DIRS= api\
stress \
mixed \
$(NULL)
all: basic_classes dirs
dirs:
for i in $(DIRS);do \
echo Compile Java files in $(CLASSES_SRC)/$(PACKAGE_SUFFIX)/$${i} ;\
$(JAVAC) -d $(CLASSES_BUILD) $(CLASSES_SRC)/$(PACKAGE_SUFFIX)/$${i}/*.java ;\
done
basic_classes:
echo Compile Java files in $(CLASSES_SRC)/$(PACKAGE_SUFFIX)
$(JAVAC) -d $(CLASSES_BUILD) $(CLASSES_SRC)/$(PACKAGE_SUFFIX)/*.java
clobber:
@echo Remove all $(PACKAGE_SUFFIX) files ...
@rm -rf $(CLASSES_BUILD)/$(PACKAGE_SUFFIX)/*

View File

@@ -0,0 +1,53 @@
#!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):
DEPTH=..\..
BUILD_DIR=$(DEPTH)\build
SRC_DIR=$(DEPTH)\src
CLASSES_SRC=$(SRC_DIR)\classes
CLASSES_BUILD=$(BUILD_DIR)\classes
JAVAC=javac
PACKAGE_SUFFIX=org\mozilla\webclient\test\basic
CLASSPATH=$(CLASSES_BUILD);$(CLASSPATH)
DIRS= api \
stress \
mixed \
$(NULL)
all: basic_classes $(DIRS)
$(DIRS)::
@echo Compile Java files in $(CLASSES_SRC)\$(PACKAGE_SUFFIX)\$@
@$(JAVAC) -d $(CLASSES_BUILD) $(CLASSES_SRC)\$(PACKAGE_SUFFIX)\$@\*.java
basic_classes:
@echo Compile Java files in $(CLASSES_SRC)\$(PACKAGE_SUFFIX)
@$(JAVAC) -d $(CLASSES_BUILD) $(CLASSES_SRC)\$(PACKAGE_SUFFIX)\*.java
clobber:
@echo Remove all $(PACKAGE_SUFFIX) files ...
@-del /Q /S $(CLASSES_BUILD)\$(PACKAGE_SUFFIX)\*

View File

@@ -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):
DEPTH=../../..
BUILD_DIR=$(DEPTH)/build
SRC_DIR=$(DEPTH)/src
UTIL_DIR=$(DEPTH)/utils
COMMON_PROPERTIES=$(DEPTH)/config/CommonProperties
TEST_DIRS_SRC=$(SRC_DIR)/test/basic
TEST_DIRS_BUILD=$(BUILD_DIR)/test/basic
PERL=perl
TESTS_SUFFIX=test/basic
SECTIONS = api \
mixed \
stress \
$(NULL)
include $(COMMON_PROPERTIES)
all: tests
test_dirs:
@for i in `cat .$(SECTION).dirs`;do \
echo Proceed test properties in $(TEST_DIRS_SRC)/$(SECTION)/$${i} ... ;\
$(PERL) $(UTIL_DIR)/configurator.pl $(COMMON_PROPERTIES) \
$(TEST_DIRS_BUILD)/$(SECTION)/$${i}/TestProperties \
$(TEST_DIRS_SRC)/$(SECTION)/$${i}/TestProperties; \
if [ -f $(TEST_DIRS_SRC)/$(SECTION)/$${i}/Test.lst ] ;then \
echo Proceed test arguments in $(TEST_DIRS_SRC)/$(SECTION)/$${i} ...; \
$(PERL) $(UTIL_DIR)/configurator.pl $(COMMON_PROPERTIES) \
$(TEST_DIRS_BUILD)/$(SECTION)/$${i}/Test.lst \
$(TEST_DIRS_SRC)/$(SECTION)/$${i}/Test.lst ;\
fi ;\
if [ -f $(TEST_DIRS_SRC)/$(SECTION)/$${i}/*.html ] ;then \
echo Copy HTML files from $(TEST_DIRS_SRC)/$(SECTION)/$${i} ;\
mkdir -p $(HTML_ROOT_DIR)/$(TESTS_SUFFIX)/$(SECTION)/$${i} ;\
cp -f $(TEST_DIRS_SRC)/$(SECTION)/$${i}/*.html $(HTML_ROOT_DIR)/$(TESTS_SUFFIX)/$(SECTION)/$${i} ;\
mkdir -p $(HTML_ROOT_DIR)/$(TESTS_SUFFIX)/$(SECTION)/$${i} ;\
cp -f $(TEST_DIRS_SRC)/$(SECTION)/$${i}/*.html $(HTML_ROOT_DIR)/$(TESTS_SUFFIX)/$(SECTION)/$${i} ;\
fi ;\
if [ -f $(TEST_DIRS_SRC)/$(SECTION)/$${i}/*.cgi ] ;then \
mkdir -p $(CGI_BIN_ROOT_DIR)/$(TESTS_SUFFIX)/$(SECTION)/$${i} ;\
for j in $(TEST_DIRS_SRC)/$(SECTION)$${i}/*.cgi; do \
CGI_NAME=`basename $${j}`; \
$(PERL) $(UTIL_DIR)/configurator.pl $(COMMON_PROPERTIES) \
$(CGI_BIN_ROOT_DIR)/$(TESTS_SUFFIX)/$(SECTION)/$${i}/$${CGI_NAME} \
$(TEST_DIRS_SRC)/$(SECTION)/$${i}/$${CGI_NAME}; \
done ;\
fi ;\
done
clobber:
rm -f $(BUILD_DIR)/run/*
for i in $(DIRS);do \
echo Make clobber in $(TEST_DIRS_BUILD)/$(SECTION)/$${i} ;\
rm -rf $(TEST_DIRS_BUILD)/$(SECTION)/$${i}/* ;\
done
sections:
@for i in $(SECTIONS); do \
mkdir -p $(HTML_ROOT_DIR)/$(TESTS_SUFFIX)/$${i} ;\
if [ -f $(TEST_DIRS_SRC)/$${i}/*.html ] ;then \
echo Copy HTML files from $(TEST_DIRS_SRC)/$${i} ;\
cp -f $(TEST_DIRS_SRC)/$${i}/*.html $(HTML_ROOT_DIR)/$(TESTS_SUFFIX)/$${i} ;\
fi ;\
mkdir -p $(CGI_BIN_ROOT_DIR)/$(TESTS_SUFFIX)/$${i} ;\
if [ -f $(TEST_DIRS_SRC)/$${i}/*.cgi ] ;then \
echo Copy CGI files from $(TEST_DIRS_SRC)/$${i} ;\
for j in $(TEST_DIRS_SRC)/$${i}/*.cgi; do \
CGI_NAME=`basename $${j}`; \
$(PERL) $(UTIL_DIR)/configurator.pl $(COMMON_PROPERTIES) \
$(CGI_BIN_ROOT_DIR)/$(TESTS_SUFFIX)/$${i}/$${CGI_NAME} \
$(TEST_DIRS_SRC)/$${i}/$${CGI_NAME}; \
done ;\
fi ;\
echo Generate list of $${i} tests ;\
$(PERL) $(UTIL_DIR)/dirGen.pl $(TEST_DIRS_SRC)/$${i} .$${i}.dirs ;\
$(MAKE) test_dirs SECTION=$${i};\
$(PERL) $(UTIL_DIR)/lstGen.pl $(BUILD_DIR)/$(TESTS_SUFFIX)/$${i} $(BUILD_DIR)/run/$${i}.lst ;\
done
tests:
@mkdir -p $(BUILD_DIR)/run
@$(PERL) $(UTIL_DIR)/configurator.pl $(COMMON_PROPERTIES) \
$(BUILD_DIR)/run/autorun.pl\
$(SRC_DIR)/run/autorun.pl
@$(PERL) $(UTIL_DIR)/configurator.pl $(COMMON_PROPERTIES) \
$(BUILD_DIR)/run/forceful.pl\
$(SRC_DIR)/run/forceful.pl
@cp -f $(SRC_DIR)/run/BWTest.lst $(BUILD_DIR)/run
@cp -f $(SRC_DIR)/run/BWMixedTest.lst $(BUILD_DIR)/run
@echo Copy HTML files from $(TEST_DIRS_SRC)
@mkdir -p $(HTML_ROOT_DIR)/$(TESTS_SUFFIX)
@cp -f $(TEST_DIRS_SRC)/*.html $(HTML_ROOT_DIR)/$(TESTS_SUFFIX)
@mkdir -p $(CGI_BIN_ROOT_DIR)/$(TESTS_SUFFIX)
@for i in $(TEST_DIRS_SRC)/*.cgi; do \
CGI_NAME=`basename $${i}`; \
$(PERL) $(UTIL_DIR)/configurator.pl $(COMMON_PROPERTIES) \
$(CGI_BIN_ROOT_DIR)/$(TESTS_SUFFIX)/$${CGI_NAME} \
$(TEST_DIRS_SRC)/$${CGI_NAME}; \
done
@$(MAKE) sections

View File

@@ -0,0 +1,122 @@
#!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):
DEPTH=..\..\..
BUILD_DIR=$(DEPTH)\build
SRC_DIR=$(DEPTH)\src
UTIL_DIR=$(DEPTH)\utils
COMMON_PROPERTIES=$(DEPTH)\config\CommonProperties
TEST_DIRS_SRC=$(SRC_DIR)\test\basic
TEST_DIRS_BUILD=$(BUILD_DIR)\test\basic
PERL=perl
TESTS_SUFFIX=test\basic
!include $(COMMON_PROPERTIES)
!if defined(SECTION)
DIRS= \
!include .$(SECTION).dirs.in
!endif
SECTIONS = api \
mixed \
stress \
$(NULL)
all: tests
!if defined(DIRS)
test_dirs: $(DIRS)
$(DIRS)::
!if defined(BUILD_TESTS)
@echo Proceed all in $(TEST_DIRS_SRC)\$(SECTION)\$@ ...
@$(PERL) $(UTIL_DIR)\configurator.pl $(COMMON_PROPERTIES) \
$(TEST_DIRS_BUILD)\$(SECTION)\$@\TestProperties \
$(TEST_DIRS_SRC)\$(SECTION)\$@\TestProperties
@if exist $(TEST_DIRS_SRC)\$(SECTION)\$@\Test.lst \
$(PERL) $(UTIL_DIR)\configurator.pl $(COMMON_PROPERTIES) \
$(TEST_DIRS_BUILD)\$(SECTION)\$@\Test.lst \
$(TEST_DIRS_SRC)\$(SECTION)\$@\Test.lst
@if not exist $(HTML_ROOT_DIR)\$(TESTS_SUFFIX)\$(SECTION)\$@ \
mkdir $(HTML_ROOT_DIR)\$(TESTS_SUFFIX)\$(SECTION)\$@
@if exist $(TEST_DIRS_SRC)\$(SECTION)\$@\*.html \
copy $(TEST_DIRS_SRC)\$(SECTION)\$@\*.html $(HTML_ROOT_DIR)\$(TESTS_SUFFIX)\$(SECTION)\$@
@if not exist $(CGI_BIN_ROOT_DIR)\$(TESTS_SUFFIX)\$(SECTION)\$@ \
mkdir $(CGI_BIN_ROOT_DIR)\$(TESTS_SUFFIX)\$(SECTION)\$@
@if exist $(TEST_DIRS_SRC)\$(SECTION)\$@\*.cgi \
copy $(TEST_DIRS_SRC)\$(SECTION)\$@\*.cgi $(CGI_BIN_ROOT_DIR)\$(TESTS_SUFFIX)\$(SECTION)\$@
!else
@echo Make clobber in $(TEST_DIRS_BUILD)\$(SECTION)\$@
@-del /Q $(TEST_DIRS_BUILD)\$(SECTION)\$@\*
!endif
!endif
$(SECTIONS)::
!if defined(BUILD_TESTS)
@echo Copy HTML files from $(TEST_DIRS_SRC)\$@
@if not exist $(HTML_ROOT_DIR)\$(TESTS_SUFFIX)\$@ \
mkdir $(HTML_ROOT_DIR)\$(TESTS_SUFFIX)\$@
@if exist $(TEST_DIRS_SRC)\$@\*.html \
copy $(TEST_DIRS_SRC)\$@\*.html $(HTML_ROOT_DIR)\$(TESTS_SUFFIX)\$@
@if not exist $(CGI_BIN_ROOT_DIR)\$(TESTS_SUFFIX)\$@ \
mkdir $(CGI_BIN_ROOT_DIR)\$(TESTS_SUFFIX)\$@
@if exist $(TEST_DIRS_SRC)\$@\*.cgi \
copy $(TEST_DIRS_SRC)\$@\*.cgi $(CGI_BIN_ROOT_DIR)\$(TESTS_SUFFIX)\$@
@echo Generate list of $@ tests
@$(PERL) $(UTIL_DIR)\dirGen.pl $(TEST_DIRS_SRC)\$@ .$@.dirs
@if exist .$@.dirs.in \
del .$@.dirs.in
@for /F "delims=" %%i IN (.$@.dirs) DO @echo %%i \>>.$@.dirs.in
@echo $$(NULL)>>.$@.dirs.in
@$(MAKE) /NOLOGO /f Makefile.win test_dirs SECTION=$@ BUILD_TESTS=1
@$(PERL) $(UTIL_DIR)\lstGen.pl $(BUILD_DIR)\$(TESTS_SUFFIX)\$@ $(BUILD_DIR)\run\$@.lst
!else
@$(MAKE) /NOLOGO /f Makefile.win test_dirs SECTION=$@
!endif
tests:
@if not exist $(BUILD_DIR)\run \
mkdir $(BUILD_DIR)\run
@copy $(SRC_DIR)\run\autorun.pl $(BUILD_DIR)\run
@copy $(SRC_DIR)\run\BWTest.lst $(BUILD_DIR)\run
@copy $(SRC_DIR)\run\BWMixedTest.lst $(BUILD_DIR)\run
@if not exist $(HTML_ROOT_DIR)\$(TESTS_SUFFIX) \
mkdir $(HTML_ROOT_DIR)\$(TESTS_SUFFIX)
@if exist $(TEST_DIRS_SRC)\*.html \
copy $(TEST_DIRS_SRC)\*.html $(HTML_ROOT_DIR)\$(TESTS_SUFFIX)
@if not exist $(CGI_BIN_ROOT_DIR)\$(TESTS_SUFFIX) \
mkdir $(CGI_BIN_ROOT_DIR)\$(TESTS_SUFFIX)
@if exist $(TEST_DIRS_SRC)\*.cgi \
copy $(TEST_DIRS_SRC)\*.cgi $(CGI_BIN_ROOT_DIR)\$(TESTS_SUFFIX)
@$(MAKE) /NOLOGO /f Makefile.win $(SECTIONS) BUILD_TESTS=1
clobber:
@echo Remove all from test dirs
@$(MAKE) /NOLOGO /f Makefile.win $(SECTIONS)

View File

@@ -0,0 +1,143 @@
##############################################################################
# This file contains common properties for automated Webclient TestBase #
# (please change prop values before making and using testbase) #
# #
##############################################################################
############################## BUILD_DESCRIPTION #############################
# Please place a brief, one line description of current build there.
# OS version, Mozilla date/mailstoun etc .
# Example: Solaris 2.7, Mozilla M16, Webclient M4
BUILD_DESCRIPTION=Webclient sources from Aug 28(M4 Webclient), M16 Mozilla , Sparc Solaris 2.7
############################## HTML_ROOT_DIR #################################
# HTML_ROOT_DIR should be pointed to directory on your local filesystem
# where HTML documents should be placed
# for example on /home/avm/httpd/htroot/webclient
# HTML_ROOT_DIR=/net/earth/export1/avm/httpd_amber/htdocs/automated
HTML_ROOT_DIR=/opt/JavaWebServer1.1.3/public_html/webclient/automated
################################ HTML_ROOT ###################################
# HTML_ROOT should be pointed to your HTTPD server entry
# for example on http://myserv.com/webclient
# HTML_ROOT=http://amber:8080/automated
HTML_ROOT=file:///opt/JavaWebServer1.1.3/public_html/webclient/automated
############################## CGI_BIN_ROOT_DIR ##############################
# CGI_BIN_ROOT_DIR should be pointed to directory on your local filesystem
# where CGI-scripts should be placed
# for example on /home/avm/httpd/cgi-bin/webclient_cgi
# CGI_BIN_ROOT_DIR=/net/earth/export1/avm/httpd_amber/cgi-bin/automated
CGI_BIN_ROOT_DIR=/opt/JavaWebServer1.1.3/public_html/cgi-bin/webclient/automated
############################## CGI_BIN_ROOT ##################################
# CGI_BIN_ROOT should be pointed to your HTTPD server cgi-bin entry
# for example on http://myserv.com/cgi-bin/webclient
# CGI_BIN_ROOT=http://amber:8080/cgi-bin/automated
CGI_BIN_ROOT=http://rampriya.eng:8080/cgi-bin/webclient/automated
################################ PERL_DIR ###################################
# PERL_DIR should be pointed to directory on your filesystem
# where perl program located . Run a "which perl" command to find out on Sparc Solaris
# for example on /usr/local/bin
# PERL_DIR=/usr/local/bin
PERL_DIR=/pkg/gnu/bin/
################################ FTP_HOST ####################################
# FTP_HOST should be equals to url to any ftp server with user name and password
# if necessary.
# For example: ftp://guest:guest@polar/
# FTP_HOST=ftp://guest:guest@polar/
################################ HTTP_HOST ####################################
# HTTP_HOST should be equals to url to any accessible httpd server.
# For example: http://localhost or http://machine_name:8080 if JWS
# HTTP_HOST=http://router
HTTP_HOST=http://rampriya.eng:8080/
############################## PAGES_TO_LOAD ##################################
# PAGES_TO_LOAD contains comma separated pages, that will be loaded by default.
# Usually this property specified in TestProperties file and can be empty.
# For example: file:///c:/temp/webclient/test/basic/bastest1.html,file:///c:/temp/webclient/test/basic/bastest2.html
PAGES_TO_LOAD=
############################# BROWSER_BIN_DIR #################################
# BROWSER_BIN_DIR should be equals to MOZILLA_FIVE_HOME variable
# I.e point to mozilla executable location.
# For example: d:\\m16\\mozilla\\dist\\win32_d.obj\\bin
#
#NOTE: You must use "\\" as file separator on Win32, because this value
#will be read via getProperty and "\" will be skipped.
# BROWSER_BIN_DIR=/net/earth/export1/avm/m16/mozilla/dist/bin
BROWSER_BIN_DIR=/opt/mozilla/dist/bin
############################### TEST_TOP_DIR ##################################
# TEST_TOP_DIR should be pointed to the top dir of automated testbase.
# For example: c:\home\avm\webclient\automated
# TEST_TOP_DIR=/net/earth/export1/avm/automated
TEST_TOP_DIR=/Blackwood/src/Webclient/automated
############################### DELAY_INTERNAL ##################################
# DELAY_INTERNAL - internal timeout for TestLoader in seconds.
# After this period of time TestLoader set result of execution automatically.
DELAY_INTERNAL=100
############################### DELAY_EXTERNAL ##################################
# DELAY_EXTERNAL - external timeout for autorun.pl in seconds.
# After this period of time autorun.pl kill the application if it is still running.
DELAY_EXTERNAL=120
############################### DELAY_OF_CYCLE ##################################
# DELAY_OF_CYCLE - timeout for autorun.pl in seconds.
# One time in such period autorun.pl performs check for test results and for
# application status.
# The good value should be in range :
# 2<= (DELAY_EXTERNAL - DELAY_INTERNAL)/DELAY_OF_CYCLE <=10
#
#
DELAY_OF_CYCLE=2
##############################################################################
#
# Additional parameters. In common case you MUST NOT change it.
#
################################################################################
TEST_LOG_FILE=WebclientTest.log
TEST_RESULT_FILE=WebclientTest.res
Integer_MIN_VALUE=-2147483648
Integer_MAX_VALUE=2147483647

View File

@@ -0,0 +1,19 @@
basic/api/Navigation_stop:0=PASSED=Mozilla doesn't crashes and nothing happens
basic/api/Navigation_stop:1=PASSED=Mozilla doesn't crashes and load process stops
basic/api/Navigation_stop:2=PASSED=Mozilla doesn't crashes and nothing happens
basic/api/Navigation_loadURL_1:0=FAILED=HotSpot Virtual Machine Error, EXCEPTION_ACCESS_VIOLATION, Error ID: 4F533F57494E13120E43505002B7
basic/api/Navigation_loadURL_1:1=PASSED=Mozilla doesn't crashes
basic/api/Navigation_loadURL_2:0=PASSED=Mozilla doesn't crashes and URL loads
basic/api/Navigation_loadURL_2:1=PASSED=Mozilla doesn't crashes, load process stops and another URL is loaded
basic/api/Navigation_loadURL_2:2=PASSED=Mozilla doesn't crashes and another URL is loaded
basic/api/Navigation_loadURL_3:0=PASSED=Mozilla doesn't crashes and loads URL
basic/api/Navigation_loadURL_3:1=PASSED=Mozilla doesn't crashes and loads URL
basic/api/Navigation_loadURL_3:2=FAILED=ftp:// protocol doesn't loads
basic/api/Navigation_loadURL_3:3=PASSED=Mozilla doesn't crashes
basic/api/Navigation_refresh_1:0=PASSED=Mozilla doesn't crashes and nothing happens
basic/api/Navigation_refresh_1:1=PASSED=Mozilla doesn't crashes, load process stops and URL reloads
basic/api/Navigation_refresh_1:2=PASSED=Mozilla doesn't crashes and URL reloads
basic/api/Navigation_refresh_2:0=PASSED=Mozilla doesn't crashes and URL reloads
basic/api/Navigation_refresh_2:1=PASSED=Mozilla doesn't crashes and URL reloads
basic/api/Navigation_refresh_2:2=PASSED=Mozilla doesn't crashes and URL reloads
basic/api/Navigation_refresh_2:3=PASSED=Mozilla doesn't crashes and URL reloads

View File

@@ -0,0 +1,166 @@
<html>
<head>
<title>
Description of tests on BookmarkEntry interface
</title>
</head>
<body bgcolor=white>
<P align=left>This document contains a simple preliminary description of
testcases on BookmarkEntry interface of Webclient API.</P>
<UL>
<LI><A href=#getProp>Tests on <B>getProperties()</B> method</A>
<LI><A href=#isFolder>Tests on <B>isFolder()</B> method</A>
<LI><A href=#insert>Tests on <B>insert(MutableTreeNode, int)</B> method (inherited from javax.swing.tree.MutableTreeNode)</A>
<LI><A href=#remove1>Tests on <B>remove(int)</B> method (inherited from javax.swing.tree.MutableTreeNode)</A>
<LI><A href=#remove2>Tests on <B>remove(MutableTreeNode)</B> method (inherited from javax.swing.tree.MutableTreeNode)</A>
<LI><A href=#remove3>Tests on <B>removeFromParent()</B> method (inherited from javax.swing.tree.MutableTreeNode)</A>
<LI><A href=#setParent>Tests on <B>setParent(MutableTreeNode)</B> method (inherited from javax.swing.tree.MutableTreeNode)</A>
<LI><A href=#setUO>Tests on <B>setUserObject</B> method (inherited from javax.swing.tree.MutableTreeNode)</A>
<LI><A href=#children>Tests on <B>children()</B> method (inherited from javax.swing.tree.TreeNode)</A>
<LI><A href=#getAllowsChildren>Tests on <B>getAllowsChildren()</B> method (inherited from javax.swing.tree.TreeNode)</A>
<LI><A href=#getChildAt>Tests on <B>getChildAt(int)</B> method (inherited from javax.swing.tree.TreeNode)</A>
<LI><A href=#getChildCount>Tests on <B>getChildCount()</B> method (inherited from javax.swing.tree.TreeNode)</A>
<LI><A href=#getIndex>Tests on <B>getIndex(TreeNode)</B> method (inherited from javax.swing.tree.TreeNode)</A>
<LI><A href=#getParent>Tests on <B>getParent()</B> method (inherited from javax.swing.tree.TreeNode)</A>
<LI><A href=#isLeaf>Tests on <B>isLeaf()</B> method (inherited from javax.swing.tree.TreeNode)</A>
</UL>
<A name=getProp>
<H2>1. Tests on getProperties() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_getProperties:0</td><td>Method gets properties from bookmarkEntry which is recieved via TreeModel</td><td>Method returns correct properties</td></tr>
<tr><td>basic/api/BookmarkEntry_getProperties:1</td><td>Method gets properties from bookmarkEntry which is recieved via newBookmarkEntry</td><td>Method returns correct properties</td></tr>
<tr><td>basic/api/BookmarkEntry_getProperties:2</td><td>Method gets properties from bookmarkEntry which is recieved via newBookmarkFolder</td><td>Method returns correct properties</td></tr>
</table>
<A name=isFolder>
<H2>2. Tests on isFolder() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_isFolder:0</td><td>Method checks bookmarkEntry recieved via newBookmarkEntry</td><td>Method returns false</td></tr>
<tr><td>basic/api/BookmarkEntry_isFolder:1</td><td>Method checks bookmarkEntry recieved via newBookmarkFolder</td><td>Method returns true</td></tr>
</table>
<A name=insert>
<H2>3. Tests on insert(MutableTreeNode child, int index) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_insert:0</td><td>Method adds NULL child to the receiver</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_insert:1</td><td>Method adds correct child to the receiver at index</td><td>Child is added</td></tr>
<tr><td>basic/api/BookmarkEntry_insert:2</td><td>Method adds correct child to the receiver at index=0</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_insert:3</td><td>Method adds correct child to the receiver at index=-2147483648</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_insert:4</td><td>Method adds correct child to the receiver at index=2147483647</td><td>Browser doesn't crashed</td></tr>
</table>
<A name=remove1>
<H2>4. Tests on remove(int index) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_remove_1:0</td><td>Method removes the child at existed index from the receiver.</td><td>Child is removed</td></tr>
<tr><td>basic/api/BookmarkEntry_remove_1:1</td><td>Method removes the child at index=0 from the receiver.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_remove_1:2</td><td>Method removes the child at index=-2147483648 from the receiver.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_remove_1:3</td><td>Method removes the child at index=2147483647 from the receiver.</td><td>Browser doesn't crashed</td></tr>
</table>
<A name=remove2>
<H2>5. Tests on remove(MutableTreeNode node) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_remove_2:0</td><td>Method removes the NULL node from the receiver.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_remove_2:1</td><td>Method removes the existed node from the receiver.</td><td>Child is removed</td></tr>
</table>
<A name=remove3>
<H2>6. Tests on removeFromParent() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_removeFromParent:0</td><td>Method removes the receiver from its parent=NULL.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_removeFromParent:1</td><td>Method Removes the receiver from its correct parent.</td><td>Reciever is removed</td></tr>
</table>
<A name=setParent>
<H2>7. Tests on setParent(MutableTreeNode newParent) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_setParent:0</td><td>Method sets the parent of the receiver to newParent=NULL.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_setParent:1</td><td>Method sets the parent of the receiver to correct newParent.</td><td>newParent is set</td></tr>
</table>
<A name=setUO>
<H2>8. Tests on setUserObject(Object object) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_setUserObject:0</td><td>Method resets the user object of the receiver to object=NULL.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_setUserObject:1</td><td>Method resets the user object of the receiver to correct object.</td><td>The user object is reseted</td></tr>
</table>
<A name=children>
<H2>9. Tests on children() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_children:0</td><td>Method returns the children of the bookmarkFolder as an Enumeration.</td><td>Correct Enumeration object is returned.</td></tr>
<tr><td>basic/api/BookmarkEntry_children:1</td><td>Method returns the children of the bookmarkEntry as an Enumeration.</td><td>Browser doesn't crashed</td></tr>
</table>
<A name=getAllowsChildren>
<H2>10. Tests on getAllowsChildren() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_getAllowsChildren:0</td><td>Method returns boolean result for the reciever=bookmarkFolder.</td><td>Result is true.</td></tr>
<tr><td>basic/api/BookmarkEntry_getAllowsChildren:1</td><td>Method returns boolean result for the reciever=bookmarkEntry.</td><td>Result is false.</td></tr>
</table>
<A name=getChildAt>
<H2>11. Tests on getChildAt(int index) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_getChildAt:0</td><td>Method tries to return the child of the bookmarkEntry.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_getChildAt:1</td><td>Method returns the child at correct index.</td><td>Child is returned.</td></tr>
<tr><td>basic/api/BookmarkEntry_getChildAt:2</td><td>Method tries to return the child at index=0.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_getChildAt:3</td><td>Method tries to return the child at index=-2147483648.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_getChildAt:4</td><td>Method tries to return the child at index=2147483647.</td><td>Browser doesn't crashed</td></tr>
</table>
<A name=getChildCount>
<H2>12. Tests on getChildCount() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_getChildCount:0</td><td>Method returns the number of children the bookmarkFolder contains.</td><td>Correct number is returned.</td></tr>
<tr><td>basic/api/BookmarkEntry_getChildCount:1</td><td>Method returns the number of children the bookmarkEntry contains.</td><td>Browser doesn't crashed</td></tr>
</table>
<A name=getIndex>
<H2>13. Tests on getIndex(TreeNode node) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_getIndex:0</td><td>Method returns the index of node in the bookmarkFolder children.</td><td>Correct number is returned.</td></tr>
<tr><td>basic/api/BookmarkEntry_getIndex:1</td><td>Method returns the index of node in the bookmarkEntry children.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_getIndex:2</td><td>Method returns the index of node=NULL in the bookmarkFolder children.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_getIndex:3</td><td>Method returns the index of node=bookmarkFolder in the bookmarkFolder children.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_getIndex:4</td><td>Method returns the index of incorrect node in the bookmarkFolder children.</td><td>Browser doesn't crashed</td></tr>
</table>
<A name=getParent>
<H2>14. Tests on getParent() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_getParent:0</td><td>Method returns the parent node of the reciever=bookmarkFolder, which has no parent.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_getParent:1</td><td>Method returns the parent node of the reciever=bookmarkFolder, which has a parent.</td><td>Correct parent is returned.</td></tr>
<tr><td>basic/api/BookmarkEntry_getParent:2</td><td>Method returns the parent node of the reciever=bookmarkEntry, which has no parent.</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/BookmarkEntry_getParent:3</td><td>Method returns the parent node of the reciever=bookmarkEntry, which has a parent.</td><td>Correct parent is returned.</td></tr>
</table>
<A name=isLeaf>
<H2>15. Tests on isLeaf() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/BookmarkEntry_isLeaf:0</td><td>Method returns true if reciever=bookmarkFolder is a leaf.</td><td>True is returned.</td></tr>
<tr><td>basic/api/BookmarkEntry_isLeaf:1</td><td>Method returns true if reciever=bookmarkEntry is a leaf.</td><td>False is returned.</td></tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,72 @@
<html>
<head>
<title>
Description of tests on Bookmarks interface
</title>
</head>
<body bgcolor=white>
<P align=left>This document contains a simple preliminary description of
testcases on Bookmarks interface of Webclient API.</P>
<UL>
<LI><A href=#addBookmark(BookmarkEntry)>Tests on <B>addBookmark(BookmarkEntry)</B> method</A>
<LI><A href=#getBookmarks()>Tests on <B>getBookmarks()</B> method</A>
<LI><A href=#newBookmarkEntry(String)>Tests on <B>newBookmarkEntry(String)</B> method</A>
<LI><A href=#newBookmarkFolder(String)>Tests on <B>newBookmarkFolder(String)</B> method</A>
<LI><A href=#removeBookmark(BookmarkEntry)>Tests on <B>removeBookmark(BookmarkEntry)</B> method</A>
</UL>
<A name="addBookmark(BookmarkEntry)">
<H2>1. Tests on addBookmark(BookmarkEntry) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_addBookmark:0</td><td>Method addBookmark() invoked and try to add to Bookmarks new Leaf with correct String</td><td>Mozilla doesn't crashes and added one leaf to Bookmarks</td></tr>
<tr><td>basic/api/History_addBookmark:1</td><td>Method addBookmark() invoked and try to add to Bookmarks new folder with correct String</td><td>Mozilla doesn't crashes and added one folder to Bookmarks</td></tr>
<tr><td>basic/api/History_addBookmark:2</td><td>Method addBookmark() invoked and try to add to Bookmarks new Leaf with name=null</td><td>Mozilla doesn't crashes and added one leaf to Bookmarks</td></tr>
<tr><td>basic/api/History_addBookmark:3</td><td>Method addBookmark() invoked and try to add to Bookmarks new folder with name=null</td><td>Mozilla doesn't crashes and added one folder to Bookmarks</td></tr>
<tr><td>basic/api/History_addBookmark:4</td><td>Method addBookmark() invoked and try to add to Bookmarks new Leaf with name=""</td><td>Mozilla doesn't crashes and added one leaf to Bookmarks</td></tr>
<tr><td>basic/api/History_addBookmark:5</td><td>Method addBookmark() invoked and try to add to Bookmarks new folder with name=""</td><td>Mozilla doesn't crashes and added one folder to Bookmarks</td></tr>
</table>
<A name="getBookmarks()">
<H2>2. Tests on getBookmarks() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_getBookmarks:0</td><td>Method getBookmarks() invoked</td><td>Mozilla doesn't crash and getBookmarks() return correct Bookmarks</td></tr>
</table>
<A name="newBookmarkEntry(String)">
<H2>3. Tests on newBookmarkEntry(String) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_newBookmarkEntry:0</td><td>Method newBookmarkEntry(String) invoked with correct url string</td><td>Mozilla doesn't crashes and creates a new bookmark leaf with correct URL</td></tr>
<tr><td>basic/api/History_newBookmarkEntry:1</td><td>Method newBookmarkEntry(String) invoked with string == null</td><td>Mozilla doesn't crashes and creates a new bookmark leaf with URL==null</td></tr>
<tr><td>basic/api/History_newBookmarkEntry:2</td><td>Method newBookmarkEntry(String) invoked with empty url string</td><td>Mozilla doesn't crashes and creates a new bookmark leaf with empty URL</td></tr>
</table>
<A name="newBookmarkFolder(String)">
<H2>4. Tests on newBookmarkFolder(String) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_newBookmarkFolder:0</td><td>Method newBookmarkFolder(String) invoked with correctly formed string </td><td>Mozilla doesn't crashes and creates a new bookmark folder with name == string </td></tr>
<tr><td>basic/api/History_newBookmarkFolder:1</td><td>Method newBookmarkFolder(String) invoked with string == null</td><td>Mozilla doesn't crashes and creates a new bookmark folder with name == null </td></tr>
<tr><td>basic/api/History_newBookmarkFolder:2</td><td>Method newBookmarkFolder(String) invoked with empty string </td><td>Mozilla doesn't crashes and creates a new bookmark folder with name == emplty string </td></tr>
</table>
<A name="removeBookmark(BookmarkEntry)">
<H2>5. Tests on removeBookmark(BookmarkEntry) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_removeBookmark:0</td><td>Method removeBookmark(BookmarkEntry) invoked when BookmarkEntry is null</td><td>Mozilla doesn't crashes and remove leaf BookmarkEntry from Bookamarks </td></tr>
<tr><td>basic/api/History_removeBookmark:1</td><td>Method removeBookmark(BookmarkEntry) invoked when BookmarkEntry is correct entry from TreeModel</td><td>Mozilla doesn't crashes and remove folder BookmarkEntry from Bookamarks </td></tr>
<tr><td>basic/api/History_removeBookmark:2</td><td>Method removeBookmark(BookmarkEntry) invoked when BookmarkEntry is unexist in TreeModel</td><td>Mozilla doesn't crashes and remove folder BookmarkEntry from Bookamarks </td></tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,68 @@
<html>
<head>
<title>
Description of tests on History interface
</title>
</head>
<body bgcolor=white>
<P align=left>This document contains a simple preliminary description of
testcases on History interface of Webclient API.</P>
<UL>
<LI><A href=#addNotify()>Tests on <B>addNotify</B> method</A>
<LI><A href=#getWebShell>Tests on <B>getWebShell()</B> method</A>
<LI><A href=#setBounds(int, int, int. int)>Tests on <B>setBounds(int, int, int. int)</B> method</A>
<LI><A href=#setBounds(Rectangle)>Tests on <B>setBounds(Rectangle)</B> method</A>
</UL>
<A name=addNotify>
<H2>1. Tests on addNotify method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_addNotify:0</td><td>Method addNotify() invoked when some URL's are loaded</td><td>Mozilla doesn't crashes</td></tr>
</table>
<A name="getWebShell">
<H2>1. Tests on getWebShell method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_getWebShell:0</td><td>Method getWebShell() invoked</td><td>Mozilla doesn't crash and getWebShell return correct BrowserControl</td></tr>
</table>
<A name="setBounds(int, int, int. int)">
<H2>3. Tests on setBounds(int, int, int. int) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_setBounds:0</td><td>Method setBounds invoked with correct bounds</td><td>Mozilla doesn't crashes and set bounds of Canvas correctly</td></tr>
<tr><td>basic/api/History_setBounds:1</td><td>Method setBounds invoked with INTEGER.MIN_VALUE as first parameter</td><td>Mozilla doesn't crashes and do no set new bounds of Canvas</td></tr>
<tr><td>basic/api/History_setBounds:2</td><td>Method setBounds invoked with INTEGER.MAX_VALUE as first parameter</td><td>Mozilla doesn't crashes and do no set new bounds of Canvas</td></tr>
<tr><td>basic/api/History_setBounds:3</td><td>Method setBounds invoked with 0 as first parameter</td><td>Mozilla doesn't crashes and set new bounds of Canvas correctly</td></tr>
<tr><td>basic/api/History_setBounds:4</td><td>Method setBounds invoked with INTEGER.MIN_VALUE as second parameter</td><td>Mozilla doesn't crashes and do no set new bounds of Canvas</td></tr>
<tr><td>basic/api/History_setBounds:5</td><td>Method setBounds invoked with INTEGER.MAX_VALUE as second parameter</td><td>Mozilla doesn't crashes and do no set new bounds of Canvas</td></tr>
<tr><td>basic/api/History_setBounds:6</td><td>Method setBounds invoked with 0 as second parameter</td><td>Mozilla doesn't crashes and set new bounds of Canvas correctly</td></tr>
<tr><td>basic/api/History_setBounds:7</td><td>Method setBounds invoked with INTEGER.MIN_VALUE as third parameter</td><td>Mozilla doesn't crashes and do no set new bounds of Canvas</td></tr>
<tr><td>basic/api/History_setBounds:8</td><td>Method setBounds invoked with INTEGER.MAX_VALUE as third parameter</td><td>Mozilla doesn't crashes and do no set new bounds of Canvas</td></tr>
<tr><td>basic/api/History_setBounds:9</td><td>Method setBounds invoked with 0 as third parameter</td><td>Mozilla doesn't crashes and set new bounds of Canvas correctly</td></tr>
<tr><td>basic/api/History_setBounds:10</td><td>Method setBounds invoked with INTEGER.MIN_VALUE as fourth parameter</td><td>Mozilla doesn't crashes and do no set new bounds of Canvas</td></tr>
<tr><td>basic/api/History_setBounds:11</td><td>Method setBounds invoked with INTEGER.MAX_VALUE as fourth parameter</td><td>Mozilla doesn't crashes and do no set new bounds of Canvas</td></tr>
<tr><td>basic/api/History_setBounds:12</td><td>Method setBounds invoked with 0 as fourth parameter</td><td>Mozilla doesn't crashes and set new bounds of Canvas correctly</td></tr>
<tr><td>basic/api/History_setBounds:13</td><td>Method setBounds invoked with 0 as all parameters</td><td>Mozilla doesn't crashes and set new bounds of Canvas correctly</td></tr>
<tr><td>basic/api/History_setBounds:14</td><td>Method setBounds invoked with inverted rectangle(Xleft >Xright)</td><td>Mozilla doesn't crashes and set new bounds of Canvas correctly</td></tr>
</table>
<A name="setBounds(Rectangle)">
<H2>4. Tests on setBounds(Rectangle) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_setBounds_rect:0</td><td>Method setBounds invoked with correctly formed rectangle with possible coordinates</td><td>Mozilla doesn't crashes and set Bounds of Canvas correctly</td></tr>
<tr><td>basic/api/History_setBounds_rect:1</td><td>Method setBounds invoked with correctly formed rectangle with all coordinates = 0</td><td>Mozilla doesn't crashes and set Bounds of Canvas correctly</td></tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,118 @@
<html>
<head>
<title>
Description of tests on CurrentPage interface
</title>
</head>
<body bgcolor=white>
<P align=left>This document contains a simple preliminary descritption of
testcases on CurrentPage interface of Webclient API.</P>
<UL>
<LI><A href=#copyCurrentSelectionToSystemClipboard()>Tests on <B>copyCurrentSelectionToSystemClipboard()</B> method</A>
<LI><A href=#findInPage(String, boolean, boolean)>Tests on <B>findInPage(String, boolean, boolean)</B> method</A>
<LI><A href=#findNextInPage(boolean)>Tests on <B>findNextInPage(boolean)</B> method</A>
<LI><A href=#getCurrentURL()>Tests on <B>getCurrentURL()</B> method</A>
<LI><A href=#getSource()>Tests on <B>getSource()</B> method</A>
<LI><A href=#getSourceBytes()>Tests on <B>getSourceBytes()</B> method</A>
<LI><A href=#resetFind()>Tests on <B>resetFind()</B> method</A>
<LI><A href=#selectAll()>Tests on <B>selectAll()</B> method</A>
<LI><A href=#getDOM()>Tests on <B>getDOM()</B> method</A>
<LI><A href=#getPageInfo()>Tests on <B>getPageInfo()</B> method</A>
</UL>
<A name=copyCurrentSelectionToSystemClipboard()>
<H2>1. Tests on copyCurrentSelectionToSystemClipboard() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/CurrentPage_copyCurSel:0</td><td>Method is invoked without any URL string</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/CurrentPage_copyCurSel:1</td><td>Method is invoked with no selection</td><td>Clipboard content doesn't change</td></tr>
<tr><td>basic/api/CurrentPage_copyCurSel:2</td><td>Method is invoked with selected text</td><td>Clipboard gets selected text</td></tr>
</table>
<A name=findInPage(String, boolean, boolean)>
<H2>2. Tests on findInPage(String search_string, boolean forward, boolean matchcase) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/CurrentPage_findInPage_1:0</td><td>Method is invoked with null search string</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/CurrentPage_findInPage_1:1</td><td>Method is invoked with empty search string</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/CurrentPage_findInPage_1:2</td><td>Method is invoked with exist search string</td><td>Browser finds search string</td></tr>
<tr><td>basic/api/CurrentPage_findInPage_1:3</td><td>Method is invoked without any URL</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/CurrentPage_findInPage_1:4</td><td>Method is invoked with unexist search string</td><td>Browser doesn't crashed and finds nothing</td></tr>
<tr><td>basic/mixed/CurrentPage_findInPage_2:0</td><td>Method is invoked with forward=true and matchcase=true</td><td>Browser finds search string</td></tr>
<tr><td>basic/mixed/CurrentPage_findInPage_2:1</td><td>Method is invoked with forward=true and matchcase=false</td><td>Browser finds search string</td></tr>
<tr><td>basic/mixed/CurrentPage_findInPage_2:2</td><td>Method is invoked with forward=false and matchcase=true</td><td>Browser finds search string</td></tr>
<tr><td>basic/mixed/CurrentPage_findInPage_2:3</td><td>Method is invoked with forward=false and matchcase=false</td><td>Browser finds search string</td></tr>
</table>
<A name=findNextInPage(boolean)>
<H2>3. Tests on findNextInPage(boolean forward) method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/mixed/CurrentPage_findNextInPage:0</td><td>Method is invoked with forward=true</td><td>Browser finds search string</td></tr>
<tr><td>basic/mixed/CurrentPage_findNextInPage:1</td><td>Method is invoked with forward=false</td><td>Browser finds search string</td></tr>
<tr><td>basic/mixed/CurrentPage_findNextInPage:2</td><td>Method is invoked without previous find</td><td>Browser finds nothing and doesn't crash</td></tr>
<tr><td>basic/mixed/CurrentPage_findNextInPage:3</td><td>Method is invoked at the end of document</td><td>Browser finds nothing and doesn't crash</td></tr>
</table>
<A name=getCurrentURL()>
<H2>4. Tests on getCurrentURL() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/CurrentPage_getCurrentURL:0</td><td>Method is invoked after URL is loaded</td><td>Method returns current URL</td></tr>
<tr><td>basic/api/CurrentPage_getCurrentURL:1</td><td>Method is invoked during URL is loading</td><td>Method returns current URL</td></tr>
<tr><td>basic/api/CurrentPage_getCurrentURL:2</td><td>Method is invoked without any URL</td><td>Browser doesn't crashed</td></tr>
</table>
<A name=getSource()>
<H2>5. Tests on getSource() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/CurrentPage_getSource:0</td><td>Method is invoked without any URL</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/CurrentPage_getSource:1</td><td>Method is invoked with correct URL</td><td>Method returns URL source</td></tr>
</table>
<A name=getSourceBytes()>
<H2>6. Tests on getSourceBytes() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/CurrentPage_getSourceBytes:0</td><td>Method is invoked without any URL</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/CurrentPage_getSourceBytes:1</td><td>Method is invoked with correct URL</td><td>Method returns URL source bytes</td></tr>
</table>
<A name=resetFind()>
<H2>7. Tests on resetFind() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/CurrentPage_resetFind:0</td><td>Method is invoked without any URL</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/CurrentPage_resetFind:1</td><td>Method is invoked with previous search result</td><td>Find parameters is nulled</td></tr>
<tr><td>basic/api/CurrentPage_resetFind:2</td><td>Method is invoked without previous search result</td><td>Browser doesn't crashed and find parameters is nulled</td></tr>
</table>
<A name=selectAll()>
<H2>8. Tests on selectAll() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/CurrentPage_selectAll:0</td><td>Method is invoked without any URL</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/CurrentPage_selectAll:1</td><td>Method is invoked with correct URL</td><td>All is selected</td></tr>
</table>
<A name=getDOM()>
<H2>9. Tests on getDOM() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/CurrentPage_getDOM:0</td><td>Method is invoked without any URL</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/CurrentPage_getDOM:1</td><td>Method is invoked with correct URL</td><td>Correct org.w3c.dom.Document object is returned</td></tr>
</table>
<A name=getPageInfo()>
<H2>9. Tests on getPageInfo() method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/CurrentPage_getPageInfo:0</td><td>Method is invoked without any URL</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/CurrentPage_getPageInfo:1</td><td>Method is invoked with correct URL</td><td>Correct java.util.Properties object is returned</td></tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,71 @@
<html>
<head>
<title>
Description of tests on EventRegistration interface
</title>
</head>
<body bgcolor=white>
<P align=left>This document contains a simple preliminary descritption of
testcases on EventRegistration interface of Webclient API.</P>
<UL>
<LI><A href=#addDocument>Tests on <B>addDocumentLoadListener</B> method</A>
<LI><A href=#addMouse>Tests on <B>addMouseListener</B> method</A>
<LI><A href=#removeDocument>Tests on <B>removeDocumentLoadListener</B> method</A>
<LI><A href=#removeMouse>Tests on <B>removeMouseListener</B> method</A>
</UL>
<A name=addDocument>
<H2>1. Tests on addDocumentLoadListener method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/EventRegistration_addDocumentLoadListener_1:0</td><td>This test registers listener and loads document</td><td>START_DOCUMENT_LOAD_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/api/EventRegistration_addDocumentLoadListener_1:1</td><td>This test registers listener and loads document</td><td>END_DOCUMENT_LOAD_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/api/EventRegistration_addDocumentLoadListener_1:2</td><td>This test registers listener and loads document</td><td>START_URL_LOAD_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/api/EventRegistration_addDocumentLoadListener_1:3</td><td>This test registers listener and loads document</td><td>END_URL_LOAD_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/api/EventRegistration_addDocumentLoadListener_1:4</td><td>This test registers listener and loads document</td><td>PROGRESS_URL_LOAD_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/api/EventRegistration_addDocumentLoadListener_1:5</td><td>This test registers listener and loads document</td><td>STATUS_URL_LOAD_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/api/EventRegistration_addDocumentLoadListener_1:6</td><td>This test registers listener and loads document</td><td>UNKNOWN_CONTENT_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/api/EventRegistration_addDocumentLoadListener_1:7</td><td>This test registers listener and loads document</td><td>FETCH_INTERRUPT_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/api/EventRegistration_addDocumentLoadListener_2:0</td><td>This test registers null listener</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/EventRegistration_addDocumentLoadListener_2:1</td><td>This test registers several same correct listeners</td><td>Events dispatched in one listener</td></tr>
<tr><td>basic/api/EventRegistration_addDocumentLoadListener_2:2</td><td>This test registers several different correct listeners</td><td>Events dispatched in last registered listener</td></tr>
</table>
<A name=addMouse>
<H2>2. Tests on addMouseListener method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/mixed/EventRegistration_addMouseListener_1:0</td><td>This test registers listener and waits for mouse events</td><td>MOUSE_DOWN_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/mixed/EventRegistration_addMouseListener_1:1</td><td>This test registers listener and waits for mouse events</td><td>MOUSE_UP_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/mixed/EventRegistration_addMouseListener_1:2</td><td>This test registers listener and waits for mouse events</td><td>MOUSE_CLICK_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/mixed/EventRegistration_addMouseListener_1:3</td><td>This test registers listener and waits for mouse events</td><td>MOUSE_DOUBLE_CLICK_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/mixed/EventRegistration_addMouseListener_1:4</td><td>This test registers listener and waits for mouse events</td><td>MOUSE_OVER_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/mixed/EventRegistration_addMouseListener_1:5</td><td>This test registers listener and waits for mouse events</td><td>MOUSE_OUT_EVENT_MASK event dispatched</td></tr>
<tr><td>basic/mixed/EventRegistration_addMouseListener_2:0</td><td>This test registers null listener</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/mixed/EventRegistration_addMouseListener_2:1</td><td>This test registers several same correct listeners</td><td>Events dispatched in one listener</td></tr>
<tr><td>basic/mixed/EventRegistration_addMouseListener_2:2</td><td>This test registers several different correct listeners</td><td>Events dispatched in last registered listener</td></tr>
</table>
<A name=removeDocument>
<H2>3. Tests on removeDocumentLoadListener method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/EventRegistration_removeDocumentLoadListener:0</td><td>This test removes null listener</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/EventRegistration_removeDocumentLoadListener:1</td><td>This test removes unregistered listener</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/EventRegistration_removeDocumentLoadListener:2</td><td>This test removes registered listener</td><td>Listener is removed</td></tr>
</table>
<A name=removeMouse>
<H2>4. Tests on removeMouseListener method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/EventRegistration_removeMouseListener_1:0</td><td>This test removes null listener</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/EventRegistration_removeMouseListener_1:1</td><td>This test removes unregistered listener</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/mixed/EventRegistration_removeMouseListener_2:0</td><td>This test removes registered listener</td><td>Listener is removed</td></tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,157 @@
<html>
<head>
<title>
Description of tests on History interface
</title>
</head>
<body bgcolor=white>
<P align=left>This document contains a simple preliminary description of
testcases on History interface of Webclient API.</P>
<UL>
<LI><A href=#back>Tests on <B>back</B> method</A>
<LI><A href=#canBack>Tests on <B>canBack</B> method</A>
<LI><A href=#canForward>Tests on <B>canForward</B> method</A>
<LI><A href=#clearHistory>Tests on <B>clearHistory</B> method</A>
<LI><A href=#forward>Tests on <B>forward</B> method</A>
<LI><A href=#getBackList>Tests on <B>getBackList</B> method</A>
<LI><A href=#getCurrentHistoryIndex>Tests on <B>getCurrentHistoryIndex</B> method</A>
<LI><A href=#getForwardList>Tests on <B>getForwardList</B> method</A>
<LI><A href=#getHistory>Tests on <B>getHistory</B> method</A>
<LI><A href=#getHistoryEntry>Tests on <B>getHistoryEntry</B> method</A>
<LI><A href=#getHistoryLength>Tests on <B>getHistoryLength</B> method</A>
<LI><A href=#getURLForIndex>Tests on <B>getURLForIndex</B> method</A>
<LI><A href=#setCurrentHistoryIndex>Tests on <B>setCurrentHistoryIndex</B> method</A>
</UL>
<A name=back>
<H2>1. Tests on back method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_back_1:0</td><td>Method back() invoked when backList is empty</td><td>Mozilla doesn't crashes and no page loads</td></tr>
<tr><td>basic/api/History_back_1:1</td><td>Method back() invoked when backList is not empty</td><td>Mozilla doesn't crashes and load previous page</td></tr>
<tr><td>basic/api/History_back_2:0</td><td>Method back() invoked when no URL loaded</td><td>Mozilla doesn't crashes and no page loads</td></tr>
</table>
<A name=canBack>
<H2>2. Tests on canBack method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_canBack_1:0</td><td>Method canBack() invoked when backList is not empty</td><td>Mozilla doesn't crashes and canBack return true</td></tr>
<tr><td>basic/api/History_canBack_1:1</td><td>Method canBack() invoked when backList is empty</td><td>Mozilla doesn't crashes and canBack return false</td></tr>
<tr><td>basic/api/History_canBack_2:0</td><td>Method canBack() invoked when no URL loaded</td><td>Mozilla doesn't crashes and canBack return false</td></tr>
</table>
<A name=canForward>
<H2>3. Tests on canForward method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_canForward_1:0</td><td>Method canForward() invoked when forwardList is not empty</td><td>Mozilla doesn't crashes and canForward return true</td></tr>
<tr><td>basic/api/History_canForward_1:1</td><td>Method canForward() invoked when forwardList is empty</td><td>Mozilla doesn't crashes and canForward return false</td></tr>
<tr><td>basic/api/History_canForward_2:0</td><td>Method canForward() invoked when no URL loaded</td><td>Mozilla doesn't crashes and canForward return false</td></tr>
</table>
<A name=clearHistory>
<H2>4. Tests on clearHistory method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_clearHistory_1:0</td><td>Method clearHistory() invoked when no URL loaded</td><td>Mozilla doesn't crashes and history.length return true</td></tr>
<tr><td>basic/api/History_clearHistory_2:0</td><td>Method clearHistory() invoked when some URL's are loaded</td><td>Mozilla doesn't crashes and clearHistory return false</td></tr>
</table>
<A name=forward>
<H2>5. Tests on forward method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_forward_1:0</td><td>Method forward() invoked when forwardList is empty</td><td>Mozilla doesn't crashes and forward do nothing and do not thrown any exception</td></tr>
<tr><td>basic/api/History_forward_1:1</td><td>Method forward() invoked when forwardList is not empty</td><td>Mozilla doesn't crashes and forward load next URL</td></tr>
<tr><td>basic/api/History_forward_2:0</td><td>Method forward() invoked when no URL loaded</td><td>Mozilla doesn't crashes and forward do nothing and do not thrown any exception</td></tr>
</table>
<A name=getBackList>
<H2>6. Tests on getBackList method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_getBackList:0</td><td>Method getBackList() invoked when backList is empty</td><td>Mozilla doesn't crashes and getBackList return null</td></tr>
<tr><td>basic/api/History_getBackList:1</td><td>Method getBackList() invoked when backList is not empty</td><td>Mozilla doesn't crashes and getBackList return correct backList</td></tr>
<tr><td>basic/api/History_getBackList:2</td><td>Method getBackList() invoked when no URL loaded</td><td>Mozilla doesn't crashes and getBackList return null</td></tr>
<tr><td>basic/api/History_getBackList:3</td><td>Method getBackList() invoked when some URL's are loaded and neither method called before</td><td>Mozilla doesn't crashes and getBackList return correct BackList</td></tr>
</table>
<A name=getCurrentHistoryIndex>
<H2>7. Tests on getCurrentHistoryIndex method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_getCurrentHistoryIndex:0</td><td>Method getCurrentHistoryIndex() invoked when current URL is the first in history</td><td>Mozilla doesn't crashes and getCurrentHistoryIndex return 0</td></tr>
<tr><td>basic/api/History_getCurrentHistoryIndex:1</td><td>Method getCurrentHistoryIndex() invoked when current URL is the last in history</td><td>Mozilla doesn't crashes and getCurrentHistoryIndex return correct length of history</td></tr>
<tr><td>basic/api/History_getCurrentHistoryIndex:2</td><td>Method getCurrentHistoryIndex() invoked when current URL is in the middle of history</td><td>Mozilla doesn't crashes and getCurrentHistoryIndex return correct index</td></tr>
<tr><td>basic/api/History_getCurrentHistoryIndex:3</td><td>Method getCurrentHistoryIndex() invoked when current URL is the last in history and neither method called before</td><td>Mozilla doesn't crashes and getCurrentHistoryIndex return correct index</td></tr>
</table>
<A name=getForwardList>
<H2>8. Tests on getForwardList method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_getForwardList:0</td><td>Method getForwardList() invoked when forwardList is empty (the last page is loaded)</td><td>Mozilla doesn't crashes and getForwardList return empty array</td></tr>
<tr><td>basic/api/History_getForwardList:1</td><td>Method getForwardList() invoked when forwardList is equal all history</td><td>Mozilla doesn't crashes and getForwardList return correct forwardList</td></tr>
<tr><td>basic/api/History_getForwardList:2</td><td>Method getForwardList() invoked when forwardList is a part of history</td><td>Mozilla doesn't crashes and getForwardList return correct forwardList</td></tr>
<tr><td>basic/api/History_getForwardList:3</td><td>Method getForwardList() invoked when forwardList is empty (the last page is loaded) and neither method called before</td><td>Mozilla doesn't crashes and getForwardList return correct forwardList</td></tr>
</table>
<A name=getHistory>
<H2>9. Tests on getHistory method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_getHistory_1:0</td><td>Method getHistory() invoked when history contains only 1 html</td><td>Mozilla doesn't crashes and getHistory return araay with 1 element</td></tr>
<tr><td>basic/api/History_getHistory_2:0</td><td>Method getHistory() invoked when current page is the first in history</td><td>Mozilla doesn't crashes and getHistory return correct array</td></tr>
<tr><td>basic/api/History_getHistory_2:1</td><td>Method getHistory() invoked when current page in the middle of history</td><td>Mozilla doesn't crashes and getHistory return correct array</td></tr>
<tr><td>basic/api/History_getHistory_2:2</td><td>Method getHistory() invoked when current page in the end of history</td><td>Mozilla doesn't crashes and getHistory return correct array</td></tr>
</table>
<A name=getHistoryEntry>
<H2>10. Tests on getHistoryEntry method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_getHistoryEntry:0</td><td>Method getHistoryEntry() invoked with arg = INTEGER.MAX_VALUE</td><td>Mozilla doesn't crashes and getHistoryEntry return null (or thrown Exception)</td></tr>
<tr><td>basic/api/History_getHistoryEntry:1</td><td>Method getHistoryEntry() invoked with arg = INTEGER.MIN_VALUE</td><td>Mozilla doesn't crashes and getHistoryEntry return null (or thrown Exception)</td></tr>
<tr><td>basic/api/History_getHistoryEntry:2</td><td>Method getHistoryEntry() invoked with arg = 0</td><td>Mozilla doesn't crashes and getHistoryEntry return a first entry of history</td></tr>
<tr><td>basic/api/History_getHistoryEntry:3</td><td>Method getHistoryEntry() invoked with arg equals a history.length</td><td>Mozilla doesn't crashes and getHistoryEntry return last entry of history</td></tr>
</table>
<A name=getHistoryLength>
<H2>11. Tests on getHistoryLength method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_getHistoryLength_1:0</td><td>Method getHistoryLength() invoked with some loaded pages</td><td>Mozilla doesn't crashes and getHistoryLength return correct value</td></tr>
<tr><td>basic/api/History_getHistoryLength_2:0</td><td>Method getHistoryLength() invoked when none URL's loaded</td><td>Mozilla doesn't crashes and getHistoryLength return 0</td></tr>
</table>
<A name=getURLForIndex>
<H2>12. Tests on getURLForIndex method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_getURLForIndex:0</td><td>Method getURLForIndex() invoked with arg = INTEGER.MAX_VALUE</td><td>Mozilla doesn't crashes and getURLForIndex return null (or thrown Exception)</td></tr>
<tr><td>basic/api/History_getURLForIndex:1</td><td>Method getURLForIndex() invoked with arg = INTEGER.MIN_VALUE</td><td>Mozilla doesn't crashes and getURLForIndex return null (or thrown Exception)</td></tr>
<tr><td>basic/api/History_getURLForIndex:2</td><td>Method getURLForIndex() invoked with arg = 0</td><td>Mozilla doesn't crashes and getURLForIndex return a first URL of history</td></tr>
<tr><td>basic/api/History_getURLForIndex:3</td><td>Method getURLForIndex() invoked with arg equals a history.length</td><td>Mozilla doesn't crashes and getURLForIndex return last URL of history</td></tr>
</table>
<A name=setCurrentHistoryIndex>
<H2>13. Tests on setCurrentHistoryIndex method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_setCurrentHistoryIndex_1:0</td><td>Method setCurrentHistoryIndex() invoked with arg = INTEGER.MAX_VALUE</td><td>Mozilla doesn't crashes and setCurrentHistoryIndex do not load any URL (or thrown Exception)</td></tr>
<tr><td>basic/api/History_setCurrentHistoryIndex_1:1</td><td>Method setCurrentHistoryIndex() invoked with arg = INTEGER.MIN_VALUE</td><td>Mozilla doesn't crashes and setCurrentHistoryIndex do not load any URL (or thrown Exception)</td></tr>
<tr><td>basic/api/History_setCurrentHistoryIndex_1:2</td><td>Method setCurrentHistoryIndex() invoked with arg = 0</td><td>Mozilla doesn't crashes and setCurrentHistoryIndex load a first URL of history</td></tr>
<tr><td>basic/api/History_setCurrentHistoryIndex_1:3</td><td>Method setCurrentHistoryIndex() invoked with 0<arg<history.length</td><td>Mozilla doesn't crashes and setCurrentHistoryIndex load correct URL </td></tr>
<tr><td>basic/api/History_setCurrentHistoryIndex_1:4</td><td>Method setCurrentHistoryIndex() invoked with arg = history.length</td><td>Mozilla doesn't crashes and setCurrentHistoryIndex load last URL of history</td></tr>
<tr><td>basic/api/History_setCurrentHistoryIndex_2:0</td><td>Method setCurrentHistoryIndex() invoked with history = null </td><td>Mozilla doesn't crashes and setCurrentHistoryIndex do not load any URL</td></tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,61 @@
<html>
<head>
<title>
Description of tests on Navigation interface
</title>
</head>
<body bgcolor=white>
<P align=left>This document contains a simple preliminary description of
testcases on Navigation interface of Webclient API.</P>
<UL>
<LI><A href=#load>Tests on <B>loadURL</B> method</A>
<LI><A href=#refresh>Tests on <B>refresh</B> method</A>
<LI><A href=#stop>Tests on <B>stop</B> method</A>
</UL>
<A name=load>
<H2>1. Tests on loadURL method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/Navigation_loadURL_1:0</td><td>Method loadURL() invoked with null URL string</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/Navigation_loadURL_1:1</td><td>Method loadURL() invoked with empty URL string</td><td>Browser doesn't crashed</td></tr>
<tr><td>basic/api/Navigation_loadURL_2:0</td><td>Method loadURL() invoked when no URL loaded</td><td>Browser doesn't crashed and URL loads</td></tr>
<tr><td>basic/api/Navigation_loadURL_2:1</td><td>Method loadURL() invoked when URL is loading</td><td>Browser doesn't crashed, load process stops and another URL is loaded</td></tr>
<tr><td>basic/api/Navigation_loadURL_2:2</td><td>Method loadURL() invoked when URL is loaded</td><td>Browser doesn't crashed and another URL is loaded</td></tr>
<tr><td>basic/api/Navigation_loadURL_3:0</td><td>Method loadURL() invoked with file:/// protocol</td><td>Browser doesn't crashed and loads URL</td></tr>
<tr><td>basic/api/Navigation_loadURL_3:1</td><td>Method loadURL() invoked with http:// protocol</td><td>Browser doesn't crashed and loads URL</td></tr>
<tr><td>basic/api/Navigation_loadURL_3:2</td><td>Method loadURL() invoked with ftp:// protocol</td><td>Browser doesn't crashed and loads URL</td></tr>
<tr><td>basic/api/Navigation_loadURL_3:3</td><td>Method loadURL() invoked with bad protocol</td><td>Browser doesn't crashed</td></tr>
</table>
<A name=refresh>
<H2>2. Tests on refresh method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/Navigation_refresh_1:0</td><td>Method refresh() invoked when no URL loaded</td><td>Browser doesn't crashed and nothing happens</td></tr>
<tr><td>basic/api/Navigation_refresh_1:1</td><td>Method refresh() invoked when URL is loading</td><td>Browser doesn't crashed, load process stops and URL reloads</td></tr>
<tr><td>basic/api/Navigation_refresh_1:2</td><td>Method refresh() invoked when URL is loaded</td><td>Browser doesn't crashed and URL reloads</td></tr>
<tr><td>basic/api/Navigation_refresh_2:0</td><td>Method refresh() invoked with value LOAD_NORMAL (=0)</td><td>Browser doesn't crashed and URL reloads</td></tr>
<tr><td>basic/api/Navigation_refresh_2:1</td><td>Method refresh() invoked with value LOAD_FORCE_RELOAD (=512)</td><td>Browser doesn't crashed and URL reloads</td></tr>
<tr><td>basic/api/Navigation_refresh_2:2</td><td>Method refresh() invoked with min long value=-9223372036854775808</td><td>Browser doesn't crashed and URL reloads</td></tr>
<tr><td>basic/api/Navigation_refresh_2:3</td><td>Method refresh() invoked with max long value=9223372036854775807</td><td>Browser doesn't crashed and URL reloads</td></tr>
</table>
<A name=stop>
<H2>3. Tests on stop method.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/Navigation_stop:0</td><td>Method stop() invoked when no URL loaded</td><td>Browser doesn't crashed and nothing happens</td></tr>
<tr><td>basic/api/Navigation_stop:1</td><td>Method stop() invoked when URL is loading</td><td>Browser doesn't crashed and load process stops</td></tr>
<tr><td>basic/api/Navigation_stop:2</td><td>Method stop() invoked when URL is loaded</td><td>Browser doesn't crashed and nothing happens</td></tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,41 @@
<html>
<head>
<title>
Description of Stress tests
</title>
</head>
<body bgcolor=white>
<P align=left>This document contains a simple preliminary description of
stress testcases.</P>
<UL>
<LI><A href=#load>Test on 500 pages loading</A>
<LI><A href=#back>Test on 500 pages loading and 500 back actions</A>
<LI><A href=#refresh>Test on 500 refreshes during page loading</A>
</UL>
<A name=load>
<H2>1. Test on 500 pages loading.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/stress/LongLoad</td><td>Browser loads 500 pages</td><td>Browser doesn't crashed and 500th page is loaded</td></tr>
</table>
<A name=back>
<H2>2. Test on 500 pages loading and 500 back actions.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/stress/LongBack</td><td>Browser loads 500 pages and makes 500 BACK actions</td><td>Browser doesn't crashed and first page is loaded</td></tr>
</table>
<A name=refresh>
<H2>3. Test on 500 refreshes during page loading.</H2>
<table border=1>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/stress/Refresh:0</td><td>Browser refreshes page for 500 times during page loading</td><td>Browser doesn't crashed and after 500 refreshes page is loaded</td></tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,197 @@
Interfaces, that can be queried from browser control:
webclient.BrowserControlCanvas
webclient.CurrentPage
webclient.EventRegistration
webclient.History
webclient.Navigation
webclient.WindowControl
Next interfaces skipped, because they are not implemented now(04/26/2000):
webclient.cache.NetDataCacheManager <SKIP> Not implemented
webclient.Preferences <SKIP> Not implemented
webclient.Print <SKIP> Not implemented
webclient.ExtendedEventRegistration <SKIP> Not implemented
Abstract class: org.mozilla.webclient.BrowserControlCanvas
Method: public void addNotify()
- 1 test, just for invoke and not crash
Method: public org.mozilla.webclient.BrowserControl getWebShell()
- 1 test: just for invoke and compare returned BrowserControl with original ?
Method: public void setBounds(Rectangle r)
- 2 tests: null and well constructed rectangle
Method: public void setBounds(int,int,int,int)
- 12 tests: Integer.MIN_VALUE,Integer.MAX_VALUE,0 on each parameters,when other parameters good
- 3 tests: correct formed rectangle, all coordinates are equals to 0, and inverted rectangle(Xleft >Xright)
Non-public methods doesn't accessible for API's end-user, so will not be tested there
Method: non-public java.awt.Point getEventCoordsLocalToWindow(MouseEvent)
Method: non-public java.awt.Rectangle getWindowBounds()
Method: non-public java.awt.Rectangle getBoundsRelativeToWindow()
Method: non-public void initialize(BrowserControl)
Method: non-public int getWindow(DrawingSurfaceInfo)
Interface: org.mozilla.webclient.CurrentPage
Method: public void copyCurrentSelectionToSystemClipboard()
- 3 tests: without selection, with selection and without URL
Method: public void findInPage(String pattern, boolean forward,boolean matchcase)
- 5 tests: null,empty, incorrect, correct string and correct string without URL
- 4 tests: find (backward,forward)x(match,unmatch case)
Method: public void findNextInPage(boolean forward)
- 4 tests: find forward, backward, without previous find and at the end of docume
nt
Method: public java.lang.String getCurrentURL()
- 3 tests: during loading URL, during fully loaded URL and without URL
Method: public java.lang.String getSource()
- 2 tests: with correct page and without URL
Method: public [B getSourceBytes(boolean viewMode)
- 4 tests: (with correct page and without URL)x(true and false viewMode)
Method: public void resetFind()
- 3 tests: without previous find, with correct find and without URL
Method: public void selectAll()
- 2 tests: with correct page and without URL
Method: public void getDOM()
- 2 tests: with correct page and without URL
Method: public void getPageInfo()
- 2 tests: with correct page and without URL
Interface: org.mozilla.webclient.EventRegistration
Method: public void addDocumentLoadListener(DocumentLoadListener)
- 8 tests: for each DocumentLoad event
- 3 tests: null listener, several same listeners and several different listeners
Method: public void addMouseListener(java.awt.event.MouseListener)
- 6 tests: for each Mouse event
- 3 tests: null listener,several same listeners and several different listeners
Method: public void removeDocumentLoadListener(DocumentLoadListener)
- 3 tests: null,registered DocumentLoadListener and non-registered DocumentLoadListener
Method: public void removeMouseListener(java.awt.event.MouseListener)
- 3 tests: null,registered MouseListener and non-registered MouseListener
Interface: org.mozilla.webclient.History
Method: public void back()
- 2 tests: When previous page exists and when unexist
Method: public boolean canBack()
- 2 tests: When previous page exists and when unexist
Method: public [Lorg.mozilla.webclient.HistoryEntry; getBackList()
- 3 tests: For 0,1,3 previous pages
Method: public void clearHistory()
- 2 tests: For empty and nonempty history
Method: public void forward()
- 2 tests: When next page exists and when unexist
Method: public boolean canForward()
- 2 tests: When next page exists and when unexist
Method: public [Lorg.mozilla.webclient.HistoryEntry; getForwardList()
- 3 tests: For 0,1,3 next pages
Method: public [Lorg.mozilla.webclient.HistoryEntry; getHistory()
- 2 test: only with current page and with several pages (3-4),
possible add 2 tests when current page first and last
Method: public org.mozilla.webclient.HistoryEntry getHistoryEntry(int)
- 4 tests: Integer.MIN_VALUE,Integer.MAX_VALUE,0,legal value
Method: public int getCurrentHistoryIndex()
- 3 tests: when current page last, first, and in the middle of the history
Method: public void setCurrentHistoryIndex(int)
- 5 tests: Integer.MIN_VALUE,Integer.MAX_VALUE,0,legal value,current index
Method: public int getHistoryLength()
- 1 test: just get HistoryLength
Method: public java.lang.String getURLForIndex(int)
- 5 tests: Integer.MIN_VALUE,Integer.MAX_VALUE, first and last
Comment:
1. Also one test on each method can be added for situations, when history is empty
2. Should be modeled situation, when history has several branches, for example
<Start URL> - < URL 1 > - < URL 2 > (do back here to URL 1)
|
<URL 3>
We should verify, that URL 2 correctly removed from history when < URL 3 > loaded
Interface: org.mozilla.webclient.Navigation
Method: public void stop()
- 3 tests: When loading in progress, when url loaded, when no URL's loaded at ALL
Method: public void refresh(long)
- 3 tests: When loading in progress, when url loaded, when no URL's loaded at ALL
- 4 test: tests on parameter values(0, 512, Long.MIN_VALUE,Long.MAX_VALUE)
Method: public void loadURL(String)
- 2 tests: empty and null string
- 3 tests: When loading in progress, when url loaded, when no URL's loaded at ALL
- 4 test: ftp://, http://, file://, bad protocol
Interface: org.mozilla.webclient.WindowControl
Method: public void setBounds(Rectangle)
- 2 tests: null and well constructed rectangle
Method: public void createWindow(int,Rectangle)
- 3 tests: Integer.MIN_VALUE,Integer.MAX_VALUE,0
- 2 tests: with valid int use null and well constructed rectangle
Method: public int getNativeWebShell()
- 1 test: just call
Method: public void moveWindowTo(int_int)
- 6 tests: Integer.MIN_VALUE,Integer.MAX_VALUE,0 for each parameter when other parameter is good
- 2 tests: move to good coordinates and move out of screen bounds
Method: public void removeFocus()
- 1 test: just call
Method: public void repaint(boolean)
- 2 tests: force repaint and not
Method: public void setVisible(boolean)
- 2 tests: with false and with true
Method: public void setFocus()
- 1 test: just call
Interface: org.mozilla.webclient.BookmarkEntry
Method: public Properties getProperties()
- 3 tests: When bookmark entry recieved via TreeModel,via newBookmarkEntry,via newBookmarkFolder
Method: public boolean isFolder()
- 2 tests: via newBookmarkEntry,via newBookmarkFolder
Inherited from interface javax.swing.tree.MutableTreeNode:
Method: public void insert(MutableTreeNode child, int index)
- 5 tests: with null and existed child, with correct, 0, MIN_INTEGER and MAX_INTEGER index
Method: public void remove(int index)
- 4 tests: with correct, 0, MIN_INTEGER and MAX_INTEGER index
Method: public void remove(MutableTreeNode node)
- 2 tests: with null and existed node
Method: public void removeFromParent()
- 2 tests: with and without parent
Method: public void setParent(MutableTreeNode newParent)
- 2 tests: with null and existed newParent
Method: public void setUserObject(Object object)
- 2 tests: with null and correct object
Inherited from interface javax.swing.tree.TreeNode:
Method: public Enumeration children()
- 2 tests: via newBookmarkEntry, newBookmarkFolder
Method: public boolean getAllowsChildren()
- 2 tests: via newBookmarkEntry, newBookmarkFolder
Method: public TreeNode getChildAt(int index)
- 5 tests: via newBookmarkEntry, newBookmarkFolder, with correct index, index=0, MIN_INTEGER and MAX_INTEGER
Method: public int getChildCount()
- 2 tests: via newBookmarkEntry, newBookmarkFolder
Method: public int getIndex(TreeNode node)
- 5 tests: via newBookmarkEntry, newBookmarkFolder, with correct, incorrect and null node
Method: public TreeNode getParent()
- 4 tests: via newBookmarkEntry, newBookmarkFolder, with existed and unexisted parent
Method: public boolean isLeaf()
- 2 tests: via newBookmarkEntry, newBookmarkFolder
Interface: org.mozilla.webclient.cache.NetDataCacheManager <SKIP>
Interface: org.mozilla.webclient.Preferences <SKIP>
Interface: org.mozilla.webclient.Print <SKIP>
Interface: org.mozilla.webclient.ExtendedEventRegistration <SKIP>
Summary 120-150 simple tests

View File

@@ -0,0 +1,82 @@
Webclient automated API tests draft description (20/04/2000)
API testing should consist from 2 main Parts:
Interfaces, quered by test application and listeners,
that are part of test application and registered in webclient API
Quered interfaces:
webclient.BrowserControlCanvas
webclient.CurrentPage
webclient.EventRegistration
webclient.ExtendedEventRegistration <SKIP> Not implemethed
webclient.History
webclient.Navigation
webclient.cache.NetDataCacheManager <SKIP> Not implemethed
webclient.Preferences <SKIP> Not implemethed
webclient.Print <SKIP> Not implemethed
webclient.WindowControl
Abstract class: org.mozilla.webclient.BrowserControlCanvas
Constructor: non-public org.mozilla.webclient.BrowserControlCanvas()
Method: public void addNotify()
Method: public org.mozilla.webclient.BrowserControl getWebShell()
Method: public void setBounds(Rectangle)
Method: public void setBounds(int_int_int_int)
Method: non-public java.awt.Point getEventCoordsLocalToWindow(MouseEvent)
Method: non-public java.awt.Rectangle getWindowBounds()
Method: non-public java.awt.Rectangle getBoundsRelativeToWindow()
Method: non-public void initialize(BrowserControl)
Method: non-public int getWindow(DrawingSurfaceInfo)
Interface: org.mozilla.webclient.CurrentPage
Method: public void copyCurrentSelectionToSystemClipboard()
Method: public void findInPage(String_boolean_boolean)
Method: public void findNextInPage(boolean)
Method: public java.lang.String getCurrentURL()
Method: public java.lang.String getSource()
Method: public [B getSourceBytes()
Method: public void resetFind()
Method: public void selectAll()
Interface: org.mozilla.webclient.EventRegistration
Method: public void addDocumentLoadListener(DocumentLoadListener)
Method: public void removeDocumentLoadListener(DocumentLoadListener)
Interface: org.mozilla.webclient.ExtendedEventRegistration <SKIP>
Interface: org.mozilla.webclient.History
Method: public void back()
Method: public boolean canBack()
Method: public [Lorg.mozilla.webclient.HistoryEntry; getBackList()
Method: public void clearHistory()
Method: public void forward()
Method: public boolean canForward()
Method: public [Lorg.mozilla.webclient.HistoryEntry; getForwardList()
Method: public [Lorg.mozilla.webclient.HistoryEntry; getHistory()
Method: public org.mozilla.webclient.HistoryEntry getHistoryEntry(int)
Method: public int getCurrentHistoryIndex()
Method: public void setCurrentHistoryIndex(int)
Method: public int getHistoryLength()
Method: public java.lang.String getURLForIndex(int)
Interface: org.mozilla.webclient.Navigation
Method: public void stop()
Method: public void refresh(long)
Method: public void loadURL(String)
Interface: org.mozilla.webclient.cache.NetDataCacheManager <SKIP>
Interface: org.mozilla.webclient.Preferences <SKIP>
Interface: org.mozilla.webclient.Print <SKIP>
Interface: org.mozilla.webclient.WindowControl
Method: public void setBounds(Rectangle)
Method: public void createWindow(int_Rectangle)
Method: public int getNativeWebShell()
Method: public void moveWindowTo(int_int)
Method: public void removeFocus()
Method: public void repaint(boolean)
Method: public void setVisible(boolean)
Method: public void setFocus()

View File

@@ -0,0 +1,33 @@
Webclient automated API tests draft description (20/04/2000)
API testing should consist from 2 main Parts:
Interfaces, quered by test application ,
that are part of test application and registered in webclient API
Quered interfaces:
webclient.BrowserControlCanvas
webclient.CurrentPage
webclient.EventRegistration
webclient.ExtendedEventRegistration <SKIP> Not implemethed
webclient.History
webclient.Navigation
webclient.cache.NetDataCacheManager <SKIP> Not implemethed
webclient.Preferences <SKIP> Not implemethed
webclient.Print <SKIP> Not implemethed
webclient.WindowControl
Suggestions about white box testing:
1)API tests for all interfaces, quered from BrowserControl:
- Verify that API doesn't crashed on critical values for each parameter
- Verify, that correct values returned(when possible)
- Verify correct work on different life stages
(For example try to history.getURLForIndex(i),
when no URLs loaded.)
2)Test on events
- Tests on right sequence of events
(For example when load new URL next events should occurs:
START_DOCUMENT_LOAD,..,END_DOCUMENT_LOAD)
- Tests on right event generation.
(For example when we make STOP during url loading,
corresponding event should occurs)

View File

@@ -0,0 +1,14 @@
<html>
<body>
<table border=1>
<tr><td colspan=3>Testcase: basic/api/History_getURLForIndex</td></tr>
<tr><td>Test ID</td><td>Action</td><td>Expected Result</td>
<tr><td>basic/api/History_getURLForIndex:0</td><td>000</td><td>000</td></tr>
<tr><td>basic/api/History_getURLForIndex:1</td><td>000</td><td>000</td></tr>
<tr><td>basic/api/History_getURLForIndex:2</td><td>000</td><td>000</td></tr>
<tr><td>basic/api/History_getURLForIndex:3</td><td>000</td><td>000</td></tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,147 @@
Interfaces, that can be quered from browser control:
webclient.BrowserControlCanvas
webclient.CurrentPage
webclient.EventRegistration
webclient.History
webclient.Navigation
webclient.WindowControl
Next interfaces skipped, because they are not implemented now(04/26/2000):
webclient.cache.NetDataCacheManager <SKIP> Not implemethed
webclient.Preferences <SKIP> Not implemethed
webclient.Print <SKIP> Not implemethed
webclient.ExtendedEventRegistration <SKIP> Not implemethed
org.mozilla.webclient.BrowserControlCanvas
Method: public void addNotify()
- 1 test, just for invoke and not crash
Method: public org.mozilla.webclient.BrowserControl getWebShell()
- 1 test: just for invoke and compare returned BrowserControl with original ?
Method: public void setBounds(Rectangle)
- 2 tests: null and well constructed rectangle
Method: public void setBounds(int_int_int_int)
- 12 tests: Integer.MIN_VALUE,Integer.MAX_VALUE,0 on each parameters,when other parameters good
- 3 tests: correct formed rectangle, all coords 0, and inverted rectangle(Xleft >Xright)
Non-public methods doesn't accesible for API's end-user, so will not be tested there
Method: non-public java.awt.Point getEventCoordsLocalToWindow(MouseEvent)
Method: non-public java.awt.Rectangle getWindowBounds()
Method: non-public java.awt.Rectangle getBoundsRelativeToWindow()
Method: non-public void initialize(BrowserControl)
Method: non-public int getWindow(DrawingSurfaceInfo)
Interface: org.mozilla.webclient.CurrentPage
Method: public void copyCurrentSelectionToSystemClipboard()
- 2 tests: without selection, with selection and compare with clipboard(when possible) ?
Method: public void findInPage(String pattern, boolean forward,boolean matchcase)
- 3 tests: null,empty anf correct string
- 8 tests: find (backward,forward)x(match,unmatch case)x(exist and unexist string)
Method: public void findNextInPage(boolean forward)
- 3 tests: find forward,backward and without previous find
Method: public java.lang.String getCurrentURL()
- 2 tests: during loading URL and during fully loaded URL
Method: public java.lang.String getSource()
- 1 tests: with correct page
Method: public [B getSourceBytes()
- 1 tests: with correct page(Possible test on different languages ?)
Method: public void resetFind()
- 2 tests: without previous find, with correct find
Method: public void selectAll()
- 1 tests: with correct page
Comments:
Possible we should add 1 tests on each method, when no pages loaded
Interface: org.mozilla.webclient.EventRegistration
Method: public void addDocumentLoadListener(DocumentLoadListener)
3 tests: null,correct DocumentLoadListener and already registered DocumentLoadListener
1 test: Several(2 - 3) different correct DocumentLoadListeners
Method: public void removeDocumentLoadListener(DocumentLoadListener)
3 tests: null,registered DocumentLoadListener and non-registered DocumentLoadListener
Interface: org.mozilla.webclient.History
Method: public void back()
2 tests: When previous page exists and when unexist
Method: public boolean canBack()
2 tests: When previous page exists and when unexist
Method: public [Lorg.mozilla.webclient.HistoryEntry; getBackList()
3 tests: For 0,1,3 previous pages
Method: public void clearHistory()
2 tests: For empty and nonempty history
Method: public void forward()
2 tests: When next page exists and when unexist
Method: public boolean canForward()
2 tests: When next page exists and when unexist
Method: public [Lorg.mozilla.webclient.HistoryEntry; getForwardList()
3 tests: For 0,1,3 next pages
Method: public [Lorg.mozilla.webclient.HistoryEntry; getHistory()
2 test: only with current page and with several pages (3-4),
possible add 2 tests when current page first and last
Method: public org.mozilla.webclient.HistoryEntry getHistoryEntry(int)
4 tests: Integer.MIN_VALUE,Integer.MAX_VALUE,0,legal value
Method: public int getCurrentHistoryIndex()
3 tests: when current page last, first, and in the middle of the history
Method: public void setCurrentHistoryIndex(int)
5 tests: Integer.MIN_VALUE,Integer.MAX_VALUE,0,legal value,current index
Method: public int getHistoryLength()
1 test: just get HistoryLength
Method: public java.lang.String getURLForIndex(int)
5 tests: Integer.MIN_VALUE,Integer.MAX_VALUE, first and last
Comment:
1. Also one test opn each method can be added for situations, when history is empty
2. Should be modeled situation, when history has several branches, for example
<Start URL> - < URL 1 > - < URL 2 > (do back here to URL 1)
|
<URL 3>
We should verify, that URL 2 correctly removed from history
Interface: org.mozilla.webclient.Navigation
Method: public void stop()
3 tests: When loading in progress, when url loaded, when no URLs loaded at ALL
Method: public void refresh(long)
3 tests: When loading in progress, when url loaded, when no URLs loaded at ALL
X test: tests on parameter values(at least Integer.MIN_VALUE,Integer.MAX_VALUE,0)
Method: public void loadURL(String)
2 tests: empty and null string
3 tests: When loading in progress, when url loaded, when no URLs loaded at ALL
4 test: ftp://, http://, file://, bad protocol
Interface: org.mozilla.webclient.WindowControl
Method: public void setBounds(Rectangle)
- 2 tests: null and well constructed rectangle
Method: public void createWindow(int,Rectangle)
- 3 tests: Integer.MIN_VALUE,Integer.MAX_VALUE,0
- 2 tests: with valid int use null and well constructed rectangle
Method: public int getNativeWebShell()
- 1 test: just call
Method: public void moveWindowTo(int_int)
- 6 tests: Integer.MIN_VALUE,Integer.MAX_VALUE,0 for each parameter when other parameter is good
- 2 tests: move to good coordinates and move out of screen bounds
Method: public void removeFocus()
- 1 test: just call
Method: public void repaint(boolean)
- 2 tests: forse repaint and not
Method: public void setVisible(boolean)
- 2 tests: with false and with true
Method: public void setFocus()
- 1 test: just call
Interface: org.mozilla.webclient.cache.NetDataCacheManager <SKIP>
Interface: org.mozilla.webclient.Preferences <SKIP>
Interface: org.mozilla.webclient.Print <SKIP>
Interface: org.mozilla.webclient.ExtendedEventRegistration <SKIP>

View File

@@ -0,0 +1,127 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
*/
//cl killer.cpp /link user32.lib
#include <windows.h>
#include <stdio.h>
//Define keywords to determine Assertion window
#define ASSERTION_DIALOG_KW_1 "nsDebug"
#define ASSERTION_DIALOG_KW_2 "Assertion"
//Define keywords to determine ERROR window
#define ERROR_DIALOG_KW_1 "java"
#define ERROR_DIALOG_KW_2 "Error"
#define IGNORE_BUTTON_TITLE "&Ignore"
#define IGNORE_BUTTON_ID 5
#define OK_BUTTON_TITLE "OK"
#define OK_BUTTON_ID 1
void safeAppendToLog(char* str);
char * logFile = NULL;
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM out) {
char title[1024];
GetWindowText(hwnd, title, 1024);
if ((!strcmp(title, OK_BUTTON_TITLE))||(!strcmp(title, IGNORE_BUTTON_TITLE))) {
*((HWND*)out) = hwnd;
return FALSE;
}
return TRUE;
}
BOOL CALLBACK EnumWindowsProc( HWND hwnd, LPARAM lParam) {
char title[1024];
char msg[1200];
GetWindowText(hwnd, title, 1024);
if (strstr(title, ERROR_DIALOG_KW_1) && strstr(title, ERROR_DIALOG_KW_2)) {
memset(msg,0,1200);
sprintf(msg,"Found Error window:\"%s\" /n",title);
safeAppendToLog(msg);
DWORD lp = 0, wp = 0;
HWND ok;
//really we can ommit this step but ...
EnumChildWindows(hwnd, EnumChildProc, (LPARAM)(&ok));
if (!ok) {
printf("OK button not found !\n");
return FALSE;
}
lp = (unsigned long)ok;
wp = OK_BUTTON_ID;
wp = wp | (BN_CLICKED << 16);
SendMessage(hwnd, WM_COMMAND, wp, lp);
return FALSE;
}
if (strstr(title, ASSERTION_DIALOG_KW_1) && strstr(title, ASSERTION_DIALOG_KW_2)) {
memset(msg,0,1200);
sprintf(msg,"Found Assertion window:\"%s\"/n",title);
safeAppendToLog(msg);
DWORD lp = 0, wp = 0;
HWND ok;
//really we can ommit this step but ...
EnumChildWindows(hwnd, EnumChildProc, (LPARAM)(&ok));
if (!ok) {
printf("OK button not found !\n");
return FALSE;
}
lp = (unsigned long)ok;
wp = IGNORE_BUTTON_ID;
wp = wp | (BN_CLICKED << 16);
SendMessage(hwnd, WM_COMMAND, wp, lp);
return FALSE;
}
return TRUE;
}
void usage() {
printf("Usage: Killer.exe <logFile>");
exit(-1);
}
void safeAppendToLog(char* str) {
FILE* log = NULL;
if((log = fopen (logFile,"a+")) == NULL) {
printf("Can't open log file \"%s\"",logFile);
exit(-2);
}
fprintf(log,"KILLER: %s",str);
if(fclose(log)) {
printf("Can't close log file \"%s\"",logFile);
exit(-2);
}
}
void main(int argc, char *argv[]) {
if(argc != 2) {
usage();
}
logFile = argv[1];
EnumWindows(EnumWindowsProc, 0);
}

View File

@@ -0,0 +1,12 @@
Killer README.
This tool is derived from OJI API tests Killer.
Usually used to help Mozilla to die in abnormal situations.
Two types of dialog windows processed:
1. Assertion dialogs(with 3 buttons: "Abort","Retry","Ignore"):
- A "Ignore" button automatically pressed to continue working
2. Error dialogs(with 2 buttons: "OK","Cancel")
- A "OK" button automatically pressed to forse Mozilla's termination

View File

@@ -0,0 +1,55 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic;
/*
* ChekingThread.java
*/
public class CheckingThread extends Thread {
int timeout = Integer.MAX_VALUE;
TestContext context = null;
TestRunner runner = null;
public CheckingThread(int timeout,TestRunner runner, TestContext context){
this.context = context;
this.runner = runner;
this.timeout = timeout;
}
public void run(){
System.out.println("CheckThread sleep to " + timeout);
try {
sleep(timeout);
} catch (Exception e) {
System.out.println("Checking thread had been interrupted");
}
System.out.println("prepare to exit ");
context.delete();
System.out.println("Context.delete completed");
runner.delete();
}
}

View File

@@ -0,0 +1,35 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic;
/*
* TestRunner.java
*/
public interface Test {
public boolean initialize(TestContext context);
public void execute();
}

View File

@@ -0,0 +1,295 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic;
/*
* TestContext.java
*/
import java.util.Properties;
import java.util.StringTokenizer;
import java.awt.Frame;
import java.awt.TextArea;
import java.awt.Panel;
import java.awt.Button;
import java.awt.BorderLayout;
import java.io.FileInputStream;
import java.io.File;
import java.io.RandomAccessFile;
import java.io.IOException;
import org.mozilla.webclient.*;
public class TestContext {
public static String TEST_PROPERTIES_FILE_NAME = "TestProperties";
public static String COMMON_PROPERTIES_FILE_NAME = "CommonProperties";
//Names for properties from common properties file
public static String DELAY_INTERNAL_PROP_NAME = "DELAY_INTERNAL";
public static String DELAY_OF_CYCLE_PROP_NAME = "DELAY_OF_CYCLE";
public static String TEST_LOG_FILE_PROP_NAME = "TEST_LOG_FILE";
public static String TEST_RESULT_FILE_PROP_NAME = "TEST_RESULT_FILE";
//Names for properties from init file
public static String BROWSER_BIN_DIR_PROP_NAME = "BROWSER_BIN_DIR";
public static String TEST_TOP_DIR_PROP_NAME = "TEST_TOP_DIR";
public static String TEST_ID_PROP_NAME = "TEST_ID";
public static String TEST_ARGUMENTS_PROP_NAME = "TEST_ARGUMENTS";
//Names for properties from individual TestProperties files
public static String TEST_URL_PROP_NAME = "TEST_HTML";
public static String PAGES_TO_LOAD_PROP_NAME="PAGES_TO_LOAD";
public static String TEST_CLASS_PROP_NAME = "TEST_CLASS";
public static int FAILED = 0;
public static int NOT_DEF = 1;
public static int PASSED = 3;
public static int UNIMPLEMENTED = 4;
private static String defaultComment = "default";
public static int defaultResult = FAILED;
public static int result = NOT_DEF;
private static String logFile = null;
private static String resFile = null;
//Internal private variables
private Properties testProps = null;
private BrowserControl browserControl = null;
private TestRunner runner = null;
private TestDocLoadListener tdl = null;
private String fileSeparator = null;
private Frame testWindow = null;
private TextArea descrArea = null;
private Panel buttonPanel = null;
private int executionCount = 0;
public TestContext(String initFileName) {
File propFile = new File(initFileName);
fileSeparator = System.getProperty("file.separator");
testProps = new Properties();
//Load properties from init file
try {
testProps.load(new FileInputStream(propFile));
} catch (Exception e) {
System.err.println("BAD initFile : " + e);
System.exit(-99);
}
//Load properties from file with common properties
propFile = new File(getTestTopDir() + fileSeparator + "config" + fileSeparator + COMMON_PROPERTIES_FILE_NAME);
try {
testProps.load(new FileInputStream(propFile));
} catch (Exception e) {
System.err.println("Couldn't read CommonProperties : " + e);
System.exit(-99);
}
//Load properties from file with test properties
propFile = new File(getTestDir() + fileSeparator + TEST_PROPERTIES_FILE_NAME);
try {
testProps.load(new FileInputStream(propFile));
} catch (Exception e) {
System.err.println("Couldn't read TestProperties : " + e);
System.exit(-99);
}
logFile = testProps.getProperty(TEST_LOG_FILE_PROP_NAME);
resFile = testProps.getProperty(TEST_RESULT_FILE_PROP_NAME);
}
public String getProperty(String propName) {
return testProps.getProperty(propName,null);
}
public Properties getProperties() {
return testProps;
}
public void setRunner(TestRunner runner) {
this.runner = runner;
}
public TestRunner getRunner() {
return runner;
}
public String getTestTopDir() {
return getProperty(TEST_TOP_DIR_PROP_NAME);
}
public String getBrowserBinDir() {
System.out.println("Browser bin is: " + getProperty(BROWSER_BIN_DIR_PROP_NAME));
return getProperty(BROWSER_BIN_DIR_PROP_NAME);
}
public String getTestID() {
return getProperty(TEST_ID_PROP_NAME);
}
public String getTestClass() {
return getProperty(TEST_CLASS_PROP_NAME);
}
public String getCurrentTestArguments() {
return getProperty(TEST_ARGUMENTS_PROP_NAME);
}
public String getTestURL() {
return getProperty(TEST_URL_PROP_NAME);
}
public String[] getPagesToLoad() {
StringTokenizer st = new StringTokenizer(getProperty(PAGES_TO_LOAD_PROP_NAME),",");
String[] pageArr = new String[st.countTokens()];
for(int i=0;st.hasMoreTokens();i++) {
pageArr[i] = st.nextToken();
}
String[] tmp = new String[pageArr.length];
for(int i=0;i<pageArr.length;i++) {
tmp[i]=pageArr[i];
}
return tmp;
}
public String getTestDir() {
String ID = getTestID();
if (ID.indexOf(":") > 0) {
ID = ID.substring(0,ID.indexOf(":"));
}
return getTestTopDir() + fileSeparator + "build" + fileSeparator + "test" + fileSeparator + ID;
}
public void setBrowserControl(BrowserControl browserControl) {
this.browserControl = browserControl;
}
public BrowserControl getBrowserControl() {
return browserControl;
}
public TestDocLoadListener getDocLoadListener() {
return tdl;
}
public void setDocLoadListener(TestDocLoadListener tdl) {
this.tdl = tdl;
}
public void removeDocLoadListener() {
this.tdl = null;
}
public void setTestWindow(Frame testWindow) {
this.testWindow = testWindow;
}
public Frame getTestWindow() {
return testWindow;
}
public void setButtonPanel(Panel bp) {
buttonPanel = bp;
}
public void addButton(Button b) {
buttonPanel.add(b);
buttonPanel.doLayout();
}
public void setDescrArea(TextArea ta) {
descrArea = ta;
}
public void addDescription(String msg) {
System.out.println("Appending to DA: "+msg);
descrArea.append(msg);
descrArea.repaint();
}
public void setDescription(String msg) {
descrArea.setText(msg);
}
public void increaseExecutionCount() {
executionCount++;
}
public int getExecutionCount() {
return executionCount;
}
public void setExecutionCount(int count) {
executionCount = count;
}
public void setDefaultResult(int res) {
defaultResult = res;
}
public void setDefaultComment(String comm) {
defaultComment = comm;
}
static public void registerFAILED(String comment) {
if ((result == NOT_DEF)||(result == PASSED)) {
result = FAILED;
appendToFile(logFile, "FAILED: "+comment+"\n", false);
appendToFile(resFile, "FAILED="+comment+"\n", true);
System.err.println("Register FAILED " + comment);
}
}
static public void registerUNIMPLEMENTED(String comment) {
//We must set UNIMPLEMENTED over ANI previous result
result = UNIMPLEMENTED;
appendToFile(logFile, "UNIMPLEMENTED: "+comment+"\n", false);
appendToFile(resFile, "UNIMPLEMENTED="+comment+"\n", true);
System.err.println("Register UNIMPLEMENTED: " + comment);
}
static public void registerPASSED(String comment) {
if (result == NOT_DEF) {
result = PASSED;
appendToFile(logFile, "PASSED: "+comment+"\n", false);
appendToFile(resFile, "PASSED="+comment+"\n", true);
System.err.println("Register PASSED: " + comment);
}
}
public static void registerIfNotRegistered(int res) {
if (result == NOT_DEF){
if (res == FAILED) {
registerFAILED("By checking thread:" + defaultComment);
} else {
registerPASSED("By checking thread:" + defaultComment);
}
}
}
public static boolean failedIsRegistered() {
return (result == FAILED)||(result == UNIMPLEMENTED);
}
public static boolean resultIsSet() {
return (result != NOT_DEF);
}
private static void appendToFile(String file, String str, boolean fromStart) {
try {
RandomAccessFile f = new RandomAccessFile(file, "rw");
if (fromStart) {
f.seek(0);
} else {
long length = f.length();
f.seek(length);
}
f.writeBytes(str);
f.close();
} catch (IOException e) {
System.out.println("IOException appending to file " + file);
System.out.println(e.toString());
}
}
public void delete() {
registerIfNotRegistered(defaultResult);
testProps = null;
runner = null;
browserControl = null;
fileSeparator = null;
testWindow = null;
}
}

View File

@@ -0,0 +1,48 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic;
/*
* TestLoader.java
*/
import org.mozilla.webclient.DocumentLoadEvent;
public interface TestDocLoadListener {
/**
* TestDocLoadListener isn't needed for most of tests.
* Please use it very carefully and only if really needed.
*
* Important: If your test register own TestDocLoadListener then execute()
* will be never called. If neede, call execute() manually when END_DOCUMENT_LOAD_EVENT_MASK
* ocurred. And also please do not use executionCount or increase it manualy.
*
*/
public void eventDispatched(DocumentLoadEvent event);
} // end of interface WebclientEventListener

View File

@@ -0,0 +1,150 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic;
/*
* TestLoader.java
*/
import org.mozilla.webclient.*;
import java.util.LinkedList;
public class TestLoader extends Thread implements DocumentLoadListener {
private Test currentTest = null;
private TestContext context = null;
private TestRunner runner = null;
private Navigation navigation = null;
private BrowserControl browserControl = null;
private EventRegistration eventRegistration = null;
private int pageCount = 0;
private int timeout = Integer.MAX_VALUE;
private String[] pages = null;
private LinkedList eventList = null;
public TestLoader(){
}
public boolean initialize(TestContext context, TestRunner runner) {
this.context = context;
this.runner = runner;
try {
browserControl = context.getBrowserControl();
eventRegistration = (EventRegistration)
browserControl.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME);
eventRegistration.addDocumentLoadListener(this);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
eventList = new LinkedList();
timeout = (new Integer(context.getProperty(TestContext.DELAY_OF_CYCLE_PROP_NAME))).intValue()*1000;
pages = context.getPagesToLoad();
currentTest = currentTest = (Test)Class.forName(context.getTestClass()).newInstance();
currentTest.initialize(context);
}catch (Exception e) {
e.printStackTrace();
TestContext.registerFAILED("Exception occured : " + e.toString());
return false;
}
return true;
}
public void run(){
System.out.println("Execution thread started.");
pageCount=0;
if(!loadNext()) {
execute();
}
while(true) {
if (eventList.size() > 0) {
DocumentLoadEvent dle = (DocumentLoadEvent)eventList.removeFirst();
switch ((int) dle.getType()) {
case ((int) DocumentLoadEvent.START_DOCUMENT_LOAD_EVENT_MASK):
transferToTest(dle);
break;
case ((int) DocumentLoadEvent.END_DOCUMENT_LOAD_EVENT_MASK):
if(!loadNext()) {
if (!transferToTest(dle)) {
execute();
}
}
break;
default:
transferToTest(dle);
break;
}
}
if(context.resultIsSet()){
delete();
}
try {
synchronized(this){
this.wait(timeout);
}
}catch(InterruptedException e) {
System.out.println("InterruptedException in TestLoader" + e);
}
}
}
private boolean loadNext(){
if (pageCount < pages.length) {
System.out.println("Try to load " + pages[pageCount] + " of :" + pages.length);
navigation.loadURL(pages[pageCount]);
pageCount++;
return true;
}
return false;
}
private boolean transferToTest(DocumentLoadEvent evt) {
TestDocLoadListener testDLL = context.getDocLoadListener();
if (testDLL !=null) {
testDLL.eventDispatched(evt);
return true;
}
return false;
}
private void execute() {
context.increaseExecutionCount();
currentTest.execute();
}
//From DocumentLoadListener
public void eventDispatched(WebclientEvent event) {
if (event instanceof DocumentLoadEvent) {
System.out.println("Add event to the list: " + event.getType()
+ "List length(before) is " + eventList.size());
eventList.addLast((Object)event);
synchronized(this) {
this.notify();
}
} else {
System.out.println("TestLoader: Strange Event " + event.getType());
}
}
private void delete() {
context.delete();
runner.delete();
}
}

View File

@@ -0,0 +1,215 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic;
/*
* TestRunner.java
*/
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.Color;
import java.awt.TextField;
import java.awt.TextArea;
import java.awt.Button;
import java.awt.Panel;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import org.mozilla.webclient.*;
import org.mozilla.util.Assert;
public class TestRunner
{
static final public int defaultWidth = 640;
static final public int defaultHeight = 480;
protected static TestContext context = null;
protected TestWindow tw = null;
protected BrowserControlCanvas browserCanvas = null;
protected BrowserControl browserControl = null;
protected TestLoader tl = null;
public TestRunner()
{
try {
BrowserControlFactory.setAppData(context.getBrowserBinDir());
browserControl = BrowserControlFactory.newBrowserControl();
browserCanvas = (BrowserControlCanvas)
browserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
}
catch(Exception e) {
System.out.println("Can't create BrowserControl: " +
e.getMessage());
}
Assert.assert(null != browserCanvas);
browserCanvas.setSize(defaultWidth, defaultHeight);
context.setBrowserControl(browserControl);
tw = new TestWindow(browserCanvas,"TestWindow", defaultWidth, defaultHeight, this);
context.setTestWindow(tw);
tw.pack();
tw.show();
tw.toFront();
tl = new TestLoader();
tl.initialize(context,this);
tl.start();
try {
CheckingThread checkingThread =
new CheckingThread((new Integer(context.getProperty(TestContext.DELAY_INTERNAL_PROP_NAME))).intValue()*1000,this,context);
checkingThread.start();
} catch (Exception e) {
System.out.println(TestContext.DELAY_INTERNAL_PROP_NAME+" props isn't correctly set");
}
}
public TestRunner(String modifier)
{
System.out.println("Constructor of TestRunnerMixed");
System.out.flush();
try {
BrowserControlFactory.setAppData(context.getBrowserBinDir());
browserControl = BrowserControlFactory.newBrowserControl();
browserCanvas = (BrowserControlCanvas)
browserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
}catch(Exception e) {
System.out.println("Can't create BrowserControl: " +
e.getMessage());
}
Assert.assert(null != browserCanvas);
browserCanvas.setSize(defaultWidth, defaultHeight);
context.setBrowserControl(browserControl);
Panel p = new Panel();
TextArea descrArea = new TextArea("Test info:\n",5,10,TextArea.SCROLLBARS_VERTICAL_ONLY);
descrArea.setEditable(false);
descrArea.setBackground(Color.lightGray);
context.setDescrArea(descrArea);
Button passed = new Button("PASSED");
Button failed = new Button("FAILED");
Button cont = new Button("CONTINUE");
cont.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent evt) {
context.delete();
delete();
}
});
passed.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent evt) {
context.registerPASSED("PASSED by TESTER");
context.delete();
delete();
}
});
failed.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent evt) {
context.registerFAILED("FAILED by TESTER");
context.delete();
delete();
}
});
p.setLayout(new BorderLayout());
Panel buttonPanel = new Panel();
buttonPanel.setLayout(new FlowLayout());
context.setButtonPanel(buttonPanel);
buttonPanel.add(passed);
buttonPanel.add(failed);
buttonPanel.add(cont);
buttonPanel.setVisible(true);
p.setBackground(Color.lightGray);
p.add(buttonPanel, BorderLayout.EAST);
p.add(descrArea,BorderLayout.CENTER);
p.doLayout();
p.setVisible(true);
tw = new TestWindow(browserCanvas,p,"MixedTestWindow", defaultWidth, defaultHeight, this);
context.setTestWindow(tw);
tw.pack();
tw.show();
tw.toFront();
tl = new TestLoader();
tl.initialize(context,this);
tl.start();
}
public void delete() {
browserCanvas.setVisible(false);
System.out.println("before deleteBrowserControl(browserControl)");
BrowserControlFactory.deleteBrowserControl(browserControl);
System.out.println("after deleteBrowserControl(browserControl)");
browserControl = null;
context=null;
tw.delete();
tw = null;
browserCanvas = null;
System.exit(0);
}
public static void usage()
{
System.out.println("usage: java org.mozilla.webclient.test.basic.TestRunner <initFile>");
System.out.println(" <path> is the absolute path to the native browser bin directory, ");
System.out.println(" including the bin.");
}
//Main procedure
public static void main(String [] arg)
{
String initFile = null;
if ( 2 == arg.length ) {
System.out.println("Length - 2 : " + arg[0]);
if ("-m".equals(arg[0])) {
initFile = arg[1];
context = new TestContext(initFile);
TestRunner tr = new TestRunner(arg[0]);
context.setRunner(tr);
} else {
usage();
System.exit(-1);
}
} else {
if ( 1 == arg.length ) {
initFile = arg[0];
context = new TestContext(initFile);
TestRunner tr = new TestRunner();
context.setRunner(tr);
} else {
usage();
System.exit(-1);
}
}
}
}
// EOF

View File

@@ -0,0 +1,104 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic;
/*
* TestWindow.java
*/
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.TextField;
import java.awt.Panel;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import org.mozilla.webclient.*;
public class TestWindow extends Frame {
private TestRunner runner;
private Panel controlPanel;
//Default constructor for automated tests.
public TestWindow (BrowserControlCanvas browserCanvas,String title, int width, int height, TestRunner runner)
{
super(title);
try {
throw(new Exception());
}catch(Exception e) {
e.printStackTrace();
}
System.out.println("Constructor of (AUTOMATED)TestWindow: "+ title);
this.runner = runner;
this.add(browserCanvas,BorderLayout.CENTER);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.out.println("Got windowClosing");
System.out.println("destroying the BrowserControl");
// should close the BrowserControlCanvas
}
public void windowClosed(WindowEvent e) {
System.out.println("Got windowClosed");
}
});
}
//Constructor for mixed tests
public TestWindow (BrowserControlCanvas browserCanvas, Panel controlPanel, String title, int width, int height, TestRunner runner)
{
super(title);
System.out.println("Constructor of TestWindow: " + title);
this.runner = runner;
this.controlPanel = controlPanel;
this.setLayout(new BorderLayout());
this.add(browserCanvas,BorderLayout.CENTER);
this.add(controlPanel,BorderLayout.SOUTH);
//pack();
//show();
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.out.println("Got windowClosing");
System.out.println("destroying the BrowserControl");
// should close the BrowserControlCanvas
}
public void windowClosed(WindowEvent e) {
System.out.println("Got windowClosed");
}
});
}
public void delete()
{
this.hide();
this.dispose();
controlPanel = null;
}
}//End of class test window

View File

@@ -0,0 +1,168 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_children.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.util.*;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_children implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private int currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkFolder, bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private TreeNode node;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
switch(currentArg) {
case 0:
try {
try{
bookmarkFolder = bookmarks.newBookmarkFolder("TEST");
bookmarkEntry = bookmarks.newBookmarkEntry("Entry1");
bookmarks.addBookmark(bookmarkFolder, bookmarkEntry);
bookmarkEntry = bookmarks.newBookmarkEntry("Entry2");
bookmarks.addBookmark(bookmarkFolder, bookmarkEntry);
} catch (Exception e) {
e.printStackTrace();
TestContext.registerFAILED("Exception during test folder initialization: " + e.toString());
return;
}
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hung up when trying to get the children of newly created folder");
Enumeration num=bookmarkFolder.children();
int count = 0;
while(num.hasMoreElements()) {
num.nextElement();
count++;
}
if (count==2) {
TestContext.registerPASSED("Correct Enumeration object was returned.");
}else {
TestContext.registerFAILED("Incorrect Enumeration object was returned.");
}
} catch(Exception e) {
if (e instanceof UnimplementedException) {
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
}else {
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
return;
}
break;
case 1:
try {
bookmarkEntry = bookmarks.newBookmarkEntry("Entry0");
Enumeration num=bookmarkEntry.children();
try {
num.nextElement();
}catch(NoSuchElementException e) {
TestContext.registerPASSED("Empty Enumeration object was returned and child count is 0");
return;
}
TestContext.registerFAILED("Not empty Enumeration object was returned, but child count should be 0");
return;
} catch(Exception e) {
e.printStackTrace();
if (e instanceof UnimplementedException) {
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
} else {
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
return;
}
case 2:
try {
TreeModel tm = bookmarks.getBookmarks();
Object root = tm.getRoot();
Object node = null;
bookmarkEntry = null;
for(int i=0;i<tm.getChildCount(root);i++) {
node = tm.getChild(root,i);
if(tm.getChildCount(node) >1) {
bookmarkEntry=(BookmarkEntry)node;
i = tm.getChildCount(root);
}
}
if(bookmarkEntry == null) {
TestContext.registerFAILED("Can't find suitable BookmarkFolder in existing bookmarks");
return;
}
Enumeration num=bookmarkEntry.children();
int count = 0;
while(num.hasMoreElements()) {
num.nextElement();
count++;
}
if (count == tm.getChildCount(node)) {
TestContext.registerPASSED("Correct Enumeration object was returned.");
}else {
TestContext.registerFAILED("Incorrect Enumeration object was returned.");
}
} catch(Exception e) {
if (e instanceof UnimplementedException) {
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
} else {
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
return;
}
break;
}
}
}

View File

@@ -0,0 +1,156 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_getAllowsChildren.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.util.*;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_getAllowsChildren implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private int currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkFolder, bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private TreeNode node;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
context.setDefaultResult(TestContext.FAILED);
try {
} catch(Exception e) {TestContext.registerFAILED("Exception during execution: " + e.toString());}
boolean result=false;
switch(currentArg) {
case 0:
context.setDefaultComment("We are trying to get result of getAllowsChildren() from just created BookmarkFolder");
try {
bookmarkFolder = bookmarks.newBookmarkFolder("TEST");
result=false;
result=bookmarkFolder.getAllowsChildren();
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (result) TestContext.registerPASSED("Just created BookmarkFolder allows children");
else TestContext.registerFAILED("Just created BookmarkFolder doesn't allow children");
break;
case 1:
context.setDefaultComment("We are trying to get result of getAllowsChildren() from just created BookmarkEntry");
try {
bookmarkEntry = bookmarks.newBookmarkEntry("Entry1");
result=true;
result=bookmarkEntry.getAllowsChildren();
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (!result) TestContext.registerPASSED("Just created BookmarkEntry doesn't allows children");
else TestContext.registerFAILED("Just created BookmarkEntry allows children");
break;
case 2:
context.setDefaultComment("We are trying to get result of getAllowsChildren() from BookmarkFolder received from Bookmarks TreeModel");
try {
result=false;
bookmarksTree = bookmarks.getBookmarks();
int count = bookmarksTree.getChildCount(bookmarksTree.getRoot());
for(int j=0;j<count;j++){
if(!bookmarksTree.isLeaf(bookmarksTree.getChild(bookmarksTree.getRoot(), j))){
bookmarkFolder = (BookmarkEntry)bookmarksTree.getChild(bookmarksTree.getRoot(), j);
j = count;
}
}
result=bookmarkFolder.getAllowsChildren();
} catch(Exception e) {
if (e instanceof UnimplementedException){
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
}else{
e.printStackTrace();
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
}
if (result) TestContext.registerPASSED("BookmarkFolder received from TreeModel allows children");
else TestContext.registerFAILED("BookmarkFolder received from TreeModel doesn't allow children");
break;
case 3:
context.setDefaultComment("We are trying to get result of getAllowsChildren() from BookmarkEntry received from Bookmarks TreeModel");
try {
result=true;
bookmarksTree = bookmarks.getBookmarks();
int count = bookmarksTree.getChildCount(bookmarksTree.getRoot());
for(int j=0;j<count;j++){
if(bookmarksTree.isLeaf(bookmarksTree.getChild(bookmarksTree.getRoot(), j))){
bookmarkEntry = (BookmarkEntry)bookmarksTree.getChild(bookmarksTree.getRoot(), j);
if(!bookmarkEntry.isFolder()){
j = count;
}
}
}
result=bookmarkEntry.getAllowsChildren();
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (!result) TestContext.registerPASSED("BookmarkEntry received from TreeModel doesn't allows children");
else TestContext.registerFAILED("BookmarkEntry received from TreeModel allows children");
break;
}
}
}

View File

@@ -0,0 +1,183 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_getChildAt.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.util.*;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_getChildAt implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private String currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkFolder, bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private TreeNode node;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = context.getCurrentTestArguments();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken());
int index=java.lang.Integer.parseInt(st.nextToken());
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to get child at index="+index);
try {
} catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
switch(num) {
case 0:
try {
bookmarkEntry = bookmarks.newBookmarkEntry("Entry1");
Object child = bookmarkEntry.getChildAt(0);
if(child == null) {
TestContext.registerPASSED("getChildAt invoked on BookmarkEntry return null, but doesn't throw exception");
}
return;
} catch(Exception e) {
if (e instanceof UnimplementedException) {
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
}else {
e.printStackTrace();
TestContext.registerPASSED("getChildAt invoked on BookmarkEntry throw exception " + e.toString());
}
return;
}
case 1:
try {
try {
bookmarkFolder = bookmarks.newBookmarkFolder("TEST");
bookmarkEntry = bookmarks.newBookmarkEntry("Entry1");
bookmarks.addBookmark(bookmarkFolder, bookmarkEntry);
}catch(Exception e) {
e.printStackTrace();
TestContext.registerFAILED("Exception occured, when prepared to test " + e.toString());
return;
}
BookmarkEntry b = (BookmarkEntry)bookmarkFolder.getChildAt(0);
if(b.equals(bookmarkEntry)) {
TestContext.registerPASSED("getChildAt return correct child");
}else {
TestContext.registerFAILED("getChildAt return child, that different from original");
}
return;
} catch(Exception e) {
if (e instanceof UnimplementedException) {
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
}else {
e.printStackTrace();
TestContext.registerFAILED("getChildAt invoked with correct index, but throw exception " + e.toString());
}
return;
}
case 2:
try {
TreeModel tm = bookmarks.getBookmarks();
Object root = tm.getRoot();
Object node = null;
bookmarkEntry = null;
for(int i=0;i<tm.getChildCount(root);i++) {
node = tm.getChild(root,i);
if(tm.getChildCount(node) >2) {
bookmarkEntry=(BookmarkEntry)node;
i = tm.getChildCount(root);
}
}
if(bookmarkEntry == null) {
TestContext.registerFAILED("Can't find suitable BookmarkFolder in existing bookmarks");
return;
}
TreeNode child = bookmarkEntry.getChildAt(2);
if (child!=null) {
TestContext.registerPASSED("Correct child was returned for valid index.");
}else {
TestContext.registerFAILED("NULL child was returned for valid index.");
}
return;
} catch(Exception e) {
if (e instanceof UnimplementedException) {
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
}else {
e.printStackTrace();
TestContext.registerFAILED("getChildAt invoked with correct index, but throw exception " + e.toString());
}
return;
}
case 3:
case 4:
try {
bookmarkFolder = bookmarks.newBookmarkFolder("TEST");
Object child = bookmarkFolder.getChildAt(index);
if(child == null) {
TestContext.registerPASSED("getChildAt invoked with invalid index: " + index + ", return null but doesn't throw exception");
} else {
TestContext.registerFAILED("getChildAt invoked with invalid index: " + index + ", but return NOT null and do don't throw exception :(");
}
return;
} catch(Exception e) {
if (e instanceof UnimplementedException) {
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
}else {
e.printStackTrace();
TestContext.registerPASSED("getChildAt invoked with invalid index: " + index + " and throw exception " + e.toString());
}
return;
}
}
}
}

View File

@@ -0,0 +1,139 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_getChildCount.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.util.*;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_getChildCount implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private int currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkFolder, bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private TreeNode node;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to get the child count");
try {
} catch(Exception e) {TestContext.registerFAILED("Exception during execution: " + e.toString());}
int count=0;
int counter = 0;
switch(currentArg) {
case 0:
try {
bookmarkFolder = bookmarks.newBookmarkFolder("TEST");
bookmarkEntry = bookmarks.newBookmarkEntry("Entry1");
bookmarks.addBookmark(bookmarkFolder, bookmarkEntry);
bookmarkEntry = bookmarks.newBookmarkEntry("Entry2");
bookmarks.addBookmark(bookmarkFolder, bookmarkEntry);
count=bookmarkFolder.getChildCount();
} catch(Exception e) {
if (e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (count==2)
TestContext.registerPASSED("Correct child count received from just created BookmarkFolder with 2 BookmarkEntry inside");
else
TestContext.registerFAILED("Incorrect child count received from just created BookmarkFolder with 2 BookmarkEntry inside, returns"+count+" instead of 2");
break;
case 1:
try {
bookmarkEntry = bookmarks.newBookmarkEntry("Entry1");
count=bookmarkEntry.getChildCount();
} catch(Exception e) {
if (e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (count==0)
TestContext.registerPASSED("Correct child count (equals 0) received from just created BookmarkEntry");
else
TestContext.registerFAILED("Incorrect child count received from just created BookmarkEntry, returns "+count+" instead of 0");
break;
case 2:
try{
bookmarksTree = bookmarks.getBookmarks();
bookmarkEntry = (BookmarkEntry)bookmarksTree.getRoot();
count = bookmarkEntry.getChildCount();
Enumeration num = bookmarkEntry.children();
counter = 0;
while(num.hasMoreElements()) {
num.nextElement();
counter++;
}
} catch(Exception e) {
if (e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (count==counter)
TestContext.registerPASSED("Correct child count "+count+" received from Root of BookmarkTree");
else
TestContext.registerFAILED("Incorrect child count received = "+count+" from Root of BookmarkTree, instead of"+counter);
break;
}
}
}

View File

@@ -0,0 +1,158 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_getIndex.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.util.*;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_getIndex implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private int currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkFolder, bookmarkEntry,bookmarkFolder2, bookmarkEntry2 = null;
private TreeModel bookmarksTree = null;
private TreeNode node;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to get index");
try {
bookmarkFolder = bookmarks.newBookmarkFolder("TEST");
bookmarkFolder2 = bookmarks.newBookmarkFolder("TEST2");
bookmarkEntry = bookmarks.newBookmarkEntry("Entry1");
bookmarks.addBookmark(bookmarkFolder, bookmarkEntry);
bookmarkEntry = bookmarks.newBookmarkEntry("Entry2");
bookmarks.addBookmark(bookmarkFolder, bookmarkEntry);
bookmarkEntry2 = bookmarks.newBookmarkEntry("Entry3");
bookmarks.addBookmark(bookmarkFolder2, bookmarkEntry2);
} catch(Exception e) {TestContext.registerFAILED("Exception during execution: " + e.toString());}
int index=666;
switch(currentArg) {
case 0:
try {
index=bookmarkFolder.getIndex((TreeNode)bookmarkEntry);
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (index==1) TestContext.registerPASSED("Correct index");
else TestContext.registerFAILED("Incorrect index.");
break;
case 1:
try {
index=bookmarkEntry.getIndex((TreeNode)bookmarkEntry);
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
TestContext.registerPASSED("Browser doesn't crashed");
break;
case 2:
try {
index=bookmarkFolder.getIndex(null);
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
TestContext.registerPASSED("Browser doesn't crashed");
break;
case 3:
try {
index=bookmarkFolder.getIndex((TreeNode)bookmarkFolder);
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
TestContext.registerPASSED("Browser doesn't crashed");
break;
case 4:
try {
index=bookmarkFolder.getIndex((TreeNode)bookmarkEntry2);
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
TestContext.registerPASSED("Browser doesn't crashed");
break;
}
}
}

View File

@@ -0,0 +1,139 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_getParent.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.util.*;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_getParent implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private int currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkFolder, bookmarkEntry,bookmarkFolder2, bookmarkEntry2 = null;
private TreeModel bookmarksTree = null;
private TreeNode node;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to get the child count");
try {
bookmarkFolder = bookmarks.newBookmarkFolder("TEST");
bookmarkFolder2 = bookmarks.newBookmarkFolder("TEST2");
bookmarks.addBookmark(bookmarkFolder, bookmarkFolder2);
bookmarkEntry = bookmarks.newBookmarkEntry("Entry1");
bookmarkEntry2 = bookmarks.newBookmarkEntry("Entry2");
bookmarks.addBookmark(bookmarkFolder, bookmarkEntry2);
} catch(Exception e) {TestContext.registerFAILED("Exception during execution: " + e.toString());}
switch(currentArg) {
case 0:
try {
bookmarkFolder.getParent();
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
TestContext.registerPASSED("Browser doesn't crashed");
break;
case 1:
try {
bookmarkFolder2.getParent();
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (bookmarkFolder2.getParent().equals("TEST")) TestContext.registerPASSED("Correct parent.");
else TestContext.registerFAILED("Incorrect parent.");
break;
case 2:
try {
bookmarkEntry.getParent();
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
TestContext.registerPASSED("Browser doesn't crashed");
break;
case 3:
try {
bookmarkEntry2.getParent();
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (bookmarkEntry2.getParent().equals("TEST")) TestContext.registerPASSED("Correct parent.");
else TestContext.registerFAILED("Incorrect parent.");
break;
}
}
}

View File

@@ -0,0 +1,121 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_getProperties.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.util.*;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_getProperties implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private int currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry, be = null;
private TreeModel bookmarksTree = null;
private TreeNode node = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to get properties in test case N"+currentArg);
switch (currentArg) {
case 0:
try {
bookmarksTree = bookmarks.getBookmarks();
node=(TreeNode)bookmarksTree.getRoot();
bookmarkEntry=(BookmarkEntry)node.getChildAt(0).getChildAt(1);
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
String real="{URL="+node.getChildAt(0).getChildAt(1)+"}";
if (bookmarkEntry.getProperties().equals(real)) TestContext.registerPASSED("getProperties return correct Properties="+bookmarkEntry.getProperties());
else TestContext.registerFAILED("getProperties return empty or bad Properties="+bookmarkEntry.getProperties());
break;
case 1:
try {
bookmarkEntry = bookmarks.newBookmarkEntry("http://java.sun.com");
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (bookmarkEntry.getProperties().toString().equals("{URL=http://java.sun.com}")) TestContext.registerPASSED("getProperties return correct Properties="+bookmarkEntry.getProperties());
else TestContext.registerFAILED("getProperties return empty or bad Properties="+bookmarkEntry.getProperties());
break;
case 2:
try {
bookmarkEntry = bookmarks.newBookmarkFolder("My bookmarks");
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (bookmarkEntry.getProperties().toString().equals("{NAME=My bookmarks}")) TestContext.registerPASSED("getProperties return correct Properties="+bookmarkEntry.getProperties());
else TestContext.registerFAILED("getProperties return empty or bad Properties"+bookmarkEntry.getProperties());
break;
} }
}

View File

@@ -0,0 +1,118 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_insert.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_insert implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private String currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private MutableTreeNode node, mtn;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = context.getCurrentTestArguments();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken());
int n=java.lang.Integer.parseInt(st.nextToken());
context.setDefaultResult(TestContext.FAILED);
if (num!=0) context.setDefaultComment("We are trying to insert new node with index="+n);
else context.setDefaultComment("We are trying to insert new node=NULL");
try {
bookmarksTree = bookmarks.getBookmarks();
node=(MutableTreeNode)bookmarksTree.getRoot();
bookmarkEntry=bookmarks.newBookmarkEntry("www.mozilla.org");
mtn=(MutableTreeNode)bookmarkEntry;
node=(MutableTreeNode)node.getChildAt(0);
} catch(Exception e) {TestContext.registerFAILED("Exception during execution: " + e.toString());}
try {
switch (num) {
case 0:
node.insert(null,1);
break;
case 1:
node.insert(mtn,1);
// TODO: check; Will be done after bookmark bug fixing
// return;
break;
case 2:
case 3:
case 4:
node.insert(mtn,n);
break;
}
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
if(num==0) TestContext.registerPASSED("Browser doesn't crashed (exception): " + e.toString());
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
TestContext.registerPASSED("Browser doesn't crashed");
}
}

View File

@@ -0,0 +1,145 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_isFolder.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_isFolder implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private int currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry = null;
private TreeModel bookmarksTree = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
boolean yes=true;
if (bookmarks==null) return;
context.setDefaultResult(TestContext.FAILED);
switch (currentArg) {
case 0:
context.setDefaultComment("We are trying to get isFolder value via newBookmarkEntry");
try {
yes=true;
bookmarkEntry = bookmarks.newBookmarkEntry("http://java.sun.com");
yes=bookmarkEntry.isFolder();
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (yes==false) TestContext.registerPASSED(".isFolder() is false and it is right");
else TestContext.registerFAILED(".isFolder() is true and it isn't right");
break;
case 1:
try {
context.setDefaultComment("We are trying to get isFolder value via newBookmarkFolder");
yes=false;
bookmarkEntry = bookmarks.newBookmarkFolder("My test bookmarks");
yes=bookmarkEntry.isFolder();
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (yes==true) TestContext.registerPASSED(".isFolder() is true and it is right");
else TestContext.registerFAILED(".isFolder() is false and it isn't right");
break;
case 2:
context.setDefaultComment("We are trying to get isFolder value of leaf received via Bookmarks TreeModel");
try{
yes = true;
bookmarksTree = bookmarks.getBookmarks();
int count = bookmarksTree.getChildCount(bookmarksTree.getRoot());
for(int j=0;j<count;j++){
if(bookmarksTree.isLeaf(bookmarksTree.getChild(bookmarksTree.getRoot(), j))){
bookmarkEntry = (BookmarkEntry)bookmarksTree.getChild(bookmarksTree.getRoot(), j);
j = count;
}
}
yes = bookmarkEntry.isFolder();
}catch(Exception e){
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (yes==false) TestContext.registerPASSED(".isFolder() is false and it is right");
else TestContext.registerFAILED(".isFolder() is true and it isn't right");
break;
case 3:
context.setDefaultComment("We are trying to get isFolder value of folder received via Bookmarks TreeModel");
try{
yes = false;
bookmarksTree = bookmarks.getBookmarks();
int count = bookmarksTree.getChildCount(bookmarksTree.getRoot());
for(int j=0;j<count;j++){
if(!bookmarksTree.isLeaf(bookmarksTree.getChild(bookmarksTree.getRoot(), j))){
bookmarkEntry = (BookmarkEntry)bookmarksTree.getChild(bookmarksTree.getRoot(), j);
j = count;
}
}
yes = bookmarkEntry.isFolder();
}catch(Exception e){
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (yes==true) TestContext.registerPASSED(".isFolder() is true and it is right");
else TestContext.registerFAILED(".isFolder() is false and it isn't right");
break;
}
}
}

View File

@@ -0,0 +1,115 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_isLeaf.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.util.*;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_isLeaf implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private int currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkFolder, bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private TreeNode node;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to get leaf info");
try {
bookmarkFolder = bookmarks.newBookmarkFolder("TEST");
bookmarkEntry = bookmarks.newBookmarkEntry("Entry1");
bookmarks.addBookmark(bookmarkFolder, bookmarkEntry);
} catch(Exception e) {TestContext.registerFAILED("Exception during execution: " + e.toString());}
boolean result=false;
switch(currentArg) {
case 0:
try {
result=true;
result=bookmarkFolder.isLeaf();
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (!result) TestContext.registerPASSED("Folder is not a leaf.");
else TestContext.registerFAILED("Folder is a leaf.");
break;
case 1:
try {
result=false;
result=bookmarkEntry.isLeaf();
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
if (result) TestContext.registerPASSED("Entry is a leaf.");
else TestContext.registerFAILED("Entry is not a leaf.");
break;
}
}
}

View File

@@ -0,0 +1,89 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_removeFromParent.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_removeFromParent implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private int currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private MutableTreeNode node, mtn;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to remove node from its parent");
try {
bookmarksTree = bookmarks.getBookmarks();
node=(MutableTreeNode)bookmarksTree.getRoot();
node=(MutableTreeNode)node.getChildAt(0);
} catch(Exception e) {TestContext.registerFAILED("Exception during execution: " + e.toString());}
try {
node.removeFromParent();
// Will be done after removeFromParent() implementation;
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
}
}

View File

@@ -0,0 +1,94 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_remove_1.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_remove_1 implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private String currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private MutableTreeNode node, mtn;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = context.getCurrentTestArguments();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken());
int index=java.lang.Integer.parseInt(st.nextToken());
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to remove child at index="+index);
try {
bookmarksTree = bookmarks.getBookmarks();
node=(MutableTreeNode)bookmarksTree.getRoot();
node=(MutableTreeNode)node.getChildAt(0);
} catch(Exception e) {TestContext.registerFAILED("Exception during execution: " + e.toString());}
try {
node.remove(index);
// Will be done after remove(int) implementation;
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
}
}

View File

@@ -0,0 +1,93 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_remove_2.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_remove_2 implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private String currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private MutableTreeNode node, mtn;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = context.getCurrentTestArguments();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken());
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to remove node");
try {
bookmarksTree = bookmarks.getBookmarks();
node=(MutableTreeNode)bookmarksTree.getRoot();
node=(MutableTreeNode)node.getChildAt(0);
} catch(Exception e) {TestContext.registerFAILED("Exception during execution: " + e.toString());}
try {
node.remove(node);
// Will be done after remove(MutableTreeNode) implementation;
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
}
}

View File

@@ -0,0 +1,102 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_setParent.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_setParent implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private int currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private MutableTreeNode node, mtn, parent, child;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
context.setDefaultResult(TestContext.FAILED);
if (currentArg!=0) context.setDefaultComment("We are trying to set correct parent");
else context.setDefaultComment("We are trying to set NULL parent");
try {
bookmarksTree = bookmarks.getBookmarks();
node=(MutableTreeNode)bookmarksTree.getRoot();
bookmarkEntry=bookmarks.newBookmarkEntry("ftp://mozilla.org");
mtn=(MutableTreeNode)bookmarkEntry;
} catch(Exception e) {TestContext.registerFAILED("Exception during execution: " + e.toString());}
if (currentArg==0) try {
mtn.setParent(null);
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
else {
try {
node=(MutableTreeNode)bookmarksTree.getRoot();
node=(MutableTreeNode)node.getChildAt(0);
mtn.setParent(node);
if ((node.toString()).equals(mtn.getParent().toString())) TestContext.registerPASSED("Right parent="+node+" was set.");
else TestContext.registerFAILED("Bad parent="+mtn.getParent()+" was set insteod of "+node);
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
return;
}
TestContext.registerPASSED("Browser doesn't crashed");
}
}

View File

@@ -0,0 +1,89 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BookmarkEntry_setUserObject.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class BookmarkEntry_setUserObject implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private int currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private MutableTreeNode node, mtn;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (bookmarks==null) return;
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to set user object");
try {
bookmarksTree = bookmarks.getBookmarks();
node=(MutableTreeNode)bookmarksTree.getRoot();
node=(MutableTreeNode)node.getChildAt(0);
} catch(Exception e) {TestContext.registerFAILED("Exception during execution: " + e.toString());}
try {
node.setUserObject(null);
// Will be done after setUserObject(Object) implementation;
} catch(Exception e) {
if (e instanceof UnimplementedException) TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
}
}
}

View File

@@ -0,0 +1,161 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* Bookmarks_addBookmark.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class Bookmarks_addBookmark implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private int currentArg;
private String currentArg1;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private TreeModel bookmarksTreeOld = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
String input_str = context.getCurrentTestArguments();
StringTokenizer str_tok = new StringTokenizer(input_str, ",");
this.currentArg = new Integer(str_tok.nextToken()).intValue();
try{
this.currentArg1 = str_tok.nextToken();
}catch(Exception e){
//System.out.println("Exception catched! currentArg1=\"\"");
this.currentArg1 = "";
}
if(this.currentArg1.equals("null")){
this.currentArg1 = null;
}
//this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if(context.getExecutionCount()==1){
try {
bookmarksTreeOld = bookmarks.getBookmarks();
//System.out.println("CurrentArg1="+currentArg1);
if(this.currentArg1!=null){
if(currentArg==1){
bookmarkEntry = bookmarks.newBookmarkFolder(this.currentArg1);
}else{
bookmarkEntry = bookmarks.newBookmarkEntry(this.currentArg1);
}
}else{
bookmarkEntry = null;
}
bookmarks.addBookmark(null, bookmarkEntry);
bookmarksTree = bookmarks.getBookmarks();
}catch(Exception e) {
if(e instanceof UnimplementedException){
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
return ;
}
if((e instanceof java.lang.IllegalArgumentException) && (bookmarkEntry==null)){
TestContext.registerPASSED("java.lang.IllegalArgumentException exception catched, but the argument is really null. Exception is: "+e.toString());
return ;
}
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
if(getResult((TreeNode)bookmarksTreeOld.getRoot(), (TreeNode)bookmarksTree.getRoot())){
TestContext.registerPASSED("addBookmark correct add value to a Bookmarks");
return ;
}else{
TestContext.registerFAILED("AddBookmark incarrect added value to Bookmarks");
return ;
}
}
}
private boolean getResult(TreeNode oldNode, TreeNode node) {
int oldCount = bookmarksTreeOld.getChildCount(bookmarksTreeOld.getRoot());
int count = node.getChildCount();
TreeNode currNode = null;
BookmarkEntry oldEntry = null;
BookmarkEntry newEntry = null;
boolean result = false;
for(int i=0; i<count; i++){
currNode = node.getChildAt(i);
if(oldNode.getIndex(currNode)!=-1){
oldEntry = (BookmarkEntry)oldNode.getChildAt(oldNode.getIndex(currNode));
newEntry = (BookmarkEntry)currNode;
if(!newEntry.isFolder()){
if(!oldEntry.URL.equals(newEntry.URL)){
System.out.println("Node is founded on oldTree but not equals currNode and i="+i);
result = false;
return false;
}else{
result = true;
}
}else{
result = getResult(oldNode.getChildAt(oldNode.getIndex(currNode)),currNode);
if(!result){
System.out.println("Failed because recursive is failed");
return false;
}
}
}else{
if(currNode.equals(bookmarkEntry)){
result = true;
}else{
result = false;
System.out.println("Return false because currNode is not equal bookmarkNode and i="+i);
return false;
}
}
}
return true;
}
}

View File

@@ -0,0 +1,98 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* Bookmarks_getBookmarks.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class Bookmarks_getBookmarks implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private String currentArg = null;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry = null;
private TreeModel bookmarksTree = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = context.getCurrentTestArguments();
if(this.currentArg.equals("null")){
this.currentArg = null;
}
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if(context.getExecutionCount()==1){
try {
bookmarkEntry = bookmarks.newBookmarkEntry("http://java.sun.com");
bookmarks.addBookmark(null, bookmarkEntry);
bookmarksTree = bookmarks.getBookmarks();
}catch(Exception e) {
if(e instanceof UnimplementedException){
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
}else{
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
return;
}
if(bookmarksTree != null && bookmarksTree.getIndexOfChild(bookmarksTree.getRoot(), bookmarkEntry)!=-1){
System.out.println("Index of child is: "+bookmarksTree.getIndexOfChild(bookmarksTree.getRoot(), bookmarkEntry));
System.out.println("GetchildCount return: "+bookmarksTree.getChildCount(bookmarksTree.getRoot()));
TestContext.registerPASSED("getBookmarks return correct TreeModel ");
return ;
}else{
TestContext.registerFAILED("getBookmarks return incorrect TreeModel ");
return ;
}
}
}
}

View File

@@ -0,0 +1,105 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* Bookmarks_newBookmarkEntry.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class Bookmarks_newBookmarkEntry implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private String currentArg = null;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = context.getCurrentTestArguments();
if(this.currentArg.equals("null")){
this.currentArg = null;
}
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if(context.getExecutionCount()==1){
try {
bookmarkEntry = bookmarks.newBookmarkEntry(currentArg);
}catch(Exception e) {
if(e instanceof UnimplementedException){
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
return ;
}
TestContext.registerFAILED("Exception during execution: " + e.toString());
return ;
}
System.out.println("URL is: " + bookmarkEntry.getProperties().getProperty(bookmarkEntry.URL));
System.out.println("NAME is: " + bookmarkEntry.getProperties().getProperty(bookmarkEntry.NAME));
System.out.println("DESCRIPTION is: " + bookmarkEntry.getProperties().getProperty(bookmarkEntry.DESCRIPTION));
try{
if(new URL(bookmarkEntry.getProperties().getProperty(bookmarkEntry.URL)).equals(new URL(currentArg))){
TestContext.registerPASSED("newBookmarkEntry construct a correct BookmarkEntry, url="+bookmarkEntry.getProperties().getProperty(bookmarkEntry.URL)+" name is:"+bookmarkEntry.getProperties().getProperty(bookmarkEntry.NAME));
return ;
}else{
TestContext.registerFAILED("newBookmarkEntry construct a incorrect BookmarkEntry");
return ;
}
}catch(MalformedURLException e){
if((currentArg.equals(""))&&(bookmarkEntry.getProperties().getProperty(bookmarkEntry.URL).equals(""))){
TestContext.registerPASSED("newBookmarkEntry construct a correct BookmarkEntry, url="+bookmarkEntry.getProperties().getProperty(bookmarkEntry.URL)+" name is:"+bookmarkEntry.getProperties().getProperty(bookmarkEntry.NAME));
return ;
}
TestContext.registerFAILED("Exception when constructing URL from: " + bookmarkEntry.getProperties().getProperty(bookmarkEntry.URL) +
" and " + currentArg);
return ;
}
}
}
}

View File

@@ -0,0 +1,98 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* Bookmarks_newBookmarkFolder.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class Bookmarks_newBookmarkFolder implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private String currentArg = null;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = context.getCurrentTestArguments();
if(this.currentArg.equals("null")){
this.currentArg = null;
}
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if(context.getExecutionCount()==1){
try {
bookmarkEntry = bookmarks.newBookmarkFolder(currentArg);
}catch(Exception e) {
if(e instanceof UnimplementedException){
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
}
if((e instanceof java.lang.IllegalArgumentException) && (this.currentArg==null)){
TestContext.registerPASSED("java.lang.IllegalArgumentException exception catched, but the argument is really null. Exception is: "+e.toString());
return ;
}
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
System.out.println("Is folder: " + bookmarkEntry.isFolder());
System.out.println("NAME is: " + bookmarkEntry.getProperties().getProperty(bookmarkEntry.NAME));
System.out.println("DESCRIPTION is: " + bookmarkEntry.getProperties().getProperty(bookmarkEntry.DESCRIPTION));
if((bookmarkEntry.getProperties().getProperty(bookmarkEntry.NAME).equals(currentArg))&&(bookmarkEntry.isFolder())){
TestContext.registerPASSED("newBookmarkFolder construct a correct BookmarkFolder");
return ;
}else{
TestContext.registerFAILED("newBookmarkFolder construct a incorrect BookmarkFolder");
return ;
}
}
}
}

View File

@@ -0,0 +1,164 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* Bookmarks_removeBookmark.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.tree.*;
public class Bookmarks_removeBookmark implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Bookmarks bookmarks = null;
private String currentArg;
private CurrentPage curPage = null;
private String[] pages = null;
private BookmarkEntry bookmarkEntry = null;
private TreeModel bookmarksTree = null;
private TreeModel bookmarksTreeOld = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = context.getCurrentTestArguments();
try {
bookmarks = (Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if(context.getExecutionCount()==1){
try {
if(currentArg.indexOf("exist")!=-1){
bookmarkEntry = bookmarks.newBookmarkEntry("http://java.sun.com/");
bookmarks.addBookmark(null, bookmarkEntry);
bookmarksTree = bookmarks.getBookmarks();
bookmarks.removeBookmark(bookmarkEntry);
bookmarksTreeOld = bookmarks.getBookmarks();
}
if(currentArg.indexOf("unexist")!=-1){
bookmarkEntry = bookmarks.newBookmarkEntry("http://java.sun.com/");
bookmarksTree = bookmarks.getBookmarks();
bookmarks.removeBookmark(bookmarkEntry);
bookmarksTreeOld = bookmarks.getBookmarks();
}
if(currentArg.indexOf("null")!=-1){
bookmarksTree = bookmarks.getBookmarks();
bookmarks.removeBookmark(null);
bookmarksTreeOld = bookmarks.getBookmarks();
}
}catch(Exception e) {
if(e instanceof UnimplementedException){
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
return ;
}
if((e instanceof java.lang.IllegalArgumentException) && (currentArg.indexOf("null")!=-1)){
TestContext.registerPASSED("java.lang.IllegalArgumentException catched, but the argument is null! Exception is: " + e.toString());
return ;
}
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
if(!currentArg.equals("exist")){
if(bookmarksTree.equals(bookmarksTreeOld)){
System.out.println("oldNode equals node - true");
TestContext.registerPASSED("removeBookmark correct remove "+this.currentArg+" value to a Bookmarks");
return ;
}else{
System.out.println("oldNode not equals node - false");
TestContext.registerFAILED("removeBookmark incorrect remove "+this.currentArg+" value to Bookmarks");
return ;
}
}else{
if(getResult((TreeNode)bookmarksTreeOld.getRoot(), (TreeNode)bookmarksTree.getRoot())){
TestContext.registerPASSED("removeBookmark correct remove "+this.currentArg+" value to a Bookmarks");
return ;
}else{
TestContext.registerFAILED("removeBookmark incorrect remove "+this.currentArg+" value to Bookmarks");
return ;
}
}
}
}
private boolean getResult(TreeNode oldNode, TreeNode node) {
int oldCount = bookmarksTreeOld.getChildCount(bookmarksTreeOld.getRoot());
int count = node.getChildCount();
TreeNode currNode = null;
BookmarkEntry oldEntry = null;
BookmarkEntry newEntry = null;
boolean result = false;
for(int i=0; i<count; i++){
currNode = node.getChildAt(i);
if(oldNode.getIndex(currNode)!=-1){
oldEntry = (BookmarkEntry)oldNode.getChildAt(oldNode.getIndex(currNode));
newEntry = (BookmarkEntry)currNode;
if(!newEntry.isFolder()){
if(!oldEntry.URL.equals(newEntry.URL)){
System.out.println("Node is founded on oldTree but not equals currNode and i="+i);
result = false;
return false;
}else{
result = true;
}
}else{
result = getResult(oldNode.getChildAt(oldNode.getIndex(currNode)),currNode);
if(!result){
System.out.println("Failed because recursive is failed");
return false;
}
}
}else{
if(currNode.equals(bookmarkEntry)){
result = true;
}else{
result = false;
System.out.println("Return false because currNode is not equal bookmarkNode and i="+i);
return false;
}
}
}
return true;
}
}

View File

@@ -0,0 +1,75 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BrowserControlCanvas_addNotify.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class BrowserControlCanvas_addNotify implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private BrowserControlCanvas browserCanvas = null;
private int currentArg = 0;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
//this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
browserCanvas = (BrowserControlCanvas)
browserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
context.setDefaultResult(TestContext.PASSED);
try{
browserCanvas.addNotify();
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
}

View File

@@ -0,0 +1,82 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BrowserControlCanvas_getWebShell.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class BrowserControlCanvas_getWebShell implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private BrowserControlCanvas browserCanvas = null;
private int currentArg = 0;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
//this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
browserCanvas = (BrowserControlCanvas)
browserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
context.setDefaultResult(TestContext.PASSED);
try{
BrowserControl brControl = (BrowserControl)browserCanvas.getWebShell();
if(brControl.equals(browserControl)){
TestContext.registerPASSED("getWebShell return correct BrowserControl");
return;
}else{
TestContext.registerFAILED("getWebShell return incorrect BrowserControl");
return;
}
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
}

View File

@@ -0,0 +1,135 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BrowserControlCanvas_setBounds.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.lang.reflect.*;
import java.security.*;
import java.awt.Rectangle;
public class BrowserControlCanvas_setBounds implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private BrowserControlCanvas browserCanvas = null;
private int currentArg1 = 0;
private int currentArg2 = 0;
private int currentArg3 = 0;
private int currentArg4 = 0;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
try {
String input_str = context.getCurrentTestArguments();
System.out.println(input_str);
StringTokenizer str_tok = new StringTokenizer(input_str, ",");
this.currentArg1 = new Integer(str_tok.nextToken()).intValue();
System.out.println("currentArg1 = "+currentArg1);
this.currentArg2 = new Integer(str_tok.nextToken()).intValue();
System.out.println("currentArg2 = "+currentArg2);
this.currentArg3 = new Integer(str_tok.nextToken()).intValue();
System.out.println("currentArg3 = "+currentArg3);
this.currentArg4 = new Integer(str_tok.nextToken()).intValue();
System.out.println("currentArg4 = "+currentArg4);
browserCanvas = (BrowserControlCanvas)
browserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
context.setDefaultResult(TestContext.PASSED);
try{
browserCanvas.setBounds(currentArg1, currentArg2, currentArg3, currentArg4);
if(getResult()){
TestContext.registerPASSED("setBounds sets bounds correctly");
}else{
TestContext.registerFAILED("setBounds do not sets bounds correctly");
}
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
public boolean getResult(){
Rectangle rect_res = (Rectangle)AccessController.doPrivileged(new PrivilegedAction(){
public Object run() {
Rectangle rect = null;
try {
final Class clazz = (Class.forName("java.awt.Component"));
final BrowserControlCanvas browserCanvas1 = browserCanvas;
Class[] param = new Class[]{};
final Method m = clazz.getDeclaredMethod("getBounds",param);
System.out.println("Method: " + m.toString());
m.setAccessible(true);
rect = (Rectangle)m.invoke(browserCanvas1,null);
} catch(Exception e) {
System.out.println("Exception on INVOKE: " +e.toString());
e.printStackTrace();
}
return rect;
}
});
if(rect_res==null){
System.out.println("rect_res is null!!!!");
return false;
}
double h = rect_res.getHeight();
double w = rect_res.getWidth();
double x = rect_res.getX();
double y = rect_res.getY();
System.out.println("H="+h+" W="+w+" X="+x+" Y="+y);
if(x==currentArg1&&y==currentArg2&&w==currentArg3&&h==currentArg4){
return true;
}
return false;
}
}

View File

@@ -0,0 +1,139 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* BrowserControlCanvas_setBounds_rect.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.security.*;
import java.lang.reflect.*;
import java.awt.Rectangle;
public class BrowserControlCanvas_setBounds_rect implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private BrowserControlCanvas browserCanvas = null;
private int currentArg1 = 0;
private int currentArg2 = 0;
private int currentArg3 = 0;
private int currentArg4 = 0;
private String[] pages = null;
private Rectangle rect = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
try {
String input_str = context.getCurrentTestArguments();
System.out.println(input_str);
StringTokenizer str_tok = new StringTokenizer(input_str, ",");
this.currentArg1 = new Integer(str_tok.nextToken()).intValue();
System.out.println("currentArg1 = "+currentArg1);
this.currentArg2 = new Integer(str_tok.nextToken()).intValue();
System.out.println("currentArg2 = "+currentArg2);
this.currentArg3 = new Integer(str_tok.nextToken()).intValue();
System.out.println("currentArg3 = "+currentArg3);
this.currentArg4 = new Integer(str_tok.nextToken()).intValue();
System.out.println("currentArg4 = "+currentArg4);
browserCanvas = (BrowserControlCanvas)
browserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
context.setDefaultResult(TestContext.PASSED);
try{
rect = new Rectangle(currentArg1, currentArg2, currentArg3, currentArg4);
if(currentArg1==0&&currentArg2==0&&currentArg3==0&&currentArg4==0){
rect = null;
}
browserCanvas.setBounds(rect);
if(getResult()){
TestContext.registerPASSED("setBounds sets bounds correctly");
}else{
TestContext.registerFAILED("setBounds do not sets bounds correctly");
}
}catch(Exception e) {
if((e instanceof java.lang.NullPointerException)&&(rect == null)){
TestContext.registerPASSED("NullPointerException catched, but the Rectangle is NULL!Exception is: " + e.toString());
return;
}
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
public boolean getResult(){
Rectangle rect_res = (Rectangle)AccessController.doPrivileged(new PrivilegedAction(){
public Object run() {
Rectangle rect = null;
try {
final Class clazz = (Class.forName("java.awt.Component"));
final BrowserControlCanvas browserCanvas1 = browserCanvas;
Class[] param = new Class[]{};
final Method m = clazz.getDeclaredMethod("getBounds",param);
System.out.println("Method: " + m.toString());
m.setAccessible(true);
rect = (Rectangle)m.invoke(browserCanvas1,null);
} catch(Exception e) {
System.out.println("Exception on INVOKE: " +e.toString());
e.printStackTrace();
}
return rect;
}
});
if(rect_res==null){
System.out.println("rect_res is null!!!!");
return false;
}
double h = rect_res.getHeight();
double w = rect_res.getWidth();
double x = rect_res.getX();
double y = rect_res.getY();
System.out.println("H="+h+" W="+w+" X="+x+" Y="+y);
if(x==currentArg1&&y==currentArg2&&w==currentArg3&&h==currentArg4){
return true;
}
return false;
}
}

View File

@@ -0,0 +1,178 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* CurrentPage_copyCurSel.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.Toolkit;
public class CurrentPage_copyCurSel implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private CurrentPage curPage = null;
private String currentArg = null;
private String[] pages = null;
private boolean loading = false;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
curPage = (CurrentPage)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (curPage==null) return;
Clipboard clip=java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken());
String url=st.nextToken().trim();
String fromClip=null;
DataFlavor df=null;
try {
df=new DataFlavor(java.lang.Class.forName("java.lang.String"),null);
} catch(Exception e) {System.out.println("DataFlavor exception "+e.toString());};
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (context.getExecutionCount()!=2) return;
}
switch (num) {
case 0:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to copy selection without URL");
try{
curPage.copyCurrentSelectionToSystemClipboard();
} catch (Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed (exception): "+e);
return;
};
TestContext.registerPASSED("Browser doesn't crashed on copyCurrentSelectionToSystemClipboard() invocation without URL.");
return;
case 1:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to copy unexisted selection");
try{
clip.setContents(new StringSelection("test string"),null);
curPage.copyCurrentSelectionToSystemClipboard();
StringSelection o2=(StringSelection)clip.getContents(df);
fromClip=(String)o2.getTransferData(df);
if (fromClip.equals("test string")) TestContext.registerPASSED("Equal clipboard values before and after copyCurrentSelectionToSystemClipboard() invocation");
else TestContext.registerFAILED("Different clipboard values before and after copyCurrentSelectionToSystemClipboard() invocation with selection");
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution : " + e.toString());
return;
};
break;
case 2:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to copy existed selection");
try {
clip.setContents(new StringSelection("test string"),null);
curPage.findInPage("html",true,true);
curPage.copyCurrentSelectionToSystemClipboard();
StringSelection o2=(StringSelection)clip.getContents(df);
fromClip=(String)o2.getTransferData(df);
if (fromClip.equals("html")) TestContext.registerPASSED("Equal clipboard values before and after copyCurrentSelectionToSystemClipboard() invocation");
else TestContext.registerFAILED("Different clipboard values before and after copyCurrentSelectionToSystemClipboard() invocation with selection");
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
break;
};
return;
}
}

View File

@@ -0,0 +1,209 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* CurrentPage_findInPage_1.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.Toolkit;
public class CurrentPage_findInPage_1 implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private CurrentPage curPage = null;
private String currentArg = null;
private String[] pages = null;
private boolean loaded, loading = false;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
curPage = (CurrentPage)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (curPage==null) return;
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken());
String url=st.nextToken();
String findMe=null;
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (context.getExecutionCount()!=2) return;
}
Clipboard clip=java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
DataFlavor df=null;
try {
df=new DataFlavor(java.lang.Class.forName("java.lang.String"),null);
} catch(Exception e) {System.out.println("DataFlavor exception "+e.toString());};
System.out.println("clip="+clip);
switch (num) {
case 0:
try{
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to find null string");
findMe=null;
curPage.findInPage(findMe, true, false);
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed with null search string (exception): "+e);
return;
};
break;
case 1:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to find empty string");
findMe="";
curPage.findInPage(findMe, true, false);
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed with empty search string (exception): "+e);
return;
};
break;
case 2:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to find existed string");
clip.setContents(new StringSelection("test string"),null);
curPage.findInPage("html",true,true);
curPage.copyCurrentSelectionToSystemClipboard();
StringSelection o2=(StringSelection)clip.getContents(df);
findMe=(String)o2.getTransferData(df);
if (findMe.equals("html")) {
TestContext.registerPASSED("Equal clipboard values before and after copyCurrentSelectionToSystemClipboard() invocation");
return;
} else {
TestContext.registerFAILED("Different clipboard values before and after copyCurrentSelectionToSystemClipboard() invocation with selection");
return;
};
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
// break;
case 3:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to find string without URL");
curPage.findInPage("html", true, false);
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed without URL (exception): "+e);
return;
};
break;
case 4:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to find unexisted string");
findMe="badtext";
curPage.findInPage(findMe, true, false);
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed with unexisted search string (exception): "+e);
return;
};
break;
};
TestContext.registerPASSED("Browser doesn't crashed with findInPage value="+findMe);
return;
}
}

View File

@@ -0,0 +1,153 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* CurrentPage_getCurURL.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.Toolkit;
public class CurrentPage_getCurURL implements Test, TestDocLoadListener
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private CurrentPage curPage = null;
private String currentArg = null;
private String[] pages = null;
private boolean loading, loaded = false;
private int first, second=0;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
curPage = (CurrentPage)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
context.setDocLoadListener(this);
return true;
}
public void eventDispatched(DocumentLoadEvent event)
{
if (event.getType()==4) {
first++;
execute();
}
if (event.getType()==1) {
second++;
if (second==2) {
loaded=true;
execute();
}
}
}
public void execute() {
System.out.println("first="+first+" secone="+second);
if (curPage==null) return;
String url, url2=null;
Clipboard clip=java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken());
url=st.nextToken().trim();
url2=st.nextToken().trim();
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD="+url);
loading=true;
}
if (first!=1) return;
}
if ((num==1)&&(second!=2)) {
System.out.println("LOAD 2");
navigation.loadURL(url2);
return;
}
if (num==2) {
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to get URL without loaded URL");
curPage.getCurrentURL();
}
catch (Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed without URL (exception): "+e);
return;
}
TestContext.registerPASSED("Browser doesn't crashed during invokation of getCurrentURL without URL");
}
try{
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to get URL: "+url);
if (url.equals(curPage.getCurrentURL())) TestContext.registerPASSED("Right URL value="+url);
else TestContext.registerFAILED("Bad URL value="+curPage.getCurrentURL()+" instead of "+url);
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
};
}
}

View File

@@ -0,0 +1,140 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* CurrentPage_getDOM.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.Toolkit;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
public class CurrentPage_getDOM implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private CurrentPage curPage = null;
private String currentArg = null;
private String[] pages = null;
private boolean loading = false;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
curPage = (CurrentPage)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (curPage==null) return;
String url=null;
Clipboard clip=java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
StringTokenizer st=new StringTokenizer(currentArg,",");
Document doc;
Node node1,node2;
url=st.nextToken().trim();
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (context.getExecutionCount()!=2) return;
}
String findMe="";
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to get DOM");
doc=curPage.getDOM();
node1=doc.getElementsByTagName("b").item(0);
node2=doc.getElementsByTagName("i").item(0);
node1.getParentNode().insertBefore(node1,node2);
curPage.findInPage("TESTIt is a",true,true);
curPage.copyCurrentSelectionToSystemClipboard();
DataFlavor df=new DataFlavor(java.lang.Class.forName("java.lang.String"),null);
StringSelection o2=(StringSelection)clip.getContents(df);
findMe=(String)o2.getTransferData(df);
if (!url.equals("null")){
if (findMe.equals("TESTIt is a")) {
TestContext.registerPASSED("Right getDOM() value");
return;
} else {
TestContext.registerFAILED("Bad getDOM() value");
return;
};
};
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else if (url.equals("null")) TestContext.registerPASSED("Browser doesn't crashed (exception): "+e);
else TestContext.registerFAILED("Exception during execution : "+e.toString());
return;
};
TestContext.registerPASSED("Browser doesn't crashed");
}
}

View File

@@ -0,0 +1,114 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* CurrentPage_getPageInfo.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.util.Properties;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.Toolkit;
public class CurrentPage_getPageInfo implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private CurrentPage curPage = null;
private String currentArg = null;
private String[] pages = null;
private boolean loading = false;
private Properties pageInfo;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
curPage = (CurrentPage)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (curPage==null) return;
String url=null;
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken());
url=st.nextToken().trim();
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD="+url);
loading=true;
}
// if(num!=1) if (context.getExecutionCount()!=2) return;
}
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to get PageInfo");
curPage.getPageInfo();
}
catch (Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution : "+e.toString());
return;
}
TestContext.registerPASSED("Browser doesn't crashed during invokation of getCurrentURL without URL");
}
}

View File

@@ -0,0 +1,126 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* CurrentPage_getSource.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.Toolkit;
public class CurrentPage_getSource implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private CurrentPage curPage = null;
private String currentArg = null;
private String[] pages = null;
private boolean loading = false;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
curPage = (CurrentPage)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (curPage==null) return;
String url=null;
Clipboard clip=java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
StringTokenizer st=new StringTokenizer(currentArg,",");
url=st.nextToken().trim();
String source="<html>/n<head>/nThis is second base html/n</head>/n<body>/n<center><H1>This is second base html</H1></center>/n</body>/n</html>";
String getsource=null;
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (context.getExecutionCount()!=2) return;
}
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to get Source");
getsource=curPage.getSource();
System.out.println("Source= "+getsource);
if (!url.equals("null"))
if (getsource.equals(source)) {
TestContext.registerPASSED("Right getSource() value");
return;
} else {
TestContext.registerFAILED("Bad getSource() value");
return;
};
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution : "+e.toString());
return;
};
TestContext.registerPASSED("Browser doesn't crash");
}
}

View File

@@ -0,0 +1,130 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* CurrentPage_getSourceBytes.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.Toolkit;
public class CurrentPage_getSourceBytes implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private CurrentPage curPage = null;
private String currentArg = null;
private String[] pages = null;
private boolean loading = false;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
curPage = (CurrentPage)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (curPage==null) return;
String url=null;
Clipboard clip=java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
StringTokenizer st=new StringTokenizer(currentArg,",");
url=st.nextToken().trim();
boolean flag=java.lang.Boolean.getBoolean(st.nextToken().trim());
String source="<html>/n<head>/nThis is second base html/n</head>/n<body>/n<center><H1>This is second base html</H1></center>/n</body>/n</html>";
byte[] getsource=null;
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (context.getExecutionCount()!=2) return;
}
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to get Source bytes");
getsource=curPage.getSourceBytes(flag);
System.out.println("SourceBytes= "+getsource);
if (!url.equals("null"))
if (getsource.equals(source)) {
TestContext.registerPASSED("Right getSourceBytes() value");
return;
} else {
TestContext.registerFAILED("Bad getSourceBytes() value");
return;
};
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution : "+e.toString());
return;
};
TestContext.registerPASSED("Browser doesn't crash");
}
}

View File

@@ -0,0 +1,162 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* CurrentPage_resetFind.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.Toolkit;
public class CurrentPage_resetFind implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private CurrentPage curPage = null;
private String currentArg = null;
private String[] pages = null;
private boolean loading = false;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
curPage = (CurrentPage)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (curPage==null) return;
Clipboard clip=java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken());
String url=st.nextToken().trim();
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (context.getExecutionCount()!=2) return;
}
switch (num) {
case 0:
try{
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to reset find without URL");
curPage.resetFind();
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed (exception): "+e);
return;
};
break;
case 1:
try{
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to reset find with previous search result");
curPage.findInPage("html",true,true);
curPage.resetFind();
curPage.findNextInPage();
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
if (e.toString().equals("java.lang.Exception: Exception: NULL SearchContext received for FindNext"))
TestContext.registerPASSED("resetFind() works in rigth way.");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
break;
case 2:
try{
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to reset find without previous search result");
curPage.resetFind();
curPage.findNextInPage();
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
if (e.toString().equals("java.lang.Exception: Exception: NULL SearchContext received for FindNext"))
TestContext.registerPASSED("resetFind() works in rigth way.");
else TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
break;
};
TestContext.registerPASSED("Browser doesn't crashed");
return;
}
}

View File

@@ -0,0 +1,149 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* CurrentPage_selectAll.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.Toolkit;
public class CurrentPage_selectAll implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private CurrentPage curPage = null;
private String currentArg = null;
private String[] pages = null;
private boolean loading = false;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
curPage = (CurrentPage)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (curPage==null) return;
Clipboard clip=java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken());
String url=st.nextToken().trim();
String source="This is second base html This is second base html\nIt is a TEST ";
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (context.getExecutionCount()!=2) return;
}
switch (num) {
case 0:
try{
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to select all without URL");
curPage.selectAll();
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed (exception): "+e);
return;
};
break;
case 1:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to select all");
curPage.selectAll();
curPage.copyCurrentSelectionToSystemClipboard();
DataFlavor df=new DataFlavor(java.lang.Class.forName("java.lang.String"),null);
StringSelection o2=(StringSelection)clip.getContents(df);
String findMe=(String)o2.getTransferData(df);
if (findMe.equals(source)) {
TestContext.registerPASSED("Right clipboard values after selectAll() invocation");
return;
} else {
TestContext.registerFAILED("Different clipboard values after selectAll() invocation");
return;
};
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
// break;
};
TestContext.registerPASSED("Browser doesn't crashed");
return;
}
}

View File

@@ -0,0 +1,147 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* EventRegistration_addDocLoadListener_1.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.event.*;
public class EventRegistration_addDocLoadListener_1 implements Test, TestDocLoadListener
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Navigation navigation = null;
private EventRegistration eventReg = null;
private String currentArg = null;
private String[] pages = null;
private CurrentPage curPage = null;
private int num = 666;
private String url = null;
private String docEvent = null;
private boolean loading = false;
private int end = 0;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
eventReg = (EventRegistration)
browserControl.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
// eventReg.addDocumentLoadListener(this);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
context.setDocLoadListener(this);
return true;
}
public void eventDispatched(DocumentLoadEvent event)
{
//System.out.println("EVENT="+event.getType());
// if (!(event instanceof DocumentLoadEvent)) return;
switch (num) {
case 0: if (event.getType()==DocumentLoadEvent.START_DOCUMENT_LOAD_EVENT_MASK)
TestContext.registerPASSED("Right DocumentLoadEvent :START_DOCUMENT_LOAD_EVENT_MASK");
break;
case 1: if (event.getType()==DocumentLoadEvent.END_DOCUMENT_LOAD_EVENT_MASK)
TestContext.registerPASSED("Right DocumentLoadEvent :END_DOCUMENT_LOAD_EVENT_MASK");
break;
case 2: if (event.getType()==DocumentLoadEvent.START_URL_LOAD_EVENT_MASK)
TestContext.registerPASSED("Right DocumentLoadEvent :START_URL_LOAD_EVENT_MASK");
break;
case 3: if (event.getType()==DocumentLoadEvent.END_URL_LOAD_EVENT_MASK)
TestContext.registerPASSED("Right DocumentLoadEvent :END_URL_LOAD_EVENT_MASK");
break;
case 4: if (event.getType()==DocumentLoadEvent.PROGRESS_URL_LOAD_EVENT_MASK)
TestContext.registerPASSED("Right DocumentLoadEvent :PROGRESS_URL_LOAD_EVENT_MASK");
break;
case 5: if (event.getType()==DocumentLoadEvent.STATUS_URL_LOAD_EVENT_MASK)
TestContext.registerPASSED("Right DocumentLoadEvent :STATUS_URL_LOAD_EVENT_MASK");
break;
case 6: if (event.getType()==DocumentLoadEvent.UNKNOWN_CONTENT_EVENT_MASK)
TestContext.registerPASSED("Right DocumentLoadEvent :UNKNOWN_CONTENT_EVENT_MASK");
break;
case 7: if (event.getType()==DocumentLoadEvent.FETCH_INTERRUPT_EVENT_MASK)
TestContext.registerPASSED("Right DocumentLoadEvent :FETCH_INTERRUPT_EVENT_MASK");
}
if (event.getType()==DocumentLoadEvent.END_DOCUMENT_LOAD_EVENT_MASK)
{
end++;
execute();
}
}
public void execute() {
if (eventReg==null) return;
StringTokenizer st=new StringTokenizer(currentArg,",");
num=java.lang.Integer.parseInt(st.nextToken().trim());
docEvent=st.nextToken().trim();
url=st.nextToken().trim();
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (end!=1) return;
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are waiting for "+docEvent+" events...");
navigation.loadURL(url);
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution : "+e.toString());
return;
};
}
}

View File

@@ -0,0 +1,198 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* EventRegistration_addDocLoadListener_2.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.event.*;
public class EventRegistration_addDocLoadListener_2 implements Test, DocumentLoadListener
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Navigation navigation = null;
private EventRegistration eventReg = null;
private String currentArg = null;
private String[] pages = null;
private CurrentPage curPage = null;
private int num = 666;
private int eventNum=0;
private String url = null;
private String docEvent = null;
private boolean loading = false;
protected static String sequence = "";
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
eventReg = (EventRegistration)
browserControl.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void eventDispatched(WebclientEvent event)
{
if (event instanceof DocumentLoadEvent)
if (event.getType() == DocumentLoadEvent.END_DOCUMENT_LOAD_EVENT_MASK)
{
sequence=sequence+"a";
eventNum++;
System.out.println("EVENT -- from "+this+" eventNum:"+eventNum+" EC="+context.getExecutionCount());
context.increaseExecutionCount();
execute();
};
}
public void execute() {
if (eventReg==null) return;
StringTokenizer st=new StringTokenizer(currentArg,",");
num=java.lang.Integer.parseInt(st.nextToken().trim());
String url=st.nextToken().trim();
try {
switch (num) {
case 0:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to register null DocumentLoadListener");
eventReg.addDocumentLoadListener(null);
break;
case 1:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to register several same DocumentLoadListeners");
eventReg.addDocumentLoadListener(this);
eventReg.addDocumentLoadListener(this);
eventReg.addDocumentLoadListener(this);
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (context.getExecutionCount()<2) return;
}
if (eventNum==1) TestContext.registerPASSED("Right number of events");
else TestContext.registerFAILED("Bad number of events");
break;
case 2:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to register several different DocumentLoadListeners");
eventReg.addDocumentLoadListener(this);
eventReg.addDocumentLoadListener(new ER3());
eventReg.addDocumentLoadListener(new ER4());
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (context.getExecutionCount()<2) return;
}
break;
}
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
if (num==0) TestContext.registerPASSED("Browser doesn't crashed (exception): "+e.toString());
else
TestContext.registerFAILED("Exception during execution : "+e.toString());
return;
};
}
}
class ER3 implements DocumentLoadListener
{
public void eventDispatched(WebclientEvent event)
{
if (event instanceof DocumentLoadEvent)
if (event.getType() == DocumentLoadEvent.END_DOCUMENT_LOAD_EVENT_MASK)
{
EventRegistration_addDocLoadListener_2.sequence+="b";
System.out.println("EVENT -- from "+this);
}
}
}
class ER4 implements DocumentLoadListener
{
public void eventDispatched(WebclientEvent event)
{
if (event instanceof DocumentLoadEvent)
if (event.getType() == DocumentLoadEvent.END_DOCUMENT_LOAD_EVENT_MASK)
{
EventRegistration_addDocLoadListener_2.sequence+="c";
System.out.println("EVENT -- from "+this);
if (EventRegistration_addDocLoadListener_2.sequence.equals("cba")) TestContext.registerPASSED("Events passed to right listener(s)");
else TestContext.registerFAILED("Events passed to bad listener(s)");
}
}
}

View File

@@ -0,0 +1,140 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* EventRegistration_removeDocLoadListener.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.event.*;
public class EventRegistration_removeDocLoadListener implements Test, DocumentLoadListener
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Navigation navigation = null;
private EventRegistration eventReg = null;
private String currentArg = null;
private String[] pages = null;
private CurrentPage curPage = null;
private int num = 666;
private int eventNum=0;
private String url = null;
private String docEvent = null;
private boolean loading = false;
protected static String sequence = "";
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
eventReg = (EventRegistration)
browserControl.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void eventDispatched(WebclientEvent event)
{
if (event.getType() == DocumentLoadEvent.END_DOCUMENT_LOAD_EVENT_MASK)
{
System.out.println("EVENT -- from "+this+" eventNum:"+eventNum+" EC="+context.getExecutionCount());
TestContext.registerFAILED("Events passed to the removed listener");
// context.IncreaseExecutionCount();
// execute();
};
}
public void execute() {
if (eventReg==null) return;
StringTokenizer st=new StringTokenizer(currentArg,",");
num=java.lang.Integer.parseInt(st.nextToken().trim());
String url=st.nextToken().trim();
try {
switch (num) {
case 0:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to remove null DocumentLoadListener");
eventReg.removeDocumentLoadListener(null);
break;
case 1:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to remove unregistred DocumentLoadListener");
eventReg.removeDocumentLoadListener(this);
TestContext.registerPASSED("Browser doesn't crashed");
break;
case 2:
context.setDefaultResult(TestContext.PASSED);
context.setDefaultComment("Listener was removed");
eventReg.addDocumentLoadListener(this);
eventReg.removeDocumentLoadListener(this);
navigation.loadURL(url);
break;
}
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
if (num==0) TestContext.registerPASSED("Browser doesn't crashed (exception): "+e.toString());
else
TestContext.registerFAILED("Exception during execution : "+e.toString());
return;
};
}
}

View File

@@ -0,0 +1,160 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* EventRegistration_removeMouseListener_1.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.event.*;
public class EventRegistration_removeMouseListener_1 implements Test, MouseListener
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Navigation navigation = null;
private EventRegistration eventReg = null;
private String currentArg = null;
private String[] pages = null;
private CurrentPage curPage = null;
private int num = 666;
private int eventNum=0;
private String url = null;
private String docEvent = null;
private boolean loading = false;
protected static String sequence = "";
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
eventReg = (EventRegistration)
browserControl.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void eventDispatched(WebclientEvent event)
{
if (event.getType() == DocumentLoadEvent.END_DOCUMENT_LOAD_EVENT_MASK)
{
System.out.println("EVENT -- from "+this+" eventNum:"+eventNum+" EC="+context.getExecutionCount());
TestContext.registerFAILED("Events passed to the removed listener");
// context.IncreaseExecutionCount();
// execute();
};
}
/***************************************************************/
public void mouseClicked(java.awt.event.MouseEvent e)
{
}
public void mouseEntered(java.awt.event.MouseEvent e)
{
}
public void mousePressed(java.awt.event.MouseEvent e)
{
}
public void mouseExited(java.awt.event.MouseEvent e)
{
}
public void mouseReleased(java.awt.event.MouseEvent e)
{
}
/****************************************************************/
public void execute() {
if (eventReg==null) return;
StringTokenizer st=new StringTokenizer(currentArg,",");
num=java.lang.Integer.parseInt(st.nextToken().trim());
String url=st.nextToken().trim();
try {
switch (num) {
case 0:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to remove null MouseListener");
eventReg.removeMouseListener(null);
break;
case 1:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to remove unregistred MouseListener");
eventReg.removeMouseListener(this);
TestContext.registerPASSED("Browser doesn't crashed");
break;
case 2:
context.setDefaultResult(TestContext.PASSED);
context.setDefaultComment("Listener was removed");
eventReg.addMouseListener(this);
// new MouseEvent(null,500,(long)0,0,0,1,false);
eventReg.removeMouseListener(this);
break;
}
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
if (num==0) TestContext.registerPASSED("Browser doesn't crashed (exception): "+e.toString());
else
TestContext.registerFAILED("Exception during execution : "+e.toString());
return;
};
}
}

View File

@@ -0,0 +1,134 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_back.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_back implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private int currentArg = 0;
private CurrentPage curPage = null;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if(context.getExecutionCount()==1){
System.out.println("back1!!! "+pages.length);
if(pages.length!=0){
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hangs when load page N " + (currentArg + 1) +
" of " + pages.length);
try {
System.out.println("Load " + currentArg + " page");
history.setCurrentHistoryIndex(currentArg);
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}else{
try {
context.setDefaultResult(TestContext.PASSED);
context.setDefaultComment("Do BACK when history is empty.");
history.back();
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
}
if(context.getExecutionCount()==2){
if(pages.length!=0){
try {
if(currentArg==0){
context.setDefaultResult(TestContext.PASSED);
context.setDefaultComment("Try to do BACK on the first page of history");
}
history.back();
System.out.println("back2!!! "+pages.length);
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}else{
TestContext.registerFAILED("Some page loaded, when history should be empty");
return ;
}
}
if(context.getExecutionCount()==3){
System.out.println("back3!!! "+pages.length);
if(pages.length!=0 && currentArg!=0){
try{
curPage = (CurrentPage)browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
try{
if(new URL(curPage.getCurrentURL()).equals(new URL(pages[currentArg-1]))){
TestContext.registerPASSED("back load correct URL when it's exist");
return ;
}else{
TestContext.registerFAILED("back load incorrect URL when it's exist");
return ;
}
}catch(MalformedURLException e){
TestContext.registerFAILED("Exception when constructing URL from: " + curPage.getCurrentURL() +
" and " + pages[pages.length-2]);
}
}
}
}
}

View File

@@ -0,0 +1,114 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_canBack.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_canBack implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private int currentArg = 0;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
boolean result;
if(context.getExecutionCount()==1){
try {
if(pages.length==0){
result = history.canBack();
if(!result){
TestContext.registerPASSED("canBack return false when history is empty");
}else{
TestContext.registerFAILED("canBack returned true when history is empty");
}
return ;
}else{
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hangs when loading page N " + (currentArg + 1) +
" of " + pages.length);
history.setCurrentHistoryIndex(currentArg);
}
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
if(context.getExecutionCount()==2){
try {
result = history.canBack();
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
if(currentArg>0){
if(result){
TestContext.registerPASSED("canBack returned correct value when it's really can back");
return ;
}else{
TestContext.registerFAILED("canBack returned false when it's really can back");
return ;
}
}else{
if(!result){
TestContext.registerPASSED("canBack returned correct value when it's really cannot back");
return ;
}else{
TestContext.registerFAILED("canBack returned true when it's really cannot back");
return ;
}
}
}
}
}

View File

@@ -0,0 +1,114 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_canForward.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_canForward implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private int currentArg = 0;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
boolean result;
if(context.getExecutionCount()==1){
try {
if(pages.length==0){
result = history.canForward();
if(!result){
TestContext.registerPASSED("canForward return false when history is empty");
}else{
TestContext.registerFAILED("canForward returned true when history is empty");
}
return ;
}else{
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hangs when loading page N " + (currentArg + 1) +
" of " + pages.length);
history.setCurrentHistoryIndex(currentArg);
}
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
if(context.getExecutionCount()==2){
try {
result = history.canForward();
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
if(currentArg<pages.length-1){
if(result){
TestContext.registerPASSED("canForward returned correct value when it's really can forward");
return ;
}else{
TestContext.registerFAILED("canForward returned false when it's really can forward");
return ;
}
}else{
if(!result){
TestContext.registerPASSED("canForward returned correct value when it's really cannot forward");
return ;
}else{
TestContext.registerFAILED("canForward returned true when it's really cannot forward");
return ;
}
}
}
}
}

View File

@@ -0,0 +1,97 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_clearHistory.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_clearHistory implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation= null;
private int currentArg = 0;
private CurrentPage curPage = null;
private String[] pages = null;
private HistoryEntry[] history_arr ;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
//this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if(context.getExecutionCount()==1){
try {
history.clearHistory();
//curPage = (CurrentPage)browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
}catch(Exception e) {
if(e instanceof UnimplementedException){
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
}else{
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
return;
}
if(history.getHistoryLength()==0){
TestContext.registerPASSED("clearHistory() really clean history");
return ;
}else{
TestContext.registerFAILED("clearHistory() do not clean history and history.length= " + history.getHistoryLength());
return ;
}
}
if(context.getExecutionCount()==2){
TestContext.registerFAILED("clearHistory() do not clean history and history.length= " + history.getHistoryLength());
}
}
}

View File

@@ -0,0 +1,124 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_forward.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_forward implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private int currentArg = 0;
private CurrentPage curPage = null;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if(context.getExecutionCount()==1){
try {
if(pages.length==0){
context.setDefaultResult(TestContext.PASSED);
context.setDefaultComment("Do FORWARD when history is empty.");
history.forward();
return ;
}else{
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hangs when load page N " + (currentArg + 1) +
" of " + pages.length);
history.setCurrentHistoryIndex(currentArg);
return;
}
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
if(context.getExecutionCount()==2){
try{
if(currentArg<pages.length-1){
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hangs when do forward and forward list isn't empty.");
history.forward();
}else{
context.setDefaultResult(TestContext.PASSED);
context.setDefaultComment("Try to do forward when forward list is empty.");
history.forward();
}
return;
}catch(Exception e){
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
if(context.getExecutionCount()==3){
try{
curPage = (CurrentPage)browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
try{
if(new URL(curPage.getCurrentURL()).equals(new URL(pages[currentArg+1]))){
TestContext.registerPASSED("forward load correct URL when it's exist");
return ;
}else{
TestContext.registerFAILED("back load incorrect URL when it's exist");
return ;
}
}catch(MalformedURLException e) {
TestContext.registerFAILED("Exception when constructing URL from: " + curPage.getCurrentURL() +
" and " + pages[currentArg+1]);
}
}catch(Exception e){
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
}
}

View File

@@ -0,0 +1,146 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_getBackList.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_getBackList implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private int currentArg = 0;
private CurrentPage curPage = null;
private String[] pages = null;
private HistoryEntry[] backList = new HistoryEntry[10];
private boolean result = true;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if(context.getExecutionCount()==1) {
if (null != history) {
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hangs when try to load page N " + (currentArg + 1) +
" of " + pages.length);
if(currentArg!=-1){
history.setCurrentHistoryIndex(currentArg);
}else{
backList = history.getBackList();
if(backList.length == pages.length){
if(getResult(history.getCurrentHistoryIndex(), backList)){
TestContext.registerPASSED("getBackList return correct value when list is equals history");
return ;
}else{
TestContext.registerFAILED("getBackList return incorrect value - incorrect elements in list. BackList must be equals history");
return ;
}
}else{
TestContext.registerFAILED("getBackList return incorrect value when list is equals history");
return ;
}
}
}catch(Exception e) {
if(e instanceof UnimplementedException){
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
return;
}
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}else{
TestContext.registerFAILED("null history passed to test");
}
}
if(context.getExecutionCount()==2){
try {
backList = history.getBackList();
}catch(Exception e) {
if(e instanceof UnimplementedException){
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
}else{
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
return;
}
if(backList==null){
if(currentArg==0) {
TestContext.registerPASSED("getBackList return correct value when list is empty");
return ;
}else{
TestContext.registerFAILED("getBackList return null when list is not empty");
return ;
}
}else{
result = getResult(history.getCurrentHistoryIndex(), backList);
if(result){
TestContext.registerPASSED("getBackList return correct value when list is not empty");
return ;
}else{
TestContext.registerFAILED("getBackList return incorrect value - list contains incorrect URL's");
return ;
}
}
}
}
public boolean getResult(int j, HistoryEntry[] list){
int count = 0;
for(int i=j; i>=0; i++){
if(!list[count].getURL().equals(history.getURLForIndex(i))){
System.out.println("URL from list - "+list[count].getURL()+" do not equals URL from history - "+history.getURLForIndex(i));
return false ;
}
count++ ;
}
return true ;
}
}

View File

@@ -0,0 +1,113 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_getCurrentHistoryIndex.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_getCurrentHistoryIndex implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private CurrentPage curPage = null;
private int currentArg = 0;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
int count = context.getExecutionCount();
if (null == history) {
TestContext.registerFAILED("null history passed to test");
return;
}
switch(count) {
case 1:
try {
if(currentArg == -1) { //Default index
if(history.getCurrentHistoryIndex()==(pages.length - 1)) {
TestContext.registerPASSED("getCurrentHistoryIndex returned correct value " +
(pages.length -1) );
}else{
TestContext.registerFAILED("getCurrentHistoryIndex return incorrect value " +
history.getCurrentHistoryIndex() + " instead of " +
(pages.length-1));
}
return;
}
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hangs when load page N " + (currentArg + 1) +
" of " + pages.length);
history.setCurrentHistoryIndex(currentArg);
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
break;
case 2:
try {
if(history.getCurrentHistoryIndex()==currentArg){
TestContext.registerPASSED("getCurrentHistoryIndex returned correct value " +
currentArg);
}else{
TestContext.registerFAILED("getCurrentHistoryIndex return incorrect value " +
history.getCurrentHistoryIndex() + " instead of " +
currentArg);
}
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
break;
default:
TestContext.registerFAILED("Very strange.Executed 3 times.");
}
return;
}
}

View File

@@ -0,0 +1,144 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_getForwardList.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_getForwardList implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private int currentArg = 0;
private CurrentPage curPage = null;
private String[] pages = null;
private HistoryEntry[] forwardList = null;
private boolean result = true;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if(context.getExecutionCount()==1){
if (null != history) {
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hangs when try to load page N " + (currentArg + 1) +
" of " + pages.length);
if(currentArg!=-1){
history.setCurrentHistoryIndex(currentArg);
}else{
forwardList = history.getForwardList();
if(forwardList.length == 0){
TestContext.registerPASSED("getForwardList return correct value - empty array when list is empty");
return ;
}else{
TestContext.registerFAILED("getForwardList return incorrect value when list is empty");
return ;
}
}
}catch(Exception e) {
if(e instanceof UnimplementedException){
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
return;
}
TestContext.registerFAILED("Exception during execution: " + e.toString());
return ;
}
}else{
TestContext.registerFAILED("null history passed to test");
}
}
if(context.getExecutionCount()==2) {
try {
forwardList = history.getForwardList();
}catch(Exception e) {
if(e instanceof UnimplementedException){
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
}else{
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
return ;
}
if(forwardList==null){
if(currentArg+1==pages.length) {
TestContext.registerPASSED("getForwardList return correct value when list is empty");
return ;
}else{
TestContext.registerFAILED("getForwardList return null when list is not empty");
return ;
}
}else{
try{
if(forwardList.length == (pages.length-currentArg)){
for(int i=currentArg; i<pages.length; i++){
if(!forwardList[i-currentArg].getURL().equals(new URL(pages[i]))){
result = false;
TestContext.registerFAILED("getForwardList return incorrect value when list is not empty");
return ;
}
}
}else{
TestContext.registerFAILED("The length of forward list and real forward list is not equal!");
return ;
}
}catch(MalformedURLException e) {
TestContext.registerFAILED("Exception when constructing URL, exception is: " +e.toString());
return ;
}
if(result){
TestContext.registerPASSED("getForwardList return correct value when list is not empty");
}
}
}
}
}

View File

@@ -0,0 +1,153 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_getHistory.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_getHistory implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private int currentArg = 0;
private String[] pages = null;
public HistoryEntry[] history_arr;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
boolean result = true;
if (null == history) {
TestContext.registerFAILED("null history passed to test");
return;
}
if(context.getExecutionCount()==1){
try{
if(history.getCurrentHistoryIndex() == currentArg) {
try {
history_arr = history.getHistory();
}catch(Exception e) {
if(e instanceof UnimplementedException){
context.setDefaultResult(TestContext.UNIMPLEMENTED);
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
}else{
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
return;
}
for(int i=0; i<pages.length; i++){
try{
if(!history_arr[i].getURL().equals(new URL(pages[i]))){
result = false;
TestContext.registerFAILED("getHistory return incorrect value");
return ;
}
}catch(MalformedURLException e){
TestContext.registerFAILED("Exception when constructing URL, exception is:" + e.toString());
return ;
}
}
if(result){
TestContext.registerPASSED("getHistory return correct value");
return ;
}
}
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hangs when try to load page N " + (currentArg + 1) +
" of " + pages.length);
history.setCurrentHistoryIndex(currentArg);
}catch(Exception e){
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
if(context.getExecutionCount()==2){
try {
history_arr = history.getHistory();
}catch(Exception e) {
if(e instanceof UnimplementedException){
context.setDefaultResult(TestContext.UNIMPLEMENTED);
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
}else{
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
return;
}
if(history_arr == null){
System.out.println("The history_arr array is null!");
if(pages.length == 0){
TestContext.registerPASSED("getHistory with pages.length = 0 return correct value - null");
return ;
}else{
TestContext.registerFAILED("getHistory return null when pages.length = "+pages.length);
return ;
}
}
for(int i=0; i<pages.length; i++){
try{
if(!history_arr[i].getURL().equals(new URL(pages[i]))){
result = false;
TestContext.registerFAILED("getHistory return incorrect value");
return ;
}
}catch(MalformedURLException e){
TestContext.registerFAILED("Exception when constructing URL, exception is:" + e.toString());
return ;
}
}
if(result){
TestContext.registerPASSED("getHistory return correct value");
return ;
}
}
}
}

View File

@@ -0,0 +1,100 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_getHistoryEntry.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_getHistoryEntry implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private HistoryEntry history_entry = null;
private int currentArg = 0;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (null != history) {
//int number_of_pages;
try {
history_entry = history.getHistoryEntry(currentArg);
if(history_entry==null){
TestContext.registerPASSED("getHistoryEntry returned correct value");
}else{
if(new URL(history_entry.getURL()).equals(new URL(pages[currentArg]))){
TestContext.registerPASSED("getHistoryEntry returned correct value");
}else{
TestContext.registerFAILED("getHistoryEntry return incorrect value");
}
}
}catch(Exception e) {
if(e instanceof UnimplementedException){
TestContext.registerUNIMPLEMENTED("This method is unimplemented yet");
}
if(e instanceof org.mozilla.util.RangeException){
if(currentArg<0){
TestContext.registerPASSED("Exception occured,but the index is out of range: " +currentArg+ " Exception is: "+ e.toString());
}else{
TestContext.registerFAILED("org.mozilla.util.RangeException is thrown, but the index is: " +currentArg+ " Exception is: " + e.toString());
}
}
else{
TestContext.registerFAILED("Exception during execution: " + e.toString());
}
return;
}
} else {
TestContext.registerFAILED("null history passed to test");
}
}
}

View File

@@ -0,0 +1,79 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_getHistoryLength.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_getHistoryLength implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private int currentArg = 0;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
//this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
int number_of_pages;
try {
number_of_pages = history.getHistoryLength();
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
if(number_of_pages == pages.length){
TestContext.registerPASSED("getHistoryLength returned correct value: " + number_of_pages);
}else{
TestContext.registerFAILED("getHistoryLength return incorrect value: " + number_of_pages + " Correct value is: " + pages.length);
}
}
}

View File

@@ -0,0 +1,106 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_getURLForIndex.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_getURLForIndex implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private int currentArg = 0;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
String exceptionDuringExecution = null;
String url = null;
if ( context.failedIsRegistered() ) {
return;
}
if ( history == null) {
TestContext.registerFAILED("null history passed to test");
return;
}
try {
url = history.getURLForIndex(currentArg);
System.out.println("CurrentArg = "+currentArg+" and url = "+url);
}catch(Exception e) {
exceptionDuringExecution = e.toString();
}
if ((currentArg>=0)&&(currentArg<=pages.length)) { //If use valid index
if(exceptionDuringExecution != null) {
TestContext.registerFAILED("Exception during execution when try to get url with valid index: " +
currentArg + " :(" + exceptionDuringExecution + ")");
return;
}
try {
if ((new URL(pages[currentArg])).equals((new URL(url)))) {
TestContext.registerPASSED("Good url returned: " + url);
}else {
TestContext.registerFAILED("Wrong url: " + url + " istead of " + pages[currentArg]);
}
} catch (MalformedURLException e) {
TestContext.registerFAILED("Exception when constructing URL from: " + url +
" and " + pages[currentArg]);
}
return;
}
//If try to get invalid index
if(exceptionDuringExecution != null) {
TestContext.registerPASSED("(" + exceptionDuringExecution + ") ocurred. But index was invalid: " + currentArg);
} else {
TestContext.registerPASSED("Browser isn't crashed on invalid index: " + currentArg);
}
}
}

View File

@@ -0,0 +1,144 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* History_setCurrentHistoryIndex.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class History_setCurrentHistoryIndex implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private CurrentPage curPage = null;
private int currentArg = 0;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if(context.getExecutionCount()==1){
if(pages.length!=0) {
try {
if(currentArg<=pages.length && currentArg>=0){
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Try to call setCurrentHistoryIndex(" + currentArg +
") when history length is " + pages.length +
". But page doesn't loaded");
history.setCurrentHistoryIndex(currentArg);
}else{
context.setDefaultResult(TestContext.PASSED);
context.setDefaultComment("Try to call setCurrentHistoryIndex(" + currentArg +
") when history length is " + pages.length +
". Browser isn't crashed");
history.setCurrentHistoryIndex(currentArg);
return ;
}
}catch(Exception e) {
if(e instanceof org.mozilla.util.RangeException){
if(currentArg<0){
TestContext.registerPASSED("Exception occured,but the index is out of range: " +currentArg+ " Exception is: "+ e.toString());
}else{
TestContext.registerFAILED("org.mozilla.util.RangeException is thrown, but the index is: " +currentArg+ " Exception is: " + e.toString());
}
}else{
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
} else {
try{
context.setDefaultResult(TestContext.PASSED);
context.setDefaultComment("Try to call setCurrentHistoryIndex(" + currentArg +
") when history is empty");
history.setCurrentHistoryIndex(currentArg);
return ;
}catch(Exception e){
if(e instanceof org.mozilla.util.RangeException){
if(currentArg<0){
TestContext.registerPASSED("Exception occured,but the index is out of range: " +currentArg+ " Exception is: "+ e.toString());
}else{
TestContext.registerFAILED("org.mozilla.util.RangeException is thrown, but the index is: " +currentArg+ " Exception is: " + e.toString());
}
}else{
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
}
}
if(context.getExecutionCount()==2){
try{
curPage = (CurrentPage)browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
try{
if(new URL(curPage.getCurrentURL()).equals(new URL(pages[currentArg]))){
TestContext.registerPASSED("setCurrentHistoryIndex returned correct value");
}else{
TestContext.registerFAILED("setCurrentHistoryIndex return incorrect value");
}
}catch(MalformedURLException e) {
TestContext.registerFAILED("Exception when constructing URL from: " + curPage.getCurrentURL() +
" and " + pages[currentArg]);
}
}catch(Exception e){
if(e instanceof org.mozilla.util.RangeException){
if(currentArg<0){
TestContext.registerPASSED("Exception occured,but the index is out of range: " +currentArg+ " Exception is: "+ e.toString());
}else{
TestContext.registerFAILED("org.mozilla.util.RangeException is thrown, but the index is: " +currentArg+ " Exception is: " + e.toString());
}
}else{
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
}
}
}
}

View File

@@ -0,0 +1,177 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* Navigation_loadFromStream.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.io.InputStream;
import java.util.Properties;
import java.io.ByteArrayInputStream;
import java.net.URL;
import java.net.MalformedURLException;
public class Navigation_loadFromStream implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private int currentArg = 0;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
InputStream is = null;
String contentType = "text/html";
String uri = "www.sun.com";
int contentLength = -1;
Properties props = null;
byte[] buf = {'1','2','3','4','5'};
System.out.println("Navigation_loadFromStream. Execution count is " + context.getExecutionCount());
if (navigation == null) {
TestContext.registerFAILED("Navigation is null at execution stage");
return;
}
if(context.getExecutionCount() > 1) {
TestContext.registerPASSED("Browser doesn't crashed, some data loaded");
return;
}
switch (currentArg) {
case 0:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hang up when try to call loadFromStream with null stream");
navigation.loadFromStream(is,uri,contentType,contentLength,props);
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed when try to invoke loadFromStream with null stream (exception): " + e.toString());
return;
};
break;
case 1:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hung up when try to invoke loadFromStream with null ContentType");
contentType=null;
is = new ByteArrayInputStream(buf);
navigation.loadFromStream(is,uri,contentType,contentLength,props);
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed when try to invoke loadFromStream with null contentType (exception): " + e.toString());
return;
};
break;
case 2:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hung up when try to invoke loadFromStream with null uri");
uri=null;
is = new ByteArrayInputStream(buf);
navigation.loadFromStream(is,uri,contentType,contentLength,props);
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed when try to invoke loadFromStream with null URI (exception): " + e.toString());
return;
};
break;
case 3:
//Valid usage ...
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hung up when try to invoke loadFromStream with valid parameters");
uri="file://dummy_test_data";
is = new ByteArrayInputStream(buf);
navigation.loadFromStream(is,uri,contentType,contentLength,props);
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Method throw exception: " + e.toString());
return;
};
break;
case 4:
//Valid usage ...
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("Hung up when try to invoke loadFromStream with empty properties");
props = new Properties();
uri="file://dummy_test_data";
is = new ByteArrayInputStream(buf);
navigation.loadFromStream(is,uri,contentType,contentLength,props);
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Method throw exception: " + e.toString());
return;
};
break;
};
return;
}
}

View File

@@ -0,0 +1,115 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* Navigation_loadURL_1.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class Navigation_loadURL_1 implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private int currentArg = 0;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
//if (context.getExecutionCount()!=2) return;
String host;
if (null != navigation) {
switch (currentArg) {
case 0:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to load null URL");
host=null;
navigation.loadURL(host);
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed (exception): " + e.toString());
return;
};
break;
case 1:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to load empty URL");
host="";
navigation.loadURL(host);
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
break;
};
TestContext.registerPASSED("Browser doesn't crashed");
return;
} }
}

View File

@@ -0,0 +1,129 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* Navigation_loadURL_2.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class Navigation_loadURL_2 implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private String currentArg = null;
private String[] pages = null;
private boolean loading = false;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (null != navigation) {
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken().trim());
String host1=st.nextToken().trim();
String host2=st.nextToken().trim();
if (!host2.equals("null")) {
if (!loading) {
navigation.loadURL(host2);
System.out.println("LOAD");
loading=true;
}
if (num!=2) if (context.getExecutionCount()!=2) return;
}
switch (num) {
case 0:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to load URL: "+host1);
navigation.loadURL(host1);
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
break;
case 1:
case 2:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to load URL when another URL is loading or loaded");
navigation.loadURL(host1);
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
break;
};
TestContext.registerPASSED("Browser doesn't crashed");
return;
} }
}

View File

@@ -0,0 +1,100 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* Navigation_loadURL_3.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class Navigation_loadURL_3 implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private String currentArg = null;
private String[] pages = null;
private boolean loading = false;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (null != navigation) {
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken().trim());
String host=st.nextToken().trim();
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to load URL with protocol:URL= "+host);
if (!loading) {
try{
navigation.loadURL(host);
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception: "+e);
}
System.out.println("LOAD");
loading=true;
}
if (num!=3) if (context.getExecutionCount()!=2) return;
TestContext.registerPASSED("Browser doesn't crashed");
return;
} }
}

View File

@@ -0,0 +1,127 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* Navigation_refresh_1.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class Navigation_refresh_1 implements Test, TestDocLoadListener
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private String currentArg = null;
private String[] pages = null;
private boolean loading, loaded = false;
private int first, second=0;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
context.setDocLoadListener(this);
return true;
}
public void eventDispatched(DocumentLoadEvent event)
{
if (event.getType()==4) {
first++;
execute();
}
if (event.getType()==1) {
second++;
execute();
}
}
public void execute() {
System.out.println("first="+first+" second="+second);
if (null != navigation) {
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken().trim());
String host=st.nextToken().trim();
String host2=st.nextToken().trim();
if (!host.equals("null")) {
if (!loading) {
navigation.loadURL(host);
System.out.println("LOAD");
loading=true;
}
if (first!=1) return;
//if (context.getExecutionCount()!=2) return;
}
if ((num==1)&&(!loaded)) {loaded=true; navigation.loadURL(host2);}
if ((num==1)&&(second!=1)) return;
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to refresh URL");
navigation.refresh(0);
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
TestContext.registerPASSED("Browser doesn't crashed");
return;
} }
}

View File

@@ -0,0 +1,109 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* Navigation_refresh_2.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.io.*;
public class Navigation_refresh_2 implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private String currentArg = null;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (context.getExecutionCount()>1) return;
if (null != navigation) {
StringTokenizer st=new StringTokenizer(currentArg,",");
long flags=java.lang.Long.parseLong(st.nextToken().trim());
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to refresh URL");
/*File f=new File("d:\\blackwood\\webclient\\automated\\html\\test\\basic\\bastest1.html");
File f2=new File("d:\\blackwood\\webclient\\automated\\html\\test\\basic\\old");
f.renameTo(f2));
File f3=new File("d:\\blackwood\\webclient\\automated\\html\\test\\basic\\bastest1.html");
File f1=new File("d:\\blackwood\\webclient\\automated\\html\\test\\basic\\bastest2.html");
f1.renameTo(f3);
*/
navigation.refresh(flags);
/*if (context.getExecutionCount()==1){
f3.renameTo(f1);
f2.renameTo(f);
}*/
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
if ((e instanceof org.mozilla.util.RangeException)||(flags<0))
TestContext.registerPASSED("Incorrect flags raises exception: " + e.toString());}
TestContext.registerPASSED("Browser doesn't crashed");
return;
} }
}

View File

@@ -0,0 +1,132 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* Navigation_stop.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
public class Navigation_stop implements Test, TestDocLoadListener
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private Navigation navigation = null;
private String currentArg = null;
private String[] pages = null;
private boolean loading, loaded = false;
private int first, second=0;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
context.setDocLoadListener(this);
return true;
}
public void eventDispatched(DocumentLoadEvent event)
{
if (event.getType()==4) {
first++;
execute();
}
if (event.getType()==1) {
second++;
execute();
}
}
public void execute() {
if (null != navigation) {
StringTokenizer st=new StringTokenizer(currentArg,",");
int num=java.lang.Integer.parseInt(st.nextToken());
String host=st.nextToken().trim();
String host2=st.nextToken().trim();
if (!host.equals("null")) {
if (!loading) {
navigation.loadURL(host);
System.out.println("LOAD");
loading=true;
}
if (first!=1) return;
// if (num!=2) if (context.getExecutionCount()!=2) return;
}
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to stop URL loading");
if ((num==2)&&(!loaded)) {loaded=true; navigation.loadURL(host2);}
if ((num==2)&&(second!=1)) return;
try {
navigation.stop();
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
TestContext.registerPASSED("Browser doesn't crashed");
/* System.out.println();
System.out.println("----------HISTORY----------");
for(int i=0;i<history.getHistoryLength();i++)
System.out.println(history.getURLForIndex(i));
System.out.println("------END OF HISTORY-----");
System.out.println();
*/
return;
} }
}

View File

@@ -0,0 +1,98 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* WindowControl_createWindow.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.awt.Rectangle;
import java.awt.Frame;
import java.awt.Container;
import java.awt.Component;
import java.net.MalformedURLException;
public class WindowControl_createWindow implements Test
{
public static String PARAM_SEPARATOR="|";
private TestContext context = null;
private BrowserControl browserControl = null;
private WindowControl windowControl = null;
private int nativeWS = 0;
private Rectangle coords;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
String arguments = context.getCurrentTestArguments().trim();
StringTokenizer st = new StringTokenizer(arguments,PARAM_SEPARATOR);
int[] coord = new int[st.countTokens()-1];
try {
windowControl = (WindowControl)
browserControl.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
if (st.nextToken().equals("well")) {
nativeWS = windowControl.getNativeWebShell();
} else {
nativeWS = (new Integer(st.nextToken())).intValue();
}
String fCoord = st.nextToken();
if (fCoord.equals("null")) {
this.coords=null;
}else {
coord[0] = (new Integer(fCoord)).intValue();
for(int i=1;st.hasMoreTokens();i++) {
coord[i] = (new Integer(st.nextToken())).intValue();
}
this.coords = new Rectangle(coord[0],coord[1],coord[2],coord[3]);
}
return true;
}
public void execute() {
if (null != windowControl) {
try {
windowControl.createWindow(nativeWS,coords);
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
TestContext.registerPASSED("Browser isn't crashed .. MBI");
return;
} else {
TestContext.registerFAILED("null WindowControl passed to test");
}
}
}

View File

@@ -0,0 +1,84 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* WindowControl_getNativeWebShell.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.awt.Rectangle;
import java.awt.Frame;
import java.awt.Container;
import java.awt.Component;
import java.net.MalformedURLException;
public class WindowControl_getNativeWebShell implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private WindowControl windowControl = null;
private int nativeWS = 0;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
try {
windowControl = (WindowControl)
browserControl.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (null != windowControl) {
try {
nativeWS = windowControl.getNativeWebShell();
}catch(Exception e) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
}
if (nativeWS == 0) {
TestContext.registerFAILED("null WebShell returned");
}else {
TestContext.registerPASSED("Browser isn't crashed on correct call ..MBI?\n" +
"WebShell point is " + nativeWS);
}
return;
} else {
TestContext.registerFAILED("null WindowControl passed to test");
}
}
}

View File

@@ -0,0 +1,108 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* WindowControl_moveWindowTo.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.awt.Rectangle;
import java.awt.Frame;
import java.awt.Container;
import java.awt.Component;
import java.net.MalformedURLException;
public class WindowControl_moveWindowTo implements Test
{
public static String COORD_SEPARATOR=",";
private TestContext context = null;
private BrowserControl browserControl = null;
private WindowControl windowControl = null;
private boolean goodCase = false;
private int x = 0;
private int y = 0;
private Frame tw = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.tw = context.getTestWindow();
String arguments = context.getCurrentTestArguments().trim();
StringTokenizer st = new StringTokenizer(arguments,COORD_SEPARATOR);
if (st.countTokens() != 2) {
TestContext.registerFAILED("Bad test arguments: " + arguments);
return false;
}
x = (new Integer(st.nextToken())).intValue();
y = (new Integer(st.nextToken())).intValue();
Rectangle bounds = tw.getBounds();
if((x>=0)&&(y>=0)&&(y<=bounds.height)&&(x<=bounds.width)) {
goodCase = true;
}
try {
windowControl = (WindowControl)
browserControl.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (null != windowControl) {
String url = null;
try {
windowControl.moveWindowTo(x,y);
}catch(Exception e) {
if (goodCase) {
TestContext.registerFAILED("Exception in legal case: " + e.toString() +
"\n x = " + x + " y = " + y);
} else {
TestContext.registerPASSED("Exception ocurred x = " + x + " y = " + y);
}
return;
}
if (goodCase) {
TestContext.registerPASSED("Browser isn't crashed on correct call ..MBI" +
" x = " + x + " y = " + y);
}else {
TestContext.registerPASSED("Browser isn't crashed on incorrect call" +
" x = " + x + " y = " + y);
}
return;
} else {
TestContext.registerFAILED("null WindowControl passed to test");
}
}
}

View File

@@ -0,0 +1,104 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.api;
/*
* WindowControl_setBounds.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.awt.Rectangle;
import java.awt.Frame;
import java.awt.Container;
import java.awt.Component;
import java.net.MalformedURLException;
public class WindowControl_setBounds implements Test
{
public static String COORD_SEPARATOR="|";
private TestContext context = null;
private BrowserControl browserControl = null;
private WindowControl windowControl = null;
private Rectangle currentArg = null;
private String[] pages = null;
private Frame tw = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.tw = context.getTestWindow();
String arguments = context.getCurrentTestArguments().trim();
if (arguments.equals("null")) {
this.currentArg = null;
} else {
StringTokenizer st = new StringTokenizer(arguments,COORD_SEPARATOR);
if (st.countTokens() != 4) {
TestContext.registerFAILED("Bad test arguments: " + arguments);
return false;
}
int[] coord = new int[st.countTokens()];
for(int i=0;st.hasMoreTokens();i++) {
coord[i] = (new Integer(st.nextToken())).intValue();
}
this.currentArg = new Rectangle(coord[0],coord[1],coord[2],coord[3]);
}
try {
windowControl = (WindowControl)
browserControl.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (null != windowControl) {
String url = null;
try {
windowControl.setBounds(currentArg);
}catch(Exception e) {
if (currentArg != null) {
TestContext.registerFAILED("Exception during execution: " + e.toString());
} else {
TestContext.registerPASSED("Exception ocurred, when null Rectangle.\n"+
"But browser isn't crashed");
}
return;
}
TestContext.registerPASSED("Browser isn't crashed on correct call ..MBI");
} else {
TestContext.registerFAILED("null WindowControl passed to test");
}
}
}

View File

@@ -0,0 +1,128 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.mixed;
/*
* CurrentPage_findInPage_2.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.Toolkit;
public class CurrentPage_findInPage_2 implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private CurrentPage curPage = null;
private String currentArg = null;
private String[] pages = null;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
curPage = (CurrentPage)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (curPage==null) return;
String findMe=null;
Boolean forw, mCase;
String fromClip=null;
int num=0;
Clipboard clip=java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
StringTokenizer st=new StringTokenizer(currentArg,",");
num=java.lang.Integer.parseInt(st.nextToken().trim());
findMe=st.nextToken();
forw=new Boolean(st.nextToken().trim());
mCase=new Boolean(st.nextToken().trim());
//System.out.println("1="+findMe+" 2="+forw.booleanValue()+" 3="+mCase.booleanValue());
try{
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to find string: "+findMe);
switch (num) {
case 0:context.setDescription("If second word is selected press PASSED button, otherwise press FAILED button");break;
case 1:context.setDescription("If first word is selected press PASSED button, otherwise press FAILED button");break;
case 2:context.setDescription("If fourth word is selected press PASSED button, otherwise press FAILED button");break;
case 3:context.setDescription("If fifth word is selected press PASSED button, otherwise press FAILED button");break;
}
curPage.findInPage(findMe, forw.booleanValue(), mCase.booleanValue());
/* if (mCase.booleanValue()) {
if (fromClip.equals("Html")) {
TestContext.registerPASSED("Right result for findInPage() method");
return;
} else TestContext.registerFAILED("Bad result for findInPage() method");
} else {
if (fromClip.equals("html")) {
TestContext.registerPASSED("Right result for findInPage() method");
return;
};
};
*/
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
// TestContext.registerPASSED("Browser doesn't crashed with FindInPage value="+findMe);
return;
}
}

View File

@@ -0,0 +1,160 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.mixed;
/*
* CurrentPage_findNextInPage.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.Toolkit;
public class CurrentPage_findNextInPage implements Test
{
private TestContext context = null;
private BrowserControl browserControl = null;
private History history = null;
private CurrentPage curPage = null;
private int currentArg = 0;
private String[] pages = null;
private boolean loading = false;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
try {
curPage = (CurrentPage)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void execute() {
if (curPage==null) return;
Clipboard clip=java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
String findMe=null;
switch (currentArg) {
case 0:
try{
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to find next string");
context.setDescription("If second word is selected press PASSED button, otherwise press FAILED button");
curPage.findInPage("html", true, true);
curPage.findNextInPage();
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
break;
case 1:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to find next string");
context.setDescription("If first word is selected press PASSED button, otherwise press FAILED button.Correction required corresponding to API changes");
curPage.findInPage("html", true, true);
curPage.findNextInPage();
curPage.findNextInPage();
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
break;
case 2:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to find string without URL");
context.setDescription("If nothing is selected press PASSED button, otherwise press FAILED button");
curPage.findNextInPage();
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerPASSED("Browser doesn't crashed without previous find (exception): "+e);
return;
};
break;
case 3:
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to find next string at the end of page");
context.setDescription("If second word is selected press PASSED button, otherwise press FAILED button");
curPage.findInPage("html",true,true);
curPage.findNextInPage();
curPage.findNextInPage();
}catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution: " + e.toString());
return;
};
break;
};
// TestContext.registerPASSED("Browser doesn't crashed with findNextInPage()");
return;
}
}

View File

@@ -0,0 +1,148 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.mixed;
/*
* EventRegistration_addMouseListener_1.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.event.*;
import java.awt.*;
public class EventRegistration_addMouseListener_1 implements Test, MouseListener, DocumentLoadListener
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Navigation navigation = null;
private EventRegistration eventReg = null;
private String currentArg = null;
private String[] pages = null;
private int num = 666;
private String url = null;
private String docEvent = null;
private boolean loading = false;
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
eventReg = (EventRegistration)
browserControl.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
context.setDescription("1. Move your mouse out of window.\n 2. Then Click your mouse in the center of window. \n 3. Then double click in the center of window. \n4. And after that you can press CONTINUE button.");
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
/***************************************************************/
public void mouseClicked(java.awt.event.MouseEvent e)
{
if (num==2) TestContext.registerPASSED("Right MOUSE_CLICK_EVENT_MASK event");
if (num==3) TestContext.registerPASSED("Right MOUSE_DOUBLE_CLICK_EVENT_MASK event");
}
public void mouseEntered(java.awt.event.MouseEvent e)
{
if (num==4) TestContext.registerPASSED("Right MOUSE_OVER_EVENT_MASK event");
}
public void mousePressed(java.awt.event.MouseEvent e)
{
if (num==0) context.registerPASSED("Right MOUSE_DOWN_EVENT_MASK event");
}
public void mouseExited(java.awt.event.MouseEvent e)
{
if (num==5) TestContext.registerPASSED("Right MOUSE_OUT_EVENT_MASK event");
}
public void mouseReleased(java.awt.event.MouseEvent e)
{
if (num==1) TestContext.registerPASSED("Right MOUSE_UP_EVENT_MASK event");
}
/****************************************************************/
public void eventDispatched(WebclientEvent event)
{
System.out.println("EVENT="+event.getType());
if (event instanceof DocumentLoadEvent)
if (event.getType() == DocumentLoadEvent.END_DOCUMENT_LOAD_EVENT_MASK)
{
context.increaseExecutionCount();
execute();
};
}
public void execute() {
if (eventReg==null) return;
StringTokenizer st=new StringTokenizer(currentArg,",");
num=java.lang.Integer.parseInt(st.nextToken().trim());
docEvent=st.nextToken().trim();
url=st.nextToken().trim();
try {
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are waiting for MOUSE events ...");
eventReg.addMouseListener(this);
eventReg.addDocumentLoadListener(this);
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (context.getExecutionCount()!=2) return;
}
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else
TestContext.registerFAILED("Exception during execution : "+e.toString());
return;
};
}
}

View File

@@ -0,0 +1,233 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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):
* Client QA Team, St. Petersburg, Russia
*/
package org.mozilla.webclient.test.basic.mixed;
/*
* EventRegistration_addMouseListener_2.java
*/
import org.mozilla.webclient.test.basic.*;
import org.mozilla.webclient.*;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.datatransfer.*;
import java.awt.event.*;
public class EventRegistration_addMouseListener_2 implements Test, DocumentLoadListener, MouseListener
{
private TestContext context = null;
private BrowserControl browserControl = null;
private Navigation navigation = null;
private EventRegistration eventReg = null;
private String currentArg = null;
private String[] pages = null;
private CurrentPage curPage = null;
private int num = 666;
protected int clicks=0;
private String url = null;
private String docEvent = null;
private boolean loading = false;
protected static String sequence = "";
public boolean initialize(TestContext context) {
this.context = context;
this.browserControl = context.getBrowserControl();
this.pages = context.getPagesToLoad();
// this.currentArg = (new Integer(context.getCurrentTestArguments())).intValue();
this.currentArg = context.getCurrentTestArguments();
try {
eventReg = (EventRegistration)
browserControl.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME);
navigation = (Navigation)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
eventReg.addDocumentLoadListener(this);
context.setDescription("1. Click !ONCE! in the center of window.\n2. Then press CONTINUE button.");
}catch (Exception e) {
TestContext.registerFAILED("Exception: " + e.toString());
return false;
}
return true;
}
public void eventDispatched(WebclientEvent event)
{
if (event instanceof DocumentLoadEvent)
if (event.getType() == DocumentLoadEvent.END_DOCUMENT_LOAD_EVENT_MASK)
{
context.increaseExecutionCount();
execute();
};
}
/***************************************************************/
public void mouseClicked(java.awt.event.MouseEvent e)
{
clicks++;
if (num==1) if (clicks!=1) TestContext.registerFAILED("Bad events number "+clicks);
else TestContext.registerPASSED("Right events number");
sequence+="a";
// if (num==2) if (sequence.equals("cba")) TestContext.registerPASSED("Right sequence of events: "+sequence);
// else TestContext.registerFAILED("Bad sequence of events: "+sequence);
}
public void mouseEntered(java.awt.event.MouseEvent e)
{
}
public void mousePressed(java.awt.event.MouseEvent e)
{
}
public void mouseExited(java.awt.event.MouseEvent e)
{
}
public void mouseReleased(java.awt.event.MouseEvent e)
{
}
/****************************************************************/
public void result()
{
System.out.println("clicks="+clicks);
if (clicks!=1) TestContext.registerFAILED("Bad events number "+clicks);
else TestContext.registerPASSED("Right events number");
}
public void execute() {
if (eventReg==null) return;
StringTokenizer st=new StringTokenizer(currentArg,",");
num=java.lang.Integer.parseInt(st.nextToken().trim());
String url=st.nextToken().trim();
try {
switch (num) {
case 0:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to register null MouseListener");
eventReg.addMouseListener(null);
break;
case 1:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to register several same MouseListeners");
eventReg.addMouseListener(this);
eventReg.addMouseListener(this);
eventReg.addMouseListener(this);
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (context.getExecutionCount()!=2) return;
}
break;
case 2:
context.setDefaultResult(TestContext.FAILED);
context.setDefaultComment("We are trying to register several different MouseListeners");
eventReg.addMouseListener(this);
eventReg.addMouseListener(new ER3());
eventReg.addMouseListener(new ER4());
if (!url.equals("null")) {
if (!loading) {
navigation.loadURL(url);
System.out.println("LOAD");
loading=true;
}
if (context.getExecutionCount()!=2) return;
}
break;
}
} catch(Exception e) {
if(e instanceof UnimplementedException)
TestContext.registerUNIMPLEMENTED("This method doesn't implemented");
else if (num==0) TestContext.registerPASSED("Browser doesn't crashed (exception): "+e.toString());
else TestContext.registerFAILED("Exception during execution : "+e.toString());
return;
};
}
}
class ER3 implements MouseListener
{
/***************************************************************/
public void mouseClicked(java.awt.event.MouseEvent e)
{
EventRegistration_addMouseListener_2.sequence+="b";
}
public void mouseEntered(java.awt.event.MouseEvent e)
{
}
public void mousePressed(java.awt.event.MouseEvent e)
{
}
public void mouseExited(java.awt.event.MouseEvent e)
{
}
public void mouseReleased(java.awt.event.MouseEvent e)
{
}
/****************************************************************/
}
class ER4 implements MouseListener
{
/***************************************************************/
public void mouseClicked(java.awt.event.MouseEvent e)
{
EventRegistration_addMouseListener_2.sequence+="c";
if (EventRegistration_addMouseListener_2.sequence.equals("cba")) TestContext.registerPASSED("Events passed to right listener");
else TestContext.registerFAILED("Events passed to bad listener");
}
public void mouseEntered(java.awt.event.MouseEvent e)
{
}
public void mousePressed(java.awt.event.MouseEvent e)
{
}
public void mouseExited(java.awt.event.MouseEvent e)
{
}
public void mouseReleased(java.awt.event.MouseEvent e)
{
}
/****************************************************************/
}

Some files were not shown because too many files have changed in this diff Show More