OLD | NEW |
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/single_request_host_resolver.h" | 5 #include "net/base/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/mock_host_resolver.h" | 8 #include "net/base/mock_host_resolver.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/base/net_log.h" | 10 #include "net/base/net_log.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 NOTIMPLEMENTED(); | 50 NOTIMPLEMENTED(); |
51 return ERR_UNEXPECTED; | 51 return ERR_UNEXPECTED; |
52 } | 52 } |
53 | 53 |
54 virtual void CancelRequest(RequestHandle req) OVERRIDE { | 54 virtual void CancelRequest(RequestHandle req) OVERRIDE { |
55 EXPECT_TRUE(has_outstanding_request()); | 55 EXPECT_TRUE(has_outstanding_request()); |
56 EXPECT_EQ(req, outstanding_request_); | 56 EXPECT_EQ(req, outstanding_request_); |
57 outstanding_request_ = NULL; | 57 outstanding_request_ = NULL; |
58 } | 58 } |
59 | 59 |
60 virtual void AddObserver(Observer* observer) OVERRIDE { | |
61 FAIL(); | |
62 } | |
63 | |
64 virtual void RemoveObserver(Observer* observer) OVERRIDE { | |
65 FAIL(); | |
66 } | |
67 | |
68 private: | 60 private: |
69 RequestHandle outstanding_request_; | 61 RequestHandle outstanding_request_; |
70 | 62 |
71 DISALLOW_COPY_AND_ASSIGN(HangingHostResolver); | 63 DISALLOW_COPY_AND_ASSIGN(HangingHostResolver); |
72 }; | 64 }; |
73 | 65 |
74 // 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. |
75 TEST(SingleRequestHostResolverTest, NormalResolve) { | 67 TEST(SingleRequestHostResolverTest, NormalResolve) { |
76 // 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" |
77 // for resolutions of "watsup". | 69 // for resolutions of "watsup". |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 SingleRequestHostResolver single_request_resolver(&resolver); | 114 SingleRequestHostResolver single_request_resolver(&resolver); |
123 single_request_resolver.Cancel(); | 115 single_request_resolver.Cancel(); |
124 | 116 |
125 // To pass, HangingHostResolver should not have received a cancellation | 117 // To pass, HangingHostResolver should not have received a cancellation |
126 // request (since there is nothing to cancel). If it does, it will crash. | 118 // request (since there is nothing to cancel). If it does, it will crash. |
127 } | 119 } |
128 | 120 |
129 } // namespace | 121 } // namespace |
130 | 122 |
131 } // namespace net | 123 } // namespace net |
OLD | NEW |