diff options
author | viettrungluu <viettrungluu@chromium.org> | 2014-10-16 11:23:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-16 18:24:13 +0000 |
commit | 37a447b86b8ac98c5827701e765de9558c6c50e7 (patch) | |
tree | e413b48d7cd1a4e91d9b701e691ad8e6554f18d5 | |
parent | ac59b2cc31ddb0bf15074e6253fbf73196a39d69 (diff) | |
download | chromium_src-37a447b86b8ac98c5827701e765de9558c6c50e7.zip chromium_src-37a447b86b8ac98c5827701e765de9558c6c50e7.tar.gz chromium_src-37a447b86b8ac98c5827701e765de9558c6c50e7.tar.bz2 |
Convert ARRAYSIZE_UNSAFE -> arraysize in components/.
BUG=423134
Review URL: https://codereview.chromium.org/658993002
Cr-Commit-Position: refs/heads/master@{#299934}
37 files changed, 116 insertions, 119 deletions
diff --git a/components/autofill/content/browser/wallet/wallet_client_unittest.cc b/components/autofill/content/browser/wallet/wallet_client_unittest.cc index a1e6eb1..6109823 100644 --- a/components/autofill/content/browser/wallet/wallet_client_unittest.cc +++ b/components/autofill/content/browser/wallet/wallet_client_unittest.cc @@ -1007,7 +1007,7 @@ TEST_F(WalletClientTest, WalletErrorCodes) { }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + for (size_t i = 0; i < arraysize(test_cases); ++i) { SCOPED_TRACE( base::StringPrintf( "%s - %s", diff --git a/components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc b/components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc index 91769ec..c5a082e 100644 --- a/components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc +++ b/components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc @@ -219,7 +219,7 @@ TEST_F(PasswordFormConversionUtilsTest, IdentifyingUsernameFields) { {{"USERNAME", NULL, "uSeRNaMe"}, "username1", "John", "Smith"}, {{"uSeRNaMe", NULL, "USERNAME"}, "username1", "John", "Smith"}}; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { + for (size_t i = 0; i < arraysize(cases); ++i) { for (size_t nonempty_username_fields = 0; nonempty_username_fields < 2; ++nonempty_username_fields) { SCOPED_TRACE(testing::Message() @@ -293,7 +293,7 @@ TEST_F(PasswordFormConversionUtilsTest, IdentifyingTwoPasswordFields) { {{"", "beta"}, "password1", "", "password2", "beta"}, {{"alpha", "beta"}, "password1", "alpha", "password2", "beta"}}; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { + for (size_t i = 0; i < arraysize(cases); ++i) { SCOPED_TRACE(testing::Message() << "Iteration " << i); PasswordFormBuilder builder(kTestFormActionURL); @@ -350,7 +350,7 @@ TEST_F(PasswordFormConversionUtilsTest, IdentifyingThreePasswordFields) { // Note: In all other cases, we give up and consider the form invalid. // This is tested in InvalidFormDueToConfusingPasswordFields. - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { + for (size_t i = 0; i < arraysize(cases); ++i) { SCOPED_TRACE(testing::Message() << "Iteration " << i); PasswordFormBuilder builder(kTestFormActionURL); @@ -482,7 +482,7 @@ TEST_F(PasswordFormConversionUtilsTest, {{NULL, "nEw-PaSsWoRd", NULL}, "", "", "password2", "beta"}}; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { + for (size_t i = 0; i < arraysize(cases); ++i) { SCOPED_TRACE(testing::Message() << "Iteration " << i); PasswordFormBuilder builder(kTestFormActionURL); @@ -556,7 +556,7 @@ TEST_F(PasswordFormConversionUtilsTest, {"alpha", "alpha", "alpha"}, {"alpha", "beta", "alpha"}}; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { + for (size_t i = 0; i < arraysize(cases); ++i) { SCOPED_TRACE(testing::Message() << "Iteration " << i); PasswordFormBuilder builder(kTestFormActionURL); diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc index 8e2e1df..06cbd80 100644 --- a/components/autofill/core/browser/autofill_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_manager_unittest.cc @@ -1493,7 +1493,7 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsForPhonePrefixOrSuffix) { {"Phone Extension", "ext", 5, "tel-extension"}}; FormFieldData field; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_fields); ++i) { + for (size_t i = 0; i < arraysize(test_fields); ++i) { test::CreateTestFormField( test_fields[i].label, test_fields[i].name, "", "text", &field); field.max_length = test_fields[i].max_length; @@ -2135,7 +2135,7 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) { FormFieldData field; const size_t default_max_length = field.max_length; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_fields); ++i) { + for (size_t i = 0; i < arraysize(test_fields); ++i) { test::CreateTestFormField( test_fields[i].label, test_fields[i].name, "", "text", &field); field.max_length = test_fields[i].max_length; diff --git a/components/autofill/core/browser/autofill_regexes_unittest.cc b/components/autofill/core/browser/autofill_regexes_unittest.cc index fc95c44..d77afa7 100644 --- a/components/autofill/core/browser/autofill_regexes_unittest.cc +++ b/components/autofill/core/browser/autofill_regexes_unittest.cc @@ -34,7 +34,7 @@ TEST(AutofillRegexesTest, AutofillRegexes) { // Case-insensitive {"StRiNg", "string"}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kPositiveCases); ++i) { + for (size_t i = 0; i < arraysize(kPositiveCases); ++i) { const TestCase& test_case = kPositiveCases[i]; SCOPED_TRACE(test_case.input); SCOPED_TRACE(test_case.pattern); @@ -54,7 +54,7 @@ TEST(AutofillRegexesTest, AutofillRegexes) { {"string", "ring "}, {"string", "rin$"}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kNegativeCases); ++i) { + for (size_t i = 0; i < arraysize(kNegativeCases); ++i) { const TestCase& test_case = kNegativeCases[i]; SCOPED_TRACE(test_case.input); SCOPED_TRACE(test_case.pattern); diff --git a/components/autofill/core/browser/contact_info_unittest.cc b/components/autofill/core/browser/contact_info_unittest.cc index 937d748..27d7d76 100644 --- a/components/autofill/core/browser/contact_info_unittest.cc +++ b/components/autofill/core/browser/contact_info_unittest.cc @@ -218,7 +218,7 @@ TEST(NameInfoTest, ParsedNamesAreEqual) { false}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + for (size_t i = 0; i < arraysize(test_cases); ++i) { SCOPED_TRACE(base::StringPrintf("i: %" PRIuS, i)); // Construct the starting_profile. diff --git a/components/autofill/core/browser/credit_card_unittest.cc b/components/autofill/core/browser/credit_card_unittest.cc index 7171110..6f3728a 100644 --- a/components/autofill/core/browser/credit_card_unittest.cc +++ b/components/autofill/core/browser/credit_card_unittest.cc @@ -518,7 +518,7 @@ TEST(CreditCardTest, GetCreditCardType) { { "7000700070007000", kGenericCard, true }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + for (size_t i = 0; i < arraysize(test_cases); ++i) { base::string16 card_number = ASCIIToUTF16(test_cases[i].card_number); SCOPED_TRACE(card_number); EXPECT_EQ(test_cases[i].type, CreditCard::GetCreditCardType(card_number)); diff --git a/components/autofill/core/browser/phone_number_i18n_unittest.cc b/components/autofill/core/browser/phone_number_i18n_unittest.cc index e7ca9a2..2c463cc 100644 --- a/components/autofill/core/browser/phone_number_i18n_unittest.cc +++ b/components/autofill/core/browser/phone_number_i18n_unittest.cc @@ -121,7 +121,7 @@ TEST(PhoneNumberI18NTest, ParsePhoneNumber) { {true, "(08) 450 777 7777", "DE", "7777777", "8450", "", "DE"}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + for (size_t i = 0; i < arraysize(test_cases); ++i) { SCOPED_TRACE("Testing phone number " + test_cases[i].input); base::string16 country_code, city_code, number; diff --git a/components/bookmarks/browser/bookmark_index_unittest.cc b/components/bookmarks/browser/bookmark_index_unittest.cc index 2ce206a..fa7e46a 100644 --- a/components/bookmarks/browser/bookmark_index_unittest.cc +++ b/components/bookmarks/browser/bookmark_index_unittest.cc @@ -173,7 +173,7 @@ TEST_F(BookmarkIndexTest, GetBookmarksMatching) { // Prefix matches against multiple candidates. { "abc1 abc2 abc3 abc4", "abc", "abc1 abc2 abc3 abc4"}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { std::vector<std::string> titles; base::SplitString(data[i].titles, ';', &titles); std::vector<TitleAndURL> bookmarks; @@ -237,7 +237,7 @@ TEST_F(BookmarkIndexTest, GetBookmarksMatchingWithURLs) { { "foo bar", "Baz Bur", "http://foo.com/blah/flub", false } }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { model_ = client_.CreateModel(); std::vector<TitleAndURL> bookmarks; bookmarks.push_back(TitleAndURL(data[i].title, data[i].url)); @@ -270,7 +270,7 @@ TEST_F(BookmarkIndexTest, Normalization) { }; GURL url(kAboutBlankURL); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { model_->AddURL(model_->other_node(), 0, UTF8ToUTF16(data[i].title), url); std::vector<BookmarkMatch> matches; model_->GetBookmarksMatching(UTF8ToUTF16(data[i].query), 10, &matches); @@ -296,7 +296,7 @@ TEST_F(BookmarkIndexTest, MatchPositionsTitles) { { "foobar foobar", "foobar foo", "0,6:7,13" }, { "foobar foobar", "foo foobar", "0,6:7,13" }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { std::vector<TitleAndURL> bookmarks; TitleAndURL bookmark(data[i].title, kAboutBlankURL); bookmarks.push_back(bookmark); @@ -347,7 +347,7 @@ TEST_F(BookmarkIndexTest, MatchPositionsURLs) { "130,134:139,143" } }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { model_ = client_.CreateModel(); std::vector<TitleAndURL> bookmarks; TitleAndURL bookmark("123456", data[i].url); @@ -369,7 +369,7 @@ TEST_F(BookmarkIndexTest, MatchPositionsURLs) { TEST_F(BookmarkIndexTest, Remove) { const char* titles[] = { "a", "b" }; const char* urls[] = {kAboutBlankURL, kAboutBlankURL}; - AddBookmarks(titles, urls, ARRAYSIZE_UNSAFE(titles)); + AddBookmarks(titles, urls, arraysize(titles)); // Remove the node and make sure we don't get back any results. model_->Remove(model_->other_node(), 0); @@ -380,19 +380,19 @@ TEST_F(BookmarkIndexTest, Remove) { TEST_F(BookmarkIndexTest, ChangeTitle) { const char* titles[] = { "a", "b" }; const char* urls[] = {kAboutBlankURL, kAboutBlankURL}; - AddBookmarks(titles, urls, ARRAYSIZE_UNSAFE(titles)); + AddBookmarks(titles, urls, arraysize(titles)); // Remove the node and make sure we don't get back any results. const char* expected[] = { "blah" }; model_->SetTitle(model_->other_node()->GetChild(0), ASCIIToUTF16("blah")); - ExpectMatches("BlAh", expected, ARRAYSIZE_UNSAFE(expected)); + ExpectMatches("BlAh", expected, arraysize(expected)); } // Makes sure no more than max queries is returned. TEST_F(BookmarkIndexTest, HonorMax) { const char* titles[] = { "abcd", "abcde" }; const char* urls[] = {kAboutBlankURL, kAboutBlankURL}; - AddBookmarks(titles, urls, ARRAYSIZE_UNSAFE(titles)); + AddBookmarks(titles, urls, arraysize(titles)); std::vector<BookmarkMatch> matches; model_->GetBookmarksMatching(ASCIIToUTF16("ABc"), 1, &matches); @@ -426,13 +426,13 @@ TEST_F(BookmarkIndexTest, GetResultsSortedByTypedCount) { }; std::map<GURL, int> typed_count_map; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) + for (size_t i = 0; i < arraysize(data); ++i) typed_count_map.insert(std::make_pair(data[i].url, data[i].typed_count)); BookmarkClientMock client(typed_count_map); scoped_ptr<BookmarkModel> model = client.CreateModel(); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) + for (size_t i = 0; i < arraysize(data); ++i) // Populate the BookmarkIndex. model->AddURL( model->other_node(), i, UTF8ToUTF16(data[i].title), data[i].url); diff --git a/components/bookmarks/browser/bookmark_model_unittest.cc b/components/bookmarks/browser/bookmark_model_unittest.cc index 486df69..d9c55c9 100644 --- a/components/bookmarks/browser/bookmark_model_unittest.cc +++ b/components/bookmarks/browser/bookmark_model_unittest.cc @@ -370,7 +370,7 @@ TEST_F(BookmarkModelTest, AddURLWithUnicodeTitle) { } TEST_F(BookmarkModelTest, AddURLWithWhitespaceTitle) { - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(url_whitespace_test_cases); ++i) { + for (size_t i = 0; i < arraysize(url_whitespace_test_cases); ++i) { const BookmarkNode* root = model_->bookmark_bar_node(); const base::string16 title( ASCIIToUTF16(url_whitespace_test_cases[i].input_title)); @@ -457,7 +457,7 @@ TEST_F(BookmarkModelTest, AddFolder) { } TEST_F(BookmarkModelTest, AddFolderWithWhitespaceTitle) { - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(title_whitespace_test_cases); ++i) { + for (size_t i = 0; i < arraysize(title_whitespace_test_cases); ++i) { const BookmarkNode* root = model_->bookmark_bar_node(); const base::string16 title( ASCIIToUTF16(title_whitespace_test_cases[i].input_title)); @@ -554,7 +554,7 @@ TEST_F(BookmarkModelTest, SetTitle) { } TEST_F(BookmarkModelTest, SetTitleWithWhitespace) { - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(title_whitespace_test_cases); ++i) { + for (size_t i = 0; i < arraysize(title_whitespace_test_cases); ++i) { const BookmarkNode* root = model_->bookmark_bar_node(); base::string16 title(ASCIIToUTF16("dummy")); const GURL url("http://foo.com"); @@ -969,7 +969,7 @@ TEST_F(BookmarkModelTestWithProfile, CreateAndRestore) { { "a [ b ]", "" }, { "a b c [ d e [ f ] ]", "g h i [ j k [ l ] ]"}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { model_ = client_.CreateModel(); TestNode bbn; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_params_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_params_unittest.cc index 2cc4186..2e27422 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_params_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_params_unittest.cc @@ -508,7 +508,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) { }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { int flags = 0; if (tests[i].allowed) flags |= DataReductionProxyParams::kAllowed; @@ -696,7 +696,7 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) { false }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { int flags = DataReductionProxyParams::kAllowed | DataReductionProxyParams::kAlternativeAllowed; if (tests[i].fallback_allowed) @@ -1077,7 +1077,7 @@ TEST_F(DataReductionProxyParamsTest, AreProxiesBypassed) { std::string ssl_origin = GetRetryMapKeyFromOrigin( TestDataReductionProxyParams::DefaultSSLOrigin()); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { int flags = 0; if (tests[i].allowed) flags |= DataReductionProxyParams::kAllowed; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc index 61382f5..ee53355 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc @@ -287,7 +287,7 @@ TEST_F(DataReductionProxyProtocolTest, TestIdempotency) { { "POST", false }, { "CONNECT", false }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { scoped_ptr<net::URLRequest> request( context.CreateRequest(GURL("http://www.google.com/"), net::DEFAULT_PRIORITY, @@ -331,7 +331,7 @@ TEST_F(DataReductionProxyProtocolTest, OverrideResponseAsRedirect) { }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { std::string headers(tests[i].headers); HeadersToRaw(&headers); scoped_refptr<HttpResponseHeaders> original_response_headers( @@ -374,7 +374,7 @@ TEST_F(DataReductionProxyProtocolTest, OverrideResponseAsRedirectCORS) { }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { std::string headers(tests[i].headers); HeadersToRaw(&headers); scoped_refptr<HttpResponseHeaders> original_response_headers( @@ -752,7 +752,7 @@ TEST_F(DataReductionProxyProtocolTest, BypassLogic) { }; std::string primary = proxy_params_->DefaultOrigin(); std::string fallback = proxy_params_->DefaultFallbackOrigin(); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { DataReductionProxyBypassType bypass_type; ConfigureTestDependencies(ProxyService::CreateFixedFromPacResult( "PROXY " + diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_tamper_detection.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_tamper_detection.cc index 3c7c644..6b89bba 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_tamper_detection.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_tamper_detection.cc @@ -365,8 +365,7 @@ void DataReductionProxyTamperDetection::GetMD5( const std::string& input, std::string* output) { base::MD5Digest digest; base::MD5Sum(input.c_str(), input.size(), &digest); - *output = std::string( - reinterpret_cast<char*>(digest.a), ARRAYSIZE_UNSAFE(digest.a)); + *output = std::string(reinterpret_cast<char*>(digest.a), arraysize(digest.a)); } std::vector<std::string> DataReductionProxyTamperDetection::GetHeaderValues( diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_tamper_detection_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_tamper_detection_unittest.cc index 3cd6b8c..6c784d4 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_tamper_detection_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_tamper_detection_unittest.cc @@ -33,8 +33,8 @@ std::string GetEncoded(const std::string& input) { base::MD5Digest digest; base::MD5Sum(input.c_str(), input.size(), &digest); std::string base64encoded; - base::Base64Encode(std::string((char*)digest.a, - ARRAYSIZE_UNSAFE(digest.a)), &base64encoded); + base::Base64Encode(std::string((char*)digest.a, arraysize(digest.a)), + &base64encoded); return base64encoded; } @@ -237,7 +237,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, ChromeProxy) { }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test); ++i) { + for (size_t i = 0; i < arraysize(test); ++i) { ReplaceWithEncodedString(&test[i].received_fingerprint); std::string raw_headers(test[i].raw_header); @@ -363,7 +363,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, Via) { }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test); ++i) { + for (size_t i = 0; i < arraysize(test); ++i) { std::string raw_headers(test[i].raw_header); HeadersToRaw(&raw_headers); scoped_refptr<net::HttpResponseHeaders> headers( @@ -494,7 +494,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, OtherHeaders) { }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test); ++i) { + for (size_t i = 0; i < arraysize(test); ++i) { ReplaceWithEncodedString(&test[i].received_fingerprint); std::string raw_headers(test[i].raw_header); @@ -572,7 +572,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, ContentLength) { }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test); ++i) { + for (size_t i = 0; i < arraysize(test); ++i) { std::string raw_headers(test[i].raw_header); HeadersToRaw(&raw_headers); scoped_refptr<net::HttpResponseHeaders> headers( @@ -611,7 +611,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, ValuesToSortedString) { }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test); ++i) { + for (size_t i = 0; i < arraysize(test); ++i) { std::vector<std::string> input_values = StringsToVector(test[i].input_values); std::string output_string = @@ -659,7 +659,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, GetHeaderValues) { }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test); ++i) { + for (size_t i = 0; i < arraysize(test); ++i) { std::string raw_headers(test[i].raw_header); HeadersToRaw(&raw_headers); scoped_refptr<net::HttpResponseHeaders> headers( @@ -735,7 +735,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, DetectAndReport) { InitEnv(); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test); ++i) { + for (size_t i = 0; i < arraysize(test); ++i) { std::string raw_headers(test[i].raw_header); ReplaceWithEncodedString(&raw_headers); HeadersToRaw(&raw_headers); diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats_unittest.cc index fa1d23a..24f39eb 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats_unittest.cc @@ -142,7 +142,7 @@ TEST_F(DataReductionProxyUsageStatsTest, IsDataReductionProxyUnreachable) { true } }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + for (size_t i = 0; i < arraysize(test_cases); ++i) { TestCase test_case = test_cases[i]; EXPECT_CALL(mock_params_, IsDataReductionProxy(testing::_, testing::_)) @@ -295,7 +295,7 @@ TEST_F(DataReductionProxyUsageStatsTest, } }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + for (size_t i = 0; i < arraysize(test_cases); ++i) { base::HistogramTester histogram_tester; std::string raw_headers(test_cases[i].headers); HeadersToRaw(&raw_headers); @@ -405,7 +405,7 @@ TEST_F(DataReductionProxyUsageStatsTest, RecordMissingViaHeaderBytes) { } }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + for (size_t i = 0; i < arraysize(test_cases); ++i) { base::HistogramTester histogram_tester; scoped_ptr<DataReductionProxyUsageStats> usage_stats( new DataReductionProxyUsageStats(&mock_params_, loop_proxy_)); diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_headers_unittest.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_headers_unittest.cc index 3e70f18..6bbe07c 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_headers_unittest.cc +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_headers_unittest.cc @@ -93,7 +93,7 @@ TEST_F(DataReductionProxyHeadersTest, GetDataReductionProxyActionValue) { "", }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { std::string headers(tests[i].headers); HeadersToRaw(&headers); scoped_refptr<net::HttpResponseHeaders> parsed( @@ -343,7 +343,7 @@ TEST_F(DataReductionProxyHeadersTest, GetProxyBypassInfo) { false, }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { std::string headers(tests[i].headers); HeadersToRaw(&headers); scoped_refptr<net::HttpResponseHeaders> parsed( @@ -495,7 +495,7 @@ TEST_F(DataReductionProxyHeadersTest, HasDataReductionProxyViaHeader) { true, }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { std::string headers(tests[i].headers); HeadersToRaw(&headers); scoped_refptr<net::HttpResponseHeaders> parsed( @@ -618,7 +618,7 @@ TEST_F(DataReductionProxyHeadersTest, GetDataReductionProxyBypassEventType) { BYPASS_EVENT_TYPE_MAX, } }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { std::string headers(tests[i].headers); HeadersToRaw(&headers); scoped_refptr<net::HttpResponseHeaders> parsed( @@ -657,7 +657,7 @@ TEST_F(DataReductionProxyHeadersTest, "fp1", }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { std::string headers(tests[i].headers); HeadersToRaw(&headers); scoped_refptr<net::HttpResponseHeaders> parsed( @@ -701,7 +701,7 @@ TEST_F(DataReductionProxyHeadersTest, "fvia1", }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { std::string headers(tests[i].headers); HeadersToRaw(&headers); scoped_refptr<net::HttpResponseHeaders> parsed( @@ -745,7 +745,7 @@ TEST_F(DataReductionProxyHeadersTest, "foh1", }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { std::string headers(tests[i].headers); HeadersToRaw(&headers); scoped_refptr<net::HttpResponseHeaders> parsed( @@ -789,7 +789,7 @@ TEST_F(DataReductionProxyHeadersTest, "fcl1", }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + for (size_t i = 0; i < arraysize(tests); ++i) { std::string headers(tests[i].headers); HeadersToRaw(&headers); scoped_refptr<net::HttpResponseHeaders> parsed( @@ -854,7 +854,7 @@ TEST_F(DataReductionProxyHeadersTest, }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test); ++i) { + for (size_t i = 0; i < arraysize(test); ++i) { std::string headers(test[i].headers); HeadersToRaw(&headers); scoped_refptr<net::HttpResponseHeaders> parsed( diff --git a/components/metrics/metrics_hashes_unittest.cc b/components/metrics/metrics_hashes_unittest.cc index ce803d1..b949058 100644 --- a/components/metrics/metrics_hashes_unittest.cc +++ b/components/metrics/metrics_hashes_unittest.cc @@ -21,7 +21,7 @@ TEST(MetricsUtilTest, HashMetricName) { {"NewTab", "0x290eb683f96572f1"}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { + for (size_t i = 0; i < arraysize(cases); ++i) { uint64 hash = HashMetricName(cases[i].input); std::string hash_hex = base::StringPrintf("0x%016" PRIx64, hash); EXPECT_EQ(cases[i].output, hash_hex); diff --git a/components/omnibox/autocomplete_input_unittest.cc b/components/omnibox/autocomplete_input_unittest.cc index 27f5079..d95ce84 100644 --- a/components/omnibox/autocomplete_input_unittest.cc +++ b/components/omnibox/autocomplete_input_unittest.cc @@ -157,7 +157,7 @@ TEST(AutocompleteInputTest, InputType) { { base::WideToUTF16(L".\u062A"), metrics::OmniboxInputType::UNKNOWN }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input_cases); ++i) { + for (size_t i = 0; i < arraysize(input_cases); ++i) { SCOPED_TRACE(input_cases[i].input); AutocompleteInput input(input_cases[i].input, base::string16::npos, std::string(), GURL(), @@ -197,7 +197,7 @@ TEST(AutocompleteInputTest, InputTypeWithDesiredTLD) { std::string() }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input_cases); ++i) { + for (size_t i = 0; i < arraysize(input_cases); ++i) { SCOPED_TRACE(input_cases[i].input); AutocompleteInput input(input_cases[i].input, base::string16::npos, "com", GURL(), OmniboxEventProto::INVALID_SPEC, true, @@ -249,7 +249,7 @@ TEST(AutocompleteInputTest, ParseForEmphasizeComponent) { Component(12, 11), kInvalidComponent } }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input_cases); ++i) { + for (size_t i = 0; i < arraysize(input_cases); ++i) { SCOPED_TRACE(input_cases[i].input); Component scheme, host; AutocompleteInput::ParseForEmphasizeComponents(input_cases[i].input, @@ -292,7 +292,7 @@ TEST(AutocompleteInputTest, InputTypeWithCursorPosition) { { ASCIIToUTF16(" ? foo bar"), 6, ASCIIToUTF16("foo bar"), 1 }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input_cases); ++i) { + for (size_t i = 0; i < arraysize(input_cases); ++i) { SCOPED_TRACE(input_cases[i].input); AutocompleteInput input(input_cases[i].input, input_cases[i].cursor_position, std::string(), diff --git a/components/omnibox/autocomplete_match_unittest.cc b/components/omnibox/autocomplete_match_unittest.cc index 19d44db..2fba94c 100644 --- a/components/omnibox/autocomplete_match_unittest.cc +++ b/components/omnibox/autocomplete_match_unittest.cc @@ -26,7 +26,7 @@ TEST(AutocompleteMatchTest, MoreRelevant) { AutocompleteMatch m2(NULL, 0, false, AutocompleteMatchType::URL_WHAT_YOU_TYPED); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { + for (size_t i = 0; i < arraysize(cases); ++i) { m1.relevance = cases[i].r1; m2.relevance = cases[i].r2; EXPECT_EQ(cases[i].expected_result, diff --git a/components/omnibox/autocomplete_result_unittest.cc b/components/omnibox/autocomplete_result_unittest.cc index c04f14e..24bdf77 100644 --- a/components/omnibox/autocomplete_result_unittest.cc +++ b/components/omnibox/autocomplete_result_unittest.cc @@ -243,10 +243,9 @@ TEST_F(AutocompleteResultTest, CopyOldMatches) { { 1, 0, 399 }, }; - ASSERT_NO_FATAL_FAILURE( - RunCopyOldMatchesTest(last, ARRAYSIZE_UNSAFE(last), - current, ARRAYSIZE_UNSAFE(current), - result, ARRAYSIZE_UNSAFE(result))); + ASSERT_NO_FATAL_FAILURE(RunCopyOldMatchesTest(last, arraysize(last), + current, arraysize(current), + result, arraysize(result))); } // Tests that matches are copied correctly from two distinct providers. @@ -268,10 +267,9 @@ TEST_F(AutocompleteResultTest, CopyOldMatches2) { { 3, 1, 300 }, }; - ASSERT_NO_FATAL_FAILURE( - RunCopyOldMatchesTest(last, ARRAYSIZE_UNSAFE(last), - current, ARRAYSIZE_UNSAFE(current), - result, ARRAYSIZE_UNSAFE(result))); + ASSERT_NO_FATAL_FAILURE(RunCopyOldMatchesTest(last, arraysize(last), + current, arraysize(current), + result, arraysize(result))); } // Tests that matches with empty destination URLs aren't treated as duplicates diff --git a/components/omnibox/keyword_provider_unittest.cc b/components/omnibox/keyword_provider_unittest.cc index 19661a8..5c398a5 100644 --- a/components/omnibox/keyword_provider_unittest.cc +++ b/components/omnibox/keyword_provider_unittest.cc @@ -334,7 +334,7 @@ TEST_F(KeywordProviderTest, GetSubstitutingTemplateURLForInput) { { "aa foo", base::string16::npos, false, "", "aa foo", base::string16::npos }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) { + for (size_t i = 0; i < arraysize(cases); i++) { AutocompleteInput input( ASCIIToUTF16(cases[i].text), cases[i].cursor_position, std::string(), GURL(), metrics::OmniboxEventProto::INVALID_SPEC, false, false, diff --git a/components/password_manager/core/browser/password_store_default_unittest.cc b/components/password_manager/core/browser/password_store_default_unittest.cc index c0eb92a..7b6ef5e 100644 --- a/components/password_manager/core/browser/password_store_default_unittest.cc +++ b/components/password_manager/core/browser/password_store_default_unittest.cc @@ -91,7 +91,7 @@ TEST_F(PasswordStoreDefaultTest, NonASCIIData) { // Build the expected forms vector and add the forms to the store. std::vector<PasswordForm*> expected_forms; - for (unsigned int i = 0; i < ARRAYSIZE_UNSAFE(form_data); ++i) { + for (unsigned int i = 0; i < arraysize(form_data); ++i) { PasswordForm* form = CreatePasswordFormFromData(form_data[i]); expected_forms.push_back(form); store->AddLogin(*form); diff --git a/components/password_manager/core/browser/password_store_unittest.cc b/components/password_manager/core/browser/password_store_unittest.cc index 0c6e3d6..e812024 100644 --- a/components/password_manager/core/browser/password_store_unittest.cc +++ b/components/password_manager/core/browser/password_store_unittest.cc @@ -134,7 +134,7 @@ TEST_F(PasswordStoreTest, IgnoreOldWwwGoogleLogins) { // Build the forms vector and add the forms to the store. std::vector<PasswordForm*> all_forms; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(form_data); ++i) { + for (size_t i = 0; i < arraysize(form_data); ++i) { PasswordForm* form = CreatePasswordFormFromData(form_data[i]); all_forms.push_back(form); store->AddLogin(*form); diff --git a/components/password_manager/core/browser/psl_matching_helper_unittest.cc b/components/password_manager/core/browser/psl_matching_helper_unittest.cc index fdc4708..fa9a4aa 100644 --- a/components/password_manager/core/browser/psl_matching_helper_unittest.cc +++ b/components/password_manager/core/browser/psl_matching_helper_unittest.cc @@ -42,7 +42,7 @@ TEST(PSLMatchingUtilsTest, IsPublicSuffixDomainMatch) { {"http://www.example.com/%00", "http://www.example.com/%00", false}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(pairs); ++i) { + for (size_t i = 0; i < arraysize(pairs); ++i) { autofill::PasswordForm form1; form1.signon_realm = pairs[i].url1; autofill::PasswordForm form2; diff --git a/components/policy/core/common/cloud/cloud_policy_validator.cc b/components/policy/core/common/cloud/cloud_policy_validator.cc index 96169eb..f7c32a1 100644 --- a/components/policy/core/common/cloud/cloud_policy_validator.cc +++ b/components/policy/core/common/cloud/cloud_policy_validator.cc @@ -253,7 +253,7 @@ void CloudPolicyValidatorBase::RunChecks() { { VALIDATE_PAYLOAD, &CloudPolicyValidatorBase::CheckPayload }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kCheckFunctions); ++i) { + for (size_t i = 0; i < arraysize(kCheckFunctions); ++i) { if (validation_flags_ & kCheckFunctions[i].flag) { status_ = (this->*(kCheckFunctions[i].checkFunction))(); if (status_ != VALIDATION_OK) diff --git a/components/policy/core/common/schema.cc b/components/policy/core/common/schema.cc index 4493170..18fa9a7 100644 --- a/components/policy/core/common/schema.cc +++ b/components/policy/core/common/schema.cc @@ -76,7 +76,7 @@ bool SchemaTypeToValueType(const std::string& type_string, { schema::kObject, base::Value::TYPE_DICTIONARY }, { schema::kString, base::Value::TYPE_STRING }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kSchemaToValueTypeMap); ++i) { + for (size_t i = 0; i < arraysize(kSchemaToValueTypeMap); ++i) { if (kSchemaToValueTypeMap[i].schema_type == type_string) { *type = kSchemaToValueTypeMap[i].value_type; return true; diff --git a/components/policy/core/common/schema_unittest.cc b/components/policy/core/common/schema_unittest.cc index 766c6d9..db1490c 100644 --- a/components/policy/core/common/schema_unittest.cc +++ b/components/policy/core/common/schema_unittest.cc @@ -410,7 +410,7 @@ TEST(SchemaTest, ValidSchema) { { "StringWithPattern", base::Value::TYPE_STRING }, }; Schema::Iterator it = schema.GetPropertiesIterator(); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kExpectedProperties); ++i) { + for (size_t i = 0; i < arraysize(kExpectedProperties); ++i) { ASSERT_FALSE(it.IsAtEnd()); EXPECT_STREQ(kExpectedProperties[i].expected_key, it.key()); ASSERT_TRUE(it.schema().valid()); @@ -473,7 +473,7 @@ TEST(SchemaTest, Lookups) { { "abab", base::Value::TYPE_STRING }, { "bb", base::Value::TYPE_NULL }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kExpectedKeys); ++i) { + for (size_t i = 0; i < arraysize(kExpectedKeys); ++i) { Schema sub = schema.GetKnownProperty(kExpectedKeys[i].expected_key); ASSERT_TRUE(sub.valid()); EXPECT_EQ(kExpectedKeys[i].expected_type, sub.type()); @@ -559,7 +559,7 @@ TEST(SchemaTest, Wrap) { }; Schema::Iterator it = schema.GetPropertiesIterator(); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kExpectedProperties); ++i) { + for (size_t i = 0; i < arraysize(kExpectedProperties); ++i) { ASSERT_FALSE(it.IsAtEnd()); EXPECT_STREQ(kExpectedProperties[i].key, it.key()); Schema sub = it.schema(); diff --git a/components/query_parser/query_parser_unittest.cc b/components/query_parser/query_parser_unittest.cc index 0ec1412..d78a8fc 100644 --- a/components/query_parser/query_parser_unittest.cc +++ b/components/query_parser/query_parser_unittest.cc @@ -116,7 +116,7 @@ TEST_F(QueryParserTest, ParseQueryNodesAndMatch) { { "\"foo blah\"", "\"foo blah\"", true, 1, 9, 0, 0 }, { "foo blah", "\"foo bar blah\"", true, 1, 4, 9, 13 }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { QueryParser parser; ScopedVector<QueryNode> query_nodes; parser.ParseQueryNodes(base::UTF8ToUTF16(data[i].query), @@ -154,7 +154,7 @@ TEST_F(QueryParserTest, ParseQueryWords) { { "\"foo bar\"", "foo", "bar", "", 2 }, { "\"foo bar\" a", "foo", "bar", "a", 3 }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { std::vector<base::string16> results; QueryParser parser; parser.ParseQueryWords(base::UTF8ToUTF16(data[i].text), &results); diff --git a/components/query_parser/snippet_unittest.cc b/components/query_parser/snippet_unittest.cc index c409415..7f96f67 100644 --- a/components/query_parser/snippet_unittest.cc +++ b/components/query_parser/snippet_unittest.cc @@ -241,7 +241,7 @@ TEST(Snippets, ExtractMatchPositions) { { "0 0 1 2 0 0 1 1", 1, { 1, 3 } }, { "0 0 1 1 0 0 5 2 0 0 10 1 0 0 3 10", 2, { 1, 2, 3, 13 } }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { Snippet::MatchPositions matches; Snippet::ExtractMatchPositions(data[i].offsets_string, "0", &matches); EXPECT_EQ(data[i].expected_match_count, matches.size()); diff --git a/components/search_engines/template_url_fetcher_unittest.cc b/components/search_engines/template_url_fetcher_unittest.cc index 7ab8c9e..0a45406 100644 --- a/components/search_engines/template_url_fetcher_unittest.cc +++ b/components/search_engines/template_url_fetcher_unittest.cc @@ -204,7 +204,7 @@ TEST_F(TemplateURLFetcherTest, DuplicatesThrownAway) { base::string16(), TemplateURLFetcher::EXPLICIT_PROVIDER }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + for (size_t i = 0; i < arraysize(test_cases); ++i) { StartDownload(test_cases[i].keyword, test_cases[i].osdd_file_name, test_cases[i].provider_type, false); ASSERT_EQ(1, template_url_fetcher()->requests_count()) @@ -213,7 +213,7 @@ TEST_F(TemplateURLFetcherTest, DuplicatesThrownAway) { } WaitForDownloadToFinish(); - ASSERT_EQ(1 + ARRAYSIZE_UNSAFE(test_cases), + ASSERT_EQ(1 + arraysize(test_cases), static_cast<size_t>(callbacks_destroyed())); ASSERT_EQ(0, add_provider_called()); } diff --git a/components/search_engines/template_url_service_sync_unittest.cc b/components/search_engines/template_url_service_sync_unittest.cc index a6323db..b800f0e 100644 --- a/components/search_engines/template_url_service_sync_unittest.cc +++ b/components/search_engines/template_url_service_sync_unittest.cc @@ -482,7 +482,7 @@ TEST_F(TemplateURLServiceSyncTest, IsLocalTemplateURLBetter) { {100, 100, false, false, false}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + for (size_t i = 0; i < arraysize(test_cases); ++i) { TemplateURL* local_turl = CreateTestTemplateURL( ASCIIToUTF16("localkey"), "www.local.com", "localguid", test_cases[i].local_time, true, test_cases[i].local_created_by_policy); @@ -1977,7 +1977,7 @@ TEST_F(TemplateURLServiceSyncTest, MergeInSyncTemplateURL) { {NEITHER, SYNC, NEITHER, NEITHER, BOTH, false, {1, 0, 0}}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + for (size_t i = 0; i < arraysize(test_cases); ++i) { // Assert all the valid states of ExpectedTemplateURLs. ASSERT_FALSE(test_cases[i].conflict_winner == BOTH); ASSERT_FALSE(test_cases[i].synced_at_start == NEITHER); diff --git a/components/search_engines/template_url_service_unittest.cc b/components/search_engines/template_url_service_unittest.cc index b878129..1385e7e 100644 --- a/components/search_engines/template_url_service_unittest.cc +++ b/components/search_engines/template_url_service_unittest.cc @@ -889,7 +889,7 @@ TEST_F(TemplateURLServiceTest, UpdateKeywordSearchTermsForURL) { "http://sugg1", "http://x/foo#query={searchTerms}", "http://icon1", false, "UTF-8;UTF-16", Time(), Time()); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { TemplateURLService::URLVisitedDetails details = { GURL(data[i].url), false }; @@ -911,7 +911,7 @@ TEST_F(TemplateURLServiceTest, DontUpdateKeywordSearchForNonReplaceable) { AddKeywordWithDate("name", "x", "http://x/foo", "http://sugg1", std::string(), "http://icon1", false, "UTF-8;UTF-16", Time(), Time()); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { TemplateURLService::URLVisitedDetails details = { GURL(data[i].url), false }; diff --git a/components/search_engines/template_url_unittest.cc b/components/search_engines/template_url_unittest.cc index 063ac239..5557832 100644 --- a/components/search_engines/template_url_unittest.cc +++ b/components/search_engines/template_url_unittest.cc @@ -62,7 +62,7 @@ TEST_F(TemplateURLTest, URLRefTestSearchTerms) { { "http://en.wikipedia.org/{searchTerms}", ASCIIToUTF16("wiki/?"), "http://en.wikipedia.org/wiki/%3F" } }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(search_term_cases); ++i) { + for (size_t i = 0; i < arraysize(search_term_cases); ++i) { const SearchTermsCase& value = search_term_cases[i]; TemplateURLData data; data.SetURL(value.url); @@ -303,7 +303,7 @@ TEST_F(TemplateURLTest, URLRefTestSearchTermsUsingTermsData) { TestingSearchTermsData search_terms_data("http://example.com/e/"); TemplateURLData data; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(search_term_cases); ++i) { + for (size_t i = 0; i < arraysize(search_term_cases); ++i) { const SearchTermsCase& value = search_term_cases[i]; data.SetURL(value.url); TemplateURL url(data); @@ -344,7 +344,7 @@ TEST_F(TemplateURLTest, URLRefTermToWide) { TemplateURL url(data); EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_)); ASSERT_TRUE(url.url_ref().SupportsReplacement(search_terms_data_)); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(to_wide_cases); i++) { + for (size_t i = 0; i < arraysize(to_wide_cases); i++) { EXPECT_EQ(to_wide_cases[i].expected_decoded_term, url.url_ref().SearchTermToString16( to_wide_cases[i].encoded_search_term)); @@ -366,7 +366,7 @@ TEST_F(TemplateURLTest, DisplayURLToURLRef) { ASCIIToUTF16("http://foo%s{language}") }, }; TemplateURLData data; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { data.SetURL(test_data[i].url); TemplateURL url(data); EXPECT_EQ(test_data[i].expected_result, @@ -409,7 +409,7 @@ TEST_F(TemplateURLTest, ReplaceSearchTerms) { }; TemplateURLData data; data.input_encodings.push_back("UTF-8"); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { data.SetURL(test_data[i].url); TemplateURL url(data); EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_)); @@ -449,7 +449,7 @@ TEST_F(TemplateURLTest, ReplaceArbitrarySearchTerms) { "http://foo/%82%A0%20%82%A2/bar"}, }; TemplateURLData data; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { data.SetURL(test_data[i].url); data.input_encodings.clear(); data.input_encodings.push_back(test_data[i].encoding); @@ -506,7 +506,7 @@ TEST_F(TemplateURLTest, ReplaceAssistedQueryStats) { }; TemplateURLData data; data.input_encodings.push_back("UTF-8"); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { data.SetURL(test_data[i].url); TemplateURL url(data); EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_)); @@ -544,7 +544,7 @@ TEST_F(TemplateURLTest, ReplaceCursorPosition) { }; TemplateURLData data; data.input_encodings.push_back("UTF-8"); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { data.SetURL(test_data[i].url); TemplateURL url(data); EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_)); @@ -581,7 +581,7 @@ TEST_F(TemplateURLTest, ReplaceInputType) { }; TemplateURLData data; data.input_encodings.push_back("UTF-8"); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { data.SetURL(test_data[i].url); TemplateURL url(data); EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_)); @@ -618,7 +618,7 @@ TEST_F(TemplateURLTest, ReplaceCurrentPageUrl) { }; TemplateURLData data; data.input_encodings.push_back("UTF-8"); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { data.SetURL(test_data[i].url); TemplateURL url(data); EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_)); @@ -655,7 +655,7 @@ TEST_F(TemplateURLTest, OmniboxStartmargin) { TemplateURL url(data); EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_)); ASSERT_TRUE(url.url_ref().SupportsReplacement(search_terms_data_)); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { TemplateURLRef::SearchTermsArgs search_terms_args(ASCIIToUTF16("foobar")); search_terms_args.enable_omnibox_start_margin = test_data[i].enable_omnibox_start_margin; @@ -692,7 +692,7 @@ TEST_F(TemplateURLTest, Suggestions) { TemplateURL url(data); EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_)); ASSERT_TRUE(url.url_ref().SupportsReplacement(search_terms_data_)); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { TemplateURLRef::SearchTermsArgs search_terms_args( ASCIIToUTF16("foobar")); search_terms_args.accepted_suggestion = test_data[i].accepted_suggestion; @@ -764,7 +764,7 @@ TEST_F(TemplateURLTest, HostAndSearchTermKey) { { "http://blah/?q=stock:{searchTerms}", "blah", "/", "q"}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { TemplateURLData data; data.SetURL(test_data[i].url); TemplateURL url(data); @@ -787,7 +787,7 @@ TEST_F(TemplateURLTest, GoogleBaseSuggestURL) { { "http://google.com/intl/xx/", "http://google.com/complete/", }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) + for (size_t i = 0; i < arraysize(data); ++i) CheckSuggestBaseURL(data[i].base_url, data[i].base_suggest_url); } @@ -1341,7 +1341,7 @@ TEST_F(TemplateURLTest, IsSearchResults) { { "http://bar/newtab", false, }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(url_data); ++i) { + for (size_t i = 0; i < arraysize(url_data); ++i) { EXPECT_EQ(url_data[i].result, search_provider.IsSearchURL(GURL(url_data[i].url), search_terms_data_)); @@ -1471,7 +1471,7 @@ TEST_F(TemplateURLTest, GenerateSearchURL) { "http://foo/blah.blah.blah.blah.blah" } }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(generate_url_cases); ++i) { + for (size_t i = 0; i < arraysize(generate_url_cases); ++i) { TemplateURLData data; data.SetURL(generate_url_cases[i].url); TemplateURL t_url(data); diff --git a/components/signin/core/browser/signin_error_controller_unittest.cc b/components/signin/core/browser/signin_error_controller_unittest.cc index 290c205..e946d20 100644 --- a/components/signin/core/browser/signin_error_controller_unittest.cc +++ b/components/signin/core/browser/signin_error_controller_unittest.cc @@ -164,10 +164,10 @@ TEST_F(SigninErrorControllerTest, AuthStatusEnumerateAllErrors) { { GoogleServiceAuthError::SERVICE_ERROR, true }, { GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true }, }; - COMPILE_ASSERT(ARRAYSIZE_UNSAFE(table) == GoogleServiceAuthError::NUM_STATES, + COMPILE_ASSERT(arraysize(table) == GoogleServiceAuthError::NUM_STATES, kTable_size_does_not_match_number_of_auth_error_types); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(table); ++i) { + for (size_t i = 0; i < arraysize(table); ++i) { FakeAuthStatusProvider provider(error_controller_.get()); provider.SetAuthError(kTestAccountId, kTestUsername, diff --git a/components/url_matcher/url_matcher_factory_unittest.cc b/components/url_matcher/url_matcher_factory_unittest.cc index e287156..c2fc71b 100644 --- a/components/url_matcher/url_matcher_factory_unittest.cc +++ b/components/url_matcher/url_matcher_factory_unittest.cc @@ -330,7 +330,7 @@ TEST(URLMatcherFactoryTest, CaseSensitivity) { kIsUrlCaseSensitive, kIsUrlLowerCaseEnforced, url), }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(case_tests); ++i) { + for (size_t i = 0; i < arraysize(case_tests); ++i) { SCOPED_TRACE(base::StringPrintf("Iteration: %" PRIuS, i)); case_tests[i].Test(); } diff --git a/components/variations/metrics_util_unittest.cc b/components/variations/metrics_util_unittest.cc index 4f32494..46f50ca 100644 --- a/components/variations/metrics_util_unittest.cc +++ b/components/variations/metrics_util_unittest.cc @@ -24,7 +24,7 @@ TEST(MetricsUtilTest, HashName) { {"0123456789ABCDEF", 348858318U} }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(known_hashes); ++i) + for (size_t i = 0; i < arraysize(known_hashes); ++i) EXPECT_EQ(known_hashes[i].hash_value, HashName(known_hashes[i].name)); } diff --git a/components/variations/study_filtering_unittest.cc b/components/variations/study_filtering_unittest.cc index b3d1fcf..fa5da68 100644 --- a/components/variations/study_filtering_unittest.cc +++ b/components/variations/study_filtering_unittest.cc @@ -138,7 +138,7 @@ TEST(VariationsStudyFilteringTest, CheckStudyLocale) { {"", true, true, true}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + for (size_t i = 0; i < arraysize(test_cases); ++i) { std::vector<std::string> filter_locales; Study_Filter filter; base::SplitString(test_cases[i].filter_locales, ',', &filter_locales); @@ -218,7 +218,7 @@ TEST(VariationsStudyFilteringTest, CheckStudyStartDate) { // Start date not set should result in true. EXPECT_TRUE(internal::CheckStudyStartDate(filter, now)); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(start_test_cases); ++i) { + for (size_t i = 0; i < arraysize(start_test_cases); ++i) { filter.set_start_date(TimeToProtoTime(start_test_cases[i].start_date)); const bool result = internal::CheckStudyStartDate(filter, now); EXPECT_EQ(start_test_cases[i].expected_result, result) @@ -273,7 +273,7 @@ TEST(VariationsStudyFilteringTest, CheckStudyVersion) { // Min/max version not set should result in true. EXPECT_TRUE(internal::CheckStudyVersion(filter, base::Version("1.2.3"))); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(min_test_cases); ++i) { + for (size_t i = 0; i < arraysize(min_test_cases); ++i) { filter.set_min_version(min_test_cases[i].min_version); const bool result = internal::CheckStudyVersion(filter, Version(min_test_cases[i].version)); @@ -282,7 +282,7 @@ TEST(VariationsStudyFilteringTest, CheckStudyVersion) { } filter.clear_min_version(); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(max_test_cases); ++i) { + for (size_t i = 0; i < arraysize(max_test_cases); ++i) { filter.set_max_version(max_test_cases[i].max_version); const bool result = internal::CheckStudyVersion(filter, Version(max_test_cases[i].version)); @@ -291,8 +291,8 @@ TEST(VariationsStudyFilteringTest, CheckStudyVersion) { } // Check intersection semantics. - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(min_test_cases); ++i) { - for (size_t j = 0; j < ARRAYSIZE_UNSAFE(max_test_cases); ++j) { + for (size_t i = 0; i < arraysize(min_test_cases); ++i) { + for (size_t j = 0; j < arraysize(max_test_cases); ++j) { filter.set_min_version(min_test_cases[i].min_version); filter.set_max_version(max_test_cases[j].max_version); @@ -353,7 +353,7 @@ TEST(VariationsStudyFilteringTest, CheckStudyHardwareClass) { // considered undefined. }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + for (size_t i = 0; i < arraysize(test_cases); ++i) { Study_Filter filter; std::vector<std::string> hardware_class; base::SplitString(test_cases[i].hardware_class, ',', &hardware_class); @@ -424,7 +424,7 @@ TEST(VariationsStudyFilteringTest, IsStudyExpired) { // Expiry date not set should result in false. EXPECT_FALSE(internal::IsStudyExpired(study, now)); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(expiry_test_cases); ++i) { + for (size_t i = 0; i < arraysize(expiry_test_cases); ++i) { study.set_expiry_date(TimeToProtoTime(expiry_test_cases[i].expiry_date)); const bool result = internal::IsStudyExpired(study, now); EXPECT_EQ(expiry_test_cases[i].expected_result, result) diff --git a/components/variations/variations_http_header_provider_unittest.cc b/components/variations/variations_http_header_provider_unittest.cc index 50e4f4b..ca8a560 100644 --- a/components/variations/variations_http_header_provider_unittest.cc +++ b/components/variations/variations_http_header_provider_unittest.cc @@ -153,7 +153,7 @@ TEST_F(VariationsHttpHeaderProviderTest, ShouldAppendHeaders) { {"http://a.b.ytimg.com", true}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { + for (size_t i = 0; i < arraysize(cases); ++i) { const GURL url(cases[i].url); EXPECT_EQ(cases[i].should_append_headers, VariationsHttpHeaderProvider::ShouldAppendHeaders(url)) |