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

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

Issue 11464028: Introduce ERR_NETWORK_CHANGED and allow URLFetcher to automatically retry on that error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed nits Created 8 years 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/dnsrr_resolver.cc ('k') | net/base/host_resolver_impl.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/dnsrr_resolver.h" 5 #include "net/base/dnsrr_resolver.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "net/base/dns_util.h" 10 #include "net/base/dns_util.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 ASSERT_EQ(3u, resolver.requests()); 90 ASSERT_EQ(3u, resolver.requests());
91 ASSERT_EQ(2u, resolver.cache_hits()); 91 ASSERT_EQ(2u, resolver.cache_hits());
92 ASSERT_EQ(0u, resolver.inflight_joins()); 92 ASSERT_EQ(0u, resolver.inflight_joins());
93 93
94 // Test what happens in the event of a network config change. 94 // Test what happens in the event of a network config change.
95 handle = resolver.Resolve("nx.testing.notatld", kDNS_TESTING, 0, 95 handle = resolver.Resolve("nx.testing.notatld", kDNS_TESTING, 0,
96 callback.callback(), &response, 0, BoundNetLog()); 96 callback.callback(), &response, 0, BoundNetLog());
97 ASSERT_TRUE(handle != DnsRRResolver::kInvalidHandle); 97 ASSERT_TRUE(handle != DnsRRResolver::kInvalidHandle);
98 resolver.OnIPAddressChanged(); 98 resolver.OnIPAddressChanged();
99 ASSERT_TRUE(callback.have_result()); 99 ASSERT_TRUE(callback.have_result());
100 ASSERT_EQ(ERR_ABORTED, callback.WaitForResult()); 100 ASSERT_EQ(ERR_NETWORK_CHANGED, callback.WaitForResult());
101 ASSERT_EQ(4u, resolver.requests()); 101 ASSERT_EQ(4u, resolver.requests());
102 ASSERT_EQ(2u, resolver.cache_hits()); 102 ASSERT_EQ(2u, resolver.cache_hits());
103 ASSERT_EQ(0u, resolver.inflight_joins()); 103 ASSERT_EQ(0u, resolver.inflight_joins());
104 104
105 // Test an inflight join. (Note that this depends on the cache being flushed 105 // Test an inflight join. (Note that this depends on the cache being flushed
106 // by OnIPAddressChanged.) 106 // by OnIPAddressChanged.)
107 TestCompletionCallback callback2; 107 TestCompletionCallback callback2;
108 DnsRRResolver::Handle handle2; 108 DnsRRResolver::Handle handle2;
109 handle = resolver.Resolve("nx.testing.notatld", kDNS_TESTING, 0, 109 handle = resolver.Resolve("nx.testing.notatld", kDNS_TESTING, 0,
110 callback.callback(), &response, 0, BoundNetLog()); 110 callback.callback(), &response, 0, BoundNetLog());
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 copy[byte] ^= (1 << bit); 202 copy[byte] ^= (1 << bit);
203 203
204 response.ParseFromResponse(copy, sizeof(copy), kDNS_TXT); 204 response.ParseFromResponse(copy, sizeof(copy), kDNS_TXT);
205 } 205 }
206 } 206 }
207 #endif 207 #endif
208 208
209 } // namespace 209 } // namespace
210 210
211 } // namespace net 211 } // namespace net
OLDNEW
« no previous file with comments | « net/base/dnsrr_resolver.cc ('k') | net/base/host_resolver_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698