void (int w, int h, Consumer<JFrame> testActor, String url, String outFilename) { final CountDownLatch loaded = new CountDownLatch(1); JFrame[] f = new JFrame[]{null}; invokeAndWaitForLatch(loaded, () -> { JFrame frame = f[0] = new JFrame(String.format("Test fps %dx%d (%s)", w, h, url)); frame.setSize(w, h); frame.setLocationRelativeTo(null); JBCefBrowser browser = new JBCefBrowser(new JBCefBrowserBuilder().setOffScreenRendering(true)); browser.getJBCefClient().addLoadHandler(new CefLoadHandlerAdapter() { @Override public void onLoadEnd(CefBrowser cefBrowser, CefFrame frame, int httpStatusCode) { browser.getJBCefClient().removeLoadHandler(this, cefBrowser); loaded.countDown(); } }, browser.getCefBrowser()); var comp = browser.getComponent(); comp.setPreferredSize(new Dimension(w, h)); frame.add(comp, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); browser.loadURL(url); }); // Start fps meter String FPS_METER_ID = RegistryManager.getInstance().get("ide.browser.jcef.osr.measureFPS.id").asString(); final JBCefFpsMeter fpsMeter = JBCefFpsMeter.get(FPS_METER_ID); if (fpsMeter == null) { fail("Can't get FPS meter instance."); return; } fpsMeter.setActive(true); testActor.accept(f[0]); fpsMeter.setActive(false); // Write collected data and dispose frame. try { fpsMeter.writeStats(new PrintStream(outFilename)); } catch (FileNotFoundException e) { e.printStackTrace(); } f[0].dispose(); }