OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 WEBKIT_SUPPORT_WEBURL_LOADER_MOCK_FACTORY_H_ | 5 #ifndef WEBKIT_SUPPORT_WEBURL_LOADER_MOCK_FACTORY_H_ |
6 #define WEBKIT_SUPPORT_WEBURL_LOADER_MOCK_FACTORY_H_ | 6 #define WEBKIT_SUPPORT_WEBURL_LOADER_MOCK_FACTORY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // Unregisters |url| so it will no longer be mocked. | 46 // Unregisters |url| so it will no longer be mocked. |
47 void UnregisterURL(const WebKit::WebURL& url); | 47 void UnregisterURL(const WebKit::WebURL& url); |
48 | 48 |
49 // Unregister all URLs so no URL will be mocked anymore. | 49 // Unregister all URLs so no URL will be mocked anymore. |
50 void UnregisterAllURLs(); | 50 void UnregisterAllURLs(); |
51 | 51 |
52 // Serves all the pending asynchronous requests. | 52 // Serves all the pending asynchronous requests. |
53 void ServeAsynchronousRequests(); | 53 void ServeAsynchronousRequests(); |
54 | 54 |
| 55 // Returns the last request handled by |ServeAsynchronousRequests()|. |
| 56 WebKit::WebURLRequest GetLastHandledAsynchronousRequest(); |
| 57 |
55 // Returns true if |url| was registered for being mocked. | 58 // Returns true if |url| was registered for being mocked. |
56 bool IsMockedURL(const WebKit::WebURL& url); | 59 bool IsMockedURL(const WebKit::WebURL& url); |
57 | 60 |
58 // Called by the loader to load a resource. | 61 // Called by the loader to load a resource. |
59 void LoadSynchronously(const WebKit::WebURLRequest& request, | 62 void LoadSynchronously(const WebKit::WebURLRequest& request, |
60 WebKit::WebURLResponse* response, | 63 WebKit::WebURLResponse* response, |
61 WebKit::WebURLError* error, | 64 WebKit::WebURLError* error, |
62 WebKit::WebData* data); | 65 WebKit::WebData* data); |
63 void LoadAsynchronouly(const WebKit::WebURLRequest& request, | 66 void LoadAsynchronouly(const WebKit::WebURLRequest& request, |
64 WebURLLoaderMock* loader); | 67 WebURLLoaderMock* loader); |
(...skipping 19 matching lines...) Expand all Loading... |
84 static bool ReadFile(const FilePath& file_path, WebKit::WebData* data); | 87 static bool ReadFile(const FilePath& file_path, WebKit::WebData* data); |
85 | 88 |
86 // The loaders that have not being served data yet. | 89 // The loaders that have not being served data yet. |
87 typedef std::map<WebURLLoaderMock*, WebKit::WebURLRequest> LoaderToRequestMap; | 90 typedef std::map<WebURLLoaderMock*, WebKit::WebURLRequest> LoaderToRequestMap; |
88 LoaderToRequestMap pending_loaders_; | 91 LoaderToRequestMap pending_loaders_; |
89 | 92 |
90 // Table of the registered URLs and the responses that they should receive. | 93 // Table of the registered URLs and the responses that they should receive. |
91 typedef std::map<WebKit::WebURL, ResponseInfo> URLToResponseMap; | 94 typedef std::map<WebKit::WebURL, ResponseInfo> URLToResponseMap; |
92 URLToResponseMap url_to_reponse_info_; | 95 URLToResponseMap url_to_reponse_info_; |
93 | 96 |
| 97 WebKit::WebURLRequest last_handled_asynchronous_request_; |
| 98 |
94 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderMockFactory); | 99 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderMockFactory); |
95 }; | 100 }; |
96 | 101 |
97 #endif // WEBKIT_SUPPORT_WEBURL_LOADER_MOCK_FACTORY_H_ | 102 #endif // WEBKIT_SUPPORT_WEBURL_LOADER_MOCK_FACTORY_H_ |
98 | 103 |
OLD | NEW |