Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
272,300 | int (Object parent, Object child) {return intValueOf(child) - intValueOf(parent) - 1; } | getIndexOfChild |
272,301 | void (String[] args) { IconLoader.activate(); final JFrame frame = new JFrame(); frame.getContentPane().setLayout(new BorderLayout()); final JPanel content = new JPanel(new BorderLayout()); frame.getContentPane().add(content, BorderLayout.CENTER); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); final JTree tree = new Tree(); TreeTestUtil.assertTreeUI(tree); content.add(tree); final Ref<BalloonImpl> balloon = new Ref<>(); tree.addMouseListener(new MouseAdapter() { @Override public void mousePressed(final MouseEvent e) { if (balloon.get() != null && balloon.get().isVisible()) { //noinspection SSBasedInspection balloon.get().dispose(); } else { //JLabel pane1 = new JLabel("Hello, world!"); //JLabel pane2 = new JLabel("Hello, again"); //JPanel pane = new JPanel(new BorderLayout()); //pane.add(pane1, BorderLayout.CENTER); //pane.add(pane2, BorderLayout.SOUTH); //pane.setBorder(new LineBorder(Color.blue)); balloon.set(new BalloonImpl( new JLabel("Content"), Color.black, null , MessageType.ERROR.getPopupBackground(), true, true, true, true, true, true, 0, true, false, null, false, 500, 25, 0, 0, false, "This is the title", JBUI.insets(2), true, false, false, Balloon.Layer.normal, false, null, -1)); balloon.get().setShowPointer(true); if (e.isShiftDown()) { balloon.get().show(new RelativePoint(e), Balloon.Position.above); } else if (e.isAltDown()) { balloon.get().show(new RelativePoint(e), Balloon.Position.below); } else if (e.isMetaDown()) { balloon.get().show(new RelativePoint(e), Balloon.Position.atLeft); } else { balloon.get().show(new RelativePoint(e), Balloon.Position.atRight); } } } }); tree.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { System.out.println(e.getPoint()); } }); frame.setBounds(300, 300, 300, 300); frame.setVisible(true); } | main |
272,302 | void (final MouseEvent e) { if (balloon.get() != null && balloon.get().isVisible()) { //noinspection SSBasedInspection balloon.get().dispose(); } else { //JLabel pane1 = new JLabel("Hello, world!"); //JLabel pane2 = new JLabel("Hello, again"); //JPanel pane = new JPanel(new BorderLayout()); //pane.add(pane1, BorderLayout.CENTER); //pane.add(pane2, BorderLayout.SOUTH); //pane.setBorder(new LineBorder(Color.blue)); balloon.set(new BalloonImpl( new JLabel("Content"), Color.black, null , MessageType.ERROR.getPopupBackground(), true, true, true, true, true, true, 0, true, false, null, false, 500, 25, 0, 0, false, "This is the title", JBUI.insets(2), true, false, false, Balloon.Layer.normal, false, null, -1)); balloon.get().setShowPointer(true); if (e.isShiftDown()) { balloon.get().show(new RelativePoint(e), Balloon.Position.above); } else if (e.isAltDown()) { balloon.get().show(new RelativePoint(e), Balloon.Position.below); } else if (e.isMetaDown()) { balloon.get().show(new RelativePoint(e), Balloon.Position.atLeft); } else { balloon.get().show(new RelativePoint(e), Balloon.Position.atRight); } } } | mousePressed |
272,303 | void (MouseEvent e) { System.out.println(e.getPoint()); } | mouseMoved |
272,304 | void () { final Dimension preferredDimension = new Dimension(2345,678); final Dimension explicitDimension = new Dimension(4343,5554); TextPanel tp = new TextPanel() {}; tp.setPreferredSize(preferredDimension); tp.setExplicitSize(explicitDimension); Assert.assertEquals("Explicit dimension is more preferable", explicitDimension, tp.getPreferredSize()); } | testSetPreferredSizeSetExplicitSizeGetExplicitSize |
272,305 | void () { assumeTrue("NST-unsupported OS", NST.isSupportedOS()); NSTLibrary lib = null; try { // NOTE: for supported OS-versions library must always loads (even SystemSettingsWrapper.isTouchBarServerRunning() == false) lib = NST.loadLibraryImpl(); } catch (Throwable e) { fail("Failed to load nst library for touchbar: " + e.getMessage()); } assertNotNull("Failed to load nst library for touchbar: native loader returns null", lib); // NOTE: it's difficult to promise correct library work in the system without running tb-server (this condition must be equals to isSettingsDomainExists()) assumeTrue("touch bar server not running", Helpers.isTouchBarServerRunning()); try { // small check that loaded library can create native objects final ID test = lib.createTouchBar("test", (uid) -> ID.NIL, null); assertNotNull("Failed to create native touchbar object, result is null", test); assertNotSame("Failed to create native touchbar object, result is ID.NIL", ID.NIL, test); if (test != ID.NIL) lib.releaseNativePeer(test); } catch (RuntimeException e) { fail("nst library was loaded, but native object can't be created: " + e.getMessage()); } // TODO: // 1. try to create emulation of OS-event when click touchbar (need to make some research with dtrace) // 2. check that created objects are valid } | testLoadingAndBasicFunctions |
272,306 | void () { Assume.assumeTrue("NST-unsupported OS", NST.isSupportedOS()); final GeneralCommandLine cmdLine = new GeneralCommandLine("pgrep", "ser"); try { final ProcessOutput out = ExecUtil.execAndGetOutput(cmdLine); assertNotNull("ProcessOutput mustn't be null", out); assertNotNull("ProcessOutput.getStdout() mustn't be null", out.getStdout()); } catch (ExecutionException e) { fail("pgrep failed with exception: " + e.getMessage()); } // TODO: // 1. ensure that isTouchbarServerRunning() == true on some known models // for example MacBookPro14,3 (it's the model indentifier, don't mix with screen size) // 2. test that can restart server (i.e. pkill with sudo) // 3. check that 'isTouchbarServerRunning() == isSettingsDomainExists()' } | testGetProcessOutput |
272,307 | void () { IoTestUtil.assumeMacOS(); final String sysVer = NSDefaults.readStringVal("loginwindow", "SystemVersionStampAsString"); assertNotNull(sysVer); assertFalse(sysVer.isEmpty()); } | testSettingsRead |
272,308 | void () { Assume.assumeTrue("NST-unsupported OS", NST.isSupportedOS()); assertNull(NSDefaults.testTouchBarSettingsWrite()); } | testTouchBarSettingsWrite |
272,309 | void (String[] args) { SwingUtilities.invokeLater(() -> _createFrame()); } | main |
272,310 | void () { NST.loadLibraryImpl(); final JFrame f = new JFrame(); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.setBounds(0, 0, 500, 110); f.setVisible(true); new Thread(()-> { int c = 1; while (--c >= 0) { final TBPanel testTB = _createSimpleTestTouchbar(); testTB.selectVisibleItemsToShow(); testTB.setTo(null); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } NST.setTouchBar(null, ID.NIL); testTB.release(); } }, "com.intellij.ui.mac.touchbar.TouchbarTest._createFrame").start(); } | _createFrame |
272,311 | TBPanel () { final int configPopoverWidth = 143; final TBPanel testTB = new TBPanel("test_simple"); testTB.addButton().setText("butt").setAction(createPrintTextCallback("pressed button"), false); return testTB; } | _createSimpleTestTouchbar |
272,312 | TBPanel () { final int configPopoverWidth = 143; final TBPanel testTB = new TBPanel("test"); testTB.addButton().setText("test1").setAction(createPrintTextCallback("pressed test1 button"), false); testTB.addButton().setText("test2").setAction(createPrintTextCallback("pressed test2 button"), false); testTB.addButton().setText("test3 with suff").setAction(createPrintTextCallback("pressed test2 button"), false); testTB.addButton().setIcon(ourTestIcon).setAction(createPrintTextCallback("pressed image button"), false); testTB.addButton().setIcon(ourTestIcon).setText("IDEA very-very-very-very long suffix").setWidth(configPopoverWidth).setAction(createPrintTextCallback("pressed image-text button"), false); testTB.addButton().setIcon(ourTestIcon).setText("IDEA very long suffix").setWidth(configPopoverWidth + 69).setAction(createPrintTextCallback("pressed image-text 2 button"), false).setToggle(); return testTB; } | _createTestButtonsTouchbar |
272,313 | Collection<Integer> (int maxIndex) { if (ourIndices != null) return ourIndices; final Random rnd = new Random(System.currentTimeMillis()); final int size = rnd.nextInt(maxIndex/2); ourIndices = new HashSet<>(); for (int c = 0; c < size; ++c) { final int id = rnd.nextInt(maxIndex); ourIndices.add(id); // System.out.println("\t" + id); } ourIndices.remove(1); ourIndices.remove(2); return ourIndices; } | _makeRandomCollection |
272,314 | TBPanel () { final TBPanel testTB = new TBPanel("test"); testTB.addSpacing(true); final TBItemScrubber scrubber = testTB.addScrubber(); final int size = 130; for (int c = 0; c < size; ++c) { String txt = String.format("%d[%1.2f]", c, Math.random()); int finalC = c; Runnable action = () -> System.out.println("performed action of scrubber item at index " + finalC + " [thread:" + Thread.currentThread() + "]"); if (c == 11) { txt = "very very long text"; } else if (c == 1) { txt = "show"; action = ()->SwingUtilities.invokeLater(()->{ ourVisible = !ourVisible; NST.showScrubberItem(scrubber.myNativePeer, _makeRandomCollection(size - 1), ourVisible, false); }); } else if (c == 2) { txt = "enable"; action = ()->SwingUtilities.invokeLater(()->{ ourEnabled = !ourEnabled; NST.enableScrubberItems(scrubber.myNativePeer, _makeRandomCollection(size - 1), ourEnabled); }); } scrubber.addItem(ourTestIcon, txt, action); } return testTB; } | _createTestScrubberTouchbar |
272,315 | TBPanel () { final TBPanel testTB = new TBPanel("test"); testTB.addSpacing(true); testTB.addButton().setText("test1").setAction(createPrintTextCallback("pressed test1 button"), false); testTB.addButton().setText("test2").setAction(createPrintTextCallback("pressed test2 button"), false); testTB.addSpacing(false); testTB.addButton().setIcon(ourTestIcon).setAction(createPrintTextCallback("pressed image button"), false); return testTB; } | _createTestAllTouchbar |
272,316 | Runnable (String text) { return ()-> System.out.println(text + " [thread:" + Thread.currentThread() + "]"); } | createPrintTextCallback |
272,317 | void () { TestScaleHelper.assumeStandalone(); } | before |
272,318 | void () { TestScaleHelper.restoreProperties(); } | after |
272,319 | void () { JBCefBrowser browser = new JBCefBrowser("chrome:version"); JBCefJSQuery jsQuery = JBCefJSQuery.create(browser); jsQuery.addHandler(result -> { CALLBACL_COUNT.incrementAndGet(); String str = "JBCefJSQuery result: " + result; System.out.println(str); browser.loadHTML("<html><body>" + str + "</body></html>"); return null; }); invokeAndWaitForLoad(browser, () -> { JFrame frame = new JFrame(JBCefLoadHtmlTest.class.getName()); frame.setSize(640, 480); frame.setLocationRelativeTo(null); frame.add(browser.getComponent(), BorderLayout.CENTER); frame.setVisible(true); }); invokeAndWaitForLoad(browser, () -> browser.getCefBrowser().executeJavaScript(jsQuery.inject("'hello'"), "about:blank", 0)); assertEquals("JS callback has been erroneously called on page reload", 1, CALLBACL_COUNT.get()); } | test |
272,320 | void () { TestScaleHelper.assumeStandalone(); } | before |
272,321 | void () { TestScaleHelper.restoreSystemProperties(); } | after |
272,322 | void () { TestScaleHelper.restoreProperties(); // Clean up the certificate storage if needed var trustManager = CertificateManager.getInstance().getTrustManager().getCustomManager(); if (mySSLInfo != null && mySSLInfo.certificate != null) { for (X509Certificate certificate : mySSLInfo.certificate.getCertificatesChain()) { if (trustManager.containsCertificate(CertificateUtil.getCommonName(certificate))) { trustManager.removeCertificate(certificate); } } } } | after |
272,323 | void () { myContinueCalled.set(true); myLatch.countDown(); } | Continue |
272,324 | void () { myCancelCalled.set(true); myLatch.countDown(); } | cancel |
272,325 | void () { await(myLatch); } | waitCall |
272,326 | boolean () { return myContinueCalled.get(); } | continueCalled |
272,327 | boolean () { return myCancelCalled.get(); } | cancelCalled |
272,328 | void () { CefClient client = myBrowser.getJBCefClient().getCefClient(); // Call CertificateErrorCallback with an unknown(for the custom trust manager) certificate { var callback = new CertificateErrorCallback(); boolean exit_code = client.onCertificateError(myBrowser.getCefBrowser(), CefLoadHandler.ErrorCode.ERR_CERT_AUTHORITY_INVALID, "some_url", mySSLInfo, callback ); callback.waitCall(); assertTrue(exit_code); assertTrue(callback.cancelCalled()); assertFalse(callback.continueCalled()); } for (var certificate : mySSLInfo.certificate.getCertificatesChain()) { CertificateManager.getInstance().getTrustManager().getCustomManager().addCertificate(certificate); } // Call CertificateErrorCallback with a known(for the custom trust manager) certificate { var callback = new CertificateErrorCallback(); boolean exit_code = client.onCertificateError(myBrowser.getCefBrowser(), CefLoadHandler.ErrorCode.ERR_CERT_AUTHORITY_INVALID, "some_url", mySSLInfo, callback ); callback.waitCall(); assertTrue(exit_code); assertTrue(callback.continueCalled()); assertFalse(callback.cancelCalled()); } for (var certificate : mySSLInfo.certificate.getCertificatesChain()) { CertificateManager.getInstance().getTrustManager().getCustomManager().removeCertificate(certificate); } // Remove the certificate from the custom trust manger { var callback = new CertificateErrorCallback(); boolean exit_code = client.onCertificateError(myBrowser.getCefBrowser(), CefLoadHandler.ErrorCode.ERR_CERT_AUTHORITY_INVALID, "some_url", mySSLInfo, callback ); callback.waitCall(); assertTrue(exit_code); assertFalse(callback.continueCalled()); assertTrue(callback.cancelCalled()); } } | test |
272,329 | CefSSLInfo () { return new CefSSLInfo(4 /*CERT_STATUS_AUTHORITY_INVALID*/, new CefX509Certificate(new byte[][]{Base64.getDecoder().decode(CER_BASE64)})); } | makeSSLInfo |
272,330 | void () { TestScaleHelper.assumeStandalone(); TestScaleHelper.setRegistryProperty("ide.browser.jcef.headless.enabled", "true"); TestScaleHelper.setRegistryProperty("ide.browser.jcef.osr.enabled", "true"); } | before |
272,331 | void () { TestScaleHelper.restoreProperties(); } | after |
272,332 | void () { JBCefBrowser browser = JBCefBrowser.createBuilder() .setOffScreenRendering(true) .setOSRHandlerFactory(new JBCefOSRHandlerFactory() { final Rectangle bounds = new Rectangle(1024, 768); @Override public @NotNull Function<JComponent, Rectangle> createScreenBoundsProvider() { return component -> bounds; } }) .setUrl("chrome:version") .build(); invokeAndWaitForLoad(browser, () -> browser.getCefBrowser().createImmediately()); } | test |
272,333 | void () { TestScaleHelper.assumeStandalone(); TestScaleHelper.setRegistryProperty("ide.browser.jcef.osr.enabled", "true"); } | before |
272,334 | void () { TestScaleHelper.restoreProperties(); } | after |
272,335 | void () { JBCefClient client = JBCefApp.getInstance().createClient(); client.setProperty(JBCefClient.Properties.JS_QUERY_POOL_SIZE, 1); JBCefOsrHandlerBrowser browser = JBCefOsrHandlerBrowser.create("", new MyRenderHandler(), client); JBCefJSQuery jsQuery = JBCefJSQuery.create(browser); doTest(browser, jsQuery); } | test1 |
272,336 | void () { JBCefOsrHandlerBrowser browser = JBCefOsrHandlerBrowser.create("", new MyRenderHandler(), false); JBCefJSQuery jsQuery = JBCefJSQuery.create(browser); browser.createImmediately(); doTest(browser, jsQuery); } | test2 |
272,337 | void () { JBCefClient client = JBCefApp.getInstance().createClient(); client.setProperty(JBCefClient.Properties.JS_QUERY_POOL_SIZE, 1); JBCefBrowser browser = JBCefBrowser.createBuilder() .setOffScreenRendering(true) .setClient(client) .setCreateImmediately(true) .build(); JBCefJSQuery jsQuery = JBCefJSQuery.create((JBCefBrowserBase)browser); doTest(browser, jsQuery); } | test3 |
272,338 | void () { JBCefBrowser browser = JBCefBrowser.createBuilder() .setOffScreenRendering(true) .build(); JBCefJSQuery jsQuery = JBCefJSQuery.create((JBCefBrowserBase)browser); browser.createImmediately(); doTest(browser, jsQuery); } | test4 |
272,339 | void (@NotNull JBCefBrowserBase browser, @NotNull JBCefJSQuery jsQuery) { CountDownLatch latch = new CountDownLatch(1); jsQuery.addHandler(result -> { System.out.println("JBCefJSQuery result: " + result); latch.countDown(); return null; }); invokeAndWaitForLoad(browser, () -> { browser.loadURL("chrome:version"); }); invokeAndWaitForLatch(latch, () -> { System.out.println("Executing JBCefJSQuery..."); browser.getCefBrowser().executeJavaScript(jsQuery.inject("'hello'"), "about:blank", 0); }); } | doTest |
272,340 | Rectangle (CefBrowser browser) { return new Rectangle(0, 0, 100, 100); } | getViewRect |
272,341 | boolean (CefBrowser browser, CefScreenInfo screenInfo) { return false; } | getScreenInfo |
272,342 | Point (CefBrowser browser, Point viewPoint) { return new Point(0, 0); } | getScreenPoint |
272,343 | double (CefBrowser browser) { return 1; } | getDeviceScaleFactor |
272,344 | void (CefBrowser browser, boolean show) { } | onPopupShow |
272,345 | void (CefBrowser browser, Rectangle size) { } | onPopupSize |
272,346 | void (CefBrowser browser, boolean popup, Rectangle[] dirtyRects, ByteBuffer buffer, int width, int height) { } | onPaint |
272,347 | boolean (CefBrowser browser, int cursorType) { return false; } | onCursorChange |
272,348 | boolean (CefBrowser browser, CefDragData dragData, int mask, int x, int y) { return false; } | startDragging |
272,349 | void (CefBrowser browser, int operation) { } | updateDragCursor |
272,350 | void () { TestScaleHelper.assumeStandalone(); } | before |
272,351 | void () { TestScaleHelper.restoreProperties(); } | after |
272,352 | void () { var client = JBCefApp.getInstance().createClient(); client.setProperty(JBCefClient.Properties.JS_QUERY_POOL_SIZE, 1); var browser = new JBCefBrowserBuilder().setUrl("about:blank").setClient(client).build(); showAndWaitForLoad(browser, JBCefJSQueryPoolSlotReuseTest.class.getSimpleName()); /* * Create and use a JS query. */ var jsQuery1 = JBCefJSQuery.create((JBCefBrowserBase)browser); var funcName = jsQuery1.getFuncName(); doTest(browser, jsQuery1); Disposer.dispose(jsQuery1); // should return the query function to the free slot /* * Make sure the query is invalid. */ boolean isIllegal = false; try { jsQuery1.inject(""); } catch (IllegalStateException ex) { isIllegal = true; } assertTrue(isIllegal); /* * Create and use a JS query again and make sure it reuses the same function under the hood. */ var jsQuery2 = JBCefJSQuery.create((JBCefBrowserBase)browser); assertEquals(funcName, jsQuery2.getFuncName()); doTest(browser, jsQuery2); Disposer.dispose(client); } | test |
272,353 | void () { TestScaleHelper.assumeStandalone(); TestScaleHelper.setSystemProperty("java.awt.headless", "false"); } | before |
272,354 | void () { TestScaleHelper.restoreProperties(); } | after |
272,355 | void () { URL url; try { url = new URL(TEST_URL); } catch (MalformedURLException e) { e.printStackTrace(); fail("Unexpected exception"); return; } String urlToQuery = url.getProtocol() + "://" + url.getHost(); JBCefCookie cookie = new JBCefCookie( "MY_COOKIE", "MY_VALUE", url.getHost(), "/", false, false); JBCefBrowser browser = new JBCefBrowser(TEST_URL); CountDownLatch loadStartedLatch = new CountDownLatch(1); browser.getJBCefClient().addLoadHandler(new CefLoadHandlerAdapter() { @Override public void onLoadStart(CefBrowser browser, CefFrame frame, CefRequest.TransitionType transitionType) { System.out.println("onLoadStart"); loadStartedLatch.countDown(); } }, browser.getCefBrowser()); JBCefCookieManager manager = JBCefBrowserBase.getGlobalJBCefCookieManager(); /* * SET (before load) */ System.out.println("Test setCookie()..."); Future<Boolean> result = manager.setCookie(urlToQuery, cookie); JBCefTestHelper.showAsync(browser, JBCefCookieManagerTest.class.getSimpleName()); testFuture(result, Function.identity()); assertTrue(loadStartedLatch.getCount() > 0); // assure the cookie had been set before the site loading has started System.out.println("...done"); // wait for the loading to start try { assertTrue(loadStartedLatch.await(5, TimeUnit.SECONDS)); } catch (InterruptedException e) { e.printStackTrace(); fail("Unexpected exception"); } /* * GET */ System.out.println("Test getCookie()..."); Future<List<JBCefCookie>> result2 = manager.getCookies(urlToQuery, false); assertTrue(testFuture(result2, futureResult -> futureResult.contains(cookie))); System.out.println("...done"); /* * DELETE */ System.out.println("Test deleteCookies()..."); Future<Boolean> result3 = manager.deleteCookies(urlToQuery, cookie.getName()); assertTrue(testFuture(result3, Function.identity())); System.out.println("...done"); /* * GET (to tineout) */ System.out.println("Test getCookie() to timeout..."); Future<List<JBCefCookie>> result4 = manager.getCookies(urlToQuery, false); assertTrue(testFuture(result4, null)); System.out.println("...done"); Disposer.dispose(browser); } | test |
272,356 | void (CefBrowser browser, CefFrame frame, CefRequest.TransitionType transitionType) { System.out.println("onLoadStart"); loadStartedLatch.countDown(); } | onLoadStart |
272,357 | void () { assumeStandalone(); } | before |
272,358 | void () { restoreProperties(); } | after |
272,359 | void () { setRegistryProperty("ide.browser.jcef.headless.enabled", "false"); setRegistryProperty("ide.browser.jcef.testMode.enabled", "false"); assertFalse(JBCefApp.isSupported()); try { JBCefApp.getInstance(); fail(); } catch (IllegalStateException ignore) { } setRegistryProperty("ide.browser.jcef.headless.enabled", "true"); setRegistryProperty("ide.browser.jcef.testMode.enabled", "true"); assertTrue(JBCefApp.isSupported()); assertNotNull(JBCefApp.getInstance()); } | test |
272,360 | void (@NotNull JBCefBrowserBase browser, @NotNull String frameTitle) { invokeAndWaitForLoad(browser, () -> show(browser, frameTitle)); } | showAndWaitForLoad |
272,361 | void (@NotNull JBCefBrowserBase browser, @NotNull String frameTitle) { EventQueue.invokeLater(() -> show(browser, frameTitle)); } | showAsync |
272,362 | void (@NotNull JBCefBrowserBase browser, @NotNull String frameTitle) { JFrame frame = new JFrame(frameTitle); frame.setSize(640, 480); frame.setLocationRelativeTo(null); frame.add(browser.getComponent(), BorderLayout.CENTER); frame.setVisible(true); } | show |
272,363 | void (@NotNull JBCefBrowserBase browser, @NotNull Runnable runnable) { CountDownLatch latch = new CountDownLatch(1); browser.getJBCefClient().addLoadHandler(new CefLoadHandlerAdapter() { @Override public void onLoadEnd(CefBrowser cefBrowser, CefFrame frame, int httpStatusCode) { System.out.println("onLoadEnd on " + browser + " for " + browser.getCefBrowser().getURL()); browser.getJBCefClient().removeLoadHandler(this, cefBrowser); latch.countDown(); } }, browser.getCefBrowser()); invokeAndWaitForLatch(latch, runnable); } | invokeAndWaitForLoad |
272,364 | void (CefBrowser cefBrowser, CefFrame frame, int httpStatusCode) { System.out.println("onLoadEnd on " + browser + " for " + browser.getCefBrowser().getURL()); browser.getJBCefClient().removeLoadHandler(this, cefBrowser); latch.countDown(); } | onLoadEnd |
272,365 | void (@NotNull Runnable runnable, @NotNull BooleanSupplier condition) { CountDownLatch latch = new CountDownLatch(1); invokeAndWaitForLatch(latch, () -> { runnable.run(); latch.countDown(); }); try { while (!condition.getAsBoolean()) { //noinspection BusyWait Thread.sleep(100); } } catch (InterruptedException e) { throw new RuntimeException(e); } } | invokeAndWaitForCondition |
272,366 | void (@NotNull CountDownLatch latch, @NotNull Runnable runnable) { UIUtil.invokeLaterIfNeeded(runnable); await(latch); } | invokeAndWaitForLatch |
272,367 | void (@NotNull CountDownLatch latch) { try { if (!latch.await(5, TimeUnit.SECONDS)) { Assert.fail("timeout:\n" + ThreadDumper.dumpThreadsToString()); } } catch (InterruptedException e) { throw new RuntimeException(e); } } | await |
272,368 | void () { TestScaleHelper.setRegistryProperty("ide.browser.jcef.osr.enabled", "true"); TestScaleHelper.assumeStandalone(); } | before |
272,369 | void () { TestScaleHelper.restoreProperties(); } | after |
272,370 | void (CefBrowser browser, CefFrame frame, int httpStatusCode) { browser.setFocus(true); latch.countDown(); super.onLoadEnd(browser, frame, httpStatusCode); } | onLoadEnd |
272,371 | void (WindowEvent e) { browser.loadHTML(HTML_TEXT.replaceAll("###CALLBACK_PLACEHOLDER###", jsQuery.inject("event.target.value")), URL); } | windowOpened |
272,372 | InputMethodEvent (String text, boolean commit) { return new InputMethodEvent(browser.getCefBrowser().getUIComponent(), InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, new AttributedString(text).getIterator(), commit ? text.length() : 0, null, null); } | makeEvent |
272,373 | void () { TestScaleHelper.assumeStandalone(); TestScaleHelper.setSystemProperty("java.awt.headless", "false"); } | before |
272,374 | void () { TestScaleHelper.restoreProperties(); } | after |
272,375 | void () { // // Try external JBCefClient. // doTest(JBCefApp.getInstance().createClient()); // // Try default JBCefClient. // doTest(null); } | test |
272,376 | void (@Nullable JBCefClient client) { JBCefBrowserBase browser = null; try { browser = new JCEFHtmlPanel(client, "about:blank"); } catch (RuntimeException ex) { fail("Exception occurred: " + ex.getMessage()); ex.printStackTrace(); } if (client == null) client = browser.getJBCefClient(); assertFalse(browser.isDisposed()); Disposer.dispose(client); assertTrue(browser.isDisposed()); } | doTest |
272,377 | void () { TestScaleHelper.assumeStandalone(); } | before |
272,378 | void () { TestScaleHelper.restoreSystemProperties(); } | after |
272,379 | void () { _testScrollingImpl(600, 1000, 5, 20); } | testPageScrolling |
272,380 | void (int w, int h, int speed, int delay) { String htmlPath = PlatformTestUtil.getPlatformTestDataPath() + "ui/jcef/long_page.html"; String url = "file://" + htmlPath; _testImpl(w, h, (f)->{ try { Robot robot = new Robot(); robot.setAutoDelay(0); Rectangle r = f.getBounds(); robot.mouseMove((int)r.getCenterX(), (int)r.getCenterY()); robot.delay(500); final long startMs = System.currentTimeMillis(); while (System.currentTimeMillis() - startMs < 20*1000) { robot.mouseWheel(-speed); robot.delay(delay); } } catch (AWTException e) { throw new RuntimeException(e); } }, url, String.format("test_scroll_fps_%dx%d_speed%d.csv", w, h, speed)); } | _testScrollingImpl |
272,381 | void () { _testSvgImpl(2500, 1600); } | testAnimatedSvgLarge |
272,382 | void () { _testSvgImpl(1400, 800); } | testAnimatedSvg |
272,383 | void (int w, int h) { String svgPath = PlatformTestUtil.getPlatformTestDataPath() + "ui/jcef/animated.svg"; String url = "file://" + svgPath; _testImpl(w, h, (f)->{ try { Thread.sleep(20*1000); } catch (InterruptedException e) { throw new RuntimeException(e); } }, url, String.format("test_svg_fps_%dx%d.csv", w, h)); } | _testSvgImpl |
272,384 | 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(); } | _testImpl |
272,385 | void (CefBrowser cefBrowser, CefFrame frame, int httpStatusCode) { browser.getJBCefClient().removeLoadHandler(this, cefBrowser); loaded.countDown(); } | onLoadEnd |
272,386 | void () { TestScaleHelper.assumeStandalone(); } | before |
272,387 | void () { TestScaleHelper.restoreSystemProperties(); } | after |
272,388 | void () { CountDownLatch latch1 = new CountDownLatch(1); CountDownLatch latch2 = new CountDownLatch(1); JBCefBrowser jbCefBrowser = new JBCefBrowser("https://maps.google.com"); // we need some heavy website, taking time to load jbCefBrowser.setErrorPage(JBCefBrowserBase.ErrorPage.DEFAULT); jbCefBrowser.getJBCefClient().addLoadHandler(new CefLoadHandler() { @Override public void onLoadingStateChange(CefBrowser browser, boolean isLoading, boolean canGoBack, boolean canGoForward) { System.out.println("JBCefLoadHtmlTest.onLoadingStateChange: " + isLoading); if (!isLoading && latch1.getCount() < 1) { latch2.countDown(); } } @Override public void onLoadStart(CefBrowser browser, CefFrame frame, CefRequest.TransitionType transitionType) { System.out.println("JBCefLoadHtmlTest.onLoadStart: " + frame.getURL()); if (frame.getURL().contains("google")) { jbCefBrowser.loadURL("https://www.jetbrains.com"); // we need some heavy website, taking time to load } } @Override public void onLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) { System.out.println("JBCefLoadHtmlTest.onLoadEnd: " + frame.getURL()); if (frame.getURL().contains("jetbrains")) { latch1.countDown(); } } @Override public void onLoadError(CefBrowser browser, CefFrame frame, ErrorCode errorCode, String errorText, String failedUrl) { System.out.println("JBCefLoadHtmlTest.onLoadError: " + failedUrl); } }, jbCefBrowser.getCefBrowser()); invokeAndWaitForLoad(jbCefBrowser, () -> { JFrame frame = new JFrame(JBCefLoadHtmlTest.class.getName()); frame.setSize(640, 480); frame.setLocationRelativeTo(null); frame.add(jbCefBrowser.getComponent()); frame.setVisible(true); }); await(latch1); await(latch2); assertThat(jbCefBrowser.getCefBrowser().getURL()).contains("jetbrains"); } | test |
272,389 | void (CefBrowser browser, boolean isLoading, boolean canGoBack, boolean canGoForward) { System.out.println("JBCefLoadHtmlTest.onLoadingStateChange: " + isLoading); if (!isLoading && latch1.getCount() < 1) { latch2.countDown(); } } | onLoadingStateChange |
272,390 | void (CefBrowser browser, CefFrame frame, CefRequest.TransitionType transitionType) { System.out.println("JBCefLoadHtmlTest.onLoadStart: " + frame.getURL()); if (frame.getURL().contains("google")) { jbCefBrowser.loadURL("https://www.jetbrains.com"); // we need some heavy website, taking time to load } } | onLoadStart |
272,391 | void (CefBrowser browser, CefFrame frame, int httpStatusCode) { System.out.println("JBCefLoadHtmlTest.onLoadEnd: " + frame.getURL()); if (frame.getURL().contains("jetbrains")) { latch1.countDown(); } } | onLoadEnd |
272,392 | void (CefBrowser browser, CefFrame frame, ErrorCode errorCode, String errorText, String failedUrl) { System.out.println("JBCefLoadHtmlTest.onLoadError: " + failedUrl); } | onLoadError |
272,393 | void () { TestScaleHelper.assumeStandalone(); TestScaleHelper.setRegistryProperty("ide.browser.jcef.osr.enabled", "true"); } | before |
272,394 | void () { TestScaleHelper.restoreProperties(); } | after |
272,395 | void () { show(JBCefBrowser.createBuilder().setOffScreenRendering(false).setUrl("chrome:version").build()); show(JBCefBrowser.createBuilder().setOffScreenRendering(true).setUrl("chrome:version").build()); } | test |
272,396 | void (@NotNull JBCefBrowser browser) { invokeAndWaitForLoad(browser, () -> { JFrame frame = new JFrame(JBCefLoadHtmlTest.class.getName()); frame.setSize(640, 480); frame.setLocationRelativeTo(null); frame.add(browser.getComponent(), BorderLayout.CENTER); frame.setVisible(true); }); } | show |
272,397 | void () { TestScaleHelper.assumeStandalone(); } | before |
272,398 | void () { test(client -> { client.setProperty(Properties.JS_QUERY_POOL_SIZE, 1); return null; }); } | test1 |
272,399 | void () { JBCefJSQueryPoolSizePropTest.test(client -> { client.setProperty(Properties.JS_QUERY_POOL_SIZE, Integer.MAX_VALUE); // stress test return null; }); } | test2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.