[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit HttpUnitSuite.java,1.12,1.13 HttpUnitTes
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2001-04-03 16:49:12
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv19605/test/com/meterware/httpunit
Modified Files:
HttpUnitSuite.java HttpUnitTest.java WebFrameTest.java
Log Message:
Handle redirection in subframes
Index: HttpUnitSuite.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/HttpUnitSuite.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- HttpUnitSuite.java 2001/04/02 19:03:54 1.12
+++ HttpUnitSuite.java 2001/04/03 16:49:08 1.13
@@ -40,6 +40,7 @@
suite.addTest( WebLinkTest.suite() );
suite.addTest( HtmlTablesTest.suite() );
suite.addTest( WebFormTest.suite() );
+ suite.addTest( WebFrameTest.suite() );
suite.addTest( RequestTargetTest.suite() );
suite.addTest( FormParametersTest.suite() );
suite.addTest( FormSubmitTest.suite() );
Index: HttpUnitTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/HttpUnitTest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- HttpUnitTest.java 2001/03/20 23:35:43 1.10
+++ HttpUnitTest.java 2001/04/03 16:49:08 1.11
@@ -1,5 +1,24 @@
package com.meterware.httpunit;
-
+/********************************************************************************************************************
+* $Id$
+*
+* Copyright (c) 2000-2001, Russell Gold
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
+* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in all copies or substantial portions
+* of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
+* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*
+*******************************************************************************************************************/
import java.net.URL;
import junit.framework.Test;
@@ -48,6 +67,11 @@
protected void defineResource( String resourceName, String value, String contentType ) {
_server.setResource( resourceName, value, contentType );
+ }
+
+
+ protected void addResourceHeader( String resourceName, String header ) {
+ _server.addResourceHeader( resourceName, header );
}
Index: WebFrameTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFrameTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WebFrameTest.java 2000/10/11 19:15:11 1.4
+++ WebFrameTest.java 2001/04/03 16:49:08 1.5
@@ -1,5 +1,24 @@
package com.meterware.httpunit;
-
+/********************************************************************************************************************
+* $Id$
+*
+* Copyright (c) 2000-2001, Russell Gold
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
+* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in all copies or substantial portions
+* of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
+* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*
+*******************************************************************************************************************/
import java.net.URL;
import junit.framework.Test;
@@ -201,6 +220,17 @@
assertMatchingSet( "Frames defined for the conversation", new String[] { "_top", "red", "blue" }, _wc.getFrameNames() );
assert( "Second response not the same as source frame contents", response == _wc.getFrameContents( "red" ) );
assertEquals( "URL for second request", getHostPath() + "/Target.html", response.getURL().toExternalForm() );
+ }
+
+
+ public void testSubFrameRedirect() throws Exception {
+ defineResource( "Linker.html", "" );
+ addResourceHeader( "Linker.html", "Location: " + getHostPath() + "/Target.html" );
+
+ _wc.getResponse( getHostPath() + "/Frames.html" );
+ assertMatchingSet( "Frames defined for the conversation", new String[] { "_top", "red", "blue" }, _wc.getFrameNames() );
+ assert( "Did not redirect", _wc.getFrameContents( "red" ).getURL().toExternalForm().endsWith( "Target.html" ) );
+
}
|