diff --git a/src/test/java/org/htmlunit/SimpleWebTestCase.java b/src/test/java/org/htmlunit/SimpleWebTestCase.java index 27da4a3310..c8766ab7bc 100644 --- a/src/test/java/org/htmlunit/SimpleWebTestCase.java +++ b/src/test/java/org/htmlunit/SimpleWebTestCase.java @@ -56,10 +56,6 @@ public final HtmlPage loadPage(final String html) throws Exception { return loadPage(html, null); } - public final HtmlPage loadPageOnlyParse(final String html) throws Exception { - return loadPage(html, null); - } - /** * User the default browser version to load a page with the specified HTML * and collect alerts into the list. diff --git a/src/test/java/org/htmlunit/benchmarks/HtmlUnitBenchmark.java b/src/test/java/org/htmlunit/benchmarks/HtmlUnitBenchmark.java index 79709c943b..07a03ccda9 100644 --- a/src/test/java/org/htmlunit/benchmarks/HtmlUnitBenchmark.java +++ b/src/test/java/org/htmlunit/benchmarks/HtmlUnitBenchmark.java @@ -2,6 +2,7 @@ import org.htmlunit.BrowserVersion; import org.htmlunit.SimpleWebTestCase; +import org.htmlunit.WebClient; import org.htmlunit.html.HtmlPage; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; @@ -759,7 +760,7 @@ Bachelor of Arts in International Studies (BAIS) """; @Benchmark - @Fork(2) + @Fork(1) @Warmup(iterations = 3) @Timeout(time = 1000) @Measurement(iterations = 4) @@ -767,8 +768,15 @@ Bachelor of Arts in International Studies (BAIS) public void JMH() throws Exception { setBrowserVersion(BrowserVersion.CHROME); - - HtmlPage pageFromString = loadPage(html); + WebClient webClient = new WebClient(BrowserVersion.getDefault(), false, null, -1); + webClient.getOptions().setJavaScriptEnabled(false); + webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); + webClient.getOptions().setCssEnabled(false); + webClient.getOptions().setHistoryPageCacheLimit(0); + webClient.getOptions().setHistorySizeLimit(0); + webClient.getOptions().setWebSocketEnabled(false); + webClient.setFrameContentHandler(baseFrameElement -> false); + HtmlPage pageFromString = loadPage(webClient, html, null, URL_FIRST); assert !pageFromString.querySelector("h1").asNormalizedText().contains("Stella"); }