blob: 2875768d6cd6609cce3a303f21eb3d37a22def81 [file] [log] [blame]
Name: Google Test: Google's C++ Testing Framework
Short Name: googletest
Version: unknown
License: BSD
License File: NOT_SHIPPED
Security critical: no
Google Test is imported as-is, to facilitate version bumping. However, the
file/directory layout of Google Test is not yet considered stable. Therefore,
until Google Test's layout stabilizes, Chromium code MUST NOT depend on it
directly. Instead, Chromium code MUST:
* #include the headers in testing/gtest and testing/gmock
* use //testing/gtest(:gtest_main) and //testing/gmock(:gmock_main) in
This will allow us to adapt to Google Test changes with minimal disruption.
## Resources for Rolling Googletest in Chrome
### What is Googletest
Googletest is an open source C++ testing framework developed by Google and used
by Chromium. See the [User Guide](
### Where is Googletest
Googletest is developed in google3 and uses
[copybara]( to sync with the public GitHub
* Development (Googler only): [google3/third\_party/googletest](http://google3/third_party/googletest/)
* GitHub:
* Chromium mirror:
* Locally, [third\_party/googletest/src/](
is a copy of Googletest which is updated via `gclient sync` according to the
`googletest revision` commit hash in the
[DEPS file](;l=244?q=DEPS%20googletest)
### Unblocking Googletest Rolls
1. Roll Googletest to include the breaking change
* Find the hash (on GitHub) of the offending commit
* If the change came from google3, the CL number can be found in the
`PiperOrigin-RevId` footer of Copybara commits
* On a fresh checkout, pull in the relevant change. Either:
* Sync using the DEPS file
roll-dep --roll-to=commitish src/third_party/googletest/src/
gclient sync
* Check out the commit directly
cd third_party/googletest/src
git remote add up
git checkout commitish
2. Observe errors
* Ideally, this can be done by building locally.
If the build is successful, this means the change does not affect your OS or
your compiler flags differ from the trybots
* Upload a CL with the added trybots from
[Testing Changes to Chromium in Chromium](#testing-changes-to-chromium-in-chromium)
3. Make changes
* To Chromium: create a CL including both the roll and other changes
* To Googletest:
* Make changes to [third\_party/googletest/src/](
and try building locally. If the fix is successful and youre confident
this change will work across all the trybots, create a PR on GitHub or a
CL to google3 (Googler only) of the changes you made locally to
See [Testing Changes to Googletest in Googletest](#testing-changes-to-googletest-in-googletest)
* What if I need to make a change to Googletest, but Im not confident it
will work with Chromium? Maybe it has to do with a tricky compiler error
that only affects a specific OS. See
[Testing Changes to Googletest in Chromium](#testing-changes-to-googletest-in-chromium)
* Once your Googletest change lands, create a roll which includes both the
offending commit and your change
### Testing Changes to Chromium in Chromium
Most changes should only require testing via the trybots,
with the following added:
`Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:linux_chromium_cfi_rel_ng;`
### Testing Changes to Googletest in Googletest
External: Upload a PR with your proposed changes to GitHub.
This will trigger automated testing.
Googlers: See the [Googletest Developers Guide](http://go/gunitdev).
### Testing Changes to Googletest in Chromium
In most cases, testing locally with changes to
should be enough. But how can you make sure the changes to Googletest actually
work in Chromium? Sometimes its not possible to test these changes locally
(different compiler flags, error that only affects a specific OS, etc).
Insert the pwnall repo:
* Development:
* Chromium mirror:
The pwnall repo allows you to make speculative changes to Googletest and run
them against the Chromium trybots. The flow is as follows:
* Create a local remote to the pwnall repo (alternatively, clone it elsewhere):
cd third_party/googletest/src
git remote
git remote add up
git remote add pwnall
* Sync the pwnall repo:
git checkout master
git pull up master
git push pwnall master
* Make changes on a new branch
* `git push pwnall branch-name`
* Update the `googletest revision` in the
[DEPS file](
with the commit hash and `/external/` to
* Upload the CL to run the change against the Chromium trybots
### Common Problems
* Differences in C++ version and clang compiler flags between Chromium and Googletest
* Chromium is on C++14, though its dependencies,
which may use Googletest, may be further behind
* Look for NACL in build errors. You may need to update your GN args with
`enable_nacl=true` to reproduce these errors locally
* [A Googletest interface is changed](
* Rolling past the commit will fail, since Chromium still uses the old interface
* Roll past the affecting commit and update uses in Chromium [in one CL](
* [A Googletest header is removed](
* Rolling past the commit will fail, since Chromium still expects the header to exist
* Roll past the affecting commit and updates uses in Chromium [in one CL](
* [A new Googletest feature](
requires [updating tests in Chromium](
### Other Resources
* [AutoRoller]( and
accompanying [configuration file](
* [Bug tracking substantial roll](