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

Side by Side Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 658993002: Convert ARRAYSIZE_UNSAFE -> arraysize in components/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 const char* const name; 1486 const char* const name;
1487 size_t max_length; 1487 size_t max_length;
1488 const char* const autocomplete_attribute; 1488 const char* const autocomplete_attribute;
1489 } test_fields[] = {{"country code", "country_code", 1, "tel-country-code"}, 1489 } test_fields[] = {{"country code", "country_code", 1, "tel-country-code"},
1490 {"area code", "area_code", 3, "tel-area-code"}, 1490 {"area code", "area_code", 3, "tel-area-code"},
1491 {"phone", "phone_prefix", 3, "tel-local-prefix"}, 1491 {"phone", "phone_prefix", 3, "tel-local-prefix"},
1492 {"-", "phone_suffix", 4, "tel-local-suffix"}, 1492 {"-", "phone_suffix", 4, "tel-local-suffix"},
1493 {"Phone Extension", "ext", 5, "tel-extension"}}; 1493 {"Phone Extension", "ext", 5, "tel-extension"}};
1494 1494
1495 FormFieldData field; 1495 FormFieldData field;
1496 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_fields); ++i) { 1496 for (size_t i = 0; i < arraysize(test_fields); ++i) {
1497 test::CreateTestFormField( 1497 test::CreateTestFormField(
1498 test_fields[i].label, test_fields[i].name, "", "text", &field); 1498 test_fields[i].label, test_fields[i].name, "", "text", &field);
1499 field.max_length = test_fields[i].max_length; 1499 field.max_length = test_fields[i].max_length;
1500 field.autocomplete_attribute = std::string(); 1500 field.autocomplete_attribute = std::string();
1501 form.fields.push_back(field); 1501 form.fields.push_back(field);
1502 } 1502 }
1503 1503
1504 std::vector<FormData> forms(1, form); 1504 std::vector<FormData> forms(1, form);
1505 FormsSeen(forms); 1505 FormsSeen(forms);
1506 1506
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 } test_fields[] = { 2128 } test_fields[] = {
2129 { "country code", "country_code", 1, "tel-country-code" }, 2129 { "country code", "country_code", 1, "tel-country-code" },
2130 { "area code", "area_code", 3, "tel-area-code" }, 2130 { "area code", "area_code", 3, "tel-area-code" },
2131 { "phone", "phone_prefix", 3, "tel-local-prefix" }, 2131 { "phone", "phone_prefix", 3, "tel-local-prefix" },
2132 { "-", "phone_suffix", 4, "tel-local-suffix" }, 2132 { "-", "phone_suffix", 4, "tel-local-suffix" },
2133 { "Phone Extension", "ext", 3, "tel-extension" } 2133 { "Phone Extension", "ext", 3, "tel-extension" }
2134 }; 2134 };
2135 2135
2136 FormFieldData field; 2136 FormFieldData field;
2137 const size_t default_max_length = field.max_length; 2137 const size_t default_max_length = field.max_length;
2138 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_fields); ++i) { 2138 for (size_t i = 0; i < arraysize(test_fields); ++i) {
2139 test::CreateTestFormField( 2139 test::CreateTestFormField(
2140 test_fields[i].label, test_fields[i].name, "", "text", &field); 2140 test_fields[i].label, test_fields[i].name, "", "text", &field);
2141 field.max_length = test_fields[i].max_length; 2141 field.max_length = test_fields[i].max_length;
2142 field.autocomplete_attribute = std::string(); 2142 field.autocomplete_attribute = std::string();
2143 form_with_maxlength.fields.push_back(field); 2143 form_with_maxlength.fields.push_back(field);
2144 2144
2145 field.max_length = default_max_length; 2145 field.max_length = default_max_length;
2146 field.autocomplete_attribute = test_fields[i].autocomplete_attribute; 2146 field.autocomplete_attribute = test_fields[i].autocomplete_attribute;
2147 form_with_autocompletetype.fields.push_back(field); 2147 form_with_autocompletetype.fields.push_back(field);
2148 } 2148 }
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
2913 test::CreateTestAddressFormData(&form); 2913 test::CreateTestAddressFormData(&form);
2914 std::vector<FormData> forms(1, form); 2914 std::vector<FormData> forms(1, form);
2915 FormsSeen(forms); 2915 FormsSeen(forms);
2916 const FormFieldData& field = form.fields[0]; 2916 const FormFieldData& field = form.fields[0];
2917 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() 2917 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery()
2918 2918
2919 EXPECT_TRUE(external_delegate_->on_query_seen()); 2919 EXPECT_TRUE(external_delegate_->on_query_seen());
2920 } 2920 }
2921 2921
2922 } // namespace autofill 2922 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698