Package org.teavm.browserrunner
Class BrowserRunner
java.lang.Object
org.teavm.browserrunner.BrowserRunner
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclass -
Constructor Summary
ConstructorsConstructorDescriptionBrowserRunner(File baseDir, String type, Function<BrowserRunParams, Process> browserRunner, boolean decodeStack) -
Method Summary
Modifier and TypeMethodDescriptionstatic ProcesschromeBrowser(BrowserRunParams runParams) voidcleanup()static ProcesscustomBrowser(BrowserRunParams runParams) voidMakes browser accessible via Chrome DevTools protocol, which allows to collect CPU profiles, seetakeConsoleProfile(String, long, TimeUnit).static ProcessfirefoxBrowser(BrowserRunParams runParams) static Function<BrowserRunParams, Process> pickBrowser(String name) voidvoidrunTest(BrowserRunDescriptor run, BrowserOutputListener outputListener) Runs code in browser, passing every line it writes to stdout or stderr to the given listener instead of printing it to stdout/stderr of the current process.voidstart()voidstop()takeConsoleProfile(String title, long timeout, TimeUnit unit) Waits for CPU profile, recorded by code running in the browser betweenconsole.profile(title)andconsole.profileEnd(title)calls.
-
Constructor Details
-
BrowserRunner
public BrowserRunner(File baseDir, String type, Function<BrowserRunParams, Process> browserRunner, boolean decodeStack)
-
-
Method Details
-
pickBrowser
-
enableDevTools
public void enableDevTools()Makes browser accessible via Chrome DevTools protocol, which allows to collect CPU profiles, seetakeConsoleProfile(String, long, TimeUnit). Only supported in Chrome. Must be called beforestart(). -
start
public void start() -
takeConsoleProfile
Waits for CPU profile, recorded by code running in the browser betweenconsole.profile(title)andconsole.profileEnd(title)calls. RequiresenableDevTools().- Returns:
- profile in format of Chrome DevTools protocol (the same as format of
.cpuprofilefiles, which can be opened by Chrome DevTools). - Throws:
TimeoutException
-
stop
public void stop() -
runTest
- Throws:
IOException
-
runTest
public void runTest(BrowserRunDescriptor run, BrowserOutputListener outputListener) throws IOException Runs code in browser, passing every line it writes to stdout or stderr to the given listener instead of printing it to stdout/stderr of the current process.- Throws:
IOException
-
cleanup
public void cleanup() -
customBrowser
-
chromeBrowser
-
firefoxBrowser
-