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