Revision: 9119
Author: [email protected]
Date: Tue Oct 19 16:03:11 2010
Log: Ignore CSS errors and warnings while running htmlUnit tests. This stops console spew when running HtmlUnit tests in Eclipse. Any CSS fatal errors will still be
reported.

Filed HtmlUnit bug at https://sourceforge.net/tracker/?func=detail&aid=3090806&group_id=47038&atid=448266

Patch by: amitmanjhi
Review by: rjrjr,jlabanca

Review at http://gwt-code-reviews.appspot.com/1032801

http://code.google.com/p/google-web-toolkit/source/detail?r=9119

Modified:
 /trunk/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java

=======================================
--- /trunk/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java Fri Jun 18 06:44:18 2010 +++ /trunk/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java Tue Oct 19 12:52:46 2010
@@ -32,6 +32,9 @@

 import net.sourceforge.htmlunit.corejs.javascript.ScriptableObject;

+import org.w3c.css.sac.CSSParseException;
+import org.w3c.css.sac.ErrorHandler;
+
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.util.ArrayList;
@@ -91,6 +94,25 @@
     public void run() {
       WebClient webClient = new WebClient(browser);
       webClient.setAlertHandler(this);
+      // Adding a handler that ignores errors to work-around
+ // https://sourceforge.net/tracker/?func=detail&aid=3090806&group_id=47038&atid=448266
+      webClient.setCssErrorHandler(new ErrorHandler() {
+
+        public void error(CSSParseException exception) {
+          // ignore
+        }
+
+        public void fatalError(CSSParseException exception) {
+          treeLogger.log(TreeLogger.WARN,
+              "CSS fatal error: " + exception.getURI() + " ["
+                  + exception.getLineNumber() + ":"
+ + exception.getColumnNumber() + "] " + exception.getMessage());
+        }
+
+        public void warning(CSSParseException exception) {
+          // ignore
+        }
+      });
       webClient.setIncorrectnessListener(this);
       webClient.setThrowExceptionOnFailingStatusCode(false);
       webClient.setThrowExceptionOnScriptError(true);

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to