| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_TEST_WEBURL_LOADER_MOCK_FACTORY_H_ | 5 #ifndef CONTENT_TEST_WEBURL_LOADER_MOCK_FACTORY_H_ |
| 6 #define CONTENT_TEST_WEBURL_LOADER_MOCK_FACTORY_H_ | 6 #define CONTENT_TEST_WEBURL_LOADER_MOCK_FACTORY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 public: | 31 public: |
| 32 WebURLLoaderMockFactory(); | 32 WebURLLoaderMockFactory(); |
| 33 virtual ~WebURLLoaderMockFactory(); | 33 virtual ~WebURLLoaderMockFactory(); |
| 34 | 34 |
| 35 // Called by TestBlinkWebUnitTestSupport to create a WebURLLoader. | 35 // Called by TestBlinkWebUnitTestSupport to create a WebURLLoader. |
| 36 // Non-mocked request are forwarded to |default_loader| which should not be | 36 // Non-mocked request are forwarded to |default_loader| which should not be |
| 37 // NULL. | 37 // NULL. |
| 38 virtual blink::WebURLLoader* CreateURLLoader( | 38 virtual blink::WebURLLoader* CreateURLLoader( |
| 39 blink::WebURLLoader* default_loader); | 39 blink::WebURLLoader* default_loader); |
| 40 | 40 |
| 41 // Registers a response and the contents to be served when the specified URL | 41 // Registers a response and the file to be served when the specified URL |
| 42 // is loaded. | 42 // is loaded. If no file is specified then the response content will be empty. |
| 43 void RegisterURL(const blink::WebURL& url, | 43 void RegisterURL(const blink::WebURL& url, |
| 44 const blink::WebURLResponse& response, | 44 const blink::WebURLResponse& response, |
| 45 const blink::WebString& filePath); | 45 const blink::WebString& filePath = blink::WebString()); |
| 46 | 46 |
| 47 // Registers an error to be served when the specified URL is requested. | 47 // Registers an error to be served when the specified URL is requested. |
| 48 void RegisterErrorURL(const blink::WebURL& url, | 48 void RegisterErrorURL(const blink::WebURL& url, |
| 49 const blink::WebURLResponse& response, | 49 const blink::WebURLResponse& response, |
| 50 const blink::WebURLError& error); | 50 const blink::WebURLError& error); |
| 51 | 51 |
| 52 // Unregisters |url| so it will no longer be mocked. | 52 // Unregisters |url| so it will no longer be mocked. |
| 53 void UnregisterURL(const blink::WebURL& url); | 53 void UnregisterURL(const blink::WebURL& url); |
| 54 | 54 |
| 55 // Unregister all URLs so no URL will be mocked anymore. | 55 // Unregister all URLs so no URL will be mocked anymore. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 // Table of the registered URLs and the responses that they should receive. | 112 // Table of the registered URLs and the responses that they should receive. |
| 113 typedef std::map<GURL, ResponseInfo> URLToResponseMap; | 113 typedef std::map<GURL, ResponseInfo> URLToResponseMap; |
| 114 URLToResponseMap url_to_reponse_info_; | 114 URLToResponseMap url_to_reponse_info_; |
| 115 | 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderMockFactory); | 116 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderMockFactory); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 #endif // CONTENT_TEST_WEBURL_LOADER_MOCK_FACTORY_H_ | 119 #endif // CONTENT_TEST_WEBURL_LOADER_MOCK_FACTORY_H_ |
| 120 | 120 |
| OLD | NEW |