← 输入框|chromiumembedded.github.io|刷新

JCEF Documentation

Java Chromium Embedded Framework documentation

View the Project on GitHub chromiumembedded/java-cef

Testing JCEF

Build JCEF using the build instructions. For CEF version changes, also follow the update validation requirements.

Choose test coverage

Run tests

The Windows runner uses separate JVMs for the OSR-enabled suite and tests tagged windowed-input. The latter disable OSR support to select the existing windowed message loop required for native input. Extra JUnit filters apply to both runs. With --reports-dir, XML reports go into osr and windowed subdirectories.

When running real-input focus and activation tests through Windows Remote Desktop, keep the local mouse cursor outside the RDP window’s desktop area until the tests finish. Keep the session connected. RDP cursor updates can override Robot.mouseMove(), sending clicks and keyboard input to another window and causing misleading focus failures.

macOS JUnit runner

Build the selected configuration first. With Python 3 and an active macOS desktop session, run from the checkout root:

tools/run_tests.sh macosx64 Release
tools/run_tests.sh macosx64 Release --include-classname '.*FocusHandlerTest'

macosx64 is the legacy script platform name for both Intel and Apple Silicon; the configured build selects the CPU architecture. The runner reuses jcef_build/native/Release/jcef_tests.app, refreshing its configuration when needed and linking to the existing build’s JARs, native library and framework. It preserves the built app’s JVM options and helper bundle identifier. It does not rebuild JCEF; rebuild after source changes. Only one test run per build configuration can use the bundle at a time.

Each run uses a temporary CEF cache, removes it on exit and disables saved-window restoration for the test process. Additional arguments go to the JUnit console; test failures and launch errors return a nonzero exit status. Check the reported test counts to verify discovery. JUnit tests do not necessarily create a visible browser window; use the samples to exercise rendering and interaction.

Tooling regression checks

Run architecture selection and distribution staging checks from the root:

python3 -m unittest discover -s tools -p platform_test.py

These tests exercise CMake in script mode and stage launchers and README files. They do not download CEF or establish native build/runtime support for the simulated targets.

Report results

Use the required desktop session and native dependencies. Reproduce sandbox or display failures in the required host environment before treating them as defects. Report commands, source/build identity, platform, JDK, results and limits. Compilation does not establish runtime behavior, and one platform’s success does not qualify the others.

macOS sample troubleshooting

The macOS build creates the detailed sample app at jcef_build/native/Release/jcef_app.app. See the launch instructions.

After repeated crashes, macOS may display a recovery dialog asking whether to reopen windows, delaying startup before the sample creates a browser window. Quit any running sample, then disable saved-window restoration for one diagnostic launch:

open jcef_build/native/Release/jcef_app.app --args -ApplePersistenceIgnoreState YES

This flag applies only to that process. It does not change system preferences or fix the crash that triggered the recovery dialog.