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/url_request/url_fetcher_impl.h" | 5 #include "net/url_request/url_fetcher_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // All requests for |hanging_domain| will hang on host resolution until the | 172 // All requests for |hanging_domain| will hang on host resolution until the |
173 // mock_resolver()->ResolveAllPending() is called. | 173 // mock_resolver()->ResolveAllPending() is called. |
174 explicit FetcherTestURLRequestContext(const std::string& hanging_domain) | 174 explicit FetcherTestURLRequestContext(const std::string& hanging_domain) |
175 : TestURLRequestContext(true), mock_resolver_(new MockHostResolver()) { | 175 : TestURLRequestContext(true), mock_resolver_(new MockHostResolver()) { |
176 mock_resolver_->set_ondemand_mode(true); | 176 mock_resolver_->set_ondemand_mode(true); |
177 mock_resolver_->rules()->AddRule(hanging_domain, "127.0.0.1"); | 177 mock_resolver_->rules()->AddRule(hanging_domain, "127.0.0.1"); |
178 // Pass ownership to ContextStorage to ensure correct destruction order. | 178 // Pass ownership to ContextStorage to ensure correct destruction order. |
179 context_storage_.set_host_resolver( | 179 context_storage_.set_host_resolver( |
180 std::unique_ptr<HostResolver>(mock_resolver_)); | 180 std::unique_ptr<HostResolver>(mock_resolver_)); |
181 context_storage_.set_throttler_manager( | 181 context_storage_.set_throttler_manager( |
182 base::WrapUnique(new URLRequestThrottlerManager())); | 182 base::MakeUnique<URLRequestThrottlerManager>()); |
183 Init(); | 183 Init(); |
184 } | 184 } |
185 | 185 |
186 MockHostResolver* mock_resolver() { return mock_resolver_; } | 186 MockHostResolver* mock_resolver() { return mock_resolver_; } |
187 | 187 |
188 private: | 188 private: |
189 MockHostResolver* mock_resolver_; | 189 MockHostResolver* mock_resolver_; |
190 | 190 |
191 DISALLOW_COPY_AND_ASSIGN(FetcherTestURLRequestContext); | 191 DISALLOW_COPY_AND_ASSIGN(FetcherTestURLRequestContext); |
192 }; | 192 }; |
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 EXPECT_EQ(-1, delegate.fetcher()->GetResponseCode()); | 1536 EXPECT_EQ(-1, delegate.fetcher()->GetResponseCode()); |
1537 EXPECT_FALSE(delegate.fetcher()->GetResponseHeaders()); | 1537 EXPECT_FALSE(delegate.fetcher()->GetResponseHeaders()); |
1538 std::string data; | 1538 std::string data; |
1539 EXPECT_TRUE(delegate.fetcher()->GetResponseAsString(&data)); | 1539 EXPECT_TRUE(delegate.fetcher()->GetResponseAsString(&data)); |
1540 EXPECT_TRUE(data.empty()); | 1540 EXPECT_TRUE(data.empty()); |
1541 } | 1541 } |
1542 | 1542 |
1543 } // namespace | 1543 } // namespace |
1544 | 1544 |
1545 } // namespace net | 1545 } // namespace net |
OLD | NEW |