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/test_url_fetcher_factory.h" | 5 #include "net/url_request/test_url_fetcher_factory.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 Fetchers::const_iterator i = fetchers_.find(id); | 268 Fetchers::const_iterator i = fetchers_.find(id); |
269 return i == fetchers_.end() ? NULL : i->second; | 269 return i == fetchers_.end() ? NULL : i->second; |
270 } | 270 } |
271 | 271 |
272 void TestURLFetcherFactory::RemoveFetcherFromMap(int id) { | 272 void TestURLFetcherFactory::RemoveFetcherFromMap(int id) { |
273 Fetchers::iterator i = fetchers_.find(id); | 273 Fetchers::iterator i = fetchers_.find(id); |
274 DCHECK(i != fetchers_.end()); | 274 DCHECK(i != fetchers_.end()); |
275 fetchers_.erase(i); | 275 fetchers_.erase(i); |
276 } | 276 } |
277 | 277 |
| 278 size_t TestURLFetcherFactory::GetFetcherCount() const { |
| 279 return fetchers_.size(); |
| 280 } |
| 281 |
278 void TestURLFetcherFactory::SetDelegateForTests( | 282 void TestURLFetcherFactory::SetDelegateForTests( |
279 TestURLFetcherDelegateForTests* delegate_for_tests) { | 283 TestURLFetcherDelegateForTests* delegate_for_tests) { |
280 delegate_for_tests_ = delegate_for_tests; | 284 delegate_for_tests_ = delegate_for_tests; |
281 } | 285 } |
282 | 286 |
283 FakeURLFetcher::FakeURLFetcher(const GURL& url, | 287 FakeURLFetcher::FakeURLFetcher(const GURL& url, |
284 URLFetcherDelegate* d, | 288 URLFetcherDelegate* d, |
285 const std::string& response_data, | 289 const std::string& response_data, |
286 bool success) | 290 bool success) |
287 : TestURLFetcher(0, url, d), | 291 : TestURLFetcher(0, url, d), |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 | 378 |
375 URLFetcher* URLFetcherImplFactory::CreateURLFetcher( | 379 URLFetcher* URLFetcherImplFactory::CreateURLFetcher( |
376 int id, | 380 int id, |
377 const GURL& url, | 381 const GURL& url, |
378 URLFetcher::RequestType request_type, | 382 URLFetcher::RequestType request_type, |
379 URLFetcherDelegate* d) { | 383 URLFetcherDelegate* d) { |
380 return new URLFetcherImpl(url, request_type, d); | 384 return new URLFetcherImpl(url, request_type, d); |
381 } | 385 } |
382 | 386 |
383 } // namespace net | 387 } // namespace net |
OLD | NEW |