[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit RequestTargetTest.java,1.2,1.3 WebFrameT
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2003-02-27 23:36:21
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv23354/test/com/meterware/httpunit
Modified Files:
RequestTargetTest.java WebFrameTest.java WebLinkTest.java
Log Message:
Frame support now includes searching the current window
Index: RequestTargetTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/RequestTargetTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RequestTargetTest.java 10 Oct 2002 21:10:19 -0000 1.2
+++ RequestTargetTest.java 27 Feb 2003 23:36:04 -0000 1.3
@@ -1,13 +1,27 @@
package com.meterware.httpunit;
-
-import java.net.URL;
-
+/********************************************************************************************************************
+* $Id$
+*
+* Copyright (c) 2000-2003, 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 junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
-import java.util.Vector;
-
/**
* Tests to ensure the proper handling of the target attribute.
@@ -45,7 +59,6 @@
assertEquals( "default response target", WebRequest.TOP_FRAME, response.getFrameName() );
WebLink link = response.getLinks()[0];
assertEquals( "default link target", WebRequest.TOP_FRAME, link.getTarget() );
- assertEquals( "default request target", WebRequest.TOP_FRAME, link.getRequest().getTarget() );
}
@@ -101,7 +114,6 @@
assertEquals( "Num forms in page", 1, response.getForms().length );
WebForm form = response.getForms()[0];
assertEquals( "default form target", WebRequest.TOP_FRAME, form.getTarget() );
- assertEquals( "default request target", WebRequest.TOP_FRAME, form.getRequest().getTarget() );
}
Index: WebFrameTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFrameTest.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- WebFrameTest.java 4 Feb 2003 05:32:03 -0000 1.14
+++ WebFrameTest.java 27 Feb 2003 23:36:04 -0000 1.15
@@ -348,6 +348,37 @@
}
+ private void defineNestedFrames() throws Exception {
+ defineResource( "Topmost.html",
+ "<HTML><HEAD><TITLE>Topmost</TITLE></HEAD>" +
+ "<FRAMESET cols=\"20%,80%\">" +
+ " <FRAME src=\"Target.html\" name=\"red\">" +
+ " <FRAME src=\"Inner.html\" name=\"blue\">" +
+ "</FRAMESET></HTML>" );
+ defineResource( "Inner.html",
+ "<HTML><HEAD><TITLE>Inner</TITLE></HEAD>" +
+ "<FRAMESET rows=\"20%,80%\">" +
+ " <FRAME src=\"Form.html\" name=\"green\">" +
+ "</FRAMESET></HTML>" );
+ }
+
+
+ public void testGetNestedFrameByName() throws Exception {
+ defineNestedFrames();
+ _wc.getResponse( getHostPath() + "/Topmost.html" );
+ _wc.getFrameContents( "green" );
+ }
+
+
+ public void testLinkWithAncestorTarget() throws Exception {
+ defineNestedFrames();
+ _wc.getResponse( getHostPath() + "/Topmost.html" );
+ WebResponse innerResponse = _wc.getFrameContents( "blue" ).getSubframeContents( "green" );
+ innerResponse.getLinks()[0].click();
+ assertEquals( "Title of 'red' frame", "Linker", _wc.getFrameContents( "red" ).getTitle() );
+ }
+
+
public void testIFrameDetection() throws Exception {
defineWebPage( "Frame", "This is a trivial page with <a href='mailto:rus...@ht...'>one link</a>" +
"and <iframe name=center src='Contents.html'><form name=hidden></form></iframe>" );
Index: WebLinkTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebLinkTest.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- WebLinkTest.java 27 Dec 2002 13:43:11 -0000 1.26
+++ WebLinkTest.java 27 Feb 2003 23:36:06 -0000 1.27
@@ -2,7 +2,7 @@
/********************************************************************************************************************
* $Id$
*
-* Copyright (c) 2000-2002, Russell Gold
+* Copyright (c) 2000-2003, 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
@@ -258,8 +258,7 @@
assertEquals( "Num links in initial page", 1, initialPage.getLinks().length );
WebLink link = initialPage.getLinks()[0];
- WebRequest request = link.getRequest();
- assertEquals( "Target for link", "blue", request.getTarget() );
+ assertEquals( "Target for link", "blue", link.getTarget() );
}
|