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

Side by Side Diff: net/base/host_resolver_impl_unittest.cc

Issue 10669038: base: Remove dereference structure operator (i.e ->) from ScopedVector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 5 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
« no previous file with comments | « net/base/host_resolver_impl.cc ('k') | net/dns/dns_transaction.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/base/host_resolver_impl.h" 5 #include "net/base/host_resolver_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 NULL)); 768 NULL));
769 769
770 for (size_t i = 0; i < 4; ++i) { 770 for (size_t i = 0; i < 4; ++i) {
771 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("a", 80 + i)->Resolve()) << i; 771 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("a", 80 + i)->Resolve()) << i;
772 } 772 }
773 773
774 proc_->SignalMultiple(2u); // One for "a". One for the second "a". 774 proc_->SignalMultiple(2u); // One for "a". One for the second "a".
775 775
776 EXPECT_EQ(OK, requests_[0]->WaitForResult()); 776 EXPECT_EQ(OK, requests_[0]->WaitForResult());
777 ASSERT_EQ(5u, requests_.size()); 777 ASSERT_EQ(5u, requests_.size());
778 EXPECT_EQ(OK, requests_->back()->WaitForResult()); 778 EXPECT_EQ(OK, requests_.back()->WaitForResult());
779 779
780 EXPECT_EQ(2u, proc_->GetCaptureList().size()); 780 EXPECT_EQ(2u, proc_->GetCaptureList().size());
781 } 781 }
782 782
783 TEST_F(HostResolverImplTest, BypassCache) { 783 TEST_F(HostResolverImplTest, BypassCache) {
784 struct MyHandler : public Handler { 784 struct MyHandler : public Handler {
785 virtual void Handle(Request* req) OVERRIDE { 785 virtual void Handle(Request* req) OVERRIDE {
786 if (req->index() == 0) { 786 if (req->index() == 0) {
787 // On completing the first request, start another request for "a". 787 // On completing the first request, start another request for "a".
788 // Since caching is enabled, this should complete synchronously. 788 // Since caching is enabled, this should complete synchronously.
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 // Test successful and fallback resolutions in HostResolverImpl::DnsTask. 1262 // Test successful and fallback resolutions in HostResolverImpl::DnsTask.
1263 TEST_F(HostResolverImplDnsTest, DnsTask) { 1263 TEST_F(HostResolverImplDnsTest, DnsTask) {
1264 resolver_->SetDefaultAddressFamily(ADDRESS_FAMILY_IPV4); 1264 resolver_->SetDefaultAddressFamily(ADDRESS_FAMILY_IPV4);
1265 1265
1266 proc_->AddRuleForAllFamilies("er_succeed", "192.168.1.101"); 1266 proc_->AddRuleForAllFamilies("er_succeed", "192.168.1.101");
1267 proc_->AddRuleForAllFamilies("nx_succeed", "192.168.1.102"); 1267 proc_->AddRuleForAllFamilies("nx_succeed", "192.168.1.102");
1268 // All other hostnames will fail in proc_. 1268 // All other hostnames will fail in proc_.
1269 1269
1270 // Initially there is no config, so client should not be invoked. 1270 // Initially there is no config, so client should not be invoked.
1271 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("ok_fail", 80)->Resolve()); 1271 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("ok_fail", 80)->Resolve());
1272 proc_->SignalMultiple(requests_->size()); 1272 proc_->SignalMultiple(requests_.size());
1273 1273
1274 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, requests_[0]->WaitForResult()); 1274 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, requests_[0]->WaitForResult());
1275 1275
1276 ChangeDnsConfig(CreateValidDnsConfig()); 1276 ChangeDnsConfig(CreateValidDnsConfig());
1277 1277
1278 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("ok_fail", 80)->Resolve()); 1278 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("ok_fail", 80)->Resolve());
1279 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("er_fail", 80)->Resolve()); 1279 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("er_fail", 80)->Resolve());
1280 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("nx_fail", 80)->Resolve()); 1280 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("nx_fail", 80)->Resolve());
1281 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("er_succeed", 80)->Resolve()); 1281 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("er_succeed", 80)->Resolve());
1282 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("nx_succeed", 80)->Resolve()); 1282 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("nx_succeed", 80)->Resolve());
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 proc_->SignalMultiple(requests_.size()); 1364 proc_->SignalMultiple(requests_.size());
1365 1365
1366 for (size_t i = 0; i < 2; ++i) 1366 for (size_t i = 0; i < 2; ++i)
1367 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, requests_[i]->WaitForResult()) << i; 1367 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, requests_[i]->WaitForResult()) << i;
1368 1368
1369 for (size_t i = 2; i < requests_.size(); ++i) 1369 for (size_t i = 2; i < requests_.size(); ++i)
1370 EXPECT_EQ(OK, requests_[i]->WaitForResult()) << i; 1370 EXPECT_EQ(OK, requests_[i]->WaitForResult()) << i;
1371 } 1371 }
1372 1372
1373 } // namespace net 1373 } // namespace net
OLDNEW
« no previous file with comments | « net/base/host_resolver_impl.cc ('k') | net/dns/dns_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698