| Code-Review | +1 |
add_member_checker("host_frame", &FormFieldData::host_frame,I think we are missing:
Can you double check?
add_member_checker(
"check_status", &FormFieldData::check_status,
std::optional{
*expected.checked
? FormFieldData::CheckStatus::kChecked
: FormFieldData::CheckStatus::kCheckableButUnchecked});Opt:
Should this be
```
matchers.push_back(testing::Property(
"check_status", &FormFieldData::check_status,
*expected.checked ? FormFieldData::CheckStatus::kChecked
: FormFieldData::CheckStatus::kCheckableButUnchecked));
```
Converting to optional here a non-null value doesn't bring a lot of value.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Norge Vizcay@viz...@google.com This one introduces the matcher used by https://crrev.com/c/7912949.
Acknowledged
add_member_checker("host_frame", &FormFieldData::host_frame,I think we are missing:
- placeholder_attribute
- pattern
- css_classes
Can you double check?
Done, good catch - they were added in a rebase and I forgot to update this here :) I also reordered the statements to match the order in the struct definition which should make these mistakes easier to see.
I added `LINT.IfChange` markers like in `FormDataEq()` to avoid this issue in the future. I've never used them before, can you check if I used them correctly?
add_member_checker(
"check_status", &FormFieldData::check_status,
std::optional{
*expected.checked
? FormFieldData::CheckStatus::kChecked
: FormFieldData::CheckStatus::kCheckableButUnchecked});Opt:
Should this be
```
matchers.push_back(testing::Property(
"check_status", &FormFieldData::check_status,
*expected.checked ? FormFieldData::CheckStatus::kChecked
: FormFieldData::CheckStatus::kCheckableButUnchecked));
```Converting to optional here a non-null value doesn't bring a lot of value.
Sorry, I agree that my hack to reuse the function wasn't great. What do you think of the new version using `and_then`? If you think this is also unnecessarily hard to read, I will simply use your snippet :)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// LINT.ThenChange(autofill_form_test_utils.cc:FormFieldDescriptionEq)We're generally required to use the full path.
add_member_checker("host_frame", &FormFieldData::host_frame,Tamino BauknechtI think we are missing:
- placeholder_attribute
- pattern
- css_classes
Can you double check?
Done, good catch - they were added in a rebase and I forgot to update this here :) I also reordered the statements to match the order in the struct definition which should make these mistakes easier to see.
I added `LINT.IfChange` markers like in `FormDataEq()` to avoid this issue in the future. I've never used them before, can you check if I used them correctly?
+1 on using a LINT rule. Left a couple of comments. Thanks for putting this together!
add_member_checker(
"check_status", &FormFieldData::check_status,
std::optional{
*expected.checked
? FormFieldData::CheckStatus::kChecked
: FormFieldData::CheckStatus::kCheckableButUnchecked});Tamino BauknechtOpt:
Should this be
```
matchers.push_back(testing::Property(
"check_status", &FormFieldData::check_status,
*expected.checked ? FormFieldData::CheckStatus::kChecked
: FormFieldData::CheckStatus::kCheckableButUnchecked));
```Converting to optional here a non-null value doesn't bring a lot of value.
Sorry, I agree that my hack to reuse the function wasn't great. What do you think of the new version using `and_then`? If you think this is also unnecessarily hard to read, I will simply use your snippet :)
Yours works for me :)
// LINT.ThenChange(autofill_form_test_utils.h:FieldDescriptionDataMembers)We're generally required to use the full path.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// LINT.ThenChange(autofill_form_test_utils.cc:FormFieldDescriptionEq)We're generally required to use the full path.
Done, good to know. Thanks :)
// LINT.ThenChange(autofill_form_test_utils.h:FieldDescriptionDataMembers)We're generally required to use the full path.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
autofill: Add test::FormFieldDescriptionEq for partial matching
This change allows users of the matcher to perform partial comparisons
to an expected `FormFieldData`. In many cases a test case only wants to
verify that a couple of members of `FormFieldData` is set accordingly.
At the moment, this requires a long call to `test::GetFormFieldData()`
to fully set up the expected object and then `test::FormFieldDataEq` is
used to compare the actual and expected objects. While
`test::WithoutUnserializedData` already enables partial comparisons, it
is very restrictive and only cancels out a fixed set of members.
Concretely, `renderer_id`, `bounds`, `should_autocomplete` and some
other fields can differ in a regular test case from the default of
`test::GetFormFieldData()` which would cause multiple lines of
additional code for each expectation. At the same time, the test might
not even have the intent to check these, but needs to add the code
anyway.
It utilizes that all fields in `FieldDescription` are optional and only
compares the explicitly set fields with a `FormFieldData`.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |