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

Side by Side Diff: net/dns/dns_response_unittest.cc

Issue 662553002: Convert ARRAYSIZE_UNSAFE -> arraysize in net/. (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
« no previous file with comments | « net/dns/dns_hosts_unittest.cc ('k') | net/dns/host_cache_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/dns/dns_response.h" 5 #include "net/dns/dns_response.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "net/base/address_list.h" 8 #include "net/base/address_list.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_util.h" 10 #include "net/base/net_util.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 }, 434 },
435 { 435 {
436 kT3QuerySize, 436 kT3QuerySize,
437 kT3ResponseDatagram, arraysize(kT3ResponseDatagram), 437 kT3ResponseDatagram, arraysize(kT3ResponseDatagram),
438 kT3IpAddresses, arraysize(kT3IpAddresses), 438 kT3IpAddresses, arraysize(kT3IpAddresses),
439 kT3CanonName, 439 kT3CanonName,
440 kT3TTL, 440 kT3TTL,
441 }, 441 },
442 }; 442 };
443 443
444 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { 444 for (size_t i = 0; i < arraysize(cases); ++i) {
445 const TestCase& t = cases[i]; 445 const TestCase& t = cases[i];
446 DnsResponse response(t.response_data, t.response_size, t.query_size); 446 DnsResponse response(t.response_data, t.response_size, t.query_size);
447 AddressList addr_list; 447 AddressList addr_list;
448 base::TimeDelta ttl; 448 base::TimeDelta ttl;
449 EXPECT_EQ(DnsResponse::DNS_PARSE_OK, 449 EXPECT_EQ(DnsResponse::DNS_PARSE_OK,
450 response.ParseToAddressList(&addr_list, &ttl)); 450 response.ParseToAddressList(&addr_list, &ttl));
451 std::vector<const char*> expected_addresses( 451 std::vector<const char*> expected_addresses(
452 t.expected_addresses, 452 t.expected_addresses,
453 t.expected_addresses + t.num_expected_addresses); 453 t.expected_addresses + t.num_expected_addresses);
454 VerifyAddressList(expected_addresses, addr_list); 454 VerifyAddressList(expected_addresses, addr_list);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 DnsResponse::DNS_SIZE_MISMATCH }, 558 DnsResponse::DNS_SIZE_MISMATCH },
559 { kResponseCNAMEAfterAddress, arraysize(kResponseCNAMEAfterAddress), 559 { kResponseCNAMEAfterAddress, arraysize(kResponseCNAMEAfterAddress),
560 DnsResponse::DNS_CNAME_AFTER_ADDRESS }, 560 DnsResponse::DNS_CNAME_AFTER_ADDRESS },
561 // Not actually a failure, just an empty result. 561 // Not actually a failure, just an empty result.
562 { kResponseNoAddresses, arraysize(kResponseNoAddresses), 562 { kResponseNoAddresses, arraysize(kResponseNoAddresses),
563 DnsResponse::DNS_PARSE_OK }, 563 DnsResponse::DNS_PARSE_OK },
564 }; 564 };
565 565
566 const size_t kQuerySize = 12 + 7; 566 const size_t kQuerySize = 12 + 7;
567 567
568 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { 568 for (size_t i = 0; i < arraysize(cases); ++i) {
569 const TestCase& t = cases[i]; 569 const TestCase& t = cases[i];
570 570
571 DnsResponse response(t.data, t.size, kQuerySize); 571 DnsResponse response(t.data, t.size, kQuerySize);
572 AddressList addr_list; 572 AddressList addr_list;
573 base::TimeDelta ttl; 573 base::TimeDelta ttl;
574 EXPECT_EQ(t.expected_result, 574 EXPECT_EQ(t.expected_result,
575 response.ParseToAddressList(&addr_list, &ttl)); 575 response.ParseToAddressList(&addr_list, &ttl));
576 } 576 }
577 } 577 }
578 578
579 } // namespace 579 } // namespace
580 580
581 } // namespace net 581 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/dns_hosts_unittest.cc ('k') | net/dns/host_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698