| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_CLIENT_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_CLIENT_H_ |
| 6 #define COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_CLIENT_H_ | 6 #define COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "third_party/WebKit/public/web/WebWidgetClient.h" | 10 #include "third_party/WebKit/public/web/WebWidgetClient.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 class WebWidget; | 13 class WebWidget; |
| 14 } // namespace blink | 14 } // namespace blink |
| 15 | 15 |
| 16 namespace test_runner { | 16 namespace test_runner { |
| 17 | 17 |
| 18 class TestRunner; | 18 class TestRunner; |
| 19 class TestRunnerForSpecificView; |
| 19 class WebTestDelegate; | 20 class WebTestDelegate; |
| 20 class WebViewTestProxyBase; | 21 class WebViewTestProxyBase; |
| 21 class WebWidgetTestProxyBase; | 22 class WebWidgetTestProxyBase; |
| 22 | 23 |
| 23 // WebWidgetTestClient implements WebWidgetClient interface, providing behavior | 24 // WebWidgetTestClient implements WebWidgetClient interface, providing behavior |
| 24 // expected by tests. WebWidgetTestClient ends up used by WebViewTestProxy | 25 // expected by tests. WebWidgetTestClient ends up used by WebViewTestProxy |
| 25 // which coordinates forwarding WebWidgetClient calls either to | 26 // which coordinates forwarding WebWidgetClient calls either to |
| 26 // WebWidgetTestClient or to the product code (i.e. currently to | 27 // WebWidgetTestClient or to the product code (i.e. currently to |
| 27 // RenderViewImpl). | 28 // RenderViewImpl). |
| 28 class WebWidgetTestClient : public blink::WebWidgetClient { | 29 class WebWidgetTestClient : public blink::WebWidgetClient { |
| 29 public: | 30 public: |
| 30 // Caller has to ensure that all arguments (i.e. |test_runner| and |delegate|) | 31 // Caller has to ensure that all arguments (i.e. |test_runner| and |delegate|) |
| 31 // live longer than |this|. | 32 // live longer than |this|. |
| 32 WebWidgetTestClient(TestRunner* test_runner, | 33 WebWidgetTestClient(WebWidgetTestProxyBase* web_widget_test_proxy_base); |
| 33 WebWidgetTestProxyBase* web_widget_test_proxy_base); | |
| 34 | 34 |
| 35 virtual ~WebWidgetTestClient(); | 35 virtual ~WebWidgetTestClient(); |
| 36 | 36 |
| 37 void set_web_view_test_proxy_base( | |
| 38 WebViewTestProxyBase* web_view_test_proxy_base) { | |
| 39 web_view_test_proxy_base_ = web_view_test_proxy_base; | |
| 40 } | |
| 41 | |
| 42 // WebWidgetClient overrides needed by WebViewTestProxy. | 37 // WebWidgetClient overrides needed by WebViewTestProxy. |
| 43 blink::WebScreenInfo screenInfo() override; | 38 blink::WebScreenInfo screenInfo() override; |
| 44 void scheduleAnimation() override; | 39 void scheduleAnimation() override; |
| 45 bool requestPointerLock() override; | 40 bool requestPointerLock() override; |
| 46 void requestPointerUnlock() override; | 41 void requestPointerUnlock() override; |
| 47 bool isPointerLocked() override; | 42 bool isPointerLocked() override; |
| 48 void setToolTipText(const blink::WebString& text, | 43 void setToolTipText(const blink::WebString& text, |
| 49 blink::WebTextDirection direction) override; | 44 blink::WebTextDirection direction) override; |
| 50 void resetInputMethod() override; | 45 void resetInputMethod() override; |
| 51 | 46 |
| 52 private: | 47 private: |
| 53 void AnimateNow(); | 48 void AnimateNow(); |
| 54 | 49 |
| 55 // Borrowed pointers to other parts of Layout Tests state. | 50 WebTestDelegate* delegate(); |
| 56 TestRunner* test_runner_; | 51 TestRunnerForSpecificView* view_test_runner(); |
| 57 WebViewTestProxyBase* web_view_test_proxy_base_; | 52 TestRunner* test_runner(); |
| 53 |
| 54 // Borrowed pointer to WebWidgetTestProxyBase. |
| 58 WebWidgetTestProxyBase* web_widget_test_proxy_base_; | 55 WebWidgetTestProxyBase* web_widget_test_proxy_base_; |
| 59 | 56 |
| 60 bool animation_scheduled_; | 57 bool animation_scheduled_; |
| 61 | 58 |
| 62 base::WeakPtrFactory<WebWidgetTestClient> weak_factory_; | 59 base::WeakPtrFactory<WebWidgetTestClient> weak_factory_; |
| 63 | 60 |
| 64 DISALLOW_COPY_AND_ASSIGN(WebWidgetTestClient); | 61 DISALLOW_COPY_AND_ASSIGN(WebWidgetTestClient); |
| 65 }; | 62 }; |
| 66 | 63 |
| 67 } // namespace test_runner | 64 } // namespace test_runner |
| 68 | 65 |
| 69 #endif // COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_CLIENT_H_ | 66 #endif // COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_CLIENT_H_ |
| OLD | NEW |