OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 class WebFrame; | 52 class WebFrame; |
53 class WebFrameWidget; | 53 class WebFrameWidget; |
54 class WebLocalFrame; | 54 class WebLocalFrame; |
55 class WebRemoteFrame; | 55 class WebRemoteFrame; |
56 class WebRemoteFrameImpl; | 56 class WebRemoteFrameImpl; |
57 enum class WebCachePolicy; | 57 enum class WebCachePolicy; |
58 | 58 |
59 namespace FrameTestHelpers { | 59 namespace FrameTestHelpers { |
60 | 60 |
61 class TestWebFrameClient; | 61 class TestWebFrameClient; |
| 62 using TestWebWidgetClient = WebWidgetClient; |
62 | 63 |
63 // Loads a url into the specified WebFrame for testing purposes. Pumps any | 64 // Loads a url into the specified WebFrame for testing purposes. Pumps any |
64 // pending resource requests, as well as waiting for the threaded parser to | 65 // pending resource requests, as well as waiting for the threaded parser to |
65 // finish, before returning. | 66 // finish, before returning. |
66 void loadFrame(WebFrame*, const std::string& url); | 67 void loadFrame(WebFrame*, const std::string& url); |
67 // Same as above, but for WebFrame::loadHTMLString(). | 68 // Same as above, but for WebFrame::loadHTMLString(). |
68 void loadHTMLString(WebFrame*, const std::string& html, const WebURL& baseURL); | 69 void loadHTMLString(WebFrame*, const std::string& html, const WebURL& baseURL); |
69 // Same as above, but for WebFrame::loadHistoryItem(). | 70 // Same as above, but for WebFrame::loadHistoryItem(). |
70 void loadHistoryItem(WebFrame*, const WebHistoryItem&, WebHistoryLoadType, WebCa
chePolicy); | 71 void loadHistoryItem(WebFrame*, const WebHistoryItem&, WebHistoryLoadType, WebCa
chePolicy); |
71 // Same as above, but for WebFrame::reload(). | 72 // Same as above, but for WebFrame::reload(). |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // Convenience class for handling the lifetime of a WebView and its associated m
ainframe in tests. | 136 // Convenience class for handling the lifetime of a WebView and its associated m
ainframe in tests. |
136 class WebViewHelper { | 137 class WebViewHelper { |
137 WTF_MAKE_NONCOPYABLE(WebViewHelper); | 138 WTF_MAKE_NONCOPYABLE(WebViewHelper); |
138 public: | 139 public: |
139 WebViewHelper(SettingOverrider* = 0); | 140 WebViewHelper(SettingOverrider* = 0); |
140 ~WebViewHelper(); | 141 ~WebViewHelper(); |
141 | 142 |
142 // Creates and initializes the WebView. Implicitly calls reset() first. If | 143 // Creates and initializes the WebView. Implicitly calls reset() first. If |
143 // a WebFrameClient or a WebViewClient are passed in, they must outlive the | 144 // a WebFrameClient or a WebViewClient are passed in, they must outlive the |
144 // WebViewHelper. | 145 // WebViewHelper. |
145 WebViewImpl* initializeWithOpener(WebFrame* opener, bool enableJavascript =
false, TestWebFrameClient* = nullptr, TestWebViewClient* = nullptr, void (*updat
eSettingsFunc)(WebSettings*) = nullptr); | 146 WebViewImpl* initializeWithOpener(WebFrame* opener, bool enableJavascript =
false, TestWebFrameClient* = nullptr, TestWebViewClient* = nullptr, TestWebWidge
tClient* = nullptr, void (*updateSettingsFunc)(WebSettings*) = nullptr); |
146 | 147 |
147 // Same as initializeWithOpener(), but always sets the opener to null. | 148 // Same as initializeWithOpener(), but always sets the opener to null. |
148 WebViewImpl* initialize(bool enableJavascript = false, TestWebFrameClient* =
0, TestWebViewClient* = 0, void (*updateSettingsFunc)(WebSettings*) = 0); | 149 WebViewImpl* initialize(bool enableJavascript = false, TestWebFrameClient* =
nullptr, TestWebViewClient* = nullptr, TestWebWidgetClient* = nullptr, void (*u
pdateSettingsFunc)(WebSettings*) = 0); |
149 | 150 |
150 // Same as initialize() but also performs the initial load of the url. Only | 151 // Same as initialize() but also performs the initial load of the url. Only |
151 // returns once the load is complete. | 152 // returns once the load is complete. |
152 WebViewImpl* initializeAndLoad(const std::string& url, bool enableJavascript
= false, TestWebFrameClient* = 0, TestWebViewClient* = 0, void (*updateSettings
Func)(WebSettings*) = 0); | 153 WebViewImpl* initializeAndLoad(const std::string& url, bool enableJavascript
= false, TestWebFrameClient* = nullptr, TestWebViewClient* = nullptr, TestWebWi
dgetClient* = nullptr, void (*updateSettingsFunc)(WebSettings*) = 0); |
153 | 154 |
154 void resize(WebSize); | 155 void resize(WebSize); |
155 | 156 |
156 void reset(); | 157 void reset(); |
157 | 158 |
158 WebView* webView() const { return m_webView; } | 159 WebView* webView() const { return m_webView; } |
159 WebViewImpl* webViewImpl() const { return m_webView; } | 160 WebViewImpl* webViewImpl() const { return m_webView; } |
160 | 161 |
161 private: | 162 private: |
162 WebViewImpl* m_webView; | 163 WebViewImpl* m_webView; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 WebDOMMessageEvent) override { } | 201 WebDOMMessageEvent) override { } |
201 | 202 |
202 private: | 203 private: |
203 Persistent<WebRemoteFrameImpl> const m_frame; | 204 Persistent<WebRemoteFrameImpl> const m_frame; |
204 }; | 205 }; |
205 | 206 |
206 } // namespace FrameTestHelpers | 207 } // namespace FrameTestHelpers |
207 } // namespace blink | 208 } // namespace blink |
208 | 209 |
209 #endif // FrameTestHelpers_h | 210 #endif // FrameTestHelpers_h |
OLD | NEW |