Skip to content

Conversation

motiz88
Copy link
Contributor

@motiz88 motiz88 commented Oct 10, 2025

Summary:
Changelog: [Internal]

The team maintaining gmock is uninterested, as a matter of principle, in improving the ergonomics of writing helper functions around EXPECT_CALL. However, such helpers have proven very useful for the jsinspector-modern C++ test suite. The out-of-the-box ergonomics are pretty bad, though, so this diff tries to improve the situation.

The biggest offender in our test suite is the expectMessageFromPage helper function - if a test fails because an expectation isn't met, the error message points to the EXPECT_CALL line inside expectMessageFromPage, which is utterly useless compared to the line of test code that called expectMessageFromPage.

Here, we reach into gmock's internals slightly to create a variant of the EXPECT_CALL macro that allows passing in a std::source_location (thanks, C++20!). We then teach expectMessageFromPage and other such helpers to capture a source location at the call site (using a parameter with a default value to source_location::current()) and use the modified macro to pass it into gmock.

Differential Revision: D84368993

Summary:
Changelog: [Internal]

Adds an integration test for `NetworkReporter`'s CDP Tracing domain output (via `PerformanceTracer` behind the scenes), i.e. the traces that power the Network track in the Performance panel in React Native DevTools.

The test covers the `Tracing` and `Network` domains being enabled simultaneously, as well as `Tracing` on its own.

Differential Revision: D84337901
Summary:
Changelog: [Internal]

The team maintaining gmock is [uninterested, as a matter of principle,](google/googletest#2646 (comment)) in improving the ergonomics of writing helper functions around `EXPECT_CALL`. However, such helpers have proven very useful for the `jsinspector-modern` C++ test suite. The out-of-the-box ergonomics *are* pretty bad, though, so this diff tries to improve the situation.

The biggest offender in our test suite is the `expectMessageFromPage` helper function - if a test fails because an expectation isn't met, the error message points to the `EXPECT_CALL` line inside `expectMessageFromPage`, which is utterly useless compared to the line of test code that *called* `expectMessageFromPage`.

Here, we reach into gmock's internals slightly to create a variant of the `EXPECT_CALL` macro that allows passing in a [`std::source_location`](https://en.cppreference.com/w/cpp/utility/source_location.html) (thanks, C++20!). We then teach `expectMessageFromPage` and other such helpers to capture a source location at the call site (using a parameter with a default value to `source_location::current()`) and use the modified macro to pass it into gmock.

Differential Revision: D84368993
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 10, 2025
Copy link

meta-codesync bot commented Oct 10, 2025

@motiz88 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D84368993.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants