mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 11:27:49 +00:00
Make Webclient compile and run on GNU/Linux with Mozilla 1.0.1.
Continue migration to ant. Start out some JUnit tests.
This commit is contained in:
parent
7c8eb9e9d2
commit
2b845fdeaf
@ -1 +1,2 @@
|
||||
debug.jvm.args=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
|
||||
build.unix.classes=true
|
||||
|
86
java/build.xml
Normal file
86
java/build.xml
Normal file
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
|
||||
* Ed Burns >edburns@acm.org<
|
||||
|
||||
|
||||
-->
|
||||
|
||||
<project name="java.supplement" default="main" basedir=".">
|
||||
|
||||
<property name="Name" value="java.supplement"/>
|
||||
<property name="name" value="java.supplement"/>
|
||||
<property name="version" value="20020930"/>
|
||||
|
||||
<!-- ************ Per user local properties ******************************* -->
|
||||
|
||||
<property file="${user.home}/build.properties"/> <!-- User local -->
|
||||
<property file="build.properties"/> <!-- Component local -->
|
||||
<property environment="myenv" />
|
||||
|
||||
<!-- ************ Compiler Defaults *************************************** -->
|
||||
|
||||
<!-- Should Java compilations set the 'debug' compiler option? -->
|
||||
<property name="compile.debug" value="true"/>
|
||||
|
||||
<!-- Should Java compilations set the 'deprecation' compiler option? -->
|
||||
<property name="compile.deprecation" value="false"/>
|
||||
|
||||
<!-- Should Java compilations set the 'optimize' compiler option? -->
|
||||
<property name="compile.optimize" value="false"/>
|
||||
|
||||
<!-- The base directory for compilation targets -->
|
||||
<property name="dist.home" value="${myenv.MOZILLA_FIVE_HOME}/.."/>
|
||||
|
||||
<!-- The base directory for compilation targets -->
|
||||
<property name="build.home" value="${myenv.MOZILLA_FIVE_HOME}/../classes"/>
|
||||
|
||||
<!-- ************ Where are we building into? ***************************** -->
|
||||
|
||||
<target name="main"
|
||||
depends="external,util"/>
|
||||
|
||||
<target name="external">
|
||||
|
||||
<mkdir dir="${build.home}"/>
|
||||
|
||||
<unjar src="${basedir}/external/dom2.jar"
|
||||
dest="${build.home}" />
|
||||
|
||||
</target>
|
||||
|
||||
<target name="util">
|
||||
|
||||
<ant dir="${basedir}/util"/>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
|
||||
<delete dir="${build.home}/org/w3c"/>
|
||||
|
||||
<ant dir="${basedir}/util" target="clean"/>
|
||||
|
||||
</target>
|
||||
|
||||
</project>
|
@ -46,7 +46,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_DOMAccessor_register
|
||||
("DOMAccessor::register: QueryInterface(nsIWebProgressService) failed: %x\n",
|
||||
rv));
|
||||
} else {
|
||||
rv = webProgressService->AddProgressListener((nsIWebProgressListener*)javaDOM);
|
||||
rv = webProgressService->AddProgressListener((nsIWebProgressListener*)javaDOM, nsIWebProgress::NOTIFY_ALL);
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("DOMAccessor::register: AddObserver(JavaDOM) failed x\n",
|
||||
|
@ -1021,15 +1021,13 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_NodeImpl_setNodeValue
|
||||
OMDNI_QUERY_AND_CALL(node, SetValue, *value)
|
||||
if (input) {
|
||||
nsAutoString typeStr;
|
||||
nsString empty;
|
||||
nsString val;
|
||||
|
||||
if (NS_SUCCEEDED(rv = input->GetType(typeStr))) {
|
||||
if (0 == typeStr.CompareWithConversion("radio", PR_TRUE) ||
|
||||
0 == typeStr.CompareWithConversion("checkbox", PR_TRUE)) {
|
||||
empty.AssignWithConversion("");
|
||||
val = *value;
|
||||
if (0 == empty.CompareWithConversion(val)) {
|
||||
if (0 == val.Length()) {
|
||||
input->SetChecked(PR_FALSE);
|
||||
}
|
||||
else {
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "prlog.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include"nsIDOMEvent.h"
|
||||
#include"nsIDOMNSEvent.h"
|
||||
|
@ -43,7 +43,7 @@ class nsIJavaDOM : public nsIWebProgressListener {
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IJAVADOM_IID)
|
||||
|
||||
NS_IMETHOD OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest,
|
||||
PRInt32 aStateFlags, PRUint32 aStatus) = 0;
|
||||
PRUint32 aStateFlags, PRUint32 aStatus) = 0;
|
||||
|
||||
NS_IMETHOD OnProgressChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, PRInt32 aCurSelfProgress,
|
||||
@ -58,7 +58,7 @@ class nsIJavaDOM : public nsIWebProgressListener {
|
||||
nsresult aStatus, const PRUnichar *aMessage) = 0;
|
||||
|
||||
NS_IMETHOD OnSecurityChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, PRInt32 state) = 0;
|
||||
nsIRequest *aRequest, PRUint32 state) = 0;
|
||||
|
||||
|
||||
NS_IMETHOD HandleUnknownContentType(nsIDocumentLoader* loader,
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#if defined(DEBUG)
|
||||
#include <stdio.h>
|
||||
@ -216,7 +217,7 @@ nsresult nsJavaDOMImpl::GetDocument(nsIWebProgress* aWebProgress,
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> domWin;
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
nsresult rv;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (nsnull == aResult) {
|
||||
@ -236,7 +237,7 @@ nsresult nsJavaDOMImpl::GetDocument(nsIWebProgress* aWebProgress,
|
||||
fprintf(stderr,
|
||||
"nsJavaDOMImpl::GetDocument: failed: "
|
||||
"webProgress=%x, domWin=%x, domDoc=%x, "
|
||||
"error=%x\n",
|
||||
"error=%d\n",
|
||||
aWebProgress,
|
||||
domWin.get(),
|
||||
domDoc.get(),
|
||||
@ -250,18 +251,20 @@ nsresult nsJavaDOMImpl::GetDocument(nsIWebProgress* aWebProgress,
|
||||
|
||||
NS_IMETHODIMP nsJavaDOMImpl::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 aStateFlags,
|
||||
PRUint32 aStateFlags,
|
||||
PRUint32 aStatus)
|
||||
{
|
||||
nsXPIDLString name;
|
||||
nsresult rv;
|
||||
nsCAutoString name;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (NS_FAILED(rv = aRequest->GetName(getter_Copies(name)))) {
|
||||
if (NS_FAILED(rv = aRequest->GetName(name))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAutoString uname;
|
||||
uname.AssignWithConversion(name.get());
|
||||
|
||||
if ((aStateFlags & STATE_START) && (aStateFlags & STATE_IS_DOCUMENT)) {
|
||||
doStartDocumentLoad(name.get());
|
||||
doStartDocumentLoad(uname.get());
|
||||
}
|
||||
if ((aStateFlags & STATE_STOP) && (aStateFlags & STATE_IS_DOCUMENT)) {
|
||||
doEndDocumentLoad(aWebProgress, aRequest, aStatus);
|
||||
@ -278,7 +281,7 @@ NS_IMETHODIMP nsJavaDOMImpl::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
|
||||
NS_IMETHODIMP nsJavaDOMImpl::OnSecurityChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 state)
|
||||
PRUint32 state)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@ -459,12 +462,12 @@ NS_IMETHODIMP nsJavaDOMImpl::doStartURLLoad(nsIWebProgress *aWebProgress,
|
||||
nsMemory::Free(urlSpec);
|
||||
if (!jURL) return NS_ERROR_FAILURE;
|
||||
|
||||
char* contentType = (char*) "";
|
||||
nsCAutoString contentType("");
|
||||
if (channel)
|
||||
channel->GetContentType(&contentType);
|
||||
if (!contentType)
|
||||
channel->GetContentType(contentType);
|
||||
if (!contentType.Length())
|
||||
contentType = (char*) "";
|
||||
jstring jContentType = env->NewStringUTF(contentType);
|
||||
jstring jContentType = env->NewStringUTF(contentType.get());
|
||||
if (!jContentType) return NS_ERROR_FAILURE;
|
||||
|
||||
env->CallStaticVoidMethod(domAccessorClass,
|
||||
|
90
java/util/build.xml
Normal file
90
java/util/build.xml
Normal file
@ -0,0 +1,90 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
|
||||
* Ed Burns >edburns@acm.org<
|
||||
|
||||
|
||||
-->
|
||||
|
||||
<project name="mozilla.util" default="main" basedir=".">
|
||||
|
||||
<property name="Name" value="mozilla.util"/>
|
||||
<property name="name" value="mozilla.util"/>
|
||||
<property name="version" value="20020930"/>
|
||||
|
||||
<!-- ************ Per user local properties ******************************* -->
|
||||
|
||||
<property file="${user.home}/build.properties"/> <!-- User local -->
|
||||
<property file="build.properties"/> <!-- Component local -->
|
||||
<property file="../build.properties"/> <!-- java-supplement local -->
|
||||
<property environment="myenv" />
|
||||
|
||||
<!-- ************ Compiler Defaults *************************************** -->
|
||||
|
||||
<!-- Should Java compilations set the 'debug' compiler option? -->
|
||||
<property name="compile.debug" value="true"/>
|
||||
|
||||
<!-- Should Java compilations set the 'deprecation' compiler option? -->
|
||||
<property name="compile.deprecation" value="false"/>
|
||||
|
||||
<!-- Should Java compilations set the 'optimize' compiler option? -->
|
||||
<property name="compile.optimize" value="false"/>
|
||||
|
||||
<!-- ************ Where are we building into? ***************************** -->
|
||||
|
||||
<!-- The base directory for compilation targets -->
|
||||
<property name="dist.home" value="${myenv.MOZILLA_FIVE_HOME}/.."/>
|
||||
|
||||
<!-- The base directory for compilation targets -->
|
||||
<property name="build.home" value="${myenv.MOZILLA_FIVE_HOME}/../classes"/>
|
||||
|
||||
<!-- The base directory for component sources -->
|
||||
<property name="source.home" value="${basedir}/classes"/>
|
||||
|
||||
<!-- Construct compile classpath -->
|
||||
<path id="compile.classpath">
|
||||
<pathelement location="${build.home}/classes"/>
|
||||
</path>
|
||||
|
||||
<target name="main"
|
||||
depends="compile.classes"/>
|
||||
|
||||
<target name="compile.classes">
|
||||
|
||||
<javac destdir="${build.home}"
|
||||
debug="${compile.debug}"
|
||||
deprecation="${compile.deprecation}"
|
||||
optimize="${compile.optimize}">
|
||||
<classpath refid="compile.classpath"/>
|
||||
<src path="${source.home}"/>
|
||||
</javac>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
|
||||
<delete dir="${build.home}/org/mozilla/util"/>
|
||||
|
||||
</target>
|
||||
|
||||
</project>
|
@ -25,7 +25,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||
#// DIRS - There are subdirectories to process
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DIRS= classes_spec src_share src_moz
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
@ -34,3 +33,11 @@ DIRS= classes_spec src_share src_moz
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
clobber_all:: clean
|
||||
|
||||
clean::
|
||||
ant clean
|
||||
|
||||
libs::
|
||||
ant
|
||||
|
142
java/webclient/build-tests.xml
Normal file
142
java/webclient/build-tests.xml
Normal file
@ -0,0 +1,142 @@
|
||||
<!--
|
||||
Copyright 2002 Sun Microsystems, Inc. All rights reserved.
|
||||
SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
-->
|
||||
|
||||
<project name="Webclient Unit Tests" default="test.local" basedir=".">
|
||||
|
||||
<!--
|
||||
This is a generic build.xml file for Ant that is used to run the
|
||||
Webclient unit tests. This build file *must* be called from the
|
||||
build.xml file in order to inherit most of it's needed properties
|
||||
(See below for the list of these properties).
|
||||
-->
|
||||
|
||||
<!-- ========== Prerequisite Properties =================================== -->
|
||||
|
||||
|
||||
<!--
|
||||
These properties MUST be set on the "ant" command line, the "antrc"
|
||||
properties file in your home directory, or from settings in a superior
|
||||
build.xml script.
|
||||
|
||||
build.home Base directory into which we are building
|
||||
the Struts components.
|
||||
|
||||
servlet.jar The servlet jar (either 2.2 or 2.3)
|
||||
|
||||
cactus.jar The Cactus jar (either for Servlet API
|
||||
2.2 or 2.3)
|
||||
|
||||
cactus.ant.jar The Cactus custom Ant tasks jar
|
||||
|
||||
httpclient.jar The Cactus httpclient jar
|
||||
|
||||
junit.jar The JUnit jar
|
||||
|
||||
tomcat.home The home directory of where Tomcat 4.0
|
||||
is installed
|
||||
|
||||
compile.debug The debug mode for compilation
|
||||
|
||||
compile.deprecation The deprecation mode for compilation
|
||||
|
||||
compile.optimize The optimization mode for compilation
|
||||
|
||||
src.dir The location of the source directory
|
||||
|
||||
app.name The name of the Struts jar (without the
|
||||
'.jar' suffix
|
||||
|
||||
-->
|
||||
|
||||
<!-- ========== Initialization Properties ================================= -->
|
||||
|
||||
<!-- ========== Derived Properties ======================================== -->
|
||||
|
||||
<!--
|
||||
These property values are derived from values defined above, and
|
||||
generally should NOT be overridden by command line settings
|
||||
-->
|
||||
|
||||
<!-- Default value for debugging arguments is no. Override in
|
||||
build.properties -->
|
||||
<property name="debug.jvm.args" value=""/>
|
||||
|
||||
<!-- Source directory for tests -->
|
||||
<property name="src.test.dir" value="${basedir}/test/automated/src/classes"/>
|
||||
|
||||
<!-- Output directory for tests -->
|
||||
<property name="out.test.dir" value="${build.home}/test"/>
|
||||
|
||||
<!-- Output directory for test data files -->
|
||||
<property name="build.test" value="${basedir}/build.test"/>
|
||||
|
||||
|
||||
<path id="test.classpath">
|
||||
<pathelement location="${junit.jar}"/>
|
||||
<pathelement location="${build.home}/classes"/>
|
||||
<pathelement location="${out.test.dir}/classes"/>
|
||||
</path>
|
||||
|
||||
|
||||
<!-- ========== Executable Targets ======================================== -->
|
||||
|
||||
<!--
|
||||
Compile unit tests
|
||||
-->
|
||||
<target name="compile.test">
|
||||
|
||||
<mkdir dir="${out.test.dir}/classes"/>
|
||||
|
||||
<javac srcdir="${src.test.dir}"
|
||||
destdir="${out.test.dir}/classes"
|
||||
debug="${compile.debug}"
|
||||
optimize="${compile.optimize}"
|
||||
deprecation="${compile.deprecation}">
|
||||
|
||||
<classpath refid="test.classpath"/>
|
||||
</javac>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="copy-test-data-files">
|
||||
<!-- Copy Unit test static files. -->
|
||||
|
||||
<mkdir dir="${build.test}"/>
|
||||
|
||||
<copy todir="${build.test}">
|
||||
<fileset dir="${basedir}/test/automated/src/test"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="clean">
|
||||
|
||||
<delete dir="${out.test.dir}/classes"/>
|
||||
<delete dir="${build.test}"/>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="run.test" depends="compile.test,copy-test-data-files">
|
||||
|
||||
<junit printsummary="yes" haltonfailure="yes" haltonerror="yes" fork="yes">
|
||||
<jvmarg value="-native"/>
|
||||
<jvmarg value="-Djava.library.path=${myenv.MOZILLA_FIVE_HOME}:${myenv.MOZILLA_FIVE_HOME}/components"/>
|
||||
<jvmarg value="-DNSPR_LOG_MODULES=${myenv.NSPR_LOG_MODULES}"/>
|
||||
<jvmarg value="-DNSPR_LOG_FILE=${myenv.NSPR_LOG_FILE}"/>
|
||||
<jvmarg line="${debug.jvm.args}"/>
|
||||
|
||||
|
||||
<classpath refid="test.classpath"/>
|
||||
|
||||
<formatter type="plain" usefile="false"/>
|
||||
|
||||
<test name="org.mozilla.webclient.wrapper_native.gtk.TestGtkBrowserControlCanvas"/>
|
||||
|
||||
</junit>
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
</project>
|
@ -95,7 +95,8 @@
|
||||
|
||||
<target name="compile.src_share" depends="compile.javah.headers">
|
||||
|
||||
<exec os="Linux" dir="${basedir}/src_share" executable="make"/>
|
||||
<exec os="Linux" dir="${basedir}/src_share" failonerror="yes"
|
||||
executable="make"/>
|
||||
|
||||
</target>
|
||||
|
||||
@ -172,20 +173,31 @@
|
||||
|
||||
<target name="compile.src_moz" depends="compile.src_share">
|
||||
|
||||
<exec os="Linux" dir="${basedir}/src_moz" executable="make"/>
|
||||
<exec os="Linux" dir="${basedir}/src_moz" executable="make"
|
||||
failonerror="yes">
|
||||
</exec>
|
||||
|
||||
<exec os="Linux" dir="${basedir}/src_moz" executable="make"
|
||||
failonerror="yes">
|
||||
<arg line="buildRunems"/>
|
||||
</exec>
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
<target name="clean">
|
||||
|
||||
<exec os="Linux" dir="${basedir}/src_moz" executable="make">
|
||||
<ant antfile="build-tests.xml" target="clean"/>
|
||||
|
||||
<exec os="Linux" dir="${basedir}/src_moz" executable="make"
|
||||
failonerror="yes">
|
||||
|
||||
<arg line="clobber_all"/>
|
||||
|
||||
</exec>
|
||||
|
||||
<exec os="Linux" dir="${basedir}/src_share" executable="make">
|
||||
<exec os="Linux" dir="${basedir}/src_share" executable="make"
|
||||
failonerror="yes">
|
||||
|
||||
<arg line="clobber_all"/>
|
||||
|
||||
@ -200,9 +212,17 @@
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
<delete file="${basedir}/src_moz/gtk/GtkBrowserControlCanvas.h"/>
|
||||
|
||||
|
||||
<delete dir="${build.home}/classes/org/mozilla/webclient"/>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="run.test" depends="main" description="Run unit tests">
|
||||
|
||||
<ant antfile="build-tests.xml" target="run.test"/>
|
||||
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
@ -52,11 +52,11 @@ import java.awt.*;
|
||||
|
||||
* See concrete subclasses for scope info.
|
||||
|
||||
* @version $Id: BrowserControlCanvas.java,v 1.3 2001/05/29 18:34:17 ashuk%eng.sun.com Exp $
|
||||
* @version $Id: BrowserControlCanvas.java,v 1.4 2002/10/01 00:39:19 edburns%acm.org Exp $
|
||||
|
||||
* @see org.mozilla.webclient.win32.Win32BrowserControlCanvas
|
||||
|
||||
* @see org.mozilla.webclient.motif.MotifBrowserControlCanvas
|
||||
* @see org.mozilla.webclient.gtk.GtkBrowserControlCanvas
|
||||
|
||||
*/
|
||||
|
||||
|
@ -44,7 +44,7 @@ import java.io.FileNotFoundException;
|
||||
* This is a static class, it is neven instantiated.
|
||||
|
||||
*
|
||||
* @version $Id: BrowserControlFactory.java,v 1.6 2001/09/10 22:02:05 edburns%acm.org Exp $
|
||||
* @version $Id: BrowserControlFactory.java,v 1.7 2002/10/01 00:39:20 edburns%acm.org Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.test.EmbeddedMozilla
|
||||
|
||||
@ -197,7 +197,7 @@ public static void deleteBrowserControl(BrowserControl toDelete)
|
||||
* figures out the proper name for the class that is the
|
||||
* BrowserControlCanvas.
|
||||
|
||||
* @return "org.mozilla.webclient.wrapper_native.win32.Win32BrowserControlCanvas" or "org.mozilla.webclient.wrapper_native.motif.MotifBrowserControlCanvas"
|
||||
* @return "org.mozilla.webclient.wrapper_native.win32.Win32BrowserControlCanvas" or "org.mozilla.webclient.wrapper_native.gtk.GtkBrowserControlCanvas"
|
||||
|
||||
*/
|
||||
|
||||
@ -225,7 +225,7 @@ private static String determinePlatformCanvasClassName()
|
||||
result = "org.mozilla.webclient.wrapper_native.win32.Win32BrowserControlCanvas";
|
||||
}
|
||||
else {
|
||||
result = "org.mozilla.webclient.wrapper_native.motif.MotifBrowserControlCanvas";
|
||||
result = "org.mozilla.webclient.wrapper_native.gtk.GtkBrowserControlCanvas";
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ public static void main(String [] args)
|
||||
Assert.setEnabled(true);
|
||||
Log.setApplicationName("BrowserControlFactory");
|
||||
Log.setApplicationVersion("0.0");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlFactory.java,v 1.6 2001/09/10 22:02:05 edburns%acm.org Exp $");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlFactory.java,v 1.7 2002/10/01 00:39:20 edburns%acm.org Exp $");
|
||||
|
||||
BrowserControlCanvas canvas = null;
|
||||
BrowserControl control = null;
|
||||
|
@ -27,6 +27,12 @@ import org.mozilla.util.Assert;
|
||||
import org.mozilla.util.Log;
|
||||
import org.mozilla.util.ParameterCheck;
|
||||
|
||||
import org.mozilla.webclient.BrowserControlCanvas;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Dimension;
|
||||
|
||||
/**
|
||||
|
||||
* GtkBrowserControlCanvas provides a concrete realization
|
||||
@ -34,26 +40,16 @@ import org.mozilla.util.ParameterCheck;
|
||||
|
||||
* <B>Lifetime And Scope</B> <P>
|
||||
|
||||
* There is one instance of the WebShellCanvas per top level awt Frame.
|
||||
* There is one instance of GtkBrowserControlCanvas per top level awt Frame.
|
||||
|
||||
* @version $Id: GtkBrowserControlCanvas.java,v 1.1 2002/09/18 18:25:23 edburns%acm.org Exp $
|
||||
* @version $Id: GtkBrowserControlCanvas.java,v 1.2 2002/10/01 00:39:21 edburns%acm.org Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.BrowserControlCanvasFactory
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
import sun.awt.*;
|
||||
import sun.awt.motif.*;
|
||||
import java.awt.*;
|
||||
|
||||
import org.mozilla.webclient.*;
|
||||
import org.mozilla.webclient.wrapper_native.*;
|
||||
|
||||
/**
|
||||
* GtkBrowserControlCanvas provides a concrete realization
|
||||
* of the RaptorCanvas.
|
||||
*/
|
||||
public class GtkBrowserControlCanvas extends BrowserControlCanvas /* implements ActionListener*/ {
|
||||
|
||||
static {
|
||||
@ -70,14 +66,14 @@ public class GtkBrowserControlCanvas extends BrowserControlCanvas /* implements
|
||||
// private MDrawingSurfaceInfo drawingSurfaceInfo;
|
||||
|
||||
static private native void loadMainDll();
|
||||
private native int createTopLevelWindow();
|
||||
private native int createContainerWindow(int parent, int width, int height);
|
||||
private native int getGTKWinID(int gtkWinPtr);
|
||||
private native void reparentWindow(int child, int parent);
|
||||
private native void processEvents();
|
||||
private native void setGTKWindowSize(int gtkWinPtr, int width, int height);
|
||||
native int createTopLevelWindow();
|
||||
native int createContainerWindow(int parent, int width, int height);
|
||||
native int getGTKWinID(int gtkWinPtr);
|
||||
native void reparentWindow(int child, int parent);
|
||||
native void processEvents();
|
||||
native void setGTKWindowSize(int gtkWinPtr, int width, int height);
|
||||
//New method for obtaining access to the Native Peer handle
|
||||
private native int getHandleToPeer();
|
||||
native int getHandleToPeer();
|
||||
|
||||
public GtkBrowserControlCanvas() {
|
||||
super();
|
||||
@ -143,6 +139,8 @@ public class GtkBrowserControlCanvas extends BrowserControlCanvas /* implements
|
||||
|
||||
return this.gtkWinPtr;
|
||||
}
|
||||
|
||||
// The test for this class is TestGtkBrowserControlCanvas
|
||||
|
||||
}
|
||||
|
||||
|
@ -568,17 +568,20 @@ NS_IMETHODIMP CBrowserContainer::UniversalDialog(const PRUnichar *inTitleMessage
|
||||
|
||||
NS_IMETHODIMP CBrowserContainer::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 aStateFlags,
|
||||
PRUint32 aStateFlags,
|
||||
PRUint32 aStatus)
|
||||
{
|
||||
nsXPIDLString name;
|
||||
nsCAutoString name;
|
||||
nsAutoString uname;
|
||||
nsCOMPtr<nsIDOMWindow> domWin;
|
||||
nsresult rv;
|
||||
|
||||
if (NS_FAILED(rv = aRequest->GetName(getter_Copies(name)))) {
|
||||
if (NS_FAILED(rv = aRequest->GetName(name))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
uname.AssignWithConversion(name.get());
|
||||
|
||||
//
|
||||
// document states
|
||||
//
|
||||
@ -589,7 +592,7 @@ NS_IMETHODIMP CBrowserContainer::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
}
|
||||
|
||||
domWin->GetDocument(getter_AddRefs(mInitContext->currentDocument));
|
||||
doStartDocumentLoad(name.get());
|
||||
doStartDocumentLoad(uname.get());
|
||||
}
|
||||
if ((aStateFlags & STATE_STOP) && (aStateFlags & STATE_IS_DOCUMENT)) {
|
||||
doEndDocumentLoad(aWebProgress);
|
||||
@ -598,10 +601,10 @@ NS_IMETHODIMP CBrowserContainer::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
// request states
|
||||
//
|
||||
if ((aStateFlags & STATE_START) && (aStateFlags & STATE_IS_REQUEST)) {
|
||||
doStartURLLoad(name.get());
|
||||
doStartURLLoad(uname.get());
|
||||
}
|
||||
if ((aStateFlags & STATE_STOP) && (aStateFlags & STATE_IS_REQUEST)) {
|
||||
doEndURLLoad(name.get());
|
||||
doEndURLLoad(uname.get());
|
||||
}
|
||||
if (aStateFlags & STATE_REDIRECTING) {
|
||||
printf("debug: edburns: STATE_REDIRECTING\n");
|
||||
@ -617,7 +620,7 @@ NS_IMETHODIMP CBrowserContainer::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
|
||||
NS_IMETHODIMP CBrowserContainer::OnSecurityChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 state)
|
||||
PRUint32 state)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@ -631,7 +634,7 @@ NS_IMETHODIMP CBrowserContainer::OnProgressChange(nsIWebProgress *aWebProgress,
|
||||
PRInt32 maxTotalProgress)
|
||||
{
|
||||
PRInt32 percentComplete = 0;
|
||||
nsXPIDLString name;
|
||||
nsCAutoString name;
|
||||
nsAutoString autoName;
|
||||
jobject msgJStr = nsnull;
|
||||
nsresult rv;
|
||||
@ -653,10 +656,10 @@ NS_IMETHODIMP CBrowserContainer::OnProgressChange(nsIWebProgress *aWebProgress,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (NS_FAILED(rv = aRequest->GetName(getter_Copies(name)))) {
|
||||
if (NS_FAILED(rv = aRequest->GetName(name))) {
|
||||
return rv;
|
||||
}
|
||||
autoName = name;
|
||||
autoName.AssignWithConversion(name.get());
|
||||
// build up the string to be sent
|
||||
autoName.AppendWithConversion(" ");
|
||||
autoName.AppendInt(percentComplete);
|
||||
|
@ -33,7 +33,6 @@
|
||||
|
||||
#include "CurrentPageActionEvents.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIFindComponent.h"
|
||||
#include "nsISearchContext.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIContentViewer.h"
|
||||
@ -102,6 +101,7 @@ wsFindEvent::handleEvent ()
|
||||
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
|
||||
|
||||
if (mInitContext) {
|
||||
#if 0
|
||||
//First get the FindComponent object
|
||||
nsCOMPtr<nsIFindComponent> findComponent;
|
||||
findComponent = do_GetService(NS_IFINDCOMPONENT_CONTRACTID, &rv);
|
||||
@ -150,6 +150,7 @@ wsFindEvent::handleEvent ()
|
||||
mInitContext->initFailCode = kSearchContextError;
|
||||
return (void *) rv;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
// this is findNext
|
||||
@ -194,6 +195,10 @@ wsFindEvent::handleEvent ()
|
||||
}
|
||||
// Save in initContext struct for future findNextInPage calls
|
||||
mInitContext->searchContext = srchcontext;
|
||||
|
||||
#else
|
||||
return (void *) rv;
|
||||
#endif
|
||||
|
||||
}
|
||||
return result;
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "nsActions.h"
|
||||
|
||||
#include "nsIContentViewerEdit.h"
|
||||
#include "nsIFindComponent.h"
|
||||
#include "nsISearchContext.h"
|
||||
#include "nsISHistory.h"
|
||||
#include "ns_util.h"
|
||||
|
@ -393,22 +393,8 @@ InputStreamShim::ReadSegments(nsWriteSegmentFun writer, void * closure, PRUint32
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InputStreamShim::GetNonBlocking(PRBool *aNonBlocking)
|
||||
InputStreamShim::IsNonBlocking(PRBool *_retval)
|
||||
{
|
||||
NS_NOTREACHED("GetNonBlocking");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InputStreamShim::GetObserver(nsIInputStreamObserver * *aObserver)
|
||||
{
|
||||
NS_NOTREACHED("GetObserver");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InputStreamShim::SetObserver(nsIInputStreamObserver * aObserver)
|
||||
{
|
||||
NS_NOTREACHED("SetObserver");
|
||||
NS_NOTREACHED("IsNonBlocking");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ VPATH = $(topsrcdir)/java/webclient/src_moz
|
||||
|
||||
# We don't need to build the stubs in the BAL case.
|
||||
ifeq ($(BAL_INTERFACE),)
|
||||
DIRS = motif
|
||||
DIRS = gtk
|
||||
endif
|
||||
|
||||
JAVAHOME = $(JDKHOME)
|
||||
@ -62,34 +62,63 @@ LIBRARY_NAME = webclient
|
||||
endif
|
||||
|
||||
REQUIRES = xpcom \
|
||||
layout \
|
||||
shistory \
|
||||
appcomps \
|
||||
appshell \
|
||||
pref \
|
||||
locale \
|
||||
intl \
|
||||
rdf \
|
||||
bookmarks \
|
||||
content \
|
||||
editor \
|
||||
string \
|
||||
embed_base \
|
||||
webBrowser_core \
|
||||
webbrwsr \
|
||||
webshell \
|
||||
windowwatcher \
|
||||
profile \
|
||||
necko \
|
||||
docshell \
|
||||
dom \
|
||||
widget \
|
||||
uriloader \
|
||||
webbrowserpersist \
|
||||
gfx \
|
||||
$(NULL)
|
||||
|
||||
layout \
|
||||
shistory \
|
||||
appcomps \
|
||||
appshell \
|
||||
pref \
|
||||
locale \
|
||||
intl \
|
||||
rdf \
|
||||
bookmarks \
|
||||
content \
|
||||
editor \
|
||||
string \
|
||||
embed_base \
|
||||
webBrowser_core \
|
||||
webbrwsr \
|
||||
webshell \
|
||||
windowwatcher \
|
||||
profile \
|
||||
necko \
|
||||
docshell \
|
||||
dom \
|
||||
widget \
|
||||
uriloader \
|
||||
webbrowserpersist \
|
||||
gfx \
|
||||
gtkembedmoz \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
ns_util.cpp \
|
||||
ns_util_export.cpp \
|
||||
dom_util.cpp \
|
||||
nsActions.cpp \
|
||||
rdf_util.cpp \
|
||||
BookmarksImpl.cpp \
|
||||
CBrowserContainer.cpp \
|
||||
PromptActionEvents.cpp \
|
||||
CurrentPageImpl.cpp \
|
||||
CurrentPageActionEvents.cpp \
|
||||
HistoryImpl.cpp \
|
||||
HistoryActionEvents.cpp \
|
||||
ISupportsPeer.cpp \
|
||||
NativeEventThread.cpp \
|
||||
NativeEventThreadActionEvents.cpp \
|
||||
NavigationImpl.cpp \
|
||||
NavigationActionEvents.cpp \
|
||||
InputStreamShim.cpp \
|
||||
RDFEnumeration.cpp \
|
||||
RDFTreeNode.cpp \
|
||||
RDFActionEvents.cpp \
|
||||
wsRDFObserver.cpp \
|
||||
WindowControlImpl.cpp \
|
||||
WindowControlActionEvents.cpp \
|
||||
PreferencesImpl.cpp \
|
||||
PreferencesActionEvents.cpp \
|
||||
WrapperFactoryImpl.cpp \
|
||||
gtk/GtkBrowserControlCanvas.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -472,8 +472,9 @@ void DoMozInitialization(WebShellInitContext * initContext)
|
||||
nsILocalFile * pathFile = nsnull;
|
||||
nsresult rv = nsnull;
|
||||
JNIEnv * env = initContext->env;
|
||||
const char * BinDir = gBinDir;
|
||||
|
||||
nsAutoString BinDir;
|
||||
BinDir.AssignWithConversion(gBinDir);
|
||||
|
||||
rv = NS_NewLocalFile(BinDir, PR_TRUE, &pathFile);
|
||||
if (NS_FAILED(rv)) {
|
||||
::util_ThrowExceptionToJava(env, "call to NS_NewLocalFile failed.");
|
||||
@ -488,7 +489,6 @@ void DoMozInitialization(WebShellInitContext * initContext)
|
||||
::util_ThrowExceptionToJava(env, "NS_GetGlobalComponentManager() failed.");
|
||||
return;
|
||||
}
|
||||
prLogModuleInfo = PR_NewLogModule("webclient");
|
||||
const char *webclientLogFile = PR_GetEnv("WEBCLIENT_LOG_FILE");
|
||||
if (nsnull != webclientLogFile) {
|
||||
PR_SetLogFile(webclientLogFile);
|
||||
|
@ -304,9 +304,10 @@ wsPostEvent::handleEvent ()
|
||||
nsCOMPtr<nsIInputStream> headersDataStream = nsnull;
|
||||
|
||||
if (mPostData) {
|
||||
nsCAutoString postData(mPostData);
|
||||
NS_NewPostDataStream(getter_AddRefs(postDataStream),
|
||||
PR_FALSE,
|
||||
(const char *) mPostData, 0);
|
||||
postData, 0);
|
||||
}
|
||||
|
||||
if (mPostHeaders) {
|
||||
|
@ -47,6 +47,8 @@
|
||||
#include "wsRDFObserver.h"
|
||||
#include "nsString.h" // for nsCAutoString
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kRDFContainerCID, NS_RDFCONTAINER_CID);
|
||||
static NS_DEFINE_CID(kSupportsArrayCID, NS_SUPPORTSARRAY_CID);
|
||||
|
@ -60,9 +60,10 @@ JNIEXPORT void JNICALL
|
||||
Java_org_mozilla_webclient_wrapper_1native_WrapperFactoryImpl_nativeAppInitialize(
|
||||
JNIEnv *env, jobject obj, jstring verifiedBinDirAbsolutePath)
|
||||
{
|
||||
|
||||
prLogModuleInfo = PR_NewLogModule("webclient");
|
||||
const char *nativePath = (const char *) ::util_GetStringUTFChars(env,
|
||||
verifiedBinDirAbsolutePath);
|
||||
|
||||
gBinDir = PL_strdup(nativePath);
|
||||
::util_ReleaseStringUTFChars(env, verifiedBinDirAbsolutePath, nativePath);
|
||||
}
|
||||
|
266
java/webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp
Normal file
266
java/webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp
Normal file
@ -0,0 +1,266 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* GtkBrowserControlCanvas.cpp
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include <jawt_md.h>
|
||||
#include <jawt.h>
|
||||
#include "GtkBrowserControlCanvas.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkmozembed.h"
|
||||
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsGtkEventHandler.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
|
||||
#include "../ns_util.h" //for throwing Exceptions to Java
|
||||
|
||||
extern "C" void NS_SetupRegistry();
|
||||
|
||||
extern "C" {
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_webclient_gtk_GtkBrowserControlCanvas
|
||||
* Method: createTopLevelWindow
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowserControlCanvas_createTopLevelWindow
|
||||
(JNIEnv * env, jobject obj) {
|
||||
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
|
||||
("GtkBrowserControlCanvas_createTopLevelWindow: entering\n"));
|
||||
|
||||
static GtkWidget *mShell = NULL;
|
||||
|
||||
/* Initialise GTK */
|
||||
gtk_set_locale ();
|
||||
|
||||
gtk_init (0, NULL);
|
||||
/*
|
||||
void * widgetGtkDll = dlopen("libwidget_gtk.so", RTLD_NOW | RTLD_GLOBAL);
|
||||
if (widgetGtkDll)
|
||||
{
|
||||
void (* symbolHandle)(_GdkEvent*,void*);
|
||||
symbolHandle =
|
||||
(void(*)(_GdkEvent*,void*)) dlsym(widgetGtkDll,
|
||||
"handle_gdk_event");
|
||||
if (symbolHandle != NULL)
|
||||
gdk_event_handler_set (symbolHandle, NULL, NULL);
|
||||
}
|
||||
*/
|
||||
gdk_rgb_init();
|
||||
|
||||
mShell = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
gtk_window_set_default_size(GTK_WINDOW(mShell), 300, 300);
|
||||
gtk_window_set_title(GTK_WINDOW(mShell), "Simple browser");
|
||||
|
||||
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
|
||||
("GtkBrowserControlCanvas_createTopLevelWindow widget: %p: exiting\n",
|
||||
mShell));
|
||||
|
||||
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
|
||||
("GtkBrowserControlCanvas_createTopLevelWindow: exiting\n"));
|
||||
|
||||
return (jint) mShell;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_webclient_gtk_GtkBrowserControlCanvas
|
||||
* Method: createContainerWindow
|
||||
* Signature: (III)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowserControlCanvas_createContainerWindow
|
||||
(JNIEnv * env, jobject obj, jint parent, jint screenWidth, jint screenHeight) {
|
||||
|
||||
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
|
||||
("GtkBrowserControlCanvas_createContainerWindow: entering\n"));
|
||||
|
||||
GtkWidget * window = (GtkWidget *) parent;
|
||||
|
||||
gtk_widget_realize(GTK_WIDGET(window));
|
||||
gtk_widget_set_uposition(window, screenWidth + 20, screenHeight + 20);
|
||||
gtk_widget_show(window);
|
||||
|
||||
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
|
||||
("GtkBrowserControlCanvas_createContainerWindow window: %p: exiting\n",
|
||||
window));
|
||||
|
||||
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
|
||||
("GtkBrowserControlCanvas_createContainerWindow: exiting\n"));
|
||||
|
||||
|
||||
|
||||
return (jint) window;
|
||||
|
||||
}
|
||||
|
||||
int getWinID(GtkWidget * gtkWidgetPtr) {
|
||||
//GdkWindow * gdkWindow = gtk_widget_get_parent_window(gtkWidgetPtr);
|
||||
GdkWindow * gdkWindow = gtkWidgetPtr->window;
|
||||
int gtkwinid = GDK_WINDOW_XWINDOW(gdkWindow);
|
||||
|
||||
return gtkwinid;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_webclient_gtk_GtkBrowserControlCanvas
|
||||
* Method: getGTKWinID
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowserControlCanvas_getGTKWinID
|
||||
(JNIEnv * env, jobject obj, jint gtkWinPtr) {
|
||||
GtkWidget * gtkWidgetPtr = (GtkWidget *) gtkWinPtr;
|
||||
|
||||
return getWinID(gtkWidgetPtr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_webclient_gtk_GtkBrowserControlCanvas
|
||||
* Method: reparentWindow
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowserControlCanvas_reparentWindow (JNIEnv * env, jobject obj, jint childID, jint parentID) {
|
||||
XReparentWindow(GDK_DISPLAY(), childID, parentID, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_webclient_gtk_GtkBrowserControlCanvas
|
||||
* Method: processEvents
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowserControlCanvas_processEvents
|
||||
(JNIEnv * env, jobject obj) {
|
||||
//printf("process events....\n");
|
||||
//processEventLoopIntelligently();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_webclient_gtk_GtkBrowserControlCanvas
|
||||
* Method: setGTKWindowSize
|
||||
* Signature: (III)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowserControlCanvas_setGTKWindowSize
|
||||
(JNIEnv * env, jobject obj, jint gtkWinPtr, jint width, jint height) {
|
||||
if (gtkWinPtr != 0) {
|
||||
GtkWidget * gtkWidgetPtr = (GtkWidget *) gtkWinPtr;
|
||||
|
||||
if (gtkWidgetPtr) {
|
||||
gtk_widget_set_usize(gtkWidgetPtr, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_webclient_gtk_GtkBrowserControlCanvas
|
||||
* Method: getHandleToPeer
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowserControlCanvas_getHandleToPeer
|
||||
(JNIEnv * env, jobject canvas) {
|
||||
JAWT awt;
|
||||
JAWT_DrawingSurface* ds;
|
||||
JAWT_DrawingSurfaceInfo* dsi;
|
||||
JAWT_X11DrawingSurfaceInfo* dsi_x11;
|
||||
Drawable handle_x11;
|
||||
jint lock;
|
||||
|
||||
//Get the AWT
|
||||
awt.version = JAWT_VERSION_1_3;
|
||||
if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
|
||||
printf(" +++ AWT Not Found +++ \n");
|
||||
::util_ThrowExceptionToJava(env, "Exception: AWT Not Found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Get the Drawing Surface
|
||||
ds = awt.GetDrawingSurface(env, canvas);
|
||||
if (ds == NULL) {
|
||||
printf(" +++ NULL Drawing Surface +++ \n");
|
||||
::util_ThrowExceptionToJava(env, "Exception: Null Drawing Surface");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Lock the Drawing Surface
|
||||
lock = ds->Lock(ds);
|
||||
if ((lock & JAWT_LOCK_ERROR) != 0) {
|
||||
printf(" +++ Error Locking Surface +++ \n");
|
||||
::util_ThrowExceptionToJava(env, "Exception: Error Locking Surface");
|
||||
awt.FreeDrawingSurface(ds);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Get the Drawing Surface info
|
||||
dsi = ds->GetDrawingSurfaceInfo(ds);
|
||||
if (dsi == NULL) {
|
||||
printf(" +++ Error Getting Surface Info +++ \n");
|
||||
::util_ThrowExceptionToJava(env, "Exception: Error Getting Surface Info");
|
||||
ds->Unlock(ds);
|
||||
awt.FreeDrawingSurface(ds);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Get the Platform specific Drawing Info
|
||||
dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
|
||||
|
||||
//Get the Handle to the Native Drawing Surface info
|
||||
handle_x11 = (Drawable) dsi_x11->drawable;
|
||||
|
||||
//Clean up after us
|
||||
ds->FreeDrawingSurfaceInfo(dsi);
|
||||
ds->Unlock(ds);
|
||||
awt.FreeDrawingSurface(ds);
|
||||
|
||||
//return the native peer handle
|
||||
return (jint) handle_x11;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_webclient_gtk_GtkBrowserControlCanvas
|
||||
* Method: loadMainDll
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowserControlCanvas_loadMainDll
|
||||
(JNIEnv *, jclass)
|
||||
{
|
||||
PR_LOG(prLogModuleInfo, PR_LOG_ERROR,
|
||||
("Incorrect loadMainDll called. Perhaps Java is loading the wrond dll?"));
|
||||
PR_ASSERT(NULL);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // End extern "C"
|
||||
|
1179
java/webclient/src_moz/gtk/GtkBrowserControlCanvasStub.cpp
Normal file
1179
java/webclient/src_moz/gtk/GtkBrowserControlCanvasStub.cpp
Normal file
File diff suppressed because it is too large
Load Diff
56
java/webclient/src_moz/gtk/Makefile.in
Normal file
56
java/webclient/src_moz/gtk/Makefile.in
Normal file
@ -0,0 +1,56 @@
|
||||
# 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 = ../../../..
|
||||
topsrcdir = $(DEPTH)
|
||||
srcdir = $(topsrcdir)/java/webclient/src_moz/gtk
|
||||
VPATH = $(topsrcdir)/java/webclient/src_moz/gtk
|
||||
|
||||
JAVAHOME = $(JDKHOME)
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
LIBRARY_NAME = webclientstub
|
||||
|
||||
CPPSRCS = \
|
||||
GtkBrowserControlCanvasStub.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifdef MOZ_ENABLE_GTK
|
||||
ifndef MOZ_MONOLITHIC_TOOLKIT
|
||||
CXXFLAGS += $(MOZ_GTK_CFLAGS)
|
||||
CFLAGS += $(MOZ_GTK_CFLAGS)
|
||||
EXTRA_DSO_LDOPTS += -L$(DEPTH)/dist/lib -lgtkxtbin -lgtksuperwin -L/usr/X11R6/lib -lXt
|
||||
else
|
||||
CXXFLAGS += $(TK_CFLAGS)
|
||||
CFLAGS += $(TK_CFLAGS)
|
||||
EXTRA_DSO_LDOPTS += -L$(DEPTH)/dist/lib -lgtkxtbin -lgtksuperwin -L/usr/X11R6/lib -lXt
|
||||
endif
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LDOPTS += -lnspr4
|
||||
|
||||
# check for OS type
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
INCLUDES := -I$(JDKHOME)/include -I$(JDKHOME)/include/linux -I.. -I../../src_share $(INCLUDES)
|
||||
else
|
||||
INCLUDES := -I$(JDKHOME)/include -I$(JDKHOME)/include/solaris -I.. -I../../src_share $(INCLUDES)
|
||||
endif
|
139
java/webclient/src_moz/gtk/StubFunctions.h
Normal file
139
java/webclient/src_moz/gtk/StubFunctions.h
Normal 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 Netscape 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/NPL/
|
||||
*
|
||||
* 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 Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Mark Lin
|
||||
* Ed Burns <edburns@acm.org>
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include "BookmarksImpl.h"
|
||||
#include "PreferencesImpl.h"
|
||||
#include "CurrentPageImpl.h"
|
||||
#include "HistoryImpl.h"
|
||||
#include "ISupportsPeer.h"
|
||||
#include "NavigationImpl.h"
|
||||
#include "RDFEnumeration.h"
|
||||
#include "RDFTreeNode.h"
|
||||
#include "WindowControlImpl.h"
|
||||
#include "WrapperFactoryImpl.h"
|
||||
#include "NativeEventThread.h"
|
||||
|
||||
#include "GtkBrowserControlCanvas.h"
|
||||
|
||||
#define WEBCLIENTSTUB_LOG_MODULE "webclientstub"
|
||||
#define WEBCLIENT_DSO "libwebclient.so"
|
||||
|
||||
/**
|
||||
|
||||
* Hooks up the local function pointers to the symbols in the <b>real</b>
|
||||
* webclient DSO.
|
||||
|
||||
* @return 0 on success, -1 on failure
|
||||
|
||||
*/
|
||||
|
||||
int locateStubFunctions(void *dll);
|
||||
|
||||
// PENDING(edburns): implement a data structure based scheme to ease
|
||||
// adding functions.
|
||||
|
||||
// from GtkBrowserControlCanvas.h
|
||||
|
||||
jint (* createTopLevelWindow) (JNIEnv *, jobject);
|
||||
jint (* createContainerWindow) (JNIEnv *, jobject, jint, jint, jint);
|
||||
jint (* getGTKWinID) (JNIEnv *, jobject, jint);
|
||||
void (* reparentWindow) (JNIEnv *, jobject, jint, jint);
|
||||
void (* processEvents) (JNIEnv *, jobject);
|
||||
void (* setGTKWindowSize) (JNIEnv *, jobject, jint, jint, jint);
|
||||
jint (* getHandleToPeer) (JNIEnv *, jobject);
|
||||
|
||||
// from NativeEventThread.h
|
||||
void (* nativeAddListener) (JNIEnv *, jobject, jint, jobject, jstring);
|
||||
void (* nativeRemoveListener) (JNIEnv *, jobject, jint, jobject, jstring);
|
||||
void (* nativeRemoveAllListeners) (JNIEnv *, jobject, jint);
|
||||
void (* nativeInitialize) (JNIEnv *, jobject, jint);
|
||||
void (* nativeProcessEvents) (JNIEnv *, jobject, jint);
|
||||
// from BookmarksImpl.h
|
||||
jint (* nativeGetBookmarks) (JNIEnv *, jobject, jint);
|
||||
jint (* nativeNewRDFNode) (JNIEnv *, jobject, jint, jstring, jboolean);
|
||||
// from PreferencesImpl.h
|
||||
void (* nativeSetUnicharPref) (JNIEnv *, jobject, jint, jstring, jstring);
|
||||
void (* nativeSetIntPref) (JNIEnv *, jobject, jint, jstring, jint);
|
||||
void (* nativeSetBoolPref) (JNIEnv *, jobject, jint, jstring, jboolean);
|
||||
jobject (* nativeGetPrefs) (JNIEnv *env, jobject obj, jint webShellPtr, jobject props);
|
||||
void (* nativeRegisterPrefChangedCallback) (JNIEnv *env, jobject obj, jint webShellPtr, jobject callback, jstring prefName, jobject closure);
|
||||
// from CurrentPageImpl.h
|
||||
void (* nativeCopyCurrentSelectionToSystemClipboard) (JNIEnv *, jobject, jint);
|
||||
void (* nativeFindInPage) (JNIEnv *, jobject, jint, jstring, jboolean, jboolean);
|
||||
void (* nativeFindNextInPage) (JNIEnv *, jobject, jint);
|
||||
jstring (* nativeGetCurrentURL) (JNIEnv *, jobject, jint);
|
||||
void (* nativeResetFind) (JNIEnv *, jobject, jint);
|
||||
void (* nativeSelectAll) (JNIEnv *, jobject, jint);
|
||||
jobject (* nativeGetDOM) (JNIEnv *, jobject, jint);
|
||||
// from HistoryImpl.h
|
||||
void (* nativeBack) (JNIEnv *, jobject, jint);
|
||||
jboolean (* nativeCanBack) (JNIEnv *, jobject, jint);
|
||||
jboolean (* nativeCanForward) (JNIEnv *, jobject, jint);
|
||||
void (* nativeClearHistory) (JNIEnv *, jobject, jint);
|
||||
void (* nativeForward) (JNIEnv *, jobject, jint);
|
||||
jobjectArray (* nativeGetBackList) (JNIEnv *, jobject, jint);
|
||||
jint (* nativeGetCurrentHistoryIndex) (JNIEnv *, jobject, jint);
|
||||
jobjectArray (* nativeGetForwardList) (JNIEnv *, jobject, jint);
|
||||
jobjectArray (* nativeGetHistory) (JNIEnv *, jobject, jint);
|
||||
jobject (* nativeGetHistoryEntry) (JNIEnv *, jobject, jint, jint);
|
||||
jint (* nativeGetHistoryLength) (JNIEnv *, jobject, jint);
|
||||
jstring (* nativeGetURLForIndex) (JNIEnv *, jobject, jint, jint);
|
||||
void (* nativeSetCurrentHistoryIndex) (JNIEnv *, jobject, jint, jint);
|
||||
// from ISupportsPeer.h
|
||||
void (* nativeAddRef) (JNIEnv *, jobject, jint);
|
||||
void (* nativeRelease) (JNIEnv *, jobject, jint);
|
||||
// from NavigationImpl.h
|
||||
void (* nativeLoadURL) (JNIEnv *, jobject, jint, jstring);
|
||||
void (* nativeLoadFromStream) (JNIEnv *, jobject, jint, jobject, jstring, jstring, jint, jobject);
|
||||
void (* nativeRefresh) (JNIEnv *, jobject, jint, jlong);
|
||||
void (* nativeStop) (JNIEnv *, jobject, jint);
|
||||
void (* nativeSetPrompt) (JNIEnv *, jobject, jint, jobject);
|
||||
// from RDFEnumeration.h
|
||||
void (* nativeFinalize) (JNIEnv *, jobject, jint);
|
||||
jboolean (* nativeHasMoreElements) (JNIEnv *, jobject, jint, jint);
|
||||
jint (* nativeNextElement) (JNIEnv *, jobject, jint, jint);
|
||||
// from RDFTreeNode.h
|
||||
jint (* nativeGetChildAt) (JNIEnv *, jobject, jint, jint, jint);
|
||||
jint (* nativeGetChildCount) (JNIEnv *, jobject, jint, jint);
|
||||
jint (* nativeGetIndex) (JNIEnv *, jobject, jint, jint, jint);
|
||||
void (* nativeInsertElementAt) (JNIEnv *, jobject, jint, jint, jint, jobject, jint);
|
||||
jint (* nativeNewFolder) (JNIEnv *, jobject, jint, jint, jobject);
|
||||
jboolean (* nativeIsContainer) (JNIEnv *, jobject, jint, jint);
|
||||
jboolean (* nativeIsLeaf) (JNIEnv *, jobject, jint, jint);
|
||||
jstring (* nativeToString) (JNIEnv *, jobject, jint, jint);
|
||||
// from WindowControlImpl.h
|
||||
jint (* nativeCreateInitContext) (JNIEnv *, jobject, jint, jint, jint, jint, jint, jobject);
|
||||
void (* nativeMoveWindowTo) (JNIEnv *, jobject, jint, jint, jint);
|
||||
void (* nativeRemoveFocus) (JNIEnv *, jobject, jint);
|
||||
void (* nativeRepaint) (JNIEnv *, jobject, jint, jboolean);
|
||||
void (* nativeSetBounds) (JNIEnv *, jobject, jint, jint, jint, jint, jint);
|
||||
void (* nativeSetFocus) (JNIEnv *, jobject, jint);
|
||||
void (* nativeSetVisible) (JNIEnv *, jobject, jint, jboolean);
|
||||
void (* nativeDestroyInitContext) (JNIEnv *, jobject, jint);
|
||||
//from WrapperFactoryImpl.h
|
||||
jboolean (* nativeDoesImplement) (JNIEnv *, jobject, jstring);
|
||||
void (* nativeAppInitialize) (JNIEnv *, jobject, jstring);
|
||||
void (* nativeTerminate) (JNIEnv *, jobject);
|
||||
|
@ -0,0 +1,130 @@
|
||||
/*
|
||||
* $Id: CompareFiles.java,v 1.1 2002/10/01 00:39:28 edburns%acm.org Exp $
|
||||
*/
|
||||
|
||||
/* -*- 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): Ed Burns <edburns@acm.org>
|
||||
*/
|
||||
|
||||
package org.mozilla.webclient;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class CompareFiles {
|
||||
|
||||
public CompareFiles() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method compares the input files character by character.
|
||||
* Skips whitespaces and comparison is not case sensitive.
|
||||
*/
|
||||
public static boolean filesIdentical (String newFileName,
|
||||
String oldFileName,
|
||||
List oldLinesToIgnore,
|
||||
int ignorePrefix)
|
||||
throws IOException {
|
||||
|
||||
boolean same = true;
|
||||
|
||||
File newFile = new File(newFileName);
|
||||
File oldFile = new File(oldFileName);
|
||||
|
||||
FileReader newFileReader = new FileReader(newFile);
|
||||
FileReader oldFileReader = new FileReader(oldFile);
|
||||
LineNumberReader newReader = new LineNumberReader(newFileReader);
|
||||
LineNumberReader oldReader = new LineNumberReader(oldFileReader);
|
||||
|
||||
String newLine, oldLine;
|
||||
|
||||
newLine = newReader.readLine().trim();
|
||||
oldLine = oldReader.readLine().trim();
|
||||
|
||||
// if one of the lines is null, but not the other
|
||||
if (((null == newLine) && (null != oldLine)) ||
|
||||
((null != newLine) && (null == oldLine))) {
|
||||
same = false;
|
||||
}
|
||||
|
||||
while (null != newLine && null != oldLine) {
|
||||
if (0 < ignorePrefix) {
|
||||
newLine = newLine.substring(ignorePrefix);
|
||||
oldLine = oldLine.substring(ignorePrefix);
|
||||
}
|
||||
|
||||
if (!newLine.equals(oldLine)) {
|
||||
|
||||
if (null != oldLinesToIgnore) {
|
||||
// go thru the list of oldLinesToIgnore and see if
|
||||
// the current oldLine matches any of them.
|
||||
Iterator ignoreLines = oldLinesToIgnore.iterator();
|
||||
boolean foundMatch = false;
|
||||
while (ignoreLines.hasNext()) {
|
||||
String newTrim = ((String) ignoreLines.next()).trim();
|
||||
if (oldLine.equals(newTrim)) {
|
||||
foundMatch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If we haven't found a match, then this mismatch is
|
||||
// important
|
||||
if (!foundMatch) {
|
||||
same = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
same = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
newLine = newReader.readLine();
|
||||
oldLine = oldReader.readLine();
|
||||
|
||||
// if one of the lines is null, but not the other
|
||||
if (((null == newLine) && (null != oldLine)) ||
|
||||
((null != newLine) && (null == oldLine))) {
|
||||
same = false;
|
||||
break;
|
||||
}
|
||||
if (null != newLine) {
|
||||
newLine = newLine.trim();
|
||||
}
|
||||
if (null != oldLine) {
|
||||
oldLine = oldLine.trim();
|
||||
}
|
||||
}
|
||||
|
||||
newReader.close();
|
||||
oldReader.close();
|
||||
|
||||
// if same is true and both files have reached eof, then
|
||||
// files are identical
|
||||
if (same == true) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,235 @@
|
||||
/*
|
||||
* $Id: WebclientTestCase.java,v 1.1 2002/10/01 00:39:28 edburns%acm.org Exp $
|
||||
*/
|
||||
|
||||
/* -*- 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): Ed Burns <edburns@acm.org>
|
||||
*/
|
||||
|
||||
package org.mozilla.webclient;
|
||||
|
||||
// WebclientTestCase.java
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.mozilla.util.Assert;
|
||||
import org.mozilla.util.ParameterCheck;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
*
|
||||
* <B>WebclientTestCase</B> is a class ...
|
||||
*
|
||||
* <B>Lifetime And Scope</B> <P>
|
||||
*
|
||||
* @version $Id: WebclientTestCase.java,v 1.1 2002/10/01 00:39:28 edburns%acm.org Exp $
|
||||
*
|
||||
* @see Blah
|
||||
* @see Bloo
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class WebclientTestCase extends TestCase
|
||||
{
|
||||
//
|
||||
// Protected Constants
|
||||
//
|
||||
|
||||
public static final String WEBCLIENTSTUB_LOG_MODULE = "webclientstub";
|
||||
public static final String WEBCLIENT_LOG_MODULE = "webclient";
|
||||
public static final String OUTPUT_FILE_ROOT = "./build.test/";
|
||||
|
||||
//
|
||||
// Class Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Instance Variables
|
||||
//
|
||||
|
||||
// Attribute Instance Variables
|
||||
|
||||
// Relationship Instance Variables
|
||||
|
||||
//
|
||||
// Constructors and Initializers
|
||||
//
|
||||
|
||||
public WebclientTestCase()
|
||||
{
|
||||
super("WebclientTestCase");
|
||||
}
|
||||
|
||||
public WebclientTestCase(String name)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
|
||||
//
|
||||
// Methods From TestCase
|
||||
//
|
||||
|
||||
public void setUp()
|
||||
{
|
||||
verifyPreconditions();
|
||||
}
|
||||
|
||||
//
|
||||
// General Methods
|
||||
//
|
||||
|
||||
/**
|
||||
|
||||
* assertTrue that the string logModuleName is a correct log module
|
||||
* string as specified in pr_log.h, and that its value is at least n.
|
||||
|
||||
*/
|
||||
|
||||
protected void verifyLogModuleValueIsAtLeastN(String logModuleName, int n)
|
||||
{
|
||||
int i = 0;
|
||||
String logModuleValue = null;
|
||||
assertTrue(null != (logModuleValue =
|
||||
System.getProperty("NSPR_LOG_MODULES")));
|
||||
|
||||
assertTrue(-1 !=
|
||||
(i = logModuleValue.indexOf(logModuleName + ":")));
|
||||
try {
|
||||
i = Integer.
|
||||
valueOf(logModuleValue.substring(i + logModuleName.length() + 1,
|
||||
i + logModuleName.length() + 2)).
|
||||
intValue();
|
||||
assertTrue(i >= n);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
assertTrue(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* assertTrue that NSPR_LOG_FILE is set.
|
||||
|
||||
*/
|
||||
|
||||
protected String verifyOutputFileIsSet()
|
||||
{
|
||||
String logFileValue = null;
|
||||
|
||||
assertTrue(null != (logFileValue =
|
||||
System.getProperty("NSPR_LOG_FILE")));
|
||||
return logFileValue;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* This implementation checks that the proper environment vars are set.
|
||||
|
||||
*/
|
||||
|
||||
protected void verifyPreconditions()
|
||||
{
|
||||
String nsprLogModules = null;
|
||||
|
||||
// make sure we have at least PR_LOG_DEBUG set
|
||||
verifyLogModuleValueIsAtLeastN(WEBCLIENTSTUB_LOG_MODULE, 4);
|
||||
verifyLogModuleValueIsAtLeastN(WEBCLIENT_LOG_MODULE, 4);
|
||||
if (sendOutputToFile()) {
|
||||
verifyOutputFileIsSet();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean verifyExpectedOutput()
|
||||
{
|
||||
boolean result = false;
|
||||
CompareFiles cf = new CompareFiles();
|
||||
String errorMessage = null;
|
||||
String outputFileName = null;
|
||||
String correctFileName = null;
|
||||
|
||||
// If this testcase doesn't participate in file comparison
|
||||
if (!this.sendOutputToFile() &&
|
||||
(null == this.getExpectedOutputFilename())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.sendOutputToFile() ) {
|
||||
outputFileName = verifyOutputFileIsSet();
|
||||
}
|
||||
correctFileName = OUTPUT_FILE_ROOT + this.getExpectedOutputFilename();
|
||||
|
||||
errorMessage = "File Comparison failed: diff -u " + outputFileName + " " +
|
||||
correctFileName;
|
||||
|
||||
ArrayList ignoreList = null;
|
||||
String [] ignore = null;
|
||||
|
||||
if (null != (ignore = this.getLinesToIgnore())) {
|
||||
ignoreList = new ArrayList();
|
||||
for (int i = 0; i < ignore.length; i++) {
|
||||
ignoreList.add(ignore[i]);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
result = cf.filesIdentical(outputFileName, correctFileName,ignoreList,
|
||||
getIgnorePrefix());
|
||||
}
|
||||
catch (IOException e) {
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
System.out.println(errorMessage);
|
||||
}
|
||||
System.out.println("VERIFY:"+result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* @return the name of the expected output filename for this testcase.
|
||||
|
||||
*/
|
||||
|
||||
public String getExpectedOutputFilename() { return null; }
|
||||
|
||||
public String [] getLinesToIgnore() { return null; }
|
||||
|
||||
public int getIgnorePrefix() { return 15; } // 15 is the ignore prefix
|
||||
// for output from PR_LOG
|
||||
|
||||
public boolean sendOutputToFile() { return false; }
|
||||
|
||||
|
||||
|
||||
} // end of class WebclientTestCase
|
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* $Id: TestGtkBrowserControlCanvas.java,v 1.1 2002/10/01 00:39:30 edburns%acm.org Exp $
|
||||
*/
|
||||
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
package org.mozilla.webclient.wrapper_native.gtk;
|
||||
|
||||
// TestGtkBrowserControlCanvas.java
|
||||
|
||||
import org.mozilla.util.Assert;
|
||||
import org.mozilla.util.ParameterCheck;
|
||||
|
||||
import org.mozilla.webclient.WebclientTestCase;
|
||||
|
||||
/**
|
||||
*
|
||||
* <B>TestGtkBrowserControlCanvas</B> is a class ...
|
||||
*
|
||||
* <B>Lifetime And Scope</B> <P>
|
||||
*
|
||||
* @version $Id: TestGtkBrowserControlCanvas.java,v 1.1 2002/10/01 00:39:30 edburns%acm.org Exp $
|
||||
*
|
||||
* @see Blah
|
||||
* @see Bloo
|
||||
*
|
||||
*/
|
||||
|
||||
public class TestGtkBrowserControlCanvas extends WebclientTestCase
|
||||
{
|
||||
//
|
||||
// Protected Constants
|
||||
//
|
||||
|
||||
public static final int WIDTH = 400;
|
||||
public static final int HEIGHT = WIDTH;
|
||||
|
||||
//
|
||||
// Class Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Instance Variables
|
||||
//
|
||||
|
||||
// Attribute Instance Variables
|
||||
|
||||
// Relationship Instance Variables
|
||||
|
||||
//
|
||||
// Constructors and Initializers
|
||||
//
|
||||
|
||||
public TestGtkBrowserControlCanvas()
|
||||
{
|
||||
super("TestGtkBrowserControlCanvas");
|
||||
}
|
||||
|
||||
public TestGtkBrowserControlCanvas(String name)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
|
||||
//
|
||||
// Methods from WebclientTestCase
|
||||
//
|
||||
|
||||
public String getExpectedOutputFilename() { return "TestGtkBrowserControlCanvas_correct"; }
|
||||
|
||||
public boolean sendOutputToFile() { return true; }
|
||||
|
||||
//
|
||||
// General Methods
|
||||
//
|
||||
|
||||
public void testLoadMainDll() {
|
||||
GtkBrowserControlCanvas gtkCanvas = new GtkBrowserControlCanvas();
|
||||
assertTrue(verifyExpectedOutput());
|
||||
}
|
||||
|
||||
} // end of class TestGtkBrowserControlCanvas
|
@ -0,0 +1,6 @@
|
||||
1024[810e350]: GtkBrowserControlCanvasStub_loadMainDll: entering
|
||||
1024[810e350]: GtkBrowserControlCanvasStub_loadMainDll: dll loaded
|
||||
1024[810e350]: GtkBrowserControlCanvasStub_locateStubFunctions: entering
|
||||
1024[810e350]: GtkBrowserControlCanvasStub_locateStubFunctions: exiting
|
||||
1024[810e350]: GtkBrowserControlCanvasStub_loadMainDll: locateStubFunctions returns: 0
|
||||
1024[810e350]: GtkBrowserControlCanvasStub_loadMainDll: exiting
|
Loading…
x
Reference in New Issue
Block a user