| 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> |
| 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" |
| 17 #include "third_party/WebKit/public/platform/WebRect.h" | 17 #include "third_party/WebKit/public/platform/WebRect.h" |
| 18 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| 18 #include "third_party/WebKit/public/platform/WebURLError.h" | 19 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 19 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 20 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 20 #include "third_party/WebKit/public/web/WebAXEnums.h" | 21 #include "third_party/WebKit/public/web/WebAXEnums.h" |
| 21 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" | 22 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" |
| 22 #include "third_party/WebKit/public/web/WebDataSource.h" | 23 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 23 #include "third_party/WebKit/public/web/WebDragOperation.h" | 24 #include "third_party/WebKit/public/web/WebDragOperation.h" |
| 24 #include "third_party/WebKit/public/web/WebFrame.h" | 25 #include "third_party/WebKit/public/web/WebFrame.h" |
| 25 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" | 26 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
| 26 #include "third_party/WebKit/public/web/WebIconURL.h" | 27 #include "third_party/WebKit/public/web/WebIconURL.h" |
| 27 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 28 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 struct WebFileChooserParams; | 69 struct WebFileChooserParams; |
| 69 struct WebPluginParams; | 70 struct WebPluginParams; |
| 70 struct WebPoint; | 71 struct WebPoint; |
| 71 struct WebSize; | 72 struct WebSize; |
| 72 struct WebWindowFeatures; | 73 struct WebWindowFeatures; |
| 73 typedef unsigned WebColor; | 74 typedef unsigned WebColor; |
| 74 } | 75 } |
| 75 | 76 |
| 76 namespace content { | 77 namespace content { |
| 77 | 78 |
| 79 class MockScreenOrientationClient; |
| 78 class MockWebPushClient; | 80 class MockWebPushClient; |
| 79 class MockWebSpeechRecognizer; | 81 class MockWebSpeechRecognizer; |
| 80 class MockWebUserMediaClient; | 82 class MockWebUserMediaClient; |
| 81 class RenderFrame; | 83 class RenderFrame; |
| 82 class SpellCheckClient; | 84 class SpellCheckClient; |
| 83 class TestInterfaces; | 85 class TestInterfaces; |
| 84 class WebTestDelegate; | 86 class WebTestDelegate; |
| 85 class WebTestInterfaces; | 87 class WebTestInterfaces; |
| 86 | 88 |
| 87 // WebTestProxyBase is the "brain" of WebTestProxy in the sense that | 89 // WebTestProxyBase is the "brain" of WebTestProxy in the sense that |
| (...skipping 30 matching lines...) Expand all Loading... |
| 118 const base::Callback<void(const SkBitmap&)>& callback); | 120 const base::Callback<void(const SkBitmap&)>& callback); |
| 119 | 121 |
| 120 void SetLogConsoleOutput(bool enabled); | 122 void SetLogConsoleOutput(bool enabled); |
| 121 | 123 |
| 122 void DidOpenChooser(); | 124 void DidOpenChooser(); |
| 123 void DidCloseChooser(); | 125 void DidCloseChooser(); |
| 124 bool IsChooserShown(); | 126 bool IsChooserShown(); |
| 125 | 127 |
| 126 void DisplayAsyncThen(const base::Closure& callback); | 128 void DisplayAsyncThen(const base::Closure& callback); |
| 127 | 129 |
| 130 void GetScreenOrientationForTesting(blink::WebScreenInfo&); |
| 131 MockScreenOrientationClient* GetScreenOrientationClientMock(); |
| 128 blink::WebMIDIClientMock* GetMIDIClientMock(); | 132 blink::WebMIDIClientMock* GetMIDIClientMock(); |
| 129 MockWebSpeechRecognizer* GetSpeechRecognizerMock(); | 133 MockWebSpeechRecognizer* GetSpeechRecognizerMock(); |
| 130 | 134 |
| 131 WebTaskList* mutable_task_list() { return &task_list_; } | 135 WebTaskList* mutable_task_list() { return &task_list_; } |
| 132 | 136 |
| 133 blink::WebView* GetWebView() const; | 137 blink::WebView* GetWebView() const; |
| 134 | 138 |
| 135 void PostSpellCheckEvent(const blink::WebString& event_name); | 139 void PostSpellCheckEvent(const blink::WebString& event_name); |
| 136 | 140 |
| 137 // WebCompositeAndReadbackAsyncCallback implementation. | 141 // WebCompositeAndReadbackAsyncCallback implementation. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 std::map<unsigned, std::string> resource_identifier_map_; | 266 std::map<unsigned, std::string> resource_identifier_map_; |
| 263 std::deque<base::Callback<void(const SkBitmap&)> > | 267 std::deque<base::Callback<void(const SkBitmap&)> > |
| 264 composite_and_readback_callbacks_; | 268 composite_and_readback_callbacks_; |
| 265 | 269 |
| 266 bool log_console_output_; | 270 bool log_console_output_; |
| 267 int chooser_count_; | 271 int chooser_count_; |
| 268 | 272 |
| 269 scoped_ptr<blink::WebMIDIClientMock> midi_client_; | 273 scoped_ptr<blink::WebMIDIClientMock> midi_client_; |
| 270 scoped_ptr<MockWebSpeechRecognizer> speech_recognizer_; | 274 scoped_ptr<MockWebSpeechRecognizer> speech_recognizer_; |
| 271 scoped_ptr<MockWebPushClient> push_client_; | 275 scoped_ptr<MockWebPushClient> push_client_; |
| 276 scoped_ptr<MockScreenOrientationClient> screen_orientation_client_; |
| 272 | 277 |
| 273 std::string accept_languages_; | 278 std::string accept_languages_; |
| 274 | 279 |
| 275 private: | 280 private: |
| 276 DISALLOW_COPY_AND_ASSIGN(WebTestProxyBase); | 281 DISALLOW_COPY_AND_ASSIGN(WebTestProxyBase); |
| 277 }; | 282 }; |
| 278 | 283 |
| 279 // WebTestProxy is used during LayoutTests and always instantiated, at time of | 284 // WebTestProxy is used during LayoutTests and always instantiated, at time of |
| 280 // writing with Base=RenderViewImpl. It does not directly inherit from it for | 285 // writing with Base=RenderViewImpl. It does not directly inherit from it for |
| 281 // layering purposes. | 286 // layering purposes. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 292 // override RenderViewImpl's getter and call a getter from WebTestProxyBase | 297 // override RenderViewImpl's getter and call a getter from WebTestProxyBase |
| 293 // instead. In addition, WebTestProxyBase will have a public setter that | 298 // instead. In addition, WebTestProxyBase will have a public setter that |
| 294 // could be called from the TestRunner. | 299 // could be called from the TestRunner. |
| 295 template <class Base, typename T> | 300 template <class Base, typename T> |
| 296 class WebTestProxy : public Base, public WebTestProxyBase { | 301 class WebTestProxy : public Base, public WebTestProxyBase { |
| 297 public: | 302 public: |
| 298 explicit WebTestProxy(T t) : Base(t) {} | 303 explicit WebTestProxy(T t) : Base(t) {} |
| 299 | 304 |
| 300 virtual ~WebTestProxy() {} | 305 virtual ~WebTestProxy() {} |
| 301 | 306 |
| 307 // WebWidgetClient implementation. |
| 308 virtual blink::WebScreenInfo screenInfo() { |
| 309 blink::WebScreenInfo info = Base::screenInfo(); |
| 310 WebTestProxyBase::GetScreenOrientationForTesting(info); |
| 311 return info; |
| 312 } |
| 313 |
| 302 // WebViewClient implementation. | 314 // WebViewClient implementation. |
| 303 virtual void scheduleAnimation() { WebTestProxyBase::ScheduleAnimation(); } | 315 virtual void scheduleAnimation() { WebTestProxyBase::ScheduleAnimation(); } |
| 304 virtual void postAccessibilityEvent(const blink::WebAXObject& object, | 316 virtual void postAccessibilityEvent(const blink::WebAXObject& object, |
| 305 blink::WebAXEvent event) { | 317 blink::WebAXEvent event) { |
| 306 WebTestProxyBase::PostAccessibilityEvent(object, event); | 318 WebTestProxyBase::PostAccessibilityEvent(object, event); |
| 307 Base::postAccessibilityEvent(object, event); | 319 Base::postAccessibilityEvent(object, event); |
| 308 } | 320 } |
| 309 virtual void startDragging(blink::WebLocalFrame* frame, | 321 virtual void startDragging(blink::WebLocalFrame* frame, |
| 310 const blink::WebDragData& data, | 322 const blink::WebDragData& data, |
| 311 blink::WebDragOperationsMask mask, | 323 blink::WebDragOperationsMask mask, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 return WebTestProxyBase::GetWebPushClient(); | 398 return WebTestProxyBase::GetWebPushClient(); |
| 387 } | 399 } |
| 388 | 400 |
| 389 private: | 401 private: |
| 390 DISALLOW_COPY_AND_ASSIGN(WebTestProxy); | 402 DISALLOW_COPY_AND_ASSIGN(WebTestProxy); |
| 391 }; | 403 }; |
| 392 | 404 |
| 393 } // namespace content | 405 } // namespace content |
| 394 | 406 |
| 395 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ | 407 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ |
| OLD | NEW |