Many unit tests create a chromium UI, which means they need the ability to create a visible window. To run these tests remotely in a terminal, or to keep them from opening windows in your current desktop session, you can run tests inside Xvfb. To do this, prefix your command line with xvfb-run -s "-screen 0 1024x768x24". For example, to run content_unittests: xvfb-run -s "-screen 0 1024x768x24" ./out/Debug/content_unittests
To run these tests, build the blink_tests target and then run blink/tools/layout_tests/run_webkit_tests.sh --debug .
More information about running layout tests or fixing layouts tests can be found on the Layout Tests page.
Most components of chrome have a unit test build target, such as content_unittests for content/ or cc_unittests for cc/, etc. There is the fallback unit_tests target for unit tests built on top of the full chrome stack.
Unit tests verify some part of the chromium code base in an isolated test environment, and are usually found in files with a _unittest.cc suffix. Browser tests run a full browser, and then execute a test inside the browser instance, and are usually found in files with a _browsertest.cc suffix. There is more information on browser tests here. To add a new test, you will generally find a similar test and clone it. If you can, strongly prefer writing a unit test over a browser test as they are generally faster and more reliable.
Before running the tests, make sure to run
If you also want
You can also use the flag
When ssh-ed in to a machine, you don't have a display connected, which means that you normally can't run tests that try to draw to the screen. However, on Linux, you can run tests in headless mode, e.g.:
$ python testing/xvfb.py out/Debug/ out/Debug/components_unittests
When ssh-ed in to a machine, you don't have a display connected, which means that you normally can't run tests that try to draw to the screen. However, on Linux, you can run tests in headless mode, like so:
Xvfb :100 -screen 0 1600x1200x24 &
DISPLAY=localhost:100 out/Release/browser_tests --gtest_filter=FooTest.*