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