Commit a8edeaa9 authored by lshang's avatar lshang Committed by Commit bot

HTTP Bad: Add a seperator between http warning message and other entries

According to the mocks(go/fns-ui-spec), there should be a seperator between http
warning message and other autofill entries.

BUG=662298, 662297

Review-Url: https://codereview.chromium.org/2542593003
Cr-Commit-Position: refs/heads/master@{#436205}
parent f2998071
...@@ -593,6 +593,10 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id, ...@@ -593,6 +593,10 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id,
// On top of the explanation message, first show a "Payment not secure" // On top of the explanation message, first show a "Payment not secure"
// message. // message.
if (IsCreditCardAutofillHttpWarningEnabled()) { if (IsCreditCardAutofillHttpWarningEnabled()) {
#if !defined(OS_ANDROID)
suggestions.insert(suggestions.begin(), Suggestion());
suggestions.front().frontend_id = POPUP_ITEM_ID_SEPARATOR;
#endif
suggestions.insert(suggestions.begin(), suggestions.insert(suggestions.begin(),
CreateHttpWarningMessageSuggestionItem( CreateHttpWarningMessageSuggestionItem(
form_structure->source_url())); form_structure->source_url()));
......
...@@ -1631,6 +1631,9 @@ TEST_F(AutofillManagerTest, ...@@ -1631,6 +1631,9 @@ TEST_F(AutofillManagerTest,
IDS_AUTOFILL_CREDIT_CARD_HTTP_WARNING_MESSAGE), IDS_AUTOFILL_CREDIT_CARD_HTTP_WARNING_MESSAGE),
l10n_util::GetStringUTF8(IDS_AUTOFILL_HTTP_WARNING_LEARN_MORE), l10n_util::GetStringUTF8(IDS_AUTOFILL_HTTP_WARNING_LEARN_MORE),
"httpWarning", POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE), "httpWarning", POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE),
#if !defined(OS_ANDROID)
Suggestion("", "", "", POPUP_ITEM_ID_SEPARATOR),
#endif
Suggestion( Suggestion(
l10n_util::GetStringUTF8(IDS_AUTOFILL_WARNING_INSECURE_CONNECTION), l10n_util::GetStringUTF8(IDS_AUTOFILL_WARNING_INSECURE_CONNECTION),
"", "", POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE)); "", "", POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE));
......
...@@ -232,6 +232,10 @@ void PasswordAutofillManager::OnShowPasswordSuggestions( ...@@ -232,6 +232,10 @@ void PasswordAutofillManager::OnShowPasswordSuggestions(
l10n_util::GetStringUTF8(IDS_AUTOFILL_PASSWORD_HTTP_WARNING_MESSAGE), l10n_util::GetStringUTF8(IDS_AUTOFILL_PASSWORD_HTTP_WARNING_MESSAGE),
l10n_util::GetStringUTF8(IDS_AUTOFILL_HTTP_WARNING_LEARN_MORE), l10n_util::GetStringUTF8(IDS_AUTOFILL_HTTP_WARNING_LEARN_MORE),
icon_str, autofill::POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE); icon_str, autofill::POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE);
#if !defined(OS_ANDROID)
suggestions.insert(suggestions.begin(), autofill::Suggestion());
suggestions.front().frontend_id = autofill::POPUP_ITEM_ID_SEPARATOR;
#endif
suggestions.insert(suggestions.begin(), suggestions.insert(suggestions.begin(),
password_field_http_warning_suggestion); password_field_http_warning_suggestion);
} }
......
...@@ -619,13 +619,17 @@ TEST_F(PasswordAutofillManagerTest, NonSecurePasswordFieldHttpWarningMessage) { ...@@ -619,13 +619,17 @@ TEST_F(PasswordAutofillManagerTest, NonSecurePasswordFieldHttpWarningMessage) {
kMarkHttpWithPasswordsOrCcWithChipAndFormWarning); kMarkHttpWithPasswordsOrCcWithChipAndFormWarning);
// Http warning message shows for non-secure context and switch flag on, so // Http warning message shows for non-secure context and switch flag on, so
// there are 3 suggestions in total, and the message comes first among // there are 3 suggestions (+ 1 separator on desktop) in total, and the
// suggestions. // message comes first among suggestions.
auto elements = testing::ElementsAre(warning_message,
#if !defined(OS_ANDROID)
base::string16(),
#endif
title, test_username_);
EXPECT_CALL(*autofill_client, EXPECT_CALL(*autofill_client,
ShowAutofillPopup(element_bounds, _, ShowAutofillPopup(element_bounds, _,
SuggestionVectorValuesAre(testing::ElementsAre( SuggestionVectorValuesAre(elements), _));
warning_message, title, test_username_)),
_));
password_autofill_manager_->OnShowPasswordSuggestions( password_autofill_manager_->OnShowPasswordSuggestions(
dummy_key, base::i18n::RIGHT_TO_LEFT, test_username_, dummy_key, base::i18n::RIGHT_TO_LEFT, test_username_,
autofill::IS_PASSWORD_FIELD, element_bounds); autofill::IS_PASSWORD_FIELD, element_bounds);
......
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