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