# HG changeset patch # User Jaroslav Tulach # Date 1399369607 -7200 # Node ID 897d7f70c5a518c98141d1c69de79dd4e427d509 # Parent 7f477a85dbff8a3c3bacad18c675c3383b9d5e0c Reuse the browser for js and in brwsr test execution diff -r 7f477a85dbff -r 897d7f70c5a5 rt/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/LaunchSetup.java --- a/rt/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/LaunchSetup.java Tue May 06 11:30:08 2014 +0200 +++ b/rt/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/LaunchSetup.java Tue May 06 11:46:47 2014 +0200 @@ -18,8 +18,10 @@ package org.apidesign.bck2brwsr.vmtest.impl; import java.io.IOException; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Set; import org.apidesign.bck2brwsr.launcher.Launcher; import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeGroups; @@ -44,7 +46,14 @@ if (js == null && create) { final String p = System.getProperty("vmtest.js", "script"); // NOI18N switch (p) { - case "brwsr": js = Launcher.createBrowser(null); break; // NOI18N + case "brwsr": // NOI18N + String cmd = null; + String pb = System.getProperty("vmtest.brwsrs"); // NOI18N + if (pb != null) { + cmd = pb.split(",")[0]; // NOI18N + } + js = brwsr(cmd); + break; case "script": js = Launcher.createJavaScript(); break; // NOI18N default: throw new IllegalArgumentException( "Unknown value of vmtest.js property: " + p @@ -65,20 +74,22 @@ @BeforeGroups("run") public void initializeLauncher() throws IOException { + Set all = new HashSet<>(brwsrs.values()); if (js(false) != null) { - js(true).initialize(); + all.add(js(true)); } - for (Launcher launcher : brwsrs.values()) { + for (Launcher launcher : all) { launcher.initialize(); } } @AfterGroups("run") public void shutDownLauncher() throws IOException, InterruptedException { + Set all = new HashSet<>(brwsrs.values()); if (js(false) != null) { - js(true).shutdown(); + all.add(js(true)); } - for (Launcher launcher : brwsrs.values()) { + for (Launcher launcher : all) { launcher.shutdown(); } }