[Test Automation] Rectify callbacks with different signatures for tests
This CL adds base::RectifyCallback<>, which takes two callback signatures
and adapts one to the other by eliminating leading arguments the actual
callback doesn't care about.
For example:
using MyCallback = int(A, B)
RectifyCallback<MyCallback>()
can take a callback with any of the following signatures:
- int()
- int(B)
- int(A, B)
This will be used to simplify how we specify test steps in the new
Kombucha 1.5 test framework, by having methods accept arbitrary
signatures and use RectifyCallback<> under the hood:
AfterShow(kMyElementID,
base::BindLambdaForTesting(
[&](){ EXPECT_EQ(..., ...) }))
Rather than:
AfterShow(kMyElementID,
base::BindLambdaForTesting(
[&](ui::InteractionSequence*,
ui::TrackedElement*){
EXPECT_EQ(..., ...)
}))
Bug: 1374319
Change-Id: Iba23af602b56e9e30b97d6fde8a8626ba268b21b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3953118
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Dana Fried <dfried@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1061871}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.