jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1620188 - in /jmeter/trunk: bin/testfiles/ src/protocol/http/org/apache/jmeter/protocol/http/parser/ test/src/org/apache/jmeter/protocol/http/parser/ xdocs/
Date Sun, 24 Aug 2014 21:09:04 GMT
Author: pmouawad
Date: Sun Aug 24 21:09:04 2014
New Revision: 1620188

URL: http://svn.apache.org/r1620188
Log:
Bug 56772 - Handle IE Conditional comments when parsing embedded resources
Bugzilla Id: 56772

Added:
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1.html   (with props)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_FF.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE6.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE7.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE8.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2.html   (with props)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_FF.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE7.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE8.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE9.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3.html   (with props)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_FF.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE10.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE55.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE6.all
Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HTMLParser.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParserHTMLParser.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JsoupBasedHtmlParser.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
    jmeter/trunk/xdocs/changes.xml

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1.html
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1.html?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1.html (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1.html Sun Aug 24 21:09:04 2014
@@ -0,0 +1,51 @@
+<HTML>
+<head>
+<!--[if IE 7]>
+<link rel="stylesheet" type="text/css" href="fileForIE7.css">
+<![endif]-->
+<!--[if IE 8]>
+<link rel="stylesheet" type="text/css" href="fileForIE8.css">
+<![endif]-->
+</head>
+<body background="images/body&amp;soul.gif">
+<table background="images/table.gif">
+<tr style="background url('images/tr.gif')">
+<td background="images/td.gif"><img name="a" src="images/image-a.gif" align="top"></td>
+</tr>
+</table>
+<img src="images/image-b.gif" name="b" align="top"/>
+<a href="somewhere"><img src="images/image-b.gif" name="b" align="top"/></a>
+<img align="top" name="c" src= "images/image-c.gif">
+<img name="d" align="top" src ="images/image-d.gif"/>
+<img
+  align="top"
+  name="e"
+  src =
+    "images/image-e.gif"
+>
+<img
+  align="top"
+  Name="F"
+  sRc = "images/sub/image-f.gif"
+/>
+<input name="a" src="images/image-a2.gif" type="image"/>
+<input src="images/image-b2.gif" name="b" type="image">
+<input type= "image" name="c" src= "images/sub/image-c2.gif"/>
+<input name="d" type ="image" src ="images/image-d2.gif">
+<input name="d2" type ="image" src ="images/image-d2.gif">
+<input name="d3" type ="imagex" src ="images/image-d2.gif">
+<input
+  type =
+    "image"
+  name="e"
+  src =
+    "images/image-e2.gif"
+/>
+<input
+  type = "image"
+  Name="F"
+  sRc = "images/image-f2.gif"
+>
+
+</body>
+</html>

Propchange: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_FF.all
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_FF.all?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_FF.all (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_FF.all Sun Aug 24 21:09:04 2014
@@ -0,0 +1,18 @@
+http://localhost/mydir/images/body&soul.gif
+http://localhost/mydir/images/table.gif
+http://localhost/mydir/images/tr.gif
+http://localhost/mydir/images/td.gif
+http://localhost/mydir/images/image-a.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-c.gif
+http://localhost/mydir/images/image-d.gif
+http://localhost/mydir/images/image-e.gif
+http://localhost/mydir/images/sub/image-f.gif
+http://localhost/mydir/images/image-a2.gif
+http://localhost/mydir/images/image-b2.gif
+http://localhost/mydir/images/sub/image-c2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-e2.gif
+http://localhost/mydir/images/image-f2.gif
\ No newline at end of file

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE6.all
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE6.all?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE6.all (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE6.all Sun Aug 24 21:09:04 2014
@@ -0,0 +1,18 @@
+http://localhost/mydir/images/body&soul.gif
+http://localhost/mydir/images/table.gif
+http://localhost/mydir/images/tr.gif
+http://localhost/mydir/images/td.gif
+http://localhost/mydir/images/image-a.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-c.gif
+http://localhost/mydir/images/image-d.gif
+http://localhost/mydir/images/image-e.gif
+http://localhost/mydir/images/sub/image-f.gif
+http://localhost/mydir/images/image-a2.gif
+http://localhost/mydir/images/image-b2.gif
+http://localhost/mydir/images/sub/image-c2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-e2.gif
+http://localhost/mydir/images/image-f2.gif
\ No newline at end of file

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE7.all
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE7.all?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE7.all (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE7.all Sun Aug 24 21:09:04 2014
@@ -0,0 +1,19 @@
+http://localhost/mydir/fileForIE7.css
+http://localhost/mydir/images/body&soul.gif
+http://localhost/mydir/images/table.gif
+http://localhost/mydir/images/tr.gif
+http://localhost/mydir/images/td.gif
+http://localhost/mydir/images/image-a.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-c.gif
+http://localhost/mydir/images/image-d.gif
+http://localhost/mydir/images/image-e.gif
+http://localhost/mydir/images/sub/image-f.gif
+http://localhost/mydir/images/image-a2.gif
+http://localhost/mydir/images/image-b2.gif
+http://localhost/mydir/images/sub/image-c2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-e2.gif
+http://localhost/mydir/images/image-f2.gif
\ No newline at end of file

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE8.all
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE8.all?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE8.all (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE8.all Sun Aug 24 21:09:04 2014
@@ -0,0 +1,19 @@
+http://localhost/mydir/fileForIE8.css
+http://localhost/mydir/images/body&soul.gif
+http://localhost/mydir/images/table.gif
+http://localhost/mydir/images/tr.gif
+http://localhost/mydir/images/td.gif
+http://localhost/mydir/images/image-a.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-c.gif
+http://localhost/mydir/images/image-d.gif
+http://localhost/mydir/images/image-e.gif
+http://localhost/mydir/images/sub/image-f.gif
+http://localhost/mydir/images/image-a2.gif
+http://localhost/mydir/images/image-b2.gif
+http://localhost/mydir/images/sub/image-c2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-e2.gif
+http://localhost/mydir/images/image-f2.gif
\ No newline at end of file

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2.html
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2.html?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2.html (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2.html Sun Aug 24 21:09:04 2014
@@ -0,0 +1,54 @@
+<HTML>
+<head>
+<!--[if gt IE 6]>
+    <!--[if lte IE 8]>
+        <!--[if IE 7]>
+            <link rel="stylesheet" type="text/css" href="fileForIE7.css">
+        <![endif]-->
+        <link rel="stylesheet" type="text/css" href="fileForIE7or8.css">
+    <![endif]-->
+    <link rel="stylesheet" type="text/css" href="fileForIE7or8or9.css">
+<![endif]-->
+</head>
+<body background="images/body&amp;soul.gif">
+<table background="images/table.gif">
+<tr style="background url('images/tr.gif')">
+<td background="images/td.gif"><img name="a" src="images/image-a.gif" align="top"></td>
+</tr>
+</table>
+<img src="images/image-b.gif" name="b" align="top"/>
+<a href="somewhere"><img src="images/image-b.gif" name="b" align="top"/></a>
+<img align="top" name="c" src= "images/image-c.gif">
+<img name="d" align="top" src ="images/image-d.gif"/>
+<img
+  align="top"
+  name="e"
+  src =
+    "images/image-e.gif"
+>
+<img
+  align="top"
+  Name="F"
+  sRc = "images/sub/image-f.gif"
+/>
+<input name="a" src="images/image-a2.gif" type="image"/>
+<input src="images/image-b2.gif" name="b" type="image">
+<input type= "image" name="c" src= "images/sub/image-c2.gif"/>
+<input name="d" type ="image" src ="images/image-d2.gif">
+<input name="d2" type ="image" src ="images/image-d2.gif">
+<input name="d3" type ="imagex" src ="images/image-d2.gif">
+<input
+  type =
+    "image"
+  name="e"
+  src =
+    "images/image-e2.gif"
+/>
+<input
+  type = "image"
+  Name="F"
+  sRc = "images/image-f2.gif"
+>
+
+</body>
+</html>

Propchange: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_FF.all
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_FF.all?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_FF.all (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_FF.all Sun Aug 24 21:09:04 2014
@@ -0,0 +1,20 @@
+http://localhost/mydir/fileForIE7or8.css
+http://localhost/mydir/fileForIE7or8or9.css
+http://localhost/mydir/images/body&soul.gif
+http://localhost/mydir/images/table.gif
+http://localhost/mydir/images/tr.gif
+http://localhost/mydir/images/td.gif
+http://localhost/mydir/images/image-a.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-c.gif
+http://localhost/mydir/images/image-d.gif
+http://localhost/mydir/images/image-e.gif
+http://localhost/mydir/images/sub/image-f.gif
+http://localhost/mydir/images/image-a2.gif
+http://localhost/mydir/images/image-b2.gif
+http://localhost/mydir/images/sub/image-c2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-e2.gif
+http://localhost/mydir/images/image-f2.gif
\ No newline at end of file

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE7.all
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE7.all?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE7.all (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE7.all Sun Aug 24 21:09:04 2014
@@ -0,0 +1,21 @@
+http://localhost/mydir/fileForIE7.css
+http://localhost/mydir/fileForIE7or8.css
+http://localhost/mydir/fileForIE7or8or9.css
+http://localhost/mydir/images/body&soul.gif
+http://localhost/mydir/images/table.gif
+http://localhost/mydir/images/tr.gif
+http://localhost/mydir/images/td.gif
+http://localhost/mydir/images/image-a.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-c.gif
+http://localhost/mydir/images/image-d.gif
+http://localhost/mydir/images/image-e.gif
+http://localhost/mydir/images/sub/image-f.gif
+http://localhost/mydir/images/image-a2.gif
+http://localhost/mydir/images/image-b2.gif
+http://localhost/mydir/images/sub/image-c2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-e2.gif
+http://localhost/mydir/images/image-f2.gif
\ No newline at end of file

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE8.all
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE8.all?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE8.all (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE8.all Sun Aug 24 21:09:04 2014
@@ -0,0 +1,20 @@
+http://localhost/mydir/fileForIE7or8.css
+http://localhost/mydir/fileForIE7or8or9.css
+http://localhost/mydir/images/body&soul.gif
+http://localhost/mydir/images/table.gif
+http://localhost/mydir/images/tr.gif
+http://localhost/mydir/images/td.gif
+http://localhost/mydir/images/image-a.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-c.gif
+http://localhost/mydir/images/image-d.gif
+http://localhost/mydir/images/image-e.gif
+http://localhost/mydir/images/sub/image-f.gif
+http://localhost/mydir/images/image-a2.gif
+http://localhost/mydir/images/image-b2.gif
+http://localhost/mydir/images/sub/image-c2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-e2.gif
+http://localhost/mydir/images/image-f2.gif
\ No newline at end of file

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE9.all
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE9.all?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE9.all (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE9.all Sun Aug 24 21:09:04 2014
@@ -0,0 +1,19 @@
+http://localhost/mydir/fileForIE7or8or9.css
+http://localhost/mydir/images/body&soul.gif
+http://localhost/mydir/images/table.gif
+http://localhost/mydir/images/tr.gif
+http://localhost/mydir/images/td.gif
+http://localhost/mydir/images/image-a.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-c.gif
+http://localhost/mydir/images/image-d.gif
+http://localhost/mydir/images/image-e.gif
+http://localhost/mydir/images/sub/image-f.gif
+http://localhost/mydir/images/image-a2.gif
+http://localhost/mydir/images/image-b2.gif
+http://localhost/mydir/images/sub/image-c2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-e2.gif
+http://localhost/mydir/images/image-f2.gif
\ No newline at end of file

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3.html
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3.html?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3.html (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3.html Sun Aug 24 21:09:04 2014
@@ -0,0 +1,50 @@
+<HTML>
+<head>
+<!--[if gt IE 5]>
+    <![if lt IE 6]>
+        <link rel="stylesheet" type="text/css" href="fileForIE55.css">
+    <![endif]>
+<![endif]-->
+</head>
+<body background="images/body&amp;soul.gif">
+<table background="images/table.gif">
+<tr style="background url('images/tr.gif')">
+<td background="images/td.gif"><img name="a" src="images/image-a.gif" align="top"></td>
+</tr>
+</table>
+<img src="images/image-b.gif" name="b" align="top"/>
+<a href="somewhere"><img src="images/image-b.gif" name="b" align="top"/></a>
+<img align="top" name="c" src= "images/image-c.gif">
+<img name="d" align="top" src ="images/image-d.gif"/>
+<img
+  align="top"
+  name="e"
+  src =
+    "images/image-e.gif"
+>
+<img
+  align="top"
+  Name="F"
+  sRc = "images/sub/image-f.gif"
+/>
+<input name="a" src="images/image-a2.gif" type="image"/>
+<input src="images/image-b2.gif" name="b" type="image">
+<input type= "image" name="c" src= "images/sub/image-c2.gif"/>
+<input name="d" type ="image" src ="images/image-d2.gif">
+<input name="d2" type ="image" src ="images/image-d2.gif">
+<input name="d3" type ="imagex" src ="images/image-d2.gif">
+<input
+  type =
+    "image"
+  name="e"
+  src =
+    "images/image-e2.gif"
+/>
+<input
+  type = "image"
+  Name="F"
+  sRc = "images/image-f2.gif"
+>
+
+</body>
+</html>

Propchange: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_FF.all
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_FF.all?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_FF.all (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_FF.all Sun Aug 24 21:09:04 2014
@@ -0,0 +1,18 @@
+http://localhost/mydir/images/body&soul.gif
+http://localhost/mydir/images/table.gif
+http://localhost/mydir/images/tr.gif
+http://localhost/mydir/images/td.gif
+http://localhost/mydir/images/image-a.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-c.gif
+http://localhost/mydir/images/image-d.gif
+http://localhost/mydir/images/image-e.gif
+http://localhost/mydir/images/sub/image-f.gif
+http://localhost/mydir/images/image-a2.gif
+http://localhost/mydir/images/image-b2.gif
+http://localhost/mydir/images/sub/image-c2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-e2.gif
+http://localhost/mydir/images/image-f2.gif
\ No newline at end of file

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE10.all
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE10.all?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE10.all (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE10.all Sun Aug 24 21:09:04 2014
@@ -0,0 +1,18 @@
+http://localhost/mydir/images/body&soul.gif
+http://localhost/mydir/images/table.gif
+http://localhost/mydir/images/tr.gif
+http://localhost/mydir/images/td.gif
+http://localhost/mydir/images/image-a.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-c.gif
+http://localhost/mydir/images/image-d.gif
+http://localhost/mydir/images/image-e.gif
+http://localhost/mydir/images/sub/image-f.gif
+http://localhost/mydir/images/image-a2.gif
+http://localhost/mydir/images/image-b2.gif
+http://localhost/mydir/images/sub/image-c2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-e2.gif
+http://localhost/mydir/images/image-f2.gif
\ No newline at end of file

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE55.all
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE55.all?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE55.all (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE55.all Sun Aug 24 21:09:04 2014
@@ -0,0 +1,19 @@
+http://localhost/mydir/fileForIE55.css
+http://localhost/mydir/images/body&soul.gif
+http://localhost/mydir/images/table.gif
+http://localhost/mydir/images/tr.gif
+http://localhost/mydir/images/td.gif
+http://localhost/mydir/images/image-a.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-c.gif
+http://localhost/mydir/images/image-d.gif
+http://localhost/mydir/images/image-e.gif
+http://localhost/mydir/images/sub/image-f.gif
+http://localhost/mydir/images/image-a2.gif
+http://localhost/mydir/images/image-b2.gif
+http://localhost/mydir/images/sub/image-c2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-e2.gif
+http://localhost/mydir/images/image-f2.gif
\ No newline at end of file

Added: jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE6.all
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE6.all?rev=1620188&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE6.all (added)
+++ jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE6.all Sun Aug 24 21:09:04 2014
@@ -0,0 +1,18 @@
+http://localhost/mydir/images/body&soul.gif
+http://localhost/mydir/images/table.gif
+http://localhost/mydir/images/tr.gif
+http://localhost/mydir/images/td.gif
+http://localhost/mydir/images/image-a.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-b.gif
+http://localhost/mydir/images/image-c.gif
+http://localhost/mydir/images/image-d.gif
+http://localhost/mydir/images/image-e.gif
+http://localhost/mydir/images/sub/image-f.gif
+http://localhost/mydir/images/image-a2.gif
+http://localhost/mydir/images/image-b2.gif
+http://localhost/mydir/images/sub/image-c2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-d2.gif
+http://localhost/mydir/images/image-e2.gif
+http://localhost/mydir/images/image-f2.gif
\ No newline at end of file

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HTMLParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HTMLParser.java?rev=1620188&r1=1620187&r2=1620188&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HTMLParser.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HTMLParser.java Sun Aug 24 21:09:04 2014
@@ -18,12 +18,15 @@
 
 package org.apache.jmeter.protocol.http.parser;
 
+
 import java.net.URL;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.logging.LoggingManager;
@@ -61,6 +64,10 @@ public abstract class HTMLParser {
     protected static final String TAG_SCRIPT        = "script";// $NON-NLS-1$
     protected static final String STYLESHEET        = "stylesheet";// $NON-NLS-1$
 
+    protected static final String IE_UA             = "MSIE ([0-9]+.[0-9]+)";// $NON-NLS-1$
+    protected static final Pattern IE_UA_PATTERN    = Pattern.compile(IE_UA);
+    private   static final float IE_10                = 10.0f;
+
     // Cache of parsers - parsers must be re-usable
     private static final Map<String, HTMLParser> parsers = new ConcurrentHashMap<String, HTMLParser>(4);
 
@@ -121,6 +128,8 @@ public abstract class HTMLParser {
      * Malformed URLs can be reported to the caller by having the Iterator
      * return the corresponding RL String. Overall problems parsing the html
      * should be reported by throwing an HTMLParseException.
+     * @param userAgent
+     *            User Agent
      *
      * @param html
      *            HTML code
@@ -129,7 +138,7 @@ public abstract class HTMLParser {
      * @param encoding Charset
      * @return an Iterator for the resource URLs
      */
-    public Iterator<URL> getEmbeddedResourceURLs(byte[] html, URL baseUrl, String encoding) throws HTMLParseException {
+    public Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] html, URL baseUrl, String encoding) throws HTMLParseException {
         // The Set is used to ignore duplicated binary files.
         // Using a LinkedHashSet to avoid unnecessary overhead in iterating
         // the elements in the set later on. As a side-effect, this will keep
@@ -137,7 +146,7 @@ public abstract class HTMLParser {
         // behaviour.
 
         Collection<URLString> col = new LinkedHashSet<URLString>();
-        return getEmbeddedResourceURLs(html, baseUrl, new URLCollection(col),encoding);
+        return getEmbeddedResourceURLs(userAgent, html, baseUrl, new URLCollection(col),encoding);
 
         // An additional note on using HashSets to store URLs: I just
         // discovered that obtaining the hashCode of a java.net.URL implies
@@ -167,6 +176,8 @@ public abstract class HTMLParser {
      * N.B. The Iterator returns URLs, but the Collection will contain objects
      * of class URLString.
      *
+     * @param userAgent
+     *            User Agent
      * @param html
      *            HTML code
      * @param baseUrl
@@ -176,7 +187,7 @@ public abstract class HTMLParser {
      * @param encoding Charset
      * @return an Iterator for the resource URLs
      */
-    public abstract Iterator<URL> getEmbeddedResourceURLs(byte[] html, URL baseUrl, URLCollection coll, String encoding)
+    public abstract Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] html, URL baseUrl, URLCollection coll, String encoding)
             throws HTMLParseException;
 
     /**
@@ -187,6 +198,8 @@ public abstract class HTMLParser {
      * N.B. The Iterator returns URLs, but the Collection will contain objects
      * of class URLString.
      *
+     * @param userAgent
+     *            User Agent
      * @param html
      *            HTML code
      * @param baseUrl
@@ -196,8 +209,8 @@ public abstract class HTMLParser {
      * @param encoding Charset
      * @return an Iterator for the resource URLs
      */
-    public Iterator<URL> getEmbeddedResourceURLs(byte[] html, URL baseUrl, Collection<URLString> coll, String encoding) throws HTMLParseException {
-        return getEmbeddedResourceURLs(html, baseUrl, new URLCollection(coll), encoding);
+    public Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] html, URL baseUrl, Collection<URLString> coll, String encoding) throws HTMLParseException {
+        return getEmbeddedResourceURLs(userAgent, html, baseUrl, new URLCollection(coll), encoding);
     }
 
     /**
@@ -209,4 +222,41 @@ public abstract class HTMLParser {
     protected boolean isReusable() {
         return false;
     }
+    
+    /**
+     * 
+     * @param ieVersion Float IE version
+     * @return
+     */
+    protected final boolean isEnableConditionalComments(Float ieVersion) {
+        if(ieVersion == null) {
+            return false;
+        }
+        // Conditionnal comment have been dropped in IE10
+        // http://msdn.microsoft.com/en-us/library/ie/hh801214%28v=vs.85%29.aspx
+        return ieVersion.floatValue() < IE_10;
+    }
+    
+    /**
+     * 
+     * @param userAgent User Agent
+     * @return version null if not IE or the version after MSIE
+     */
+    protected Float extractIEVersion(String userAgent) {
+        Matcher matcher = IE_UA_PATTERN.matcher(userAgent);
+        String ieVersion = null;
+        while (matcher.find()) {
+            if (matcher.groupCount() > 0) {
+                ieVersion = matcher.group(1);
+            } else {
+                ieVersion = matcher.group();
+            }
+            break;
+        }
+        if(ieVersion != null) {
+            return Float.valueOf(ieVersion);
+        } else {
+            return null;
+        }
+    }
 }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParserHTMLParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParserHTMLParser.java?rev=1620188&r1=1620187&r2=1620188&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParserHTMLParser.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParserHTMLParser.java Sun Aug 24 21:09:04 2014
@@ -66,7 +66,7 @@ class HtmlParserHTMLParser extends HTMLP
      * {@inheritDoc}
      */
     @Override
-    public Iterator<URL> getEmbeddedResourceURLs(byte[] html, URL baseUrl, URLCollection urls, String encoding) throws HTMLParseException {
+    public Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] html, URL baseUrl, URLCollection urls, String encoding) throws HTMLParseException {
 
         if (log.isDebugEnabled()) {
             log.debug("Parsing html of: " + baseUrl);

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java?rev=1620188&r1=1620187&r2=1620188&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java Sun Aug 24 21:09:04 2014
@@ -54,7 +54,7 @@ class JTidyHTMLParser extends HTMLParser
      * {@inheritDoc}
      */
     @Override
-    public Iterator<URL> getEmbeddedResourceURLs(byte[] html, URL baseUrl, URLCollection urls, String encoding) throws HTMLParseException {
+    public Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] html, URL baseUrl, URLCollection urls, String encoding) throws HTMLParseException {
         Document dom = null;
         try {
             dom = (Document) getDOM(html, encoding);

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JsoupBasedHtmlParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JsoupBasedHtmlParser.java?rev=1620188&r1=1620187&r2=1620188&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JsoupBasedHtmlParser.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JsoupBasedHtmlParser.java Sun Aug 24 21:09:04 2014
@@ -139,9 +139,10 @@ public class JsoupBasedHtmlParser extend
     }
 
     @Override
-    public Iterator<URL> getEmbeddedResourceURLs(byte[] html, URL baseUrl,
+    public Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] html, URL baseUrl,
             URLCollection coll, String encoding) throws HTMLParseException {
         try {
+            // TODO Handle conditional comments for IE
             String contents = new String(html,encoding);
             Document doc = Jsoup.parse(contents);
             JMeterNodeVisitor nodeVisitor = new JMeterNodeVisitor(new URLPointer(baseUrl), coll);

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java?rev=1620188&r1=1620187&r2=1620188&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java Sun Aug 24 21:09:04 2014
@@ -22,11 +22,16 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.Stack;
 
 import jodd.lagarto.EmptyTagVisitor;
 import jodd.lagarto.LagartoException;
 import jodd.lagarto.LagartoParser;
+import jodd.lagarto.LagartoParserConfig;
 import jodd.lagarto.Tag;
+import jodd.lagarto.TagType;
+import jodd.lagarto.TagUtil;
+import jodd.lagarto.dom.HtmlCCommentExpressionMatcher;
 import jodd.log.LoggerFactory;
 import jodd.log.impl.Slf4jLoggerFactory;
 
@@ -56,23 +61,27 @@ public class LagartoBasedHtmlParser exte
     }
     
     private static final class JMeterTagVisitor extends EmptyTagVisitor {
-
+        private HtmlCCommentExpressionMatcher htmlCCommentExpressionMatcher;
         private URLCollection urls;
         private URLPointer baseUrl;
+        private Float ieVersion;
+        private Stack<Boolean> enabled = new Stack<Boolean>();
 
         /**
          * @param baseUrl 
          * @param urls 
+         * @param ieVersion 
          */
-        public JMeterTagVisitor(final URLPointer baseUrl, URLCollection urls) {
+        public JMeterTagVisitor(final URLPointer baseUrl, URLCollection urls, Float ieVersion) {
             this.urls = urls;
             this.baseUrl = baseUrl;
+            this.ieVersion = ieVersion;
         }
 
         private final void extractAttribute(Tag tag, String attributeName) {
-            String url = tag.getAttributeValue(attributeName, false);
+            CharSequence url = tag.getAttributeValue(attributeName);
             if (!StringUtils.isEmpty(url)) {
-                urls.addURL(url, baseUrl.url);
+                urls.addURL(url.toString(), baseUrl.url);
             }
         }
         /*
@@ -83,6 +92,9 @@ public class LagartoBasedHtmlParser exte
          */
         @Override
         public void script(Tag tag, CharSequence body) {
+            if (!enabled.peek()) {
+                return;
+            }
             extractAttribute(tag, ATT_SRC);
         }
 
@@ -93,67 +105,115 @@ public class LagartoBasedHtmlParser exte
          */
         @Override
         public void tag(Tag tag) {
-
-            String tagName = tag.getName().toLowerCase();
-            if (tagName.equals(TAG_BODY)) {
-                extractAttribute(tag, ATT_BACKGROUND);
-            } else if (tagName.equals(TAG_BASE)) {
-                String baseref = tag.getAttributeValue(ATT_HREF, false);
-                try {
-                    if (!StringUtils.isEmpty(baseref))// Bugzilla 30713
-                    {
-                        baseUrl.url = ConversionUtils.makeRelativeURL(baseUrl.url, baseref);
+            if (!enabled.peek()) {
+                return;
+            }
+            TagType tagType = tag.getType();
+            switch (tagType) {
+            case START:
+            case SELF_CLOSING:
+                if (tag.nameEquals(TAG_BODY)) {
+                    extractAttribute(tag, ATT_BACKGROUND);
+                } else if (tag.nameEquals(TAG_BASE)) {
+                    CharSequence baseref = tag.getAttributeValue(ATT_HREF);
+                    try {
+                        if (!StringUtils.isEmpty(baseref))// Bugzilla 30713
+                        {
+                            baseUrl.url = ConversionUtils.makeRelativeURL(baseUrl.url, baseref.toString());
+                        }
+                    } catch (MalformedURLException e1) {
+                        throw new RuntimeException(e1);
                     }
-                } catch (MalformedURLException e1) {
-                    throw new RuntimeException(e1);
-                }
-            } else if (tagName.equals(TAG_IMAGE)) {
-                extractAttribute(tag, ATT_SRC);
-            } else if (tagName.equals(TAG_APPLET)) {
-                extractAttribute(tag, ATT_CODE);
-            } else if (tagName.equals(TAG_OBJECT)) {
-                extractAttribute(tag, ATT_CODEBASE);                
-                extractAttribute(tag, ATT_DATA);                 
-            } else if (tagName.equals(TAG_INPUT)) {
-                // we check the input tag type for image
-                if (ATT_IS_IMAGE.equalsIgnoreCase(tag.getAttributeValue(ATT_TYPE, false))) {
-                    // then we need to download the binary
+                } else if (tag.nameEquals(TAG_IMAGE)) {
+                    extractAttribute(tag, ATT_SRC);
+                } else if (tag.nameEquals(TAG_APPLET)) {
+                    extractAttribute(tag, ATT_CODE);
+                } else if (tag.nameEquals(TAG_OBJECT)) {
+                    extractAttribute(tag, ATT_CODEBASE);                
+                    extractAttribute(tag, ATT_DATA);                 
+                } else if (tag.nameEquals(TAG_INPUT)) {
+                    // we check the input tag type for image
+                    if (TagUtil.equalsIgnoreCase(ATT_IS_IMAGE, tag.getAttributeValue(ATT_TYPE))) {
+                        // then we need to download the binary
+                        extractAttribute(tag, ATT_SRC);
+                    }
+                } else if (tag.nameEquals(TAG_SCRIPT)) {
                     extractAttribute(tag, ATT_SRC);
+                    // Bug 51750
+                } else if (tag.nameEquals(TAG_FRAME) || tag.nameEquals(TAG_IFRAME)) {
+                    extractAttribute(tag, ATT_SRC);
+                } else if (tag.nameEquals(TAG_EMBED)) {
+                    extractAttribute(tag, ATT_SRC);
+                } else if (tag.nameEquals(TAG_BGSOUND)){
+                    extractAttribute(tag, ATT_SRC);
+                } else if (tag.nameEquals(TAG_LINK)) {
+                    CharSequence relAttribute = tag.getAttributeValue(ATT_REL);
+                    // Putting the string first means it works even if the attribute is null
+                    if (TagUtil.equalsIgnoreCase(STYLESHEET,relAttribute)) {
+                        extractAttribute(tag, ATT_HREF);
+                    }
+                } else {
+                    extractAttribute(tag, ATT_BACKGROUND);
                 }
-            } else if (tagName.equals(TAG_SCRIPT)) {
-                extractAttribute(tag, ATT_SRC);
-                // Bug 51750
-            } else if (tagName.equals(TAG_FRAME) || tagName.equals(TAG_IFRAME)) {
-                extractAttribute(tag, ATT_SRC);
-            } else if (tagName.equals(TAG_EMBED)) {
-                extractAttribute(tag, ATT_SRC);
-            } else if (tagName.equals(TAG_BGSOUND)){
-                extractAttribute(tag, ATT_SRC);
-            } else if (tagName.equals(TAG_LINK)) {
-                // Putting the string first means it works even if the attribute is null
-                if (STYLESHEET.equalsIgnoreCase(tag.getAttributeValue(ATT_REL, false))) {
-                    extractAttribute(tag, ATT_HREF);
+    
+    
+                // Now look for URLs in the STYLE attribute
+                CharSequence styleTagStr = tag.getAttributeValue(ATT_STYLE);
+                if(!StringUtils.isEmpty(styleTagStr)) {
+                    HtmlParsingUtils.extractStyleURLs(baseUrl.url, urls, styleTagStr.toString());
                 }
-            } else {
-                extractAttribute(tag, ATT_BACKGROUND);
+                break;
+            case END:
+                break;
             }
+        }
 
-
-            // Now look for URLs in the STYLE attribute
-            String styleTagStr = tag.getAttributeValue(ATT_STYLE, false);
-            if(styleTagStr != null) {
-                HtmlParsingUtils.extractStyleURLs(baseUrl.url, urls, styleTagStr);
+        /* (non-Javadoc)
+         * @see jodd.lagarto.EmptyTagVisitor#condComment(java.lang.CharSequence, boolean, boolean, boolean)
+         */
+        @Override
+        public void condComment(CharSequence expression, boolean isStartingTag,
+                boolean isHidden, boolean isHiddenEndTag) {
+            // See http://css-tricks.com/how-to-create-an-ie-only-stylesheet/
+            if(!isStartingTag) {
+                enabled.pop();
+            } else {
+                if (htmlCCommentExpressionMatcher == null) {
+                    htmlCCommentExpressionMatcher = new HtmlCCommentExpressionMatcher();
+                }
+                String expressionString = expression.toString().trim();
+                enabled.push(Boolean.valueOf(htmlCCommentExpressionMatcher.match(ieVersion.floatValue(),
+                        expressionString)));                
             }
         }
+
+        /* (non-Javadoc)
+         * @see jodd.lagarto.EmptyTagVisitor#start()
+         */
+        @Override
+        public void start() {
+            super.start();
+            enabled.clear();
+            enabled.push(Boolean.TRUE);
+        }
     }
 
     @Override
-    public Iterator<URL> getEmbeddedResourceURLs(byte[] html, URL baseUrl,
+    public Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] html, URL baseUrl,
             URLCollection coll, String encoding) throws HTMLParseException {
         try {
+            Float ieVersion = extractIEVersion(userAgent);
+            
             String contents = new String(html,encoding); 
-            LagartoParser lagartoParser = new LagartoParser(contents);
-            JMeterTagVisitor tagVisitor = new JMeterTagVisitor(new URLPointer(baseUrl), coll);
+            // As per Jodd javadocs, emitStrings should be false for visitor for better performances
+            LagartoParser lagartoParser = new LagartoParser(contents, false);
+            LagartoParserConfig<LagartoParserConfig> config = new LagartoParserConfig<LagartoParserConfig>();
+            config.setCaseSensitive(false);
+            // Conditional comments only apply for IE < 10
+            config.setEnableConditionalComments(isEnableConditionalComments(ieVersion));
+            
+            lagartoParser.setConfig(config);
+            JMeterTagVisitor tagVisitor = new JMeterTagVisitor(new URLPointer(baseUrl), coll, ieVersion);
             lagartoParser.parse(tagVisitor);
             return coll.iterator();
         } catch (LagartoException e) {
@@ -167,6 +227,10 @@ public class LagartoBasedHtmlParser exte
         }
     }
 
+    
+
+
+
     /* (non-Javadoc)
      * @see org.apache.jmeter.protocol.http.parser.HTMLParser#isReusable()
      */

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java?rev=1620188&r1=1620187&r2=1620188&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java Sun Aug 24 21:09:04 2014
@@ -144,7 +144,7 @@ class RegexpHTMLParser extends HTMLParse
      * @throws HTMLParseException 
      */
     @Override
-    public Iterator<URL> getEmbeddedResourceURLs(byte[] html, URL baseUrl, URLCollection urls, String encoding) throws HTMLParseException {
+    public Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] html, URL baseUrl, URLCollection urls, String encoding) throws HTMLParseException {
         Pattern pattern= null;
         Perl5Matcher matcher = null;
         try {

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java?rev=1620188&r1=1620187&r2=1620188&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java Sun Aug 24 21:09:04 2014
@@ -44,6 +44,15 @@ import junit.framework.TestSuite;
 public class TestHTMLParser extends JMeterTestCase {
     private static final Logger log = LoggingManager.getLoggerForClass();
 
+    private static final String DEFAULT_UA  = "Apache-HttpClient/4.2.6";
+    private static final String UA_FF       = "Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0";
+    private static final String UA_IE55     = "Mozilla/4.0 (compatible;MSIE 5.5; Windows 98)";
+    private static final String UA_IE6      = "Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)";
+    private static final String UA_IE7      = "Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)";
+    private static final String UA_IE8      = "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)";
+    private static final String UA_IE9      = "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))";
+    private static final String UA_IE10     = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)";
+
     public TestHTMLParser(String arg0) {
         super(arg0);
     }
@@ -51,6 +60,7 @@ public class TestHTMLParser extends JMet
 
         private int testNumber = 0;
 
+
         public TestHTMLParser(String name, int test) {
             super(name);
             testNumber = test;
@@ -83,31 +93,49 @@ public class TestHTMLParser extends JMet
 
             private String expectedList;
 
+            public String userAgent;
+
             /**
              * 
              * @param htmlFileName HTML File with content
              * @param baseUrl Base URL
              * @param expectedSet Set of expected URLs
              * @param expectedList List of expected URLs
+             * @param userAgent User Agent
              */
             private TestData(String htmlFileName, String baseUrl, String expectedSet, String expectedList) {
+                this(htmlFileName, baseUrl, expectedList, expectedList, DEFAULT_UA);
+            }
+            /**
+             * 
+             * @param htmlFileName HTML File with content
+             * @param baseUrl Base URL
+             * @param expectedSet Set of expected URLs
+             * @param expectedList List of expected URLs
+             * @param userAgent User Agent
+             */
+            private TestData(String htmlFileName, String baseUrl, String expectedSet, String expectedList, String userAgent) {
                 this.fileName = htmlFileName;
                 this.baseURL = baseUrl;
                 this.expectedSet = expectedSet;
                 this.expectedList = expectedList;
+                this.userAgent = userAgent;
             }
 
 //            private TestData(String f, String b, String s) {
 //                this(f, b, s, null);
 //            }
         }
-
+        
+        private static final String DEFAULT_JMETER_PARSER = 
+                "org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser";
+        
         // List of parsers to test. Should probably be derived automatically
         private static final String[] PARSERS = { 
             "org.apache.jmeter.protocol.http.parser.HtmlParserHTMLParser",
             "org.apache.jmeter.protocol.http.parser.JTidyHTMLParser",
             "org.apache.jmeter.protocol.http.parser.RegexpHTMLParser",
-            "org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser",
+            DEFAULT_JMETER_PARSER,
             "org.apache.jmeter.protocol.http.parser.JsoupBasedHtmlParser"
             };
 
@@ -151,6 +179,78 @@ public class TestHTMLParser extends JMet
                         "testfiles/HTMLParserTestFile_2.all"),
                          };
 
+
+        private static final TestData[] SPECIFIC_PARSER_TESTS = new TestData[] {
+            new TestData("testfiles/HTMLParserTestCaseWithConditional1.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional1_FF.all",
+                    UA_FF),
+            new TestData("testfiles/HTMLParserTestCaseWithConditional1.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional1_IE6.all",
+                    UA_IE6),
+            new TestData("testfiles/HTMLParserTestCaseWithConditional1.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional1_IE7.all",
+                    UA_IE7),
+            new TestData("testfiles/HTMLParserTestCaseWithConditional1.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional1_IE8.all",
+                    UA_IE8),
+            new TestData("testfiles/HTMLParserTestCaseWithConditional1.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional1_IE8.all",
+                    UA_IE8),
+
+            // FF gets mixed up by nested comments
+            new TestData("testfiles/HTMLParserTestCaseWithConditional2.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional2_FF.all",
+                    UA_FF),
+
+            new TestData("testfiles/HTMLParserTestCaseWithConditional2.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional2_IE7.all",
+                    UA_IE7),
+            new TestData("testfiles/HTMLParserTestCaseWithConditional2.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional2_IE8.all",
+                    UA_IE8),
+            new TestData("testfiles/HTMLParserTestCaseWithConditional2.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional2_IE9.all",
+                    UA_IE9),
+            new TestData("testfiles/HTMLParserTestCaseWithConditional3.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional3_FF.all",
+                    UA_FF),
+            new TestData("testfiles/HTMLParserTestCaseWithConditional3.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional3_IE10.all",
+                    UA_IE10),
+            new TestData("testfiles/HTMLParserTestCaseWithConditional3.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional3_IE55.all",
+                    UA_IE55),
+            new TestData("testfiles/HTMLParserTestCaseWithConditional3.html",
+                    "http://localhost/mydir/myfile.html",
+                    null,
+                    "testfiles/HTMLParserTestCaseWithConditional3_IE6.all",
+                    UA_IE6)        
+        };   
+
         public static junit.framework.Test suite() {
             TestSuite suite = new TestSuite("TestHTMLParser");
             suite.addTest(new TestHTMLParser("testDefaultParser"));
@@ -170,6 +270,14 @@ public class TestHTMLParser extends JMet
                 }
                 suite.addTest(ps);
             }
+            
+            TestSuite ps = new TestSuite(DEFAULT_JMETER_PARSER+"_conditional_comments");// Identify subtests
+            for (int j = 0; j < SPECIFIC_PARSER_TESTS.length; j++) {
+                TestSuite ts = new TestSuite(SPECIFIC_PARSER_TESTS[j].fileName);
+                ts.addTest(new TestHTMLParser("testSpecificParserList", DEFAULT_JMETER_PARSER, j));
+                ps.addTest(ts);
+            }
+            suite.addTest(ps);
             return suite;
         }
 
@@ -246,17 +354,25 @@ public class TestHTMLParser extends JMet
         public void testParserSet() throws Exception {
             HTMLParser p = HTMLParser.getParser(parserName);
             filetest(p, TESTS[testNumber].fileName, TESTS[testNumber].baseURL, TESTS[testNumber].expectedSet, null,
-                    false);
+                    false, TESTS[testNumber].userAgent);
         }
 
         public void testParserList() throws Exception {
             HTMLParser p = HTMLParser.getParser(parserName);
             filetest(p, TESTS[testNumber].fileName, TESTS[testNumber].baseURL, TESTS[testNumber].expectedList,
-                    new Vector<URLString>(), true);
+                    new Vector<URLString>(), true, TESTS[testNumber].userAgent);
+        }
+        
+        public void testSpecificParserList() throws Exception {
+            HTMLParser p = HTMLParser.getParser(parserName);
+            filetest(p, SPECIFIC_PARSER_TESTS[testNumber].fileName, SPECIFIC_PARSER_TESTS[testNumber].baseURL, SPECIFIC_PARSER_TESTS[testNumber].expectedList,
+                    new ArrayList<URLString>(), true, SPECIFIC_PARSER_TESTS[testNumber].userAgent);
         }
 
+
         private static void filetest(HTMLParser p, String file, String url, String resultFile, Collection<URLString> c,
-                boolean orderMatters) // Does the order matter?
+                boolean orderMatters, // Does the order matter?
+                String userAgent)
                 throws Exception {
             String parserName = p.getClass().getName().substring("org.apache.jmeter.protocol.http.parser.".length());
             String fname = file.substring(file.indexOf('/')+1);
@@ -273,9 +389,9 @@ public class TestHTMLParser extends JMet
             }
             Iterator<URL> result;
             if (c == null) {
-                result = p.getEmbeddedResourceURLs(buffer, new URL(url), System.getProperty("file.encoding"));
+                result = p.getEmbeddedResourceURLs(userAgent, buffer, new URL(url), System.getProperty("file.encoding"));
             } else {
-                result = p.getEmbeddedResourceURLs(buffer, new URL(url), c,System.getProperty("file.encoding"));
+                result = p.getEmbeddedResourceURLs(userAgent, buffer, new URL(url), c,System.getProperty("file.encoding"));
             }
             /*
              * TODO: Exact ordering is only required for some tests; change the
@@ -301,14 +417,14 @@ public class TestHTMLParser extends JMet
 
             while (expected.hasNext()) {
                 Object next = expected.next();
-                assertTrue(fname+"::"+parserName + "::Expecting another result " + next, result.hasNext());
+                assertTrue(userAgent+"::"+fname+"::"+parserName + "::Expecting another result " + next, result.hasNext());
                 try {
-                    assertEquals(fname+"::"+parserName + "(next)", next, result.next().toString());
+                    assertEquals(userAgent+"::"+fname+"::"+parserName + "(next)", next, result.next().toString());
                 } catch (ClassCastException e) {
-                    fail(fname+"::"+parserName + "::Expected URL, but got " + e.toString());
+                    fail(userAgent+"::"+fname+"::"+parserName + "::Expected URL, but got " + e.toString());
                 }
             }
-            assertFalse(fname+"::"+parserName + "::Should have reached the end of the results", result.hasNext());
+            assertFalse(userAgent+"::"+fname+"::"+parserName + "::Should have reached the end of the results", result.hasNext());
         }
 
         // Get expected results as a List

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1620188&r1=1620187&r2=1620188&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sun Aug 24 21:09:04 2014
@@ -203,6 +203,7 @@ jmeter.gui.action.LookAndFeelCommand: Us
 <li><bugzilla>52013</bugzilla> - Test Script Recorder's Child View Results Tree does not take into account Test Script Recorder excluded/included URLs. Based on report and analysis of James Liang</li>
 <li><bugzilla>56119</bugzilla> - File uploads fail every other attempt using timers. Enable idle timeouts for servers that don't send Keep-Alive headers.</li>
 <li><bugzilla>56272</bugzilla> - MirrorServer should support query parameters for status and redirects</li>
+<li><bugzilla>56772</bugzilla> - Handle IE Conditional comments when parsing embedded resources</li>
 </ul>
 
 <h3>Other samplers</h3>



Mime
View raw message