|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.stjs.testing.driver.browser.AbstractBrowser
org.stjs.testing.driver.browser.LongPollingBrowser
public abstract class LongPollingBrowser
Represents a testing session opened with one instance of a browser that uses long-polling to fetch new tests to
execute from the HTTP server. LongPollingBrowser handles multithreading synchronization between the browser, the HTTP
server and the JUnit runner. The JUnit runner notifies this browser that a new test method must be executed by
calling executeTest(MultiTestMethod), or that it has finished executing all the tests by calling notifyNoMoreTests().
The HTTP server waits for a new test to send to the browser by calling awaitNewTestReady().
On top of that, LongPollinBrowser delegates the details of starting and stopping the browser itself to its concrete
subclasses.
| Constructor Summary | |
|---|---|
LongPollingBrowser(DriverConfiguration config)
|
|
| Method Summary | |
|---|---|
MultiTestMethod |
awaitNextTest()
Blocks until JUnit notifies this browser session that either a new test must be executed (ie: executeTest() is called), or there are no more tests (ie: notifyNoMoreTests() is called). |
protected abstract void |
doStart()
|
void |
executeTest(MultiTestMethod method)
Notifies this browser that the specified test must be executed. |
long |
getId()
|
MultiTestMethod |
getMethodUnderExecution()
Returns the test is currently being executed by this browser. |
Set<Class<? extends AsyncProcess>> |
getSharedDependencies()
Returns a list of AsyncProcess that the JUnit session must start before attempting to start this browser. |
protected String |
getStartPageUri(long browserId,
boolean persistent)
|
protected String |
getStartPageUrl(long browserId,
boolean persistent)
|
protected void |
markAsDead()
|
void |
markAsDead(Throwable throwable,
String userAgent)
|
void |
notifyNoMoreTests()
Notifies this browser that there are no more tests to execute. |
protected void |
registerWithLongPollingServer()
|
void |
sendNoMoreTestFixture(com.sun.net.httpserver.HttpExchange exchange)
Writes to the HTTP response the HTML and/or javascript code that is necessary for the browser understand that there will be no more tests. |
void |
sendTestFixture(MultiTestMethod meth,
com.sun.net.httpserver.HttpExchange exchange)
Writes to the HTTP response the HTML and/or javascript code that is necessary for the browser to execute the specified test. |
void |
start()
Starts the browser session. |
| Methods inherited from class org.stjs.testing.driver.browser.AbstractBrowser |
|---|
appendScriptTag, buildProcess, buildResult, getConfig, isRunningOnWindows, processSet, sendResponse, startProcess, startProcess, stop |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LongPollingBrowser(DriverConfiguration config)
| Method Detail |
|---|
protected String getStartPageUri(long browserId,
boolean persistent)
protected String getStartPageUrl(long browserId,
boolean persistent)
protected void registerWithLongPollingServer()
public void start()
throws org.junit.runners.model.InitializationError
org.junit.runners.model.InitializationError
protected abstract void doStart()
throws org.junit.runners.model.InitializationError
org.junit.runners.model.InitializationErrorpublic MultiTestMethod awaitNextTest()
public void executeTest(MultiTestMethod method)
method - The test to execute.public void notifyNoMoreTests()
public MultiTestMethod getMethodUnderExecution()
public void sendTestFixture(MultiTestMethod meth,
com.sun.net.httpserver.HttpExchange exchange)
throws Exception
meth - The test to send to the browserbrowserSession - The session to which the test is sentexchange - contains the HTTP response that must be written to
Exception
public void sendNoMoreTestFixture(com.sun.net.httpserver.HttpExchange exchange)
throws IOException
browserSession - The session to be notifiedexchange - contains the HTTP response that must be written to
IOExceptionpublic Set<Class<? extends AsyncProcess>> getSharedDependencies()
Browser
protected void markAsDead()
public void markAsDead(Throwable throwable,
String userAgent)
public long getId()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||