[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit HttpUnitTest.java,1.12,1.13 WebPageTest.
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2001-07-02 13:05:59
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv10516/test/com/meterware/httpunit
Modified Files:
HttpUnitTest.java WebPageTest.java
Log Message:
Added support for refresh meta tag
Index: HttpUnitTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/HttpUnitTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- HttpUnitTest.java 2001/06/11 21:21:09 1.12
+++ HttpUnitTest.java 2001/07/02 13:05:56 1.13
@@ -47,7 +47,7 @@
}
- public void tearDown() {
+ public void tearDown() throws Exception {
if (_server != null) _server.shutDown();
}
Index: WebPageTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- WebPageTest.java 2001/06/11 21:21:09 1.11
+++ WebPageTest.java 2001/07/02 13:05:56 1.12
@@ -54,9 +54,10 @@
}
- public void setUp() throws Exception {
- super.setUp();
+ public void tearDown() throws Exception {
+ super.tearDown();
HttpUnitOptions.resetDefaultCharacterSet();
+ HttpUnitOptions.setAutoRefresh( false );
}
@@ -84,6 +85,7 @@
WebResponse simplePage = wc.getResponse( request );
assertEquals( "Title", "A Sample Page", simplePage.getTitle() );
assertEquals( "Character set", "iso-8859-1", simplePage.getCharacterSet() );
+ assertNull( "No refresh request should have been found", simplePage.getRefreshRequest() );
}
@@ -208,6 +210,41 @@
assertEquals( "Message", "Hello, " + hebrewName, cells[0][0] );
assertEquals( "Character set", "iso-8859-8", answer.getCharacterSet() );
}
+
+
+ public void testMetaRefreshRequest() throws Exception {
+ String refreshURL = getHostPath() + "/NextPage.html";
+ String page = "<html><head><title>Sample</title>" +
+ "<meta Http_equiv=refresh content='2;" + refreshURL + "'></head>\n" +
+ "<body>This has no data\n" +
+ "</body></html>\n";
+ defineResource( "SimplePage.html", page );
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" );
+ WebResponse simplePage = wc.getResponse( request );
+
+ assertEquals( "Refresh URL", refreshURL, simplePage.getRefreshRequest().getURL().toExternalForm() );
+ assertEquals( "Refresh delay", 2, simplePage.getRefreshDelay() );
+ }
+
+
+ public void testAutoRefresh() throws Exception {
+ String refreshURL = getHostPath() + "/NextPage.html";
+ String page = "<html><head><title>Sample</title>" +
+ "<meta Http_equiv=refresh content='2;" + refreshURL + "'></head>\n" +
+ "<body>This has no data\n" +
+ "</body></html>\n";
+ defineResource( "SimplePage.html", page );
+ defineWebPage( "NextPage", "Not much here" );
+
+ HttpUnitOptions.setAutoRefresh( true );
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" );
+ WebResponse simplePage = wc.getResponse( request );
+
+ assertNull( "No refresh request should have been found", simplePage.getRefreshRequest() );
+ }
private String toUnicode( String string ) {
|