Chromium Code Reviews| Index: chrome/browser/extensions/api/push_messaging/stub_url_fetcher.h |
| diff --git a/chrome/browser/extensions/api/push_messaging/stub_url_fetcher.h b/chrome/browser/extensions/api/push_messaging/stub_url_fetcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1811edfbe232bea4e131235d9dd8a2541f3ede0b |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/push_messaging/stub_url_fetcher.h |
| @@ -0,0 +1,83 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_STUB_URL_FETCHER_H_ |
|
Munjal (Google)
2012/08/15 23:04:19
No need ot write our own stub URL fetcher. Use Tes
Pete Williamson
2012/08/20 18:38:42
Done.
|
| +#define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_STUB_URL_FETCHER_H_ |
| + |
| + |
| +#include "net/url_request/url_fetcher.h" |
| +#include "googleurl/src/gurl.h" |
| +#include "net/url_request/url_request_status.h" |
| + |
| +namespace net { |
| + |
| +class StubURLFetcher : public URLFetcher { |
| + public: |
| + StubURLFetcher(std::string fakeBody, bool retval); |
| + virtual ~StubURLFetcher(); |
| + |
| + // unneeded virtual functions - do just enough to compile |
| + virtual void SetUploadData(const std::string& upload_content_type, |
| + const std::string& upload_content) OVERRIDE {} |
| + virtual void SetChunkedUpload(const std::string& upload_content_type) |
| + OVERRIDE {} |
| + virtual void AppendChunkToUpload(const std::string& data, |
| + bool is_last_chunk) OVERRIDE {} |
| + virtual void SetLoadFlags(int load_flags) OVERRIDE {} |
| + virtual int GetLoadFlags() const OVERRIDE; |
| + virtual void SetReferrer(const std::string& referrer) OVERRIDE {} |
| + virtual void SetExtraRequestHeaders( |
| + const std::string& extra_request_headers) OVERRIDE {} |
| + virtual void AddExtraRequestHeader(const std::string& header_line) OVERRIDE {} |
| + virtual void GetExtraRequestHeaders( |
| + HttpRequestHeaders* headers) const OVERRIDE {} |
| + virtual void SetRequestContext( |
| + URLRequestContextGetter* request_context_getter) OVERRIDE {} |
| + virtual void SetFirstPartyForCookies( |
| + const GURL& first_party_for_cookies) OVERRIDE {} |
| + virtual void SetURLRequestUserData( |
| + const void* key, |
| + const CreateDataCallback& create_data_callback) OVERRIDE {} |
| + virtual void SetStopOnRedirect(bool stop_on_redirect) OVERRIDE {} |
| + virtual void SetAutomaticallyRetryOn5xx(bool retry) OVERRIDE {} |
| + virtual void SetMaxRetries(int max_retries) OVERRIDE {} |
| + virtual int GetMaxRetries() const OVERRIDE; |
| + virtual base::TimeDelta GetBackoffDelay() const OVERRIDE; |
| + virtual void SaveResponseToFileAtPath( |
| + const FilePath& file_path, |
| + scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy) OVERRIDE {} |
| + virtual void SaveResponseToTemporaryFile( |
| + scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy) OVERRIDE {} |
| + virtual HttpResponseHeaders* GetResponseHeaders() const OVERRIDE; |
| + virtual HostPortPair GetSocketAddress() const OVERRIDE; |
| + virtual bool WasFetchedViaProxy() const OVERRIDE; |
| + virtual void Start() OVERRIDE {} |
| + virtual const GURL& GetOriginalURL() const OVERRIDE; |
| + virtual const GURL& GetURL() const OVERRIDE; |
| + virtual const URLRequestStatus& GetStatus() const OVERRIDE; |
| + virtual int GetResponseCode() const OVERRIDE; |
| + virtual const ResponseCookies& GetCookies() const OVERRIDE; |
| + virtual bool FileErrorOccurred( |
| + base::PlatformFileError* out_error_code) const OVERRIDE; |
| + virtual void ReceivedContentWasMalformed() OVERRIDE {} |
| + virtual bool GetResponseAsString(std::string* out_response_string) |
| + const OVERRIDE; |
| + virtual bool GetResponseAsFilePath(bool take_ownership, |
| + FilePath* out_response_path) |
| + const OVERRIDE; |
| + |
| + private: |
| + std::string fakeBody_; |
| + bool retval_; |
| + GURL gurl_; |
| + ResponseCookies responseCookies_; |
| + URLRequestStatus requestStatus_; |
| +}; |
| + |
| + |
| +} // namespace net |
| + |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_STUB_URL_FETCHER_H_ |