Quantcast

[HtmlUnit] SVN: [13718] trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/ WebDriverTestCase.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[HtmlUnit] SVN: [13718] trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/ WebDriverTestCase.java

rbri
Revision: 13718
          http://sourceforge.net/p/htmlunit/code/13718
Author:   rbri
Date:     2017-03-13 16:57:57 +0000 (Mon, 13 Mar 2017)
Log Message:
-----------
be a bit more patient and check again before start crying

Modified Paths:
--------------
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java 2017-03-13 16:53:17 UTC (rev 13717)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java 2017-03-13 16:57:57 UTC (rev 13718)
@@ -1116,9 +1116,24 @@
 //            }
 //            webClient_ = null;
 
-            final List<Thread> jsThreads = getJavaScriptThreads();
+            List<Thread> jsThreads = getJavaScriptThreads();
+
             if (jsThreads.size() > 0) {
                 LOG.error("There are still " + jsThreads.size()
+                            + " JS threads running after the test; we will wait a bit");
+                for (Thread thread : jsThreads) {
+                    try {
+                        thread.join(1_000);
+                    }
+                    catch (final InterruptedException e) {
+                        LOG.error("JS threads does not die", e);
+                    }
+                }
+            }
+
+            jsThreads = getJavaScriptThreads();
+            if (jsThreads.size() > 0) {
+                LOG.error("There are still " + jsThreads.size()
                             + " JS threads running after the test; we will interrupt these threads");
                 for (Thread thread : jsThreads) {
                     thread.interrupt();
@@ -1126,11 +1141,12 @@
                         thread.join(1_000);
                     }
                     catch (final InterruptedException e) {
-                        LOG.error("JS threads does not die", e);
+                        LOG.error("InterruptedException while wating for a JS threads to die", e);
                     }
                 }
             }
 
+            jsThreads = getJavaScriptThreads();
             assertEquals("There are still " + jsThreads.size()
                     + " JS threads running after the test", 0, jsThreads.size());
         }


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
Loading...