Commit b4e81784 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[Passwords] Include Renderer ids in Generation Data on iOS

Following r661908 Autofill Mojo types are now available in the browser
and on all platforms. However, the provided StructTraits assume the
existence of renderer ids in NewPasswordFormGenerationData, which
currently don't exist on iOS. This change fixes this.

Bug: 962853
Change-Id: I08d664d88d99c4bc76df8b6e0330a3c719e1063c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1624919
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662523}
parent a8cb40c1
...@@ -1431,9 +1431,9 @@ TEST_F(PasswordGenerationAgentTest, GenerationAvailableByRendererIds) { ...@@ -1431,9 +1431,9 @@ TEST_F(PasswordGenerationAgentTest, GenerationAvailableByRendererIds) {
// Simulate that the browser informs about eligible for generation form. // Simulate that the browser informs about eligible for generation form.
// Check that generation is available only on new password field of this form. // Check that generation is available only on new password field of this form.
NewPasswordFormGenerationData generation_data = { NewPasswordFormGenerationData generation_data;
.new_password_renderer_id = generation_data.new_password_renderer_id =
password_elements[0].UniqueRendererFormControlId()}; password_elements[0].UniqueRendererFormControlId();
password_generation_->FoundFormEligibleForGeneration(generation_data); password_generation_->FoundFormEligibleForGeneration(generation_data);
ExpectAutomaticGenerationAvailable(kPasswordElementsIds[0], kAvailable); ExpectAutomaticGenerationAvailable(kPasswordElementsIds[0], kAvailable);
......
...@@ -460,9 +460,9 @@ TEST_F(AutofillTypeTraitsTestImpl, PassPasswordFormGenerationData) { ...@@ -460,9 +460,9 @@ TEST_F(AutofillTypeTraitsTestImpl, PassPasswordFormGenerationData) {
} }
TEST_F(AutofillTypeTraitsTestImpl, NewPasswordFormGenerationData) { TEST_F(AutofillTypeTraitsTestImpl, NewPasswordFormGenerationData) {
NewPasswordFormGenerationData input = { NewPasswordFormGenerationData input;
.new_password_renderer_id = 1234u, input.new_password_renderer_id = 1234u,
.confirmation_password_renderer_id = 5789u}; input.confirmation_password_renderer_id = 5789u;
base::RunLoop loop; base::RunLoop loop;
mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy(); mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy();
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "components/autofill/core/common/password_form_generation_data.h" #include "components/autofill/core/common/password_form_generation_data.h"
#include <utility>
namespace autofill { namespace autofill {
PasswordFormGenerationData::PasswordFormGenerationData() = default; PasswordFormGenerationData::PasswordFormGenerationData() = default;
...@@ -18,4 +20,25 @@ PasswordFormGenerationData::PasswordFormGenerationData( ...@@ -18,4 +20,25 @@ PasswordFormGenerationData::PasswordFormGenerationData(
PasswordFormGenerationData::~PasswordFormGenerationData() = default; PasswordFormGenerationData::~PasswordFormGenerationData() = default;
NewPasswordFormGenerationData::NewPasswordFormGenerationData() = default;
NewPasswordFormGenerationData::NewPasswordFormGenerationData(
const NewPasswordFormGenerationData& other) = default;
NewPasswordFormGenerationData::NewPasswordFormGenerationData(
uint32_t new_password_renderer_id,
uint32_t confirmation_password_renderer_id)
: new_password_renderer_id(new_password_renderer_id),
confirmation_password_renderer_id(confirmation_password_renderer_id) {}
#if defined(OS_IOS)
NewPasswordFormGenerationData::NewPasswordFormGenerationData(
base::string16 form_name,
base::string16 new_password_element,
base::string16 confirmation_password_element)
: form_name(std::move(form_name)),
new_password_element(std::move(new_password_element)),
confirmation_password_element(std::move(confirmation_password_element)) {}
#endif
} // namespace autofill } // namespace autofill
...@@ -44,16 +44,23 @@ struct PasswordFormGenerationData { ...@@ -44,16 +44,23 @@ struct PasswordFormGenerationData {
// TODO(https://crbug.com/866444): Remove old PasswordFormGenerationData and // TODO(https://crbug.com/866444): Remove old PasswordFormGenerationData and
// rename to PasswordFormGenerationData when the old parser is gone. // rename to PasswordFormGenerationData when the old parser is gone.
struct NewPasswordFormGenerationData { struct NewPasswordFormGenerationData {
NewPasswordFormGenerationData();
NewPasswordFormGenerationData(const NewPasswordFormGenerationData& other);
NewPasswordFormGenerationData(uint32_t new_password_renderer_id,
uint32_t confirmation_password_renderer_id);
#if defined(OS_IOS) #if defined(OS_IOS)
NewPasswordFormGenerationData(base::string16 form_name,
base::string16 new_password_element,
base::string16 confirmation_password_element);
base::string16 form_name; base::string16 form_name;
base::string16 new_password_element; base::string16 new_password_element;
base::string16 confirmation_password_element; base::string16 confirmation_password_element;
#else #endif
uint32_t new_password_renderer_id = uint32_t new_password_renderer_id =
FormFieldData::kNotSetFormControlRendererId; FormFieldData::kNotSetFormControlRendererId;
uint32_t confirmation_password_renderer_id = uint32_t confirmation_password_renderer_id =
FormFieldData::kNotSetFormControlRendererId; FormFieldData::kNotSetFormControlRendererId;
#endif
}; };
} // namespace autofill } // namespace autofill
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment