OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "components/autofill/browser/form_structure.h" | 5 #include "components/autofill/browser/form_structure.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "components/autofill/browser/autofill_metrics.h" | 10 #include "components/autofill/browser/autofill_metrics.h" |
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2138 field.form_control_type = "text"; | 2138 field.form_control_type = "text"; |
2139 | 2139 |
2140 field.label = ASCIIToUTF16("email"); | 2140 field.label = ASCIIToUTF16("email"); |
2141 field.name = ASCIIToUTF16("email"); | 2141 field.name = ASCIIToUTF16("email"); |
2142 form.fields.push_back(field); | 2142 form.fields.push_back(field); |
2143 | 2143 |
2144 field.label = ASCIIToUTF16("First Name"); | 2144 field.label = ASCIIToUTF16("First Name"); |
2145 field.name = ASCIIToUTF16("first"); | 2145 field.name = ASCIIToUTF16("first"); |
2146 form.fields.push_back(field); | 2146 form.fields.push_back(field); |
2147 | 2147 |
| 2148 // Password fields shouldn't affect the signature. |
| 2149 field.label = ASCIIToUTF16("Password"); |
| 2150 field.name = ASCIIToUTF16("password"); |
| 2151 field.form_control_type = "password"; |
| 2152 form.fields.push_back(field); |
| 2153 |
2148 form_structure.reset(new FormStructure(form, std::string())); | 2154 form_structure.reset(new FormStructure(form, std::string())); |
2149 | 2155 |
2150 EXPECT_EQ(FormStructureTest::Hash64Bit( | 2156 EXPECT_EQ(FormStructureTest::Hash64Bit( |
2151 std::string("://&&email&first")), | 2157 std::string("://&&email&first")), |
2152 form_structure->FormSignature()); | 2158 form_structure->FormSignature()); |
2153 | 2159 |
2154 form.origin = GURL(std::string("http://www.facebook.com")); | 2160 form.origin = GURL(std::string("http://www.facebook.com")); |
2155 form_structure.reset(new FormStructure(form, std::string())); | 2161 form_structure.reset(new FormStructure(form, std::string())); |
2156 EXPECT_EQ(FormStructureTest::Hash64Bit( | 2162 EXPECT_EQ(FormStructureTest::Hash64Bit( |
2157 std::string("http://www.facebook.com&&email&first")), | 2163 std::string("http://www.facebook.com&&email&first")), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2193 field.form_control_type = "submit"; | 2199 field.form_control_type = "submit"; |
2194 form.fields.push_back(field); | 2200 form.fields.push_back(field); |
2195 | 2201 |
2196 EXPECT_EQ(form, FormStructure(form, std::string()).ToFormData()); | 2202 EXPECT_EQ(form, FormStructure(form, std::string()).ToFormData()); |
2197 | 2203 |
2198 // Currently |FormStructure(form_data)ToFormData().user_submitted| is always | 2204 // Currently |FormStructure(form_data)ToFormData().user_submitted| is always |
2199 // false. This forces a future author that changes this to update this test. | 2205 // false. This forces a future author that changes this to update this test. |
2200 form.user_submitted = true; | 2206 form.user_submitted = true; |
2201 EXPECT_NE(form, FormStructure(form, std::string()).ToFormData()); | 2207 EXPECT_NE(form, FormStructure(form, std::string()).ToFormData()); |
2202 } | 2208 } |
OLD | NEW |