| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_WEB_TEST_PROXY_H_ | 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ |
| 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_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> |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 // FIXME: Make this private again. | 114 // FIXME: Make this private again. |
| 115 void ScheduleComposite(); | 115 void ScheduleComposite(); |
| 116 | 116 |
| 117 void DidOpenChooser(); | 117 void DidOpenChooser(); |
| 118 void DidCloseChooser(); | 118 void DidCloseChooser(); |
| 119 bool IsChooserShown(); | 119 bool IsChooserShown(); |
| 120 | 120 |
| 121 void DisplayAsyncThen(const base::Closure& callback); | 121 void DisplayAsyncThen(const base::Closure& callback); |
| 122 | 122 |
| 123 void DiscardBackingStore(); | |
| 124 | |
| 125 blink::WebMIDIClientMock* GetMIDIClientMock(); | 123 blink::WebMIDIClientMock* GetMIDIClientMock(); |
| 126 MockWebSpeechRecognizer* GetSpeechRecognizerMock(); | 124 MockWebSpeechRecognizer* GetSpeechRecognizerMock(); |
| 127 | 125 |
| 128 WebTaskList* mutable_task_list() { return &task_list_; } | 126 WebTaskList* mutable_task_list() { return &task_list_; } |
| 129 | 127 |
| 130 blink::WebView* GetWebView() const; | 128 blink::WebView* GetWebView() const; |
| 131 | 129 |
| 132 void DidForceResize(); | |
| 133 | |
| 134 void PostSpellCheckEvent(const blink::WebString& eventName); | 130 void PostSpellCheckEvent(const blink::WebString& eventName); |
| 135 | 131 |
| 136 // WebCompositeAndReadbackAsyncCallback implementation. | 132 // WebCompositeAndReadbackAsyncCallback implementation. |
| 137 virtual void didCompositeAndReadback(const SkBitmap& bitmap); | 133 virtual void didCompositeAndReadback(const SkBitmap& bitmap); |
| 138 | 134 |
| 139 protected: | 135 protected: |
| 140 WebTestProxyBase(); | 136 WebTestProxyBase(); |
| 141 ~WebTestProxyBase(); | 137 ~WebTestProxyBase(); |
| 142 | 138 |
| 143 void DidInvalidateRect(const blink::WebRect&); | |
| 144 void DidScrollRect(int, int, const blink::WebRect&); | |
| 145 void ScheduleAnimation(); | 139 void ScheduleAnimation(); |
| 146 bool IsCompositorFramePending() const; | |
| 147 // FIXME: Remove once we switch to use didForceResize. | |
| 148 void SetWindowRect(const blink::WebRect&); | |
| 149 void Show(blink::WebNavigationPolicy); | |
| 150 void DidAutoResize(const blink::WebSize&); | |
| 151 void PostAccessibilityEvent(const blink::WebAXObject&, blink::WebAXEvent); | 140 void PostAccessibilityEvent(const blink::WebAXObject&, blink::WebAXEvent); |
| 152 void StartDragging(blink::WebLocalFrame*, const blink::WebDragData&, | 141 void StartDragging(blink::WebLocalFrame*, const blink::WebDragData&, |
| 153 blink::WebDragOperationsMask, const blink::WebImage&, | 142 blink::WebDragOperationsMask, const blink::WebImage&, |
| 154 const blink::WebPoint&); | 143 const blink::WebPoint&); |
| 155 void DidChangeSelection(bool isEmptySelection); | 144 void DidChangeSelection(bool isEmptySelection); |
| 156 void DidChangeContents(); | 145 void DidChangeContents(); |
| 157 void DidEndEditing(); | 146 void DidEndEditing(); |
| 158 bool CreateView(blink::WebLocalFrame* creator, const blink::WebURLRequest&, | 147 bool CreateView(blink::WebLocalFrame* creator, const blink::WebURLRequest&, |
| 159 const blink::WebWindowFeatures&, | 148 const blink::WebWindowFeatures&, |
| 160 const blink::WebString& frameName, blink::WebNavigationPolicy, | 149 const blink::WebString& frameName, blink::WebNavigationPolicy, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 bool WillCheckAndDispatchMessageEvent(blink::WebLocalFrame* sourceFrame, | 206 bool WillCheckAndDispatchMessageEvent(blink::WebLocalFrame* sourceFrame, |
| 218 blink::WebFrame* targetFrame, | 207 blink::WebFrame* targetFrame, |
| 219 blink::WebSecurityOrigin target, | 208 blink::WebSecurityOrigin target, |
| 220 blink::WebDOMMessageEvent); | 209 blink::WebDOMMessageEvent); |
| 221 void ResetInputMethod(); | 210 void ResetInputMethod(); |
| 222 | 211 |
| 223 private: | 212 private: |
| 224 template <class, typename, typename> | 213 template <class, typename, typename> |
| 225 friend class WebFrameTestProxy; | 214 friend class WebFrameTestProxy; |
| 226 void LocationChangeDone(blink::WebFrame*); | 215 void LocationChangeDone(blink::WebFrame*); |
| 227 void PaintPagesWithBoundaries(); | |
| 228 SkCanvas* GetCanvas(); | |
| 229 void InvalidateAll(); | |
| 230 void AnimateNow(); | 216 void AnimateNow(); |
| 231 void DrawSelectionRect(SkCanvas* canvas); | 217 void DrawSelectionRect(SkCanvas* canvas); |
| 232 void DidDisplayAsync(const base::Closure& callback, const SkBitmap& bitmap); | 218 void DidDisplayAsync(const base::Closure& callback, const SkBitmap& bitmap); |
| 233 | 219 |
| 234 blink::WebWidget* web_widget() const { return web_widget_; } | 220 blink::WebWidget* web_widget() const { return web_widget_; } |
| 235 | 221 |
| 236 TestInterfaces* test_interfaces_; | 222 TestInterfaces* test_interfaces_; |
| 237 WebTestDelegate* delegate_; | 223 WebTestDelegate* delegate_; |
| 238 blink::WebWidget* web_widget_; | 224 blink::WebWidget* web_widget_; |
| 239 | 225 |
| 240 WebTaskList task_list_; | 226 WebTaskList task_list_; |
| 241 | 227 |
| 242 scoped_ptr<SpellCheckClient> spellcheck_; | 228 scoped_ptr<SpellCheckClient> spellcheck_; |
| 243 scoped_ptr<WebUserMediaClientMock> user_media_client_; | 229 scoped_ptr<WebUserMediaClientMock> user_media_client_; |
| 244 | 230 |
| 245 // Painting. | 231 // Painting. |
| 246 scoped_ptr<SkCanvas> canvas_; | |
| 247 blink::WebRect paint_rect_; | |
| 248 bool is_painting_; | |
| 249 bool animate_scheduled_; | 232 bool animate_scheduled_; |
| 250 std::map<unsigned, std::string> resource_identifier_map_; | 233 std::map<unsigned, std::string> resource_identifier_map_; |
| 251 std::deque<base::Callback<void(const SkBitmap&)> > | 234 std::deque<base::Callback<void(const SkBitmap&)> > |
| 252 composite_and_readback_callbacks_; | 235 composite_and_readback_callbacks_; |
| 253 | 236 |
| 254 bool log_console_output_; | 237 bool log_console_output_; |
| 255 int chooser_count_; | 238 int chooser_count_; |
| 256 | 239 |
| 257 scoped_ptr<blink::WebMIDIClientMock> m_midiClient; | 240 scoped_ptr<blink::WebMIDIClientMock> m_midiClient; |
| 258 scoped_ptr<MockWebSpeechRecognizer> m_speechRecognizer; | 241 scoped_ptr<MockWebSpeechRecognizer> m_speechRecognizer; |
| 259 | 242 |
| 260 private: | 243 private: |
| 261 DISALLOW_COPY_AND_ASSIGN(WebTestProxyBase); | 244 DISALLOW_COPY_AND_ASSIGN(WebTestProxyBase); |
| 262 }; | 245 }; |
| 263 | 246 |
| 264 // Use this template to inject methods into your WebViewClient/WebFrameClient | 247 // Use this template to inject methods into your WebViewClient/WebFrameClient |
| 265 // implementation required for the running layout tests. | 248 // implementation required for the running layout tests. |
| 266 template <class Base, typename T> | 249 template <class Base, typename T> |
| 267 class WebTestProxy : public Base, public WebTestProxyBase { | 250 class WebTestProxy : public Base, public WebTestProxyBase { |
| 268 public: | 251 public: |
| 269 explicit WebTestProxy(T t) : Base(t) {} | 252 explicit WebTestProxy(T t) : Base(t) {} |
| 270 | 253 |
| 271 virtual ~WebTestProxy() {} | 254 virtual ~WebTestProxy() {} |
| 272 | 255 |
| 273 // WebViewClient implementation. | 256 // WebViewClient implementation. |
| 274 virtual void didInvalidateRect(const blink::WebRect& rect) { | |
| 275 WebTestProxyBase::DidInvalidateRect(rect); | |
| 276 } | |
| 277 virtual void didScrollRect(int dx, int dy, const blink::WebRect& clipRect) { | |
| 278 WebTestProxyBase::DidScrollRect(dx, dy, clipRect); | |
| 279 } | |
| 280 virtual void scheduleComposite() { WebTestProxyBase::ScheduleComposite(); } | 257 virtual void scheduleComposite() { WebTestProxyBase::ScheduleComposite(); } |
| 281 virtual void scheduleAnimation() { WebTestProxyBase::ScheduleAnimation(); } | 258 virtual void scheduleAnimation() { WebTestProxyBase::ScheduleAnimation(); } |
| 282 virtual bool isCompositorFramePending() const { | |
| 283 return WebTestProxyBase::IsCompositorFramePending(); | |
| 284 } | |
| 285 virtual void setWindowRect(const blink::WebRect& rect) { | |
| 286 WebTestProxyBase::SetWindowRect(rect); | |
| 287 Base::setWindowRect(rect); | |
| 288 } | |
| 289 virtual void show(blink::WebNavigationPolicy policy) { | |
| 290 WebTestProxyBase::Show(policy); | |
| 291 Base::show(policy); | |
| 292 } | |
| 293 virtual void didAutoResize(const blink::WebSize& newSize) { | |
| 294 WebTestProxyBase::DidAutoResize(newSize); | |
| 295 Base::didAutoResize(newSize); | |
| 296 } | |
| 297 virtual void postAccessibilityEvent(const blink::WebAXObject& object, | 259 virtual void postAccessibilityEvent(const blink::WebAXObject& object, |
| 298 blink::WebAXEvent event) { | 260 blink::WebAXEvent event) { |
| 299 WebTestProxyBase::PostAccessibilityEvent(object, event); | 261 WebTestProxyBase::PostAccessibilityEvent(object, event); |
| 300 Base::postAccessibilityEvent(object, event); | 262 Base::postAccessibilityEvent(object, event); |
| 301 } | 263 } |
| 302 virtual void startDragging(blink::WebLocalFrame* frame, | 264 virtual void startDragging(blink::WebLocalFrame* frame, |
| 303 const blink::WebDragData& data, | 265 const blink::WebDragData& data, |
| 304 blink::WebDragOperationsMask mask, | 266 blink::WebDragOperationsMask mask, |
| 305 const blink::WebImage& image, | 267 const blink::WebImage& image, |
| 306 const blink::WebPoint& point) { | 268 const blink::WebPoint& point) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 WebTestProxyBase::PostSpellCheckEvent(eventName); | 344 WebTestProxyBase::PostSpellCheckEvent(eventName); |
| 383 } | 345 } |
| 384 | 346 |
| 385 private: | 347 private: |
| 386 DISALLOW_COPY_AND_ASSIGN(WebTestProxy); | 348 DISALLOW_COPY_AND_ASSIGN(WebTestProxy); |
| 387 }; | 349 }; |
| 388 | 350 |
| 389 } // namespace content | 351 } // namespace content |
| 390 | 352 |
| 391 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ | 353 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ |
| OLD | NEW |