Revision: 670
          http://svn.sourceforge.net/jwebunit/?rev=670&view=rev
Author:   henryju
Date:     2007-03-03 09:43:59 -0800 (Sat, 03 Mar 2007)

Log Message:
-----------
gotoFrame should throw an Exception when no frame is found. [1638720]

Modified Paths:
--------------
    
branches/1.x/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FramesAndWindowsTest.java
    
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FramesAndWindowsTest/Frames.html
    
branches/1.x/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
    branches/1.x/src/changes/changes.xml

Modified: 
branches/1.x/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FramesAndWindowsTest.java
===================================================================
--- 
branches/1.x/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FramesAndWindowsTest.java
  2007-03-03 16:54:49 UTC (rev 669)
+++ 
branches/1.x/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FramesAndWindowsTest.java
  2007-03-03 17:43:59 UTC (rev 670)
@@ -26,15 +26,6 @@
         getTestContext().setBaseUrl(HOST_PATH + "/FramesAndWindowsTest");
     }
     
-    public void testHttpUnitWithRhinoForWindowOpen() throws Throwable {
-        try {
-            beginAt("RootPage.html");
-            clickLink("ChildPage1"); // does javascript:window.open(...)
-        } catch (NoSuchFieldError e) {
-            fail("HttpUnit 1.6 does not support the current version of Rhino");
-        }
-    }   
-    
     /**
      * helper function
      * @param childName
@@ -117,9 +108,11 @@
                assertFramePresent("ContentFrame");
         gotoFrame("ContentFrame");
         assertTextPresent("ContentFrame");
-    }
+        assertException(RuntimeException.class, "gotoFrame",
+                               new Object[] { "BottomFrame" });
+       }
 
-    public void testGotoFrameById() {
+       public void testGotoFrameById() {
         beginAt("Frames.html");
         assertFramePresent("frame1");
         gotoFrame("frame1");
@@ -132,16 +125,17 @@
         assertFramePresent("frame2");
         gotoFrame("frame2");
         assertTextPresent("ContentFrame");
+        assertException(RuntimeException.class, "gotoFrame", new Object[] { 
"TopFrame" });
     }
 
     public void testGotoInlineFrame() {
-               beginAt("InlineFrame.html");
-               assertTextPresent("TopFrame");
+        beginAt("InlineFrame.html");
+        assertTextPresent("TopFrame");
         // Is this how it should work? see also the test below
         assertTextNotPresent("ContentFrame");
-               gotoFrame("ContentFrame");
-               assertTextPresent("ContentFrame"); // only 'ContentFrame' 
matches frameset tag too
-       }
+        gotoFrame("ContentFrame");
+        assertTextPresent("ContentFrame"); // only 'ContentFrame' matches 
frameset tag too
+    }
 
     public void testFormInputInFrame() {
         beginAt("Frames.html");

Modified: 
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FramesAndWindowsTest/Frames.html
===================================================================
--- 
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FramesAndWindowsTest/Frames.html
   2007-03-03 16:54:49 UTC (rev 669)
+++ 
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/FramesAndWindowsTest/Frames.html
   2007-03-03 17:43:59 UTC (rev 670)
@@ -1,8 +1,8 @@
 <html>
 <head></head>
 <frameset rows="33%, 33%, 33%">
-<frame id="frame1" name="TopFrame" src="TopFrame.html">
-<frame id="frame2" name="ContentFrame" src="ContentFrame.html">
-<frame id="frame3" name="BottomFrame" src="BottomFrame.html">
+    <frame id="frame1" name="TopFrame" src="TopFrame.html">
+    <frame id="frame2" name="ContentFrame" src="ContentFrame.html">
+    <frame id="frame3" name="BottomFrame" src="BottomFrame.html">
 </frameset>
-</html>
\ No newline at end of file
+</html>

Modified: 
branches/1.x/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
===================================================================
--- 
branches/1.x/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
   2007-03-03 16:54:49 UTC (rev 669)
+++ 
branches/1.x/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
   2007-03-03 17:43:59 UTC (rev 670)
@@ -304,7 +304,11 @@
      * [EMAIL PROTECTED]
      */
     public void gotoFrame(String frameNameOrId) {
-        win = getFrame(frameNameOrId);
+       WebWindow frame = getFrame(frameNameOrId);
+       if (frame == null) {
+               throw new RuntimeException("No frame found in current page with 
name or id [" + frameNameOrId + "]");
+       }
+        win = frame;
     }
 
     /**

Modified: branches/1.x/src/changes/changes.xml
===================================================================
--- branches/1.x/src/changes/changes.xml        2007-03-03 16:54:49 UTC (rev 
669)
+++ branches/1.x/src/changes/changes.xml        2007-03-03 17:43:59 UTC (rev 
670)
@@ -8,6 +8,9 @@
     </properties>
     <body>
         <release version="1.4-RC4" date="UNKNOW">
+            <action type="fix" dev="Julien Henry" issue="1638720">
+                gotoFrame should throw an Exception when no frame is found.
+            </action>
             <action type="fix" dev="Julien Henry" issue="735092">
                 Make WebTestCase abstract.
             </action>


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
JWebUnit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to