com.google.caja.plugin
Class BrowserTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.google.caja.util.CajaTestCase
              extended by com.google.caja.plugin.BrowserTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
BrowserTestCaseStub, DomitaTest, HostIframeTest, HostToolsTest

public abstract class BrowserTestCase
extends CajaTestCase

Test case class with tools for controlling a web browser running pages from a local web server.

Author:
maoziqing@gmail.com (Ziqing Mao), kpreid@switchb.org (Kevin Reid)

Nested Class Summary
static interface BrowserTestCase.Check
           
 
Field Summary
protected  org.mortbay.jetty.Server server
           
 
Fields inherited from class com.google.caja.util.CajaTestCase
is, mc, mq, SEED
 
Constructor Summary
BrowserTestCase()
           
 
Method Summary
protected abstract  void driveBrowser(org.openqa.selenium.WebDriver driver, java.lang.String pageName)
          Do what should be done with the browser.
static void poll(int timeoutMillis, int intervalMillis, BrowserTestCase.Check c)
          Run 'c' every 'intervalMillis' milliseconds until it returns true or 'timeoutSecs' seconds have passed (in which case, fail).
protected  int portNumber()
          The port the local web server will run on.
protected  void runBrowserTest(java.lang.String pageName)
          Start the web server and browser, go to pageName, call driveBrowser(driver, pageName), and then clean up.
protected  void StartLocalServer()
          Start a local web server on the port specified by portNumber().
protected  void StopLocalServer()
          Stop the local web server
 
Methods inherited from class com.google.caja.util.CajaTestCase
assertArrayEquals, assertCloneable, assertDeepEquals, assertMessage, assertMessage, assertMessagesLessSevereThan, assertNoErrors, assertNoMessage, assertNoWarnings, checkHeadless, css, css, cssDecls, cssDecls, dataFromResource, formatShort, fromResource, fromResource, fromString, fromString, fromString, html, htmlFragment, js, js, js, jsExpr, jsExpr, markup, markupFragment, minify, plain, quasi, render, render, renderProgram, runTest, setUp, tearDown, xml, xmlFragment
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

server

protected org.mortbay.jetty.Server server
Constructor Detail

BrowserTestCase

public BrowserTestCase()
Method Detail

StartLocalServer

protected void StartLocalServer()
Start a local web server on the port specified by portNumber().


StopLocalServer

protected void StopLocalServer()
Stop the local web server


portNumber

protected int portNumber()
The port the local web server will run on.


runBrowserTest

protected void runBrowserTest(java.lang.String pageName)
Start the web server and browser, go to pageName, call driveBrowser(driver, pageName), and then clean up.


driveBrowser

protected abstract void driveBrowser(org.openqa.selenium.WebDriver driver,
                                     java.lang.String pageName)
Do what should be done with the browser.


poll

public static void poll(int timeoutMillis,
                        int intervalMillis,
                        BrowserTestCase.Check c)
Run 'c' every 'intervalMillis' milliseconds until it returns true or 'timeoutSecs' seconds have passed (in which case, fail).



Copyright (C) 2008 Google Inc.
Licensed under the Apache License, Version 2.0