| OLD | NEW |
| 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/single_request_host_resolver.h" | 5 #include "net/dns/single_request_host_resolver.h" |
| 6 | 6 |
| 7 #include "net/base/address_list.h" | 7 #include "net/base/address_list.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "net/base/net_log.h" | 9 #include "net/base/net_log.h" |
| 10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 RequestHandle outstanding_request_; | 61 RequestHandle outstanding_request_; |
| 62 | 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(HangingHostResolver); | 63 DISALLOW_COPY_AND_ASSIGN(HangingHostResolver); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 // Test that a regular end-to-end lookup returns the expected result. | 66 // Test that a regular end-to-end lookup returns the expected result. |
| 67 TEST(SingleRequestHostResolverTest, NormalResolve) { | 67 TEST(SingleRequestHostResolverTest, NormalResolve) { |
| 68 // Create a host resolver dependency that returns address "199.188.1.166" | 68 // Create a host resolver dependency that returns address "199.188.1.166" |
| 69 // for resolutions of "watsup". | 69 // for resolutions of "watsup". |
| 70 MockHostResolver resolver; | 70 MockHostResolver resolver; |
| 71 resolver.rules()->AddIPLiteralRule("watsup", "199.188.1.166", ""); | 71 resolver.rules()->AddIPLiteralRule("watsup", "199.188.1.166", std::string()); |
| 72 | 72 |
| 73 SingleRequestHostResolver single_request_resolver(&resolver); | 73 SingleRequestHostResolver single_request_resolver(&resolver); |
| 74 | 74 |
| 75 // Resolve "watsup:90" using our SingleRequestHostResolver. | 75 // Resolve "watsup:90" using our SingleRequestHostResolver. |
| 76 AddressList addrlist; | 76 AddressList addrlist; |
| 77 TestCompletionCallback callback; | 77 TestCompletionCallback callback; |
| 78 HostResolver::RequestInfo request(HostPortPair("watsup", 90)); | 78 HostResolver::RequestInfo request(HostPortPair("watsup", 90)); |
| 79 int rv = single_request_resolver.Resolve( | 79 int rv = single_request_resolver.Resolve( |
| 80 request, &addrlist, callback.callback(), BoundNetLog()); | 80 request, &addrlist, callback.callback(), BoundNetLog()); |
| 81 EXPECT_EQ(ERR_IO_PENDING, rv); | 81 EXPECT_EQ(ERR_IO_PENDING, rv); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 SingleRequestHostResolver single_request_resolver(&resolver); | 115 SingleRequestHostResolver single_request_resolver(&resolver); |
| 116 single_request_resolver.Cancel(); | 116 single_request_resolver.Cancel(); |
| 117 | 117 |
| 118 // To pass, HangingHostResolver should not have received a cancellation | 118 // To pass, HangingHostResolver should not have received a cancellation |
| 119 // request (since there is nothing to cancel). If it does, it will crash. | 119 // request (since there is nothing to cancel). If it does, it will crash. |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace | 122 } // namespace |
| 123 | 123 |
| 124 } // namespace net | 124 } // namespace net |
| OLD | NEW |