OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "chrome/common/autofill_messages.h" | 6 #include "chrome/common/autofill_messages.h" |
7 #include "chrome/common/form_data.h" | 7 #include "chrome/common/form_data.h" |
8 #include "chrome/common/form_field_data.h" | 8 #include "chrome/common/form_field_data.h" |
9 #include "chrome/test/base/chrome_render_view_test.h" | 9 #include "chrome/test/base/chrome_render_view_test.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 expected.name = ASCIIToUTF16("middlename"); | 58 expected.name = ASCIIToUTF16("middlename"); |
59 expected.value = string16(); | 59 expected.value = string16(); |
60 expected.form_control_type = ASCIIToUTF16("text"); | 60 expected.form_control_type = ASCIIToUTF16("text"); |
61 expected.max_length = WebInputElement::defaultMaxLength(); | 61 expected.max_length = WebInputElement::defaultMaxLength(); |
62 EXPECT_FORM_FIELD_DATA_EQUALS(expected, forms[0].fields[1]); | 62 EXPECT_FORM_FIELD_DATA_EQUALS(expected, forms[0].fields[1]); |
63 | 63 |
64 expected.name = ASCIIToUTF16("lastname"); | 64 expected.name = ASCIIToUTF16("lastname"); |
65 expected.value = string16(); | 65 expected.value = string16(); |
66 expected.form_control_type = ASCIIToUTF16("text"); | 66 expected.form_control_type = ASCIIToUTF16("text"); |
| 67 expected.autocomplete_attribute = ASCIIToUTF16("off"); |
67 expected.max_length = WebInputElement::defaultMaxLength(); | 68 expected.max_length = WebInputElement::defaultMaxLength(); |
68 EXPECT_FORM_FIELD_DATA_EQUALS(expected, forms[0].fields[2]); | 69 EXPECT_FORM_FIELD_DATA_EQUALS(expected, forms[0].fields[2]); |
| 70 expected.autocomplete_attribute = string16(); // reset |
69 | 71 |
70 expected.name = ASCIIToUTF16("state"); | 72 expected.name = ASCIIToUTF16("state"); |
71 expected.value = ASCIIToUTF16("?"); | 73 expected.value = ASCIIToUTF16("?"); |
72 expected.form_control_type = ASCIIToUTF16("select-one"); | 74 expected.form_control_type = ASCIIToUTF16("select-one"); |
73 expected.max_length = 0; | 75 expected.max_length = 0; |
74 EXPECT_FORM_FIELD_DATA_EQUALS(expected, forms[0].fields[3]); | 76 EXPECT_FORM_FIELD_DATA_EQUALS(expected, forms[0].fields[3]); |
75 | 77 |
76 // Verify that |didAcceptAutofillSuggestion()| sends the expected number of | 78 // Verify that |didAcceptAutofillSuggestion()| sends the expected number of |
77 // fields. | 79 // fields. |
78 WebFrame* web_frame = GetMainFrame(); | 80 WebFrame* web_frame = GetMainFrame(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 const IPC::Message* message2 = | 167 const IPC::Message* message2 = |
166 render_thread_->sink().GetUniqueMessageMatching( | 168 render_thread_->sink().GetUniqueMessageMatching( |
167 AutofillHostMsg_FillAutofillFormData::ID); | 169 AutofillHostMsg_FillAutofillFormData::ID); |
168 | 170 |
169 // No message should be sent in this case. |firstname| is filled directly. | 171 // No message should be sent in this case. |firstname| is filled directly. |
170 ASSERT_EQ(static_cast<IPC::Message*>(NULL), message2); | 172 ASSERT_EQ(static_cast<IPC::Message*>(NULL), message2); |
171 EXPECT_EQ(firstname.value(), WebKit::WebString::fromUTF8("David")); | 173 EXPECT_EQ(firstname.value(), WebKit::WebString::fromUTF8("David")); |
172 } | 174 } |
173 | 175 |
174 } // namespace autofill | 176 } // namespace autofill |
OLD | NEW |