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

Side by Side Diff: chrome/browser/autofill/phone_field_unittest.cc

Issue 6480083: Changed parsing code for the phonenumbers fields to incorporate different com... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/scoped_ptr.h" 5 #include "base/scoped_ptr.h"
6 #include "base/scoped_vector.h" 6 #include "base/scoped_vector.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/autofill/phone_field.h" 8 #include "chrome/browser/autofill/phone_field.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "webkit/glue/form_field.h" 10 #include "webkit/glue/form_field.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_)); 164 ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_));
165 ASSERT_TRUE( 165 ASSERT_TRUE(
166 field_type_map_.find(ASCIIToUTF16("areacode1")) != field_type_map_.end()); 166 field_type_map_.find(ASCIIToUTF16("areacode1")) != field_type_map_.end());
167 EXPECT_EQ(PHONE_HOME_CITY_CODE, field_type_map_[ASCIIToUTF16("areacode1")]); 167 EXPECT_EQ(PHONE_HOME_CITY_CODE, field_type_map_[ASCIIToUTF16("areacode1")]);
168 ASSERT_TRUE( 168 ASSERT_TRUE(
169 field_type_map_.find(ASCIIToUTF16("phone1")) != field_type_map_.end()); 169 field_type_map_.find(ASCIIToUTF16("phone1")) != field_type_map_.end());
170 EXPECT_EQ(PHONE_HOME_NUMBER, field_type_map_[ASCIIToUTF16("phone1")]); 170 EXPECT_EQ(PHONE_HOME_NUMBER, field_type_map_[ASCIIToUTF16("phone1")]);
171 } 171 }
172 172
173 TEST_F(PhoneFieldTest, ThreePartPhoneNumber) { 173 TEST_F(PhoneFieldTest, ThreePartPhoneNumber) {
174 // Phone in format <field> - <field> - <field> could be either
175 // <area code> - <prefix> - <suffix>, or
176 // <country code> - <area code> - <phone>. The only distinguishing feature is
177 // size: <prefix> is no bigger than 3 characters, and <suffix> is no bigger
178 // than 4.
174 list_.push_back( 179 list_.push_back(
175 new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Phone:"), 180 new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Phone:"),
176 ASCIIToUTF16("dayphone1"), 181 ASCIIToUTF16("dayphone1"),
177 string16(), 182 string16(),
178 ASCIIToUTF16("text"), 183 ASCIIToUTF16("text"),
179 0, 184 0,
180 false), 185 false),
181 ASCIIToUTF16("areacode1"))); 186 ASCIIToUTF16("areacode1")));
182 list_.push_back( 187 list_.push_back(
183 new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("-"), 188 new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("-"),
184 ASCIIToUTF16("dayphone2"), 189 ASCIIToUTF16("dayphone2"),
185 string16(), 190 string16(),
186 ASCIIToUTF16("text"), 191 ASCIIToUTF16("text"),
187 0, 192 3,
188 false), 193 false),
189 ASCIIToUTF16("prefix1"))); 194 ASCIIToUTF16("prefix1")));
190 list_.push_back( 195 list_.push_back(
191 new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("-"), 196 new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("-"),
192 ASCIIToUTF16("dayphone3"), 197 ASCIIToUTF16("dayphone3"),
193 string16(), 198 string16(),
194 ASCIIToUTF16("text"), 199 ASCIIToUTF16("text"),
195 0, 200 4,
196 false), 201 false),
197 ASCIIToUTF16("suffix1"))); 202 ASCIIToUTF16("suffix1")));
198 list_.push_back( 203 list_.push_back(
199 new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("ext.:"), 204 new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("ext.:"),
200 ASCIIToUTF16("dayphone4"), 205 ASCIIToUTF16("dayphone4"),
201 string16(), 206 string16(),
202 ASCIIToUTF16("text"), 207 ASCIIToUTF16("text"),
203 0, 208 0,
204 false), 209 false),
205 ASCIIToUTF16("ext1"))); 210 ASCIIToUTF16("ext1")));
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 EXPECT_EQ(PHONE_FAX_CITY_CODE, field_type_map_[ASCIIToUTF16("areacode1")]); 353 EXPECT_EQ(PHONE_FAX_CITY_CODE, field_type_map_[ASCIIToUTF16("areacode1")]);
349 ASSERT_TRUE( 354 ASSERT_TRUE(
350 field_type_map_.find(ASCIIToUTF16("prefix1")) != field_type_map_.end()); 355 field_type_map_.find(ASCIIToUTF16("prefix1")) != field_type_map_.end());
351 EXPECT_EQ(PHONE_FAX_NUMBER, field_type_map_[ASCIIToUTF16("prefix1")]); 356 EXPECT_EQ(PHONE_FAX_NUMBER, field_type_map_[ASCIIToUTF16("prefix1")]);
352 ASSERT_TRUE( 357 ASSERT_TRUE(
353 field_type_map_.find(ASCIIToUTF16("suffix1")) != field_type_map_.end()); 358 field_type_map_.find(ASCIIToUTF16("suffix1")) != field_type_map_.end());
354 EXPECT_EQ(PHONE_FAX_NUMBER, field_type_map_[ASCIIToUTF16("suffix1")]); 359 EXPECT_EQ(PHONE_FAX_NUMBER, field_type_map_[ASCIIToUTF16("suffix1")]);
355 } 360 }
356 361
357 } // namespace 362 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/autofill/phone_field.cc ('k') | chrome/test/data/autofill/heuristics/input/form_phones_en.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698