| 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 COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_PROXY_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ |
| 6 #define COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_PROXY_H_ | 6 #define COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "components/test_runner/test_runner_export.h" | 15 #include "components/test_runner/test_runner_export.h" |
| 16 #include "components/test_runner/web_view_test_client.h" | 16 #include "components/test_runner/web_view_test_client.h" |
| 17 #include "components/test_runner/web_widget_test_client.h" | 17 #include "components/test_runner/web_widget_test_client.h" |
| 18 #include "components/test_runner/web_widget_test_proxy.h" | |
| 19 #include "third_party/WebKit/public/platform/WebDragOperation.h" | 18 #include "third_party/WebKit/public/platform/WebDragOperation.h" |
| 20 #include "third_party/WebKit/public/platform/WebRect.h" | 19 #include "third_party/WebKit/public/platform/WebRect.h" |
| 21 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 20 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| 22 #include "third_party/WebKit/public/platform/WebURLError.h" | 21 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 23 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 22 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 24 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" | 23 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" |
| 25 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" | 24 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
| 26 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 25 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
| 27 #include "third_party/WebKit/public/web/WebTextDirection.h" | 26 #include "third_party/WebKit/public/web/WebTextDirection.h" |
| 28 #include "third_party/WebKit/public/web/WebViewClient.h" | 27 #include "third_party/WebKit/public/web/WebViewClient.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 49 class TestRunnerForSpecificView; | 48 class TestRunnerForSpecificView; |
| 50 class TextInputController; | 49 class TextInputController; |
| 51 class WebTestDelegate; | 50 class WebTestDelegate; |
| 52 class WebTestInterfaces; | 51 class WebTestInterfaces; |
| 53 | 52 |
| 54 // WebViewTestProxyBase is the "brain" of WebViewTestProxy in the sense that | 53 // WebViewTestProxyBase is the "brain" of WebViewTestProxy in the sense that |
| 55 // WebViewTestProxy does the bridge between RenderViewImpl and | 54 // WebViewTestProxy does the bridge between RenderViewImpl and |
| 56 // WebViewTestProxyBase and when it requires a behavior to be different from the | 55 // WebViewTestProxyBase and when it requires a behavior to be different from the |
| 57 // usual, it will call WebViewTestProxyBase that implements the expected | 56 // usual, it will call WebViewTestProxyBase that implements the expected |
| 58 // behavior. See WebViewTestProxy class comments for more information. | 57 // behavior. See WebViewTestProxy class comments for more information. |
| 59 class TEST_RUNNER_EXPORT WebViewTestProxyBase : public WebWidgetTestProxyBase { | 58 class TEST_RUNNER_EXPORT WebViewTestProxyBase { |
| 60 public: | 59 public: |
| 60 blink::WebWidget* web_widget() { return web_widget_; } |
| 61 void set_web_widget(blink::WebWidget* widget) { |
| 62 DCHECK(widget); |
| 63 DCHECK(!web_widget_); |
| 64 web_widget_ = widget; |
| 65 } |
| 66 |
| 61 blink::WebView* web_view() { return web_view_; } | 67 blink::WebView* web_view() { return web_view_; } |
| 62 void set_web_view(blink::WebView* view) { | 68 void set_web_view(blink::WebView* view) { |
| 63 DCHECK(view); | 69 DCHECK(view); |
| 64 DCHECK(!web_view_); | 70 DCHECK(!web_view_); |
| 65 web_view_ = view; | 71 web_view_ = view; |
| 66 } | 72 } |
| 67 | 73 |
| 68 void set_view_test_client( | 74 void set_view_test_client( |
| 69 std::unique_ptr<WebViewTestClient> view_test_client) { | 75 std::unique_ptr<WebViewTestClient> view_test_client) { |
| 70 DCHECK(view_test_client); | 76 DCHECK(view_test_client); |
| 71 DCHECK(!view_test_client_); | 77 DCHECK(!view_test_client_); |
| 72 view_test_client_ = std::move(view_test_client); | 78 view_test_client_ = std::move(view_test_client); |
| 73 } | 79 } |
| 74 | 80 |
| 81 void set_widget_test_client( |
| 82 std::unique_ptr<WebWidgetTestClient> widget_test_client) { |
| 83 DCHECK(widget_test_client); |
| 84 DCHECK(!widget_test_client_); |
| 85 widget_test_client_ = std::move(widget_test_client); |
| 86 } |
| 87 |
| 75 WebTestDelegate* delegate() { return delegate_; } | 88 WebTestDelegate* delegate() { return delegate_; } |
| 76 void set_delegate(WebTestDelegate* delegate) { | 89 void set_delegate(WebTestDelegate* delegate) { |
| 77 DCHECK(delegate); | 90 DCHECK(delegate); |
| 78 DCHECK(!delegate_); | 91 DCHECK(!delegate_); |
| 79 delegate_ = delegate; | 92 delegate_ = delegate; |
| 80 } | 93 } |
| 81 | 94 |
| 82 TestInterfaces* test_interfaces() { return test_interfaces_; } | 95 TestInterfaces* test_interfaces() { return test_interfaces_; } |
| 83 void SetInterfaces(WebTestInterfaces* web_test_interfaces); | 96 void SetInterfaces(WebTestInterfaces* web_test_interfaces); |
| 84 | 97 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 95 void Reset(); | 108 void Reset(); |
| 96 void BindTo(blink::WebLocalFrame* frame); | 109 void BindTo(blink::WebLocalFrame* frame); |
| 97 | 110 |
| 98 void GetScreenOrientationForTesting(blink::WebScreenInfo&); | 111 void GetScreenOrientationForTesting(blink::WebScreenInfo&); |
| 99 | 112 |
| 100 protected: | 113 protected: |
| 101 WebViewTestProxyBase(); | 114 WebViewTestProxyBase(); |
| 102 ~WebViewTestProxyBase(); | 115 ~WebViewTestProxyBase(); |
| 103 | 116 |
| 104 blink::WebViewClient* view_test_client() { return view_test_client_.get(); } | 117 blink::WebViewClient* view_test_client() { return view_test_client_.get(); } |
| 118 blink::WebWidgetClient* widget_test_client() { |
| 119 return widget_test_client_.get(); |
| 120 } |
| 105 | 121 |
| 106 private: | 122 private: |
| 107 TestInterfaces* test_interfaces_; | 123 TestInterfaces* test_interfaces_; |
| 108 WebTestDelegate* delegate_; | 124 WebTestDelegate* delegate_; |
| 109 blink::WebView* web_view_; | 125 blink::WebView* web_view_; |
| 110 blink::WebWidget* web_widget_; | 126 blink::WebWidget* web_widget_; |
| 111 std::unique_ptr<WebViewTestClient> view_test_client_; | 127 std::unique_ptr<WebViewTestClient> view_test_client_; |
| 128 std::unique_ptr<WebWidgetTestClient> widget_test_client_; |
| 112 std::unique_ptr<AccessibilityController> accessibility_controller_; | 129 std::unique_ptr<AccessibilityController> accessibility_controller_; |
| 113 std::unique_ptr<EventSender> event_sender_; | 130 std::unique_ptr<EventSender> event_sender_; |
| 114 std::unique_ptr<TextInputController> text_input_controller_; | 131 std::unique_ptr<TextInputController> text_input_controller_; |
| 115 std::unique_ptr<TestRunnerForSpecificView> view_test_runner_; | 132 std::unique_ptr<TestRunnerForSpecificView> view_test_runner_; |
| 116 | 133 |
| 117 DISALLOW_COPY_AND_ASSIGN(WebViewTestProxyBase); | 134 DISALLOW_COPY_AND_ASSIGN(WebViewTestProxyBase); |
| 118 }; | 135 }; |
| 119 | 136 |
| 120 // WebViewTestProxy is used during LayoutTests and always instantiated, at time | 137 // WebViewTestProxy is used during LayoutTests and always instantiated, at time |
| 121 // of writing with Base=RenderViewImpl. It does not directly inherit from it for | 138 // of writing with Base=RenderViewImpl. It does not directly inherit from it for |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } | 246 } |
| 230 | 247 |
| 231 private: | 248 private: |
| 232 virtual ~WebViewTestProxy() {} | 249 virtual ~WebViewTestProxy() {} |
| 233 | 250 |
| 234 DISALLOW_COPY_AND_ASSIGN(WebViewTestProxy); | 251 DISALLOW_COPY_AND_ASSIGN(WebViewTestProxy); |
| 235 }; | 252 }; |
| 236 | 253 |
| 237 } // namespace test_runner | 254 } // namespace test_runner |
| 238 | 255 |
| 239 #endif // COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_PROXY_H_ | 256 #endif // COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ |
| OLD | NEW |