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 | |
282 void TestURLFetcherFactory::SetDelegateForTests( | 278 void TestURLFetcherFactory::SetDelegateForTests( |
283 TestURLFetcherDelegateForTests* delegate_for_tests) { | 279 TestURLFetcherDelegateForTests* delegate_for_tests) { |
284 delegate_for_tests_ = delegate_for_tests; | 280 delegate_for_tests_ = delegate_for_tests; |
285 } | 281 } |
286 | 282 |
287 FakeURLFetcher::FakeURLFetcher(const GURL& url, | 283 FakeURLFetcher::FakeURLFetcher(const GURL& url, |
288 URLFetcherDelegate* d, | 284 URLFetcherDelegate* d, |
289 const std::string& response_data, | 285 const std::string& response_data, |
290 bool success) | 286 bool success) |
291 : TestURLFetcher(0, url, d), | 287 : TestURLFetcher(0, url, d), |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 374 |
379 URLFetcher* URLFetcherImplFactory::CreateURLFetcher( | 375 URLFetcher* URLFetcherImplFactory::CreateURLFetcher( |
380 int id, | 376 int id, |
381 const GURL& url, | 377 const GURL& url, |
382 URLFetcher::RequestType request_type, | 378 URLFetcher::RequestType request_type, |
383 URLFetcherDelegate* d) { | 379 URLFetcherDelegate* d) { |
384 return new URLFetcherImpl(url, request_type, d); | 380 return new URLFetcherImpl(url, request_type, d); |
385 } | 381 } |
386 | 382 |
387 } // namespace net | 383 } // namespace net |
OLD | NEW |