|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
com.google.gwt.junit.remote.BrowserManagerServer
public class BrowserManagerServer
Manages instances of a web browser as child processes. This class is experimental and unsupported. An instance of this class can create browser windows using one specific shell-level command. It performs process management (baby sitting) on behalf of a remote client. This can be useful for running a GWTTestCase on a browser that cannot be run on the native platform. For example, a GWTTestCase test running on Linux could use a remote call to a Windows machine to test with Internet Explorer.
Calling main(String[]) can instantiate and register multiple
instances of this class at given RMI namespace locations.
This system has been tested on Internet Explorer 6 & 7. Firefox does not work in the general case; if an existing Firefox process is already running, new processes simply delegate to the existing process and terminate, which breaks the model. A shell script that sets MOZNOREMOTE=1 and cleans up locks/sessions is needed. Safari on MacOS requires very special treatment given Safari's poor command line support, but that is beyond the scope of this documentation.
TODO(scottb): We technically need a watchdog thread to slurp up stdout and stderr from the child processes, or they might block. However, most browsers never write to stdout and stderr, so this is low priority. (There is now a thread that is spawned for each task to wait for an exit value - this might be adapted for that purpose one day.)
This class is not actually serializable as-is, because timer is not serializable.
see http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4062587
| Method Summary | |
|---|---|
void |
keepAlive(int token,
long keepAliveMs)
Keeps the browser process represented by token alive for keepAliveMs, starting now. |
void |
killBrowser(int token)
Forceably kills the browser process represented by token,
disregarding any previous calls to BrowserManager.keepAlive(int, long). |
int |
launchNewBrowser(java.lang.String url,
long keepAliveMs)
Launches a new browser window for the specified URL. |
static void |
main(java.lang.String[] args)
Starts up and registers one or more browser servers. |
| Methods inherited from class java.rmi.server.UnicastRemoteObject |
|---|
clone, exportObject, exportObject, exportObject, unexportObject |
| Methods inherited from class java.rmi.server.RemoteServer |
|---|
getClientHost, getLog, setLog |
| Methods inherited from class java.rmi.server.RemoteObject |
|---|
equals, getRef, hashCode, toString, toStub |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
public void keepAlive(int token,
long keepAliveMs)
BrowserManager
keepAlive in interface BrowserManagertoken - an opaque token representing the browser windowkeepAliveMs - the number of milliseconds to let the browser process
live; if roughly keepAliveMs milliseconds elapse
without a subsequent call to this method, the browser process
associated with token will be forceably terminatedBrowserManager.keepAlive(int, long)public void killBrowser(int token)
BrowserManagertoken,
disregarding any previous calls to BrowserManager.keepAlive(int, long). If the
process has already terminated, this method completes normally.
killBrowser in interface BrowserManagertoken - an opaque token representing the browser window processBrowserManager.killBrowser(int)
public int launchNewBrowser(java.lang.String url,
long keepAliveMs)
BrowserManager
launchNewBrowser in interface BrowserManagerurl - the URL to browse tokeepAliveMs - the initial number of milliseconds to let the browser
process live; if roughly keepAliveMs milliseconds
expire without a subsequent call to BrowserManager.keepAlive(int, long),
the browser process will be forceably terminated
BrowserManager.launchNewBrowser(java.lang.String, long)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||