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_SHELL_RENDERER_TEST_RUNNER_WEBTESTPROXY_H_ | 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ |
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBTESTPROXY_H_ | 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "content/shell/renderer/test_runner/WebTask.h" | 15 #include "content/shell/renderer/test_runner/WebTask.h" |
16 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" | 16 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 class MockWebSpeechRecognizer; | 77 class MockWebSpeechRecognizer; |
78 class RenderFrame; | 78 class RenderFrame; |
79 class SpellCheckClient; | 79 class SpellCheckClient; |
80 class TestInterfaces; | 80 class TestInterfaces; |
81 class WebTestDelegate; | 81 class WebTestDelegate; |
82 class WebTestInterfaces; | 82 class WebTestInterfaces; |
83 class WebUserMediaClientMock; | 83 class WebUserMediaClientMock; |
84 | 84 |
85 class WebTestProxyBase : public blink::WebCompositeAndReadbackAsyncCallback { | 85 class WebTestProxyBase : public blink::WebCompositeAndReadbackAsyncCallback { |
86 public: | 86 public: |
87 void setInterfaces(WebTestInterfaces*); | 87 void SetInterfaces(WebTestInterfaces* interfaces); |
88 void setDelegate(WebTestDelegate*); | 88 void SetDelegate(WebTestDelegate* delegate); |
89 void setWidget(blink::WebWidget*); | 89 void set_widget(blink::WebWidget* widget) { web_widget_ = widget; } |
90 | 90 |
91 void reset(); | 91 void Reset(); |
92 | 92 |
93 blink::WebSpellCheckClient *spellCheckClient() const; | 93 blink::WebSpellCheckClient* GetSpellCheckClient() const; |
94 blink::WebColorChooser* createColorChooser(blink::WebColorChooserClient*, co
nst blink::WebColor&, const blink::WebVector<blink::WebColorSuggestion>& suggest
ions); | 94 blink::WebColorChooser* CreateColorChooser( |
95 bool runFileChooser(const blink::WebFileChooserParams&, blink::WebFileChoose
rCompletion*); | 95 blink::WebColorChooserClient*, const blink::WebColor&, |
96 void showValidationMessage(const blink::WebRect& anchorInRootView, const bli
nk::WebString& mainText, const blink::WebString& supplementalText, blink::WebTex
tDirection); | 96 const blink::WebVector<blink::WebColorSuggestion>& suggestions); |
97 void hideValidationMessage(); | 97 bool RunFileChooser(const blink::WebFileChooserParams&, |
98 void moveValidationMessage(const blink::WebRect& anchorInRootView); | 98 blink::WebFileChooserCompletion*); |
99 | 99 void ShowValidationMessage(const blink::WebRect& anchorInRootView, |
100 std::string captureTree(bool debugRenderTree); | 100 const blink::WebString& mainText, |
101 SkCanvas* capturePixels(); | 101 const blink::WebString& supplementalText, |
102 void CapturePixelsForPrinting( | 102 blink::WebTextDirection); |
103 base::Callback<void(const SkBitmap&)> callback); | 103 void HideValidationMessage(); |
104 void CapturePixelsAsync(base::Callback<void(const SkBitmap&)> callback); | 104 void MoveValidationMessage(const blink::WebRect& anchorInRootView); |
105 | 105 |
106 void setLogConsoleOutput(bool enabled); | 106 std::string CaptureTree(bool debugRenderTree); |
107 | 107 SkCanvas* CapturePixels(); |
108 // FIXME: Make this private again. | 108 void CapturePixelsForPrinting( |
109 void scheduleComposite(); | 109 const base::Callback<void(const SkBitmap&)>& callback); |
110 | 110 void CapturePixelsAsync( |
111 void didOpenChooser(); | 111 const base::Callback<void(const SkBitmap&)>& callback); |
112 void didCloseChooser(); | 112 |
113 bool isChooserShown(); | 113 void SetLogConsoleOutput(bool enabled); |
114 | 114 |
115 void displayAsyncThen(base::Closure callback); | 115 // FIXME: Make this private again. |
116 | 116 void ScheduleComposite(); |
117 void discardBackingStore(); | 117 |
118 | 118 void DidOpenChooser(); |
119 blink::WebMIDIClientMock* midiClientMock(); | 119 void DidCloseChooser(); |
120 MockWebSpeechRecognizer* speechRecognizerMock(); | 120 bool IsChooserShown(); |
121 | 121 |
122 WebTaskList* taskList() { return &m_taskList; } | 122 void DisplayAsyncThen(const base::Closure& callback); |
123 | 123 |
124 blink::WebView* webView(); | 124 void DiscardBackingStore(); |
125 | 125 |
126 void didForceResize(); | 126 blink::WebMIDIClientMock* GetMIDIClientMock(); |
127 | 127 MockWebSpeechRecognizer* GetSpeechRecognizerMock(); |
128 void postSpellCheckEvent(const blink::WebString& eventName); | 128 |
129 | 129 WebTaskList* mutable_task_list() { return &task_list_; } |
130 // WebCompositeAndReadbackAsyncCallback implementation. | 130 |
131 virtual void didCompositeAndReadback(const SkBitmap& bitmap); | 131 blink::WebView* GetWebView() const; |
132 | 132 |
133 protected: | 133 void DidForceResize(); |
134 WebTestProxyBase(); | 134 |
135 ~WebTestProxyBase(); | 135 void PostSpellCheckEvent(const blink::WebString& eventName); |
136 | 136 |
137 void didInvalidateRect(const blink::WebRect&); | 137 // WebCompositeAndReadbackAsyncCallback implementation. |
138 void didScrollRect(int, int, const blink::WebRect&); | 138 virtual void didCompositeAndReadback(const SkBitmap& bitmap); |
139 void scheduleAnimation(); | 139 |
140 bool isCompositorFramePending() const; | 140 protected: |
141 // FIXME: Remove once we switch to use didForceResize. | 141 WebTestProxyBase(); |
142 void setWindowRect(const blink::WebRect&); | 142 ~WebTestProxyBase(); |
143 void show(blink::WebNavigationPolicy); | 143 |
144 void didAutoResize(const blink::WebSize&); | 144 void DidInvalidateRect(const blink::WebRect&); |
145 void postAccessibilityEvent(const blink::WebAXObject&, blink::WebAXEvent); | 145 void DidScrollRect(int, int, const blink::WebRect&); |
146 void startDragging(blink::WebLocalFrame*, const blink::WebDragData&, blink::
WebDragOperationsMask, const blink::WebImage&, const blink::WebPoint&); | 146 void ScheduleAnimation(); |
147 void didChangeSelection(bool isEmptySelection); | 147 bool IsCompositorFramePending() const; |
148 void didChangeContents(); | 148 // FIXME: Remove once we switch to use didForceResize. |
149 void didEndEditing(); | 149 void SetWindowRect(const blink::WebRect&); |
150 bool createView(blink::WebLocalFrame* creator, const blink::WebURLRequest&,
const blink::WebWindowFeatures&, const blink::WebString& frameName, blink::WebNa
vigationPolicy, bool suppressOpener); | 150 void Show(blink::WebNavigationPolicy); |
151 blink::WebPlugin* createPlugin(blink::WebLocalFrame*, const blink::WebPlugin
Params&); | 151 void DidAutoResize(const blink::WebSize&); |
152 void setStatusText(const blink::WebString&); | 152 void PostAccessibilityEvent(const blink::WebAXObject&, blink::WebAXEvent); |
153 void didStopLoading(); | 153 void StartDragging(blink::WebLocalFrame*, const blink::WebDragData&, |
154 void showContextMenu(blink::WebLocalFrame*, const blink::WebContextMenuData&
); | 154 blink::WebDragOperationsMask, const blink::WebImage&, |
155 blink::WebUserMediaClient* userMediaClient(); | 155 const blink::WebPoint&); |
156 void printPage(blink::WebLocalFrame*); | 156 void DidChangeSelection(bool isEmptySelection); |
157 blink::WebNotificationPresenter* notificationPresenter(); | 157 void DidChangeContents(); |
158 blink::WebMIDIClient* webMIDIClient(); | 158 void DidEndEditing(); |
159 blink::WebSpeechRecognizer* speechRecognizer(); | 159 bool CreateView(blink::WebLocalFrame* creator, const blink::WebURLRequest&, |
160 bool requestPointerLock(); | 160 const blink::WebWindowFeatures&, |
161 void requestPointerUnlock(); | 161 const blink::WebString& frameName, blink::WebNavigationPolicy, |
162 bool isPointerLocked(); | 162 bool suppressOpener); |
163 void didFocus(); | 163 blink::WebPlugin* CreatePlugin(blink::WebLocalFrame*, |
164 void didBlur(); | 164 const blink::WebPluginParams&); |
165 void setToolTipText(const blink::WebString&, blink::WebTextDirection); | 165 void SetStatusText(const blink::WebString&); |
166 void didAddMessageToConsole(const blink::WebConsoleMessage&, const blink::We
bString& sourceName, unsigned sourceLine); | 166 void DidStopLoading(); |
167 void loadURLExternally(blink::WebLocalFrame* frame, const blink::WebURLReque
st& request, blink::WebNavigationPolicy policy, const blink::WebString& suggeste
d_name); | 167 void ShowContextMenu(blink::WebLocalFrame*, const blink::WebContextMenuData&); |
168 void didStartProvisionalLoad(blink::WebLocalFrame*); | 168 blink::WebUserMediaClient* GetUserMediaClient(); |
169 void didReceiveServerRedirectForProvisionalLoad(blink::WebLocalFrame*); | 169 void PrintPage(blink::WebLocalFrame*); |
170 bool didFailProvisionalLoad(blink::WebLocalFrame*, const blink::WebURLError&
); | 170 blink::WebNotificationPresenter* GetNotificationPresenter(); |
171 void didCommitProvisionalLoad(blink::WebLocalFrame*, const blink::WebHistory
Item&, blink::WebHistoryCommitType); | 171 blink::WebMIDIClient* GetWebMIDIClient(); |
172 void didReceiveTitle(blink::WebLocalFrame*, const blink::WebString& title, b
link::WebTextDirection); | 172 blink::WebSpeechRecognizer* GetSpeechRecognizer(); |
173 void didChangeIcon(blink::WebLocalFrame*, blink::WebIconURL::Type); | 173 bool RequestPointerLock(); |
174 void didFinishDocumentLoad(blink::WebLocalFrame*); | 174 void RequestPointerUnlock(); |
175 void didHandleOnloadEvents(blink::WebLocalFrame*); | 175 bool IsPointerLocked(); |
176 void didFailLoad(blink::WebLocalFrame*, const blink::WebURLError&); | 176 void DidFocus(); |
177 void didFinishLoad(blink::WebLocalFrame*); | 177 void DidBlur(); |
178 void didChangeLocationWithinPage(blink::WebLocalFrame*); | 178 void SetToolTipText(const blink::WebString&, blink::WebTextDirection); |
179 void didDetectXSS(blink::WebLocalFrame*, const blink::WebURL& insecureURL, b
ool didBlockEntirePage); | 179 void DidAddMessageToConsole(const blink::WebConsoleMessage&, |
180 void didDispatchPingLoader(blink::WebLocalFrame*, const blink::WebURL&); | 180 const blink::WebString& sourceName, |
181 void willRequestResource(blink::WebLocalFrame*, const blink::WebCachedURLReq
uest&); | 181 unsigned sourceLine); |
182 void willSendRequest(blink::WebLocalFrame*, unsigned identifier, blink::WebU
RLRequest&, const blink::WebURLResponse& redirectResponse); | 182 void LoadURLExternally(blink::WebLocalFrame* frame, |
183 void didReceiveResponse(blink::WebLocalFrame*, unsigned identifier, const bl
ink::WebURLResponse&); | 183 const blink::WebURLRequest& request, |
184 void didChangeResourcePriority(blink::WebLocalFrame*, unsigned identifier, c
onst blink::WebURLRequest::Priority&, int intra_priority_value); | 184 blink::WebNavigationPolicy policy, |
185 void didFinishResourceLoad(blink::WebLocalFrame*, unsigned identifier); | 185 const blink::WebString& suggested_name); |
186 blink::WebNavigationPolicy decidePolicyForNavigation(blink::WebLocalFrame*,
blink::WebDataSource::ExtraData*, const blink::WebURLRequest&, blink::WebNavigat
ionType, blink::WebNavigationPolicy defaultPolicy, bool isRedirect); | 186 void DidStartProvisionalLoad(blink::WebLocalFrame*); |
187 bool willCheckAndDispatchMessageEvent(blink::WebLocalFrame* sourceFrame, bli
nk::WebFrame* targetFrame, blink::WebSecurityOrigin target, blink::WebDOMMessage
Event); | 187 void DidReceiveServerRedirectForProvisionalLoad(blink::WebLocalFrame*); |
188 void resetInputMethod(); | 188 bool DidFailProvisionalLoad(blink::WebLocalFrame*, const blink::WebURLError&); |
189 | 189 void DidCommitProvisionalLoad(blink::WebLocalFrame*, |
190 private: | 190 const blink::WebHistoryItem&, |
191 template<class, typename, typename> friend class WebFrameTestProxy; | 191 blink::WebHistoryCommitType); |
192 void locationChangeDone(blink::WebFrame*); | 192 void DidReceiveTitle(blink::WebLocalFrame*, const blink::WebString& title, |
193 void paintRect(const blink::WebRect&); | 193 blink::WebTextDirection); |
194 void paintInvalidatedRegion(); | 194 void DidChangeIcon(blink::WebLocalFrame*, blink::WebIconURL::Type); |
195 void paintPagesWithBoundaries(); | 195 void DidFinishDocumentLoad(blink::WebLocalFrame*); |
196 SkCanvas* canvas(); | 196 void DidHandleOnloadEvents(blink::WebLocalFrame*); |
197 void invalidateAll(); | 197 void DidFailLoad(blink::WebLocalFrame*, const blink::WebURLError&); |
198 void animateNow(); | 198 void DidFinishLoad(blink::WebLocalFrame*); |
199 void DrawSelectionRect(SkCanvas* canvas); | 199 void DidChangeLocationWithinPage(blink::WebLocalFrame*); |
200 void DisplayForSoftwareMode(const base::Closure& callback); | 200 void DidDetectXSS(blink::WebLocalFrame*, const blink::WebURL& insecureURL, |
201 void DidDisplayAsync(const base::Closure& callback, const SkBitmap& bitmap); | 201 bool didBlockEntirePage); |
202 | 202 void DidDispatchPingLoader(blink::WebLocalFrame*, const blink::WebURL&); |
203 blink::WebWidget* webWidget(); | 203 void WillRequestResource(blink::WebLocalFrame*, |
204 | 204 const blink::WebCachedURLRequest&); |
205 TestInterfaces* m_testInterfaces; | 205 void WillSendRequest(blink::WebLocalFrame*, unsigned identifier, |
206 WebTestDelegate* m_delegate; | 206 blink::WebURLRequest&, |
207 blink::WebWidget* m_webWidget; | 207 const blink::WebURLResponse& redirectResponse); |
208 | 208 void DidReceiveResponse(blink::WebLocalFrame*, unsigned identifier, |
209 WebTaskList m_taskList; | 209 const blink::WebURLResponse&); |
210 | 210 void DidChangeResourcePriority(blink::WebLocalFrame*, unsigned identifier, |
211 scoped_ptr<SpellCheckClient> m_spellcheck; | 211 const blink::WebURLRequest::Priority&, |
212 scoped_ptr<WebUserMediaClientMock> m_userMediaClient; | 212 int intra_priority_value); |
213 | 213 void DidFinishResourceLoad(blink::WebLocalFrame*, unsigned identifier); |
214 // Painting. | 214 blink::WebNavigationPolicy DecidePolicyForNavigation( |
215 scoped_ptr<SkCanvas> m_canvas; | 215 blink::WebLocalFrame*, blink::WebDataSource::ExtraData*, |
216 blink::WebRect m_paintRect; | 216 const blink::WebURLRequest&, blink::WebNavigationType, |
217 bool m_isPainting; | 217 blink::WebNavigationPolicy defaultPolicy, bool isRedirect); |
218 bool m_animateScheduled; | 218 bool WillCheckAndDispatchMessageEvent(blink::WebLocalFrame* sourceFrame, |
219 std::map<unsigned, std::string> m_resourceIdentifierMap; | 219 blink::WebFrame* targetFrame, |
220 std::map<unsigned, blink::WebURLRequest> m_requestMap; | 220 blink::WebSecurityOrigin target, |
221 std::deque<base::Callback<void(const SkBitmap&)> > | 221 blink::WebDOMMessageEvent); |
222 m_compositeAndReadbackCallbacks; | 222 void ResetInputMethod(); |
223 | 223 |
224 bool m_logConsoleOutput; | 224 private: |
225 int m_chooserCount; | 225 template <class, typename, typename> |
226 | 226 friend class WebFrameTestProxy; |
227 scoped_ptr<blink::WebMIDIClientMock> m_midiClient; | 227 void LocationChangeDone(blink::WebFrame*); |
228 scoped_ptr<MockWebSpeechRecognizer> m_speechRecognizer; | 228 void PaintRect(const blink::WebRect&); |
229 | 229 void PaintInvalidatedRegion(); |
230 private: | 230 void PaintPagesWithBoundaries(); |
231 DISALLOW_COPY_AND_ASSIGN(WebTestProxyBase); | 231 SkCanvas* GetCanvas(); |
| 232 void InvalidateAll(); |
| 233 void AnimateNow(); |
| 234 void DrawSelectionRect(SkCanvas* canvas); |
| 235 void DisplayForSoftwareMode(const base::Closure& callback); |
| 236 void DidDisplayAsync(const base::Closure& callback, const SkBitmap& bitmap); |
| 237 |
| 238 blink::WebWidget* web_widget() const { return web_widget_; } |
| 239 |
| 240 TestInterfaces* test_interfaces_; |
| 241 WebTestDelegate* delegate_; |
| 242 blink::WebWidget* web_widget_; |
| 243 |
| 244 WebTaskList task_list_; |
| 245 |
| 246 scoped_ptr<SpellCheckClient> spellcheck_; |
| 247 scoped_ptr<WebUserMediaClientMock> user_media_client_; |
| 248 |
| 249 // Painting. |
| 250 scoped_ptr<SkCanvas> canvas_; |
| 251 blink::WebRect paint_rect_; |
| 252 bool is_painting_; |
| 253 bool animate_scheduled_; |
| 254 std::map<unsigned, std::string> resource_identifier_map_; |
| 255 std::deque<base::Callback<void(const SkBitmap&)> > |
| 256 composite_and_readback_callbacks_; |
| 257 |
| 258 bool log_console_output_; |
| 259 int chooser_count_; |
| 260 |
| 261 scoped_ptr<blink::WebMIDIClientMock> m_midiClient; |
| 262 scoped_ptr<MockWebSpeechRecognizer> m_speechRecognizer; |
| 263 |
| 264 private: |
| 265 DISALLOW_COPY_AND_ASSIGN(WebTestProxyBase); |
232 }; | 266 }; |
233 | 267 |
234 // Use this template to inject methods into your WebViewClient/WebFrameClient | 268 // Use this template to inject methods into your WebViewClient/WebFrameClient |
235 // implementation required for the running layout tests. | 269 // implementation required for the running layout tests. |
236 template<class Base, typename T> | 270 template <class Base, typename T> |
237 class WebTestProxy : public Base, public WebTestProxyBase { | 271 class WebTestProxy : public Base, public WebTestProxyBase { |
238 public: | 272 public: |
239 explicit WebTestProxy(T t) | 273 explicit WebTestProxy(T t) : Base(t) {} |
240 : Base(t) | 274 |
241 { | 275 virtual ~WebTestProxy() {} |
242 } | 276 |
243 | 277 // WebViewClient implementation. |
244 virtual ~WebTestProxy() { } | 278 virtual void didInvalidateRect(const blink::WebRect& rect) { |
245 | 279 WebTestProxyBase::DidInvalidateRect(rect); |
246 // WebViewClient implementation. | 280 } |
247 virtual void didInvalidateRect(const blink::WebRect& rect) | 281 virtual void didScrollRect(int dx, int dy, const blink::WebRect& clipRect) { |
248 { | 282 WebTestProxyBase::DidScrollRect(dx, dy, clipRect); |
249 WebTestProxyBase::didInvalidateRect(rect); | 283 } |
250 } | 284 virtual void scheduleComposite() { WebTestProxyBase::ScheduleComposite(); } |
251 virtual void didScrollRect(int dx, int dy, const blink::WebRect& clipRect) | 285 virtual void scheduleAnimation() { WebTestProxyBase::ScheduleAnimation(); } |
252 { | 286 virtual bool isCompositorFramePending() const { |
253 WebTestProxyBase::didScrollRect(dx, dy, clipRect); | 287 return WebTestProxyBase::IsCompositorFramePending(); |
254 } | 288 } |
255 virtual void scheduleComposite() | 289 virtual void setWindowRect(const blink::WebRect& rect) { |
256 { | 290 WebTestProxyBase::SetWindowRect(rect); |
257 WebTestProxyBase::scheduleComposite(); | 291 Base::setWindowRect(rect); |
258 } | 292 } |
259 virtual void scheduleAnimation() | 293 virtual void show(blink::WebNavigationPolicy policy) { |
260 { | 294 WebTestProxyBase::Show(policy); |
261 WebTestProxyBase::scheduleAnimation(); | 295 Base::show(policy); |
262 } | 296 } |
263 virtual bool isCompositorFramePending() const | 297 virtual void didAutoResize(const blink::WebSize& newSize) { |
264 { | 298 WebTestProxyBase::DidAutoResize(newSize); |
265 return WebTestProxyBase::isCompositorFramePending(); | 299 Base::didAutoResize(newSize); |
266 } | 300 } |
267 virtual void setWindowRect(const blink::WebRect& rect) | 301 virtual void postAccessibilityEvent(const blink::WebAXObject& object, |
268 { | 302 blink::WebAXEvent event) { |
269 WebTestProxyBase::setWindowRect(rect); | 303 WebTestProxyBase::PostAccessibilityEvent(object, event); |
270 Base::setWindowRect(rect); | 304 Base::postAccessibilityEvent(object, event); |
271 } | 305 } |
272 virtual void show(blink::WebNavigationPolicy policy) | 306 virtual void startDragging(blink::WebLocalFrame* frame, |
273 { | 307 const blink::WebDragData& data, |
274 WebTestProxyBase::show(policy); | 308 blink::WebDragOperationsMask mask, |
275 Base::show(policy); | 309 const blink::WebImage& image, |
276 } | 310 const blink::WebPoint& point) { |
277 virtual void didAutoResize(const blink::WebSize& newSize) | 311 WebTestProxyBase::StartDragging(frame, data, mask, image, point); |
278 { | 312 // Don't forward this call to Base because we don't want to do a real |
279 WebTestProxyBase::didAutoResize(newSize); | 313 // drag-and-drop. |
280 Base::didAutoResize(newSize); | 314 } |
281 } | 315 virtual void didChangeContents() { |
282 virtual void postAccessibilityEvent(const blink::WebAXObject& object, blink:
:WebAXEvent event) | 316 WebTestProxyBase::DidChangeContents(); |
283 { | 317 Base::didChangeContents(); |
284 WebTestProxyBase::postAccessibilityEvent(object, event); | 318 } |
285 Base::postAccessibilityEvent(object, event); | 319 virtual blink::WebView* createView(blink::WebLocalFrame* creator, |
286 } | 320 const blink::WebURLRequest& request, |
287 virtual void startDragging(blink::WebLocalFrame* frame, const blink::WebDrag
Data& data, blink::WebDragOperationsMask mask, const blink::WebImage& image, con
st blink::WebPoint& point) | 321 const blink::WebWindowFeatures& features, |
288 { | 322 const blink::WebString& frameName, |
289 WebTestProxyBase::startDragging(frame, data, mask, image, point); | 323 blink::WebNavigationPolicy policy, |
290 // Don't forward this call to Base because we don't want to do a real dr
ag-and-drop. | 324 bool suppressOpener) { |
291 } | 325 if (!WebTestProxyBase::CreateView(creator, request, features, frameName, |
292 virtual void didChangeContents() | 326 policy, suppressOpener)) |
293 { | 327 return 0; |
294 WebTestProxyBase::didChangeContents(); | 328 return Base::createView(creator, request, features, frameName, policy, |
295 Base::didChangeContents(); | 329 suppressOpener); |
296 } | 330 } |
297 virtual blink::WebView* createView(blink::WebLocalFrame* creator, const blin
k::WebURLRequest& request, const blink::WebWindowFeatures& features, const blink
::WebString& frameName, blink::WebNavigationPolicy policy, bool suppressOpener) | 331 virtual void setStatusText(const blink::WebString& text) { |
298 { | 332 WebTestProxyBase::SetStatusText(text); |
299 if (!WebTestProxyBase::createView(creator, request, features, frameName,
policy, suppressOpener)) | 333 Base::setStatusText(text); |
300 return 0; | 334 } |
301 return Base::createView(creator, request, features, frameName, policy, s
uppressOpener); | 335 virtual blink::WebUserMediaClient* userMediaClient() { |
302 } | 336 return WebTestProxyBase::GetUserMediaClient(); |
303 virtual void setStatusText(const blink::WebString& text) | 337 } |
304 { | 338 virtual void printPage(blink::WebLocalFrame* frame) { |
305 WebTestProxyBase::setStatusText(text); | 339 WebTestProxyBase::PrintPage(frame); |
306 Base::setStatusText(text); | 340 } |
307 } | 341 virtual blink::WebMIDIClient* webMIDIClient() { |
308 virtual blink::WebUserMediaClient* userMediaClient() | 342 return WebTestProxyBase::GetWebMIDIClient(); |
309 { | 343 } |
310 return WebTestProxyBase::userMediaClient(); | 344 virtual blink::WebSpeechRecognizer* speechRecognizer() { |
311 } | 345 return WebTestProxyBase::GetSpeechRecognizer(); |
312 virtual void printPage(blink::WebLocalFrame* frame) | 346 } |
313 { | 347 virtual bool requestPointerLock() { |
314 WebTestProxyBase::printPage(frame); | 348 return WebTestProxyBase::RequestPointerLock(); |
315 } | 349 } |
316 virtual blink::WebMIDIClient* webMIDIClient() | 350 virtual void requestPointerUnlock() { |
317 { | 351 WebTestProxyBase::RequestPointerUnlock(); |
318 return WebTestProxyBase::webMIDIClient(); | 352 } |
319 } | 353 virtual bool isPointerLocked() { return WebTestProxyBase::IsPointerLocked(); } |
320 virtual blink::WebSpeechRecognizer* speechRecognizer() | 354 virtual void didFocus() { |
321 { | 355 WebTestProxyBase::DidFocus(); |
322 return WebTestProxyBase::speechRecognizer(); | 356 Base::didFocus(); |
323 } | 357 } |
324 virtual bool requestPointerLock() | 358 virtual void didBlur() { |
325 { | 359 WebTestProxyBase::DidBlur(); |
326 return WebTestProxyBase::requestPointerLock(); | 360 Base::didBlur(); |
327 } | 361 } |
328 virtual void requestPointerUnlock() | 362 virtual void setToolTipText(const blink::WebString& text, |
329 { | 363 blink::WebTextDirection hint) { |
330 WebTestProxyBase::requestPointerUnlock(); | 364 WebTestProxyBase::SetToolTipText(text, hint); |
331 } | 365 Base::setToolTipText(text, hint); |
332 virtual bool isPointerLocked() | 366 } |
333 { | 367 virtual void resetInputMethod() { WebTestProxyBase::ResetInputMethod(); } |
334 return WebTestProxyBase::isPointerLocked(); | 368 virtual bool runFileChooser(const blink::WebFileChooserParams& params, |
335 } | 369 blink::WebFileChooserCompletion* completion) { |
336 virtual void didFocus() | 370 return WebTestProxyBase::RunFileChooser(params, completion); |
337 { | 371 } |
338 WebTestProxyBase::didFocus(); | 372 virtual void showValidationMessage(const blink::WebRect& anchorInRootView, |
339 Base::didFocus(); | 373 const blink::WebString& mainText, |
340 } | 374 const blink::WebString& supplementalText, |
341 virtual void didBlur() | 375 blink::WebTextDirection hint) { |
342 { | 376 WebTestProxyBase::ShowValidationMessage(anchorInRootView, mainText, |
343 WebTestProxyBase::didBlur(); | 377 supplementalText, hint); |
344 Base::didBlur(); | 378 } |
345 } | 379 virtual void hideValidationMessage() { |
346 virtual void setToolTipText(const blink::WebString& text, blink::WebTextDire
ction hint) | 380 WebTestProxyBase::HideValidationMessage(); |
347 { | 381 } |
348 WebTestProxyBase::setToolTipText(text, hint); | 382 virtual void moveValidationMessage(const blink::WebRect& anchorInRootView) { |
349 Base::setToolTipText(text, hint); | 383 WebTestProxyBase::MoveValidationMessage(anchorInRootView); |
350 } | 384 } |
351 virtual void resetInputMethod() | 385 virtual void postSpellCheckEvent(const blink::WebString& eventName) { |
352 { | 386 WebTestProxyBase::PostSpellCheckEvent(eventName); |
353 WebTestProxyBase::resetInputMethod(); | 387 } |
354 } | 388 |
355 virtual bool runFileChooser(const blink::WebFileChooserParams& params, blink
::WebFileChooserCompletion* completion) | 389 private: |
356 { | 390 DISALLOW_COPY_AND_ASSIGN(WebTestProxy); |
357 return WebTestProxyBase::runFileChooser(params, completion); | |
358 } | |
359 virtual void showValidationMessage(const blink::WebRect& anchorInRootView, c
onst blink::WebString& mainText, const blink::WebString& supplementalText, blink
::WebTextDirection hint) | |
360 { | |
361 WebTestProxyBase::showValidationMessage(anchorInRootView, mainText, supp
lementalText, hint); | |
362 } | |
363 virtual void hideValidationMessage() | |
364 { | |
365 WebTestProxyBase::hideValidationMessage(); | |
366 } | |
367 virtual void moveValidationMessage(const blink::WebRect& anchorInRootView) | |
368 { | |
369 WebTestProxyBase::moveValidationMessage(anchorInRootView); | |
370 } | |
371 virtual void postSpellCheckEvent(const blink::WebString& eventName) | |
372 { | |
373 WebTestProxyBase::postSpellCheckEvent(eventName); | |
374 } | |
375 | |
376 private: | |
377 DISALLOW_COPY_AND_ASSIGN(WebTestProxy); | |
378 }; | 391 }; |
379 | 392 |
380 } // namespace content | 393 } // namespace content |
381 | 394 |
382 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBTESTPROXY_H_ | 395 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ |
OLD | NEW |