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..4c97f4c6ffc5f4c9133139d6bad22ded1eef7430 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. |
Ilya Sherman
2013/06/15 00:28:09
I don't see any code to trigger a form submission
sgurun-gerrit only
2013/06/17 21:20:32
I actually looked into it. I could not find any sa
Ilya Sherman
2013/06/18 05:56:25
Presumably you could install a test AutocompleteHi
|
+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 and the warning; these will be culled by the renderer. |
Ilya Sherman
2013/06/15 00:28:09
What is the warning referred to in this comment?
sgurun-gerrit only
2013/06/17 21:20:32
inherited from copy/paste. does not make sense, re
|
+ 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) { |