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

Unified Diff: components/autofill/browser/autofill_manager_unittest.cc

Issue 15097004: Enable Autocomplete feature for chromium webview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setSaveFormData2
Patch Set: enable autocomplete independent of autofill. Created 7 years, 6 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/browser/autofill_manager_unittest.cc
diff --git a/components/autofill/browser/autofill_manager_unittest.cc b/components/autofill/browser/autofill_manager_unittest.cc
index 769575cd5bdf183384e235d63a76b16a217e2682..7e2155bf53c2eb6e836ed48f6889c4971b6f6f04 100644
--- a/components/autofill/browser/autofill_manager_unittest.cc
+++ b/components/autofill/browser/autofill_manager_unittest.cc
@@ -2705,6 +2705,50 @@ TEST_F(AutofillManagerTest, FormSubmitted) {
FormSubmitted(results);
}
+// Test that when the personal data manager is null, the form submission flow
+// works as expected.
+TEST_F(AutofillManagerTest, FormSubmittedNoPersonalDataManager) {
+ autofill_manager_.reset(new TestAutofillManager(
+ web_contents(),
+ autofill::TabAutofillManagerDelegate::FromWebContents(web_contents()),
+ NULL));
+
+ // Set up our form data.
+ FormData form;
+ CreateTestAddressFormData(&form);
+ form.method = ASCIIToUTF16("GET");
+ std::vector<FormData> forms(1, form);
+ FormsSeen(forms);
+ const FormFieldData& field = form.fields[0];
+ GetAutofillSuggestions(form, field);
+
+ // Add some Autocomplete suggestions. We should return the autocomplete
+ // suggestions, these will be culled by the renderer.
+ std::vector<base::string16> suggestions;
+ suggestions.push_back(ASCIIToUTF16("Jay"));
+ suggestions.push_back(ASCIIToUTF16("Jason"));
+ AutocompleteSuggestionsReturned(suggestions);
+
+ int page_id = 0;
+ std::vector<base::string16> values;
+ std::vector<base::string16> labels;
+ std::vector<base::string16> icons;
+ std::vector<int> unique_ids;
+ EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons,
+ &unique_ids));
+
+ base::string16 expected_values[] = {
+ ASCIIToUTF16("Jay"),
+ ASCIIToUTF16("Jason")
+ };
+ base::string16 expected_labels[] = { base::string16(), base::string16()};
+ base::string16 expected_icons[] = { base::string16(), base::string16()};
+ int expected_unique_ids[] = {0, 0};
+ ExpectSuggestions(page_id, values, labels, icons, unique_ids,
+ kDefaultPageID, arraysize(expected_values), expected_values,
+ expected_labels, expected_icons, expected_unique_ids);
+}
+
// Test that we are able to save form data when forms are submitted and we only
// have server data for the field types.
TEST_F(AutofillManagerTest, FormSubmittedServerTypes) {

Powered by Google App Engine
This is Rietveld 408576698