| 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_VIEW_TEST_PROXY_H_ |
| 6 #define COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_PROXY_H_ | 6 #define COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_PROXY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 class WebView; | 37 class WebView; |
| 38 class WebWidget; | 38 class WebWidget; |
| 39 struct WebFileChooserParams; | 39 struct WebFileChooserParams; |
| 40 struct WebPoint; | 40 struct WebPoint; |
| 41 struct WebWindowFeatures; | 41 struct WebWindowFeatures; |
| 42 } | 42 } |
| 43 | 43 |
| 44 namespace test_runner { | 44 namespace test_runner { |
| 45 | 45 |
| 46 class AccessibilityController; | 46 class AccessibilityController; |
| 47 class EventSender; | |
| 48 class TestInterfaces; | 47 class TestInterfaces; |
| 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 : public WebWidgetTestProxyBase { |
| 60 public: | 59 public: |
| 60 WebWidgetTestProxyBase::Subtype subtype() override; |
| 61 |
| 61 blink::WebView* web_view() { return web_view_; } | 62 blink::WebView* web_view() { return web_view_; } |
| 62 void set_web_view(blink::WebView* view) { | 63 void set_web_view(blink::WebView* view) { |
| 63 DCHECK(view); | 64 DCHECK(view); |
| 64 DCHECK(!web_view_); | 65 DCHECK(!web_view_); |
| 65 web_view_ = view; | 66 web_view_ = view; |
| 66 } | 67 } |
| 67 | 68 |
| 68 void set_view_test_client( | 69 void set_view_test_client( |
| 69 std::unique_ptr<WebViewTestClient> view_test_client) { | 70 std::unique_ptr<WebViewTestClient> view_test_client) { |
| 70 DCHECK(view_test_client); | 71 DCHECK(view_test_client); |
| 71 DCHECK(!view_test_client_); | 72 DCHECK(!view_test_client_); |
| 72 view_test_client_ = std::move(view_test_client); | 73 view_test_client_ = std::move(view_test_client); |
| 73 } | 74 } |
| 74 | 75 |
| 75 WebTestDelegate* delegate() { return delegate_; } | 76 WebTestDelegate* delegate() { return delegate_; } |
| 76 void set_delegate(WebTestDelegate* delegate) { | 77 void set_delegate(WebTestDelegate* delegate) { |
| 77 DCHECK(delegate); | 78 DCHECK(delegate); |
| 78 DCHECK(!delegate_); | 79 DCHECK(!delegate_); |
| 79 delegate_ = delegate; | 80 delegate_ = delegate; |
| 80 } | 81 } |
| 81 | 82 |
| 82 TestInterfaces* test_interfaces() { return test_interfaces_; } | 83 TestInterfaces* test_interfaces() { return test_interfaces_; } |
| 83 void SetInterfaces(WebTestInterfaces* web_test_interfaces); | 84 void SetInterfaces(WebTestInterfaces* web_test_interfaces); |
| 84 | 85 |
| 85 EventSender* event_sender() { return event_sender_.get(); } | |
| 86 | |
| 87 AccessibilityController* accessibility_controller() { | 86 AccessibilityController* accessibility_controller() { |
| 88 return accessibility_controller_.get(); | 87 return accessibility_controller_.get(); |
| 89 } | 88 } |
| 90 | 89 |
| 91 TestRunnerForSpecificView* view_test_runner() { | 90 TestRunnerForSpecificView* view_test_runner() { |
| 92 return view_test_runner_.get(); | 91 return view_test_runner_.get(); |
| 93 } | 92 } |
| 94 | 93 |
| 95 void Reset(); | 94 void Reset(); |
| 96 void BindTo(blink::WebLocalFrame* frame); | 95 void BindTo(blink::WebLocalFrame* frame); |
| 97 | 96 |
| 98 void GetScreenOrientationForTesting(blink::WebScreenInfo&); | 97 void GetScreenOrientationForTesting(blink::WebScreenInfo&); |
| 99 | 98 |
| 100 protected: | 99 protected: |
| 101 WebViewTestProxyBase(); | 100 WebViewTestProxyBase(); |
| 102 ~WebViewTestProxyBase(); | 101 ~WebViewTestProxyBase(); |
| 103 | 102 |
| 104 blink::WebViewClient* view_test_client() { return view_test_client_.get(); } | 103 blink::WebViewClient* view_test_client() { return view_test_client_.get(); } |
| 105 | 104 |
| 106 private: | 105 private: |
| 107 TestInterfaces* test_interfaces_; | 106 TestInterfaces* test_interfaces_; |
| 108 WebTestDelegate* delegate_; | 107 WebTestDelegate* delegate_; |
| 109 blink::WebView* web_view_; | 108 blink::WebView* web_view_; |
| 110 blink::WebWidget* web_widget_; | 109 blink::WebWidget* web_widget_; |
| 111 std::unique_ptr<WebViewTestClient> view_test_client_; | 110 std::unique_ptr<WebViewTestClient> view_test_client_; |
| 112 std::unique_ptr<AccessibilityController> accessibility_controller_; | 111 std::unique_ptr<AccessibilityController> accessibility_controller_; |
| 113 std::unique_ptr<EventSender> event_sender_; | |
| 114 std::unique_ptr<TextInputController> text_input_controller_; | 112 std::unique_ptr<TextInputController> text_input_controller_; |
| 115 std::unique_ptr<TestRunnerForSpecificView> view_test_runner_; | 113 std::unique_ptr<TestRunnerForSpecificView> view_test_runner_; |
| 116 | 114 |
| 117 DISALLOW_COPY_AND_ASSIGN(WebViewTestProxyBase); | 115 DISALLOW_COPY_AND_ASSIGN(WebViewTestProxyBase); |
| 118 }; | 116 }; |
| 119 | 117 |
| 120 // WebViewTestProxy is used during LayoutTests and always instantiated, at time | 118 // WebViewTestProxy is used during LayoutTests and always instantiated, at time |
| 121 // of writing with Base=RenderViewImpl. It does not directly inherit from it for | 119 // of writing with Base=RenderViewImpl. It does not directly inherit from it for |
| 122 // layering purposes. | 120 // layering purposes. |
| 123 // The intent of that class is to wrap RenderViewImpl for tests purposes in | 121 // The intent of that class is to wrap RenderViewImpl for tests purposes in |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 228 |
| 231 private: | 229 private: |
| 232 virtual ~WebViewTestProxy() {} | 230 virtual ~WebViewTestProxy() {} |
| 233 | 231 |
| 234 DISALLOW_COPY_AND_ASSIGN(WebViewTestProxy); | 232 DISALLOW_COPY_AND_ASSIGN(WebViewTestProxy); |
| 235 }; | 233 }; |
| 236 | 234 |
| 237 } // namespace test_runner | 235 } // namespace test_runner |
| 238 | 236 |
| 239 #endif // COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_PROXY_H_ | 237 #endif // COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_PROXY_H_ |
| OLD | NEW |