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 #ifndef NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ | 5 #ifndef NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ |
6 #define NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ | 6 #define NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 // status. | 414 // status. |
415 void SetFakeResponse(const GURL& url, | 415 void SetFakeResponse(const GURL& url, |
416 const std::string& response_data, | 416 const std::string& response_data, |
417 HttpStatusCode response_code, | 417 HttpStatusCode response_code, |
418 URLRequestStatus::Status status); | 418 URLRequestStatus::Status status); |
419 | 419 |
420 // Clear all the fake responses that were previously set via | 420 // Clear all the fake responses that were previously set via |
421 // SetFakeResponse(). | 421 // SetFakeResponse(). |
422 void ClearFakeResponses(); | 422 void ClearFakeResponses(); |
423 | 423 |
| 424 // This helper is needed to create FakeURLFetcherFactory with some |
| 425 // default_factory but default creator. |
| 426 static FakeURLFetcherCreator CreateDefaultFakeURLFetcherCreator(); |
| 427 |
424 private: | 428 private: |
425 struct FakeURLResponse { | 429 struct FakeURLResponse { |
426 std::string response_data; | 430 std::string response_data; |
427 HttpStatusCode response_code; | 431 HttpStatusCode response_code; |
428 URLRequestStatus::Status status; | 432 URLRequestStatus::Status status; |
429 }; | 433 }; |
430 typedef std::map<GURL, FakeURLResponse> FakeResponseMap; | 434 typedef std::map<GURL, FakeURLResponse> FakeResponseMap; |
431 | 435 |
432 const FakeURLFetcherCreator creator_; | 436 const FakeURLFetcherCreator creator_; |
433 FakeResponseMap fake_responses_; | 437 FakeResponseMap fake_responses_; |
(...skipping 22 matching lines...) Expand all Loading... |
456 int id, | 460 int id, |
457 const GURL& url, | 461 const GURL& url, |
458 URLFetcher::RequestType request_type, | 462 URLFetcher::RequestType request_type, |
459 URLFetcherDelegate* d) OVERRIDE; | 463 URLFetcherDelegate* d) OVERRIDE; |
460 | 464 |
461 }; | 465 }; |
462 | 466 |
463 } // namespace net | 467 } // namespace net |
464 | 468 |
465 #endif // NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ | 469 #endif // NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ |
OLD | NEW |