Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1696)

Unified Diff: components/autofill/core/browser/autofill_external_delegate_unittest.cc

Issue 667043002: Add a flag to ignore autocomplete="off" for Autofill. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: fix MSVC error C4373 Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_external_delegate_unittest.cc
diff --git a/components/autofill/core/browser/autofill_external_delegate_unittest.cc b/components/autofill/core/browser/autofill_external_delegate_unittest.cc
index 82e32b94c28e0b4b436eb54532989d4c88801b28..8d94045a8ebbcc438a2c2cfe7b08dfe2cecc22e7 100644
--- a/components/autofill/core/browser/autofill_external_delegate_unittest.cc
+++ b/components/autofill/core/browser/autofill_external_delegate_unittest.cc
@@ -4,6 +4,7 @@
#include <vector>
+#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string16.h"
@@ -13,6 +14,7 @@
#include "components/autofill/core/browser/test_autofill_client.h"
#include "components/autofill/core/browser/test_autofill_driver.h"
#include "components/autofill/core/browser/test_autofill_external_delegate.h"
+#include "components/autofill/core/common/autofill_switches.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_field_data.h"
#include "components/autofill/core/common/password_form_fill_data.h"
@@ -448,6 +450,34 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateHideWarning) {
autofill_ids);
}
+TEST_F(AutofillExternalDelegateUnitTest, IgnoreAutocompleteOffForAutofill) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kIgnoreAutocompleteOffForAutofill);
+
+ const FormData form;
+ FormFieldData field;
+ field.is_focusable = true;
+ field.should_autocomplete = false;
+ const gfx::RectF element_bounds;
+
+ external_delegate_->OnQuery(kQueryId, form, field, element_bounds, false);
+
+ std::vector<base::string16> autofill_items;
+ autofill_items.push_back(base::string16());
+ std::vector<int> autofill_ids;
+ autofill_ids.push_back(POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY);
+
+ // Ensure the popup tries to show itself, despite autocomplete="off".
+ EXPECT_CALL(autofill_client_, ShowAutofillPopup(_, _, _, _, _, _, _));
+ EXPECT_CALL(autofill_client_, HideAutofillPopup()).Times(0);
+
+ external_delegate_->OnSuggestionsReturned(kQueryId,
+ autofill_items,
+ autofill_items,
+ autofill_items,
+ autofill_ids);
+}
+
TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateFillFieldWithValue) {
EXPECT_CALL(autofill_client_, HideAutofillPopup());
base::string16 dummy_string(ASCIIToUTF16("baz foo"));
« no previous file with comments | « components/autofill/core/browser/autofill_external_delegate.cc ('k') | components/autofill/core/browser/autofill_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698