| 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 #ifndef CHROME_COMMON_NET_TEST_URL_FETCHER_FACTORY_H_ | 5 #ifndef CHROME_COMMON_NET_TEST_URL_FETCHER_FACTORY_H_ |
| 6 #define CHROME_COMMON_NET_TEST_URL_FETCHER_FACTORY_H_ | 6 #define CHROME_COMMON_NET_TEST_URL_FETCHER_FACTORY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Note: if you don't know when your request objects will be created you | 42 // Note: if you don't know when your request objects will be created you |
| 43 // might want to use the FakeUrlFetcher and FakeUrlFetcherFactory classes | 43 // might want to use the FakeUrlFetcher and FakeUrlFetcherFactory classes |
| 44 // below. | 44 // below. |
| 45 | 45 |
| 46 class TestURLFetcher : public URLFetcher { | 46 class TestURLFetcher : public URLFetcher { |
| 47 public: | 47 public: |
| 48 TestURLFetcher(int id, | 48 TestURLFetcher(int id, |
| 49 const GURL& url, | 49 const GURL& url, |
| 50 RequestType request_type, | 50 RequestType request_type, |
| 51 Delegate* d); | 51 Delegate* d); |
| 52 ~TestURLFetcher(); | 52 virtual ~TestURLFetcher(); |
| 53 | 53 |
| 54 // Overriden to do nothing. It is assumed the caller will notify the delegate. | 54 // Overriden to do nothing. It is assumed the caller will notify the delegate. |
| 55 virtual void Start() {} | 55 virtual void Start() {} |
| 56 | 56 |
| 57 // Overriden to cache the chunks uploaded. Caller can read back the uploaded | 57 // Overriden to cache the chunks uploaded. Caller can read back the uploaded |
| 58 // chunks with the upload_data() accessor. | 58 // chunks with the upload_data() accessor. |
| 59 virtual void AppendChunkToUpload(const std::string& data, bool is_last_chunk); | 59 virtual void AppendChunkToUpload(const std::string& data, bool is_last_chunk); |
| 60 | 60 |
| 61 // Unique ID in our factory. | 61 // Unique ID in our factory. |
| 62 int id() const { return id_; } | 62 int id() const { return id_; } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 void ClearFakeReponses(); | 195 void ClearFakeReponses(); |
| 196 | 196 |
| 197 private: | 197 private: |
| 198 typedef std::map<GURL, std::pair<std::string, bool> > FakeResponseMap; | 198 typedef std::map<GURL, std::pair<std::string, bool> > FakeResponseMap; |
| 199 FakeResponseMap fake_responses_; | 199 FakeResponseMap fake_responses_; |
| 200 | 200 |
| 201 DISALLOW_COPY_AND_ASSIGN(FakeURLFetcherFactory); | 201 DISALLOW_COPY_AND_ASSIGN(FakeURLFetcherFactory); |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 #endif // CHROME_COMMON_NET_TEST_URL_FETCHER_FACTORY_H_ | 204 #endif // CHROME_COMMON_NET_TEST_URL_FETCHER_FACTORY_H_ |
| OLD | NEW |