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

Unified Diff: components/autofill/core/browser/phone_field_unittest.cc

Issue 2417783004: Replace for loops with |arraysize| with for each loops (Closed)
Patch Set: Created 4 years, 2 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/core/browser/phone_field_unittest.cc
diff --git a/components/autofill/core/browser/phone_field_unittest.cc b/components/autofill/core/browser/phone_field_unittest.cc
index 14c0b2c9d39d0b7465981be43b6af97744a6c79f..f72c364f03d4b276cb2407d1dc7e20e89695faed 100644
--- a/components/autofill/core/browser/phone_field_unittest.cc
+++ b/components/autofill/core/browser/phone_field_unittest.cc
@@ -79,10 +79,10 @@ TEST_F(PhoneFieldTest, NonParse) {
TEST_F(PhoneFieldTest, ParseOneLinePhone) {
FormFieldData field;
- for (size_t i = 0; i < arraysize(kFieldTypes); ++i) {
+ for (const auto& field_type : kFieldTypes) {
vabr (Chromium) 2016/10/17 07:40:33 const char* (Also everywhere below.)
jdoerrie 2016/10/17 08:42:27 Done.
Clear();
- field.form_control_type = kFieldTypes[i];
+ field.form_control_type = field_type;
field.label = ASCIIToUTF16("Phone");
field.name = ASCIIToUTF16("phone");
list_.push_back(new AutofillField(field, ASCIIToUTF16("phone1")));
@@ -98,10 +98,10 @@ TEST_F(PhoneFieldTest, ParseOneLinePhone) {
TEST_F(PhoneFieldTest, ParseTwoLinePhone) {
FormFieldData field;
- for (size_t i = 0; i < arraysize(kFieldTypes); ++i) {
+ for (const auto& field_type : kFieldTypes) {
Clear();
- field.form_control_type = kFieldTypes[i];
+ field.form_control_type = field_type;
field.label = ASCIIToUTF16("Area Code");
field.name = ASCIIToUTF16("area code");
list_.push_back(new AutofillField(field, ASCIIToUTF16("areacode1")));
@@ -127,10 +127,10 @@ TEST_F(PhoneFieldTest, ThreePartPhoneNumber) {
// than 4.
FormFieldData field;
- for (size_t i = 0; i < arraysize(kFieldTypes); ++i) {
+ for (const auto& field_type : kFieldTypes) {
Clear();
- field.form_control_type = kFieldTypes[i];
+ field.form_control_type = field_type;
field.label = ASCIIToUTF16("Phone:");
field.name = ASCIIToUTF16("dayphone1");
field.max_length = 0;
@@ -168,10 +168,10 @@ TEST_F(PhoneFieldTest, ThreePartPhoneNumber) {
TEST_F(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix) {
FormFieldData field;
- for (size_t i = 0; i < arraysize(kFieldTypes); ++i) {
+ for (const auto& field_type : kFieldTypes) {
Clear();
- field.form_control_type = kFieldTypes[i];
+ field.form_control_type = field_type;
field.label = ASCIIToUTF16("Phone:");
field.name = ASCIIToUTF16("area");
list_.push_back(new AutofillField(field, ASCIIToUTF16("areacode1")));
@@ -197,10 +197,10 @@ TEST_F(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix) {
TEST_F(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix2) {
FormFieldData field;
- for (size_t i = 0; i < arraysize(kFieldTypes); ++i) {
+ for (const auto& field_type : kFieldTypes) {
Clear();
- field.form_control_type = kFieldTypes[i];
+ field.form_control_type = field_type;
field.label = ASCIIToUTF16("(");
field.name = ASCIIToUTF16("phone1");
field.max_length = 3;
@@ -231,10 +231,10 @@ TEST_F(PhoneFieldTest, CountryAndCityAndPhoneNumber) {
// The |maxlength| is considered, otherwise it's too broad.
FormFieldData field;
- for (size_t i = 0; i < arraysize(kFieldTypes); ++i) {
+ for (const auto& field_type : kFieldTypes) {
Clear();
- field.form_control_type = kFieldTypes[i];
+ field.form_control_type = field_type;
field.label = ASCIIToUTF16("Phone Number");
field.name = ASCIIToUTF16("CountryCode");
field.max_length = 3;

Powered by Google App Engine
This is Rietveld 408576698