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_PROXY_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_PROXY_H_ |
6 #define COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_PROXY_H_ | 6 #define COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_PROXY_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "components/test_runner/test_runner_export.h" | 12 #include "components/test_runner/test_runner_export.h" |
13 #include "components/test_runner/web_widget_test_client.h" | 13 #include "components/test_runner/web_widget_test_client.h" |
14 #include "third_party/WebKit/public/web/WebWidgetClient.h" | 14 #include "third_party/WebKit/public/web/WebWidgetClient.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
| 17 class WebLocalFrame; |
17 class WebString; | 18 class WebString; |
18 class WebWidget; | 19 class WebWidget; |
19 } | 20 } |
20 | 21 |
21 namespace test_runner { | 22 namespace test_runner { |
22 | 23 |
| 24 class EventSender; |
| 25 class WebViewTestProxyBase; |
| 26 |
23 class TEST_RUNNER_EXPORT WebWidgetTestProxyBase { | 27 class TEST_RUNNER_EXPORT WebWidgetTestProxyBase { |
24 public: | 28 public: |
| 29 enum class Subtype { |
| 30 WebViewTestProxy, |
| 31 WebWidgetTestProxy, |
| 32 }; |
| 33 virtual Subtype subtype(); |
| 34 |
25 blink::WebWidget* web_widget() { return web_widget_; } | 35 blink::WebWidget* web_widget() { return web_widget_; } |
26 void set_web_widget(blink::WebWidget* widget) { | 36 void set_web_widget(blink::WebWidget* widget) { |
27 DCHECK(widget); | 37 DCHECK(widget); |
28 DCHECK(!web_widget_); | 38 DCHECK(!web_widget_); |
29 web_widget_ = widget; | 39 web_widget_ = widget; |
30 } | 40 } |
31 | 41 |
32 void set_widget_test_client( | 42 void set_widget_test_client( |
33 std::unique_ptr<WebWidgetTestClient> widget_test_client) { | 43 std::unique_ptr<WebWidgetTestClient> widget_test_client) { |
34 DCHECK(widget_test_client); | 44 DCHECK(widget_test_client); |
35 DCHECK(!widget_test_client_); | 45 DCHECK(!widget_test_client_); |
36 widget_test_client_ = std::move(widget_test_client); | 46 widget_test_client_ = std::move(widget_test_client); |
37 } | 47 } |
38 | 48 |
| 49 WebViewTestProxyBase* web_view_test_proxy_base() const { |
| 50 return web_view_test_proxy_base_; |
| 51 } |
| 52 void set_web_view_test_proxy_base( |
| 53 WebViewTestProxyBase* web_view_test_proxy_base) { |
| 54 DCHECK(web_view_test_proxy_base); |
| 55 DCHECK(!web_view_test_proxy_base_); |
| 56 web_view_test_proxy_base_ = web_view_test_proxy_base; |
| 57 } |
| 58 |
| 59 EventSender* event_sender() { return event_sender_.get(); } |
| 60 |
| 61 void Reset(); |
| 62 void BindTo(blink::WebLocalFrame* frame); |
| 63 |
39 protected: | 64 protected: |
40 WebWidgetTestProxyBase(); | 65 WebWidgetTestProxyBase(); |
41 ~WebWidgetTestProxyBase(); | 66 ~WebWidgetTestProxyBase(); |
42 | 67 |
43 blink::WebWidgetClient* widget_test_client() { | 68 blink::WebWidgetClient* widget_test_client() { |
44 return widget_test_client_.get(); | 69 return widget_test_client_.get(); |
45 } | 70 } |
46 | 71 |
47 private: | 72 private: |
48 blink::WebWidget* web_widget_; | 73 blink::WebWidget* web_widget_; |
| 74 WebViewTestProxyBase* web_view_test_proxy_base_; |
49 std::unique_ptr<WebWidgetTestClient> widget_test_client_; | 75 std::unique_ptr<WebWidgetTestClient> widget_test_client_; |
| 76 std::unique_ptr<EventSender> event_sender_; |
50 | 77 |
51 DISALLOW_COPY_AND_ASSIGN(WebWidgetTestProxyBase); | 78 DISALLOW_COPY_AND_ASSIGN(WebWidgetTestProxyBase); |
52 }; | 79 }; |
53 | 80 |
54 // WebWidgetTestProxy is used during LayoutTests and always instantiated, at | 81 // WebWidgetTestProxy is used during LayoutTests and always instantiated, at |
55 // time of writing with Base=RenderWidget. It does not directly inherit from it | 82 // time of writing with Base=RenderWidget. It does not directly inherit from it |
56 // for layering purposes. | 83 // for layering purposes. |
57 // The intent of that class is to wrap RenderWidget for tests purposes in | 84 // The intent of that class is to wrap RenderWidget for tests purposes in |
58 // order to reduce the amount of test specific code in the production code. | 85 // order to reduce the amount of test specific code in the production code. |
59 // WebWidgetTestProxy is only doing the glue between RenderWidget and | 86 // WebWidgetTestProxy is only doing the glue between RenderWidget and |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 132 |
106 private: | 133 private: |
107 virtual ~WebWidgetTestProxy() {} | 134 virtual ~WebWidgetTestProxy() {} |
108 | 135 |
109 DISALLOW_COPY_AND_ASSIGN(WebWidgetTestProxy); | 136 DISALLOW_COPY_AND_ASSIGN(WebWidgetTestProxy); |
110 }; | 137 }; |
111 | 138 |
112 } // namespace test_runner | 139 } // namespace test_runner |
113 | 140 |
114 #endif // COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_PROXY_H_ | 141 #endif // COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_PROXY_H_ |
OLD | NEW |