| 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_PROXY_H_ |
| 6 #define COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ | 6 #define COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 #include <utility> | 10 #include <utility> |
| 10 | 11 |
| 11 #include "base/callback.h" | 12 #include "base/callback.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.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 "third_party/WebKit/public/platform/WebDragOperation.h" | 17 #include "third_party/WebKit/public/platform/WebDragOperation.h" |
| 18 #include "third_party/WebKit/public/platform/WebRect.h" | 18 #include "third_party/WebKit/public/platform/WebRect.h" |
| 19 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 19 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| 20 #include "third_party/WebKit/public/platform/WebURLError.h" | 20 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 21 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 21 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 22 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" | 22 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" |
| 23 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" | 23 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 web_widget_ = widget; | 62 web_widget_ = widget; |
| 63 } | 63 } |
| 64 | 64 |
| 65 blink::WebView* web_view() { return web_view_; } | 65 blink::WebView* web_view() { return web_view_; } |
| 66 void set_web_view(blink::WebView* view) { | 66 void set_web_view(blink::WebView* view) { |
| 67 DCHECK(view); | 67 DCHECK(view); |
| 68 DCHECK(!web_view_); | 68 DCHECK(!web_view_); |
| 69 web_view_ = view; | 69 web_view_ = view; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void set_view_test_client(scoped_ptr<WebViewTestClient> view_test_client) { | 72 void set_view_test_client( |
| 73 std::unique_ptr<WebViewTestClient> view_test_client) { |
| 73 DCHECK(view_test_client); | 74 DCHECK(view_test_client); |
| 74 DCHECK(!view_test_client_); | 75 DCHECK(!view_test_client_); |
| 75 view_test_client_ = std::move(view_test_client); | 76 view_test_client_ = std::move(view_test_client); |
| 76 } | 77 } |
| 77 | 78 |
| 78 WebTestDelegate* delegate() { return delegate_; } | 79 WebTestDelegate* delegate() { return delegate_; } |
| 79 void set_delegate(WebTestDelegate* delegate) { | 80 void set_delegate(WebTestDelegate* delegate) { |
| 80 DCHECK(delegate); | 81 DCHECK(delegate); |
| 81 DCHECK(!delegate_); | 82 DCHECK(!delegate_); |
| 82 delegate_ = delegate; | 83 delegate_ = delegate; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 101 WebTestProxyBase(); | 102 WebTestProxyBase(); |
| 102 ~WebTestProxyBase(); | 103 ~WebTestProxyBase(); |
| 103 | 104 |
| 104 blink::WebViewClient* view_test_client() { return view_test_client_.get(); } | 105 blink::WebViewClient* view_test_client() { return view_test_client_.get(); } |
| 105 | 106 |
| 106 private: | 107 private: |
| 107 TestInterfaces* test_interfaces_; | 108 TestInterfaces* test_interfaces_; |
| 108 WebTestDelegate* delegate_; | 109 WebTestDelegate* delegate_; |
| 109 blink::WebView* web_view_; | 110 blink::WebView* web_view_; |
| 110 blink::WebWidget* web_widget_; | 111 blink::WebWidget* web_widget_; |
| 111 scoped_ptr<WebViewTestClient> view_test_client_; | 112 std::unique_ptr<WebViewTestClient> view_test_client_; |
| 112 scoped_ptr<AccessibilityController> accessibility_controller_; | 113 std::unique_ptr<AccessibilityController> accessibility_controller_; |
| 113 scoped_ptr<EventSender> event_sender_; | 114 std::unique_ptr<EventSender> event_sender_; |
| 114 scoped_ptr<TextInputController> text_input_controller_; | 115 std::unique_ptr<TextInputController> text_input_controller_; |
| 115 | 116 |
| 116 DISALLOW_COPY_AND_ASSIGN(WebTestProxyBase); | 117 DISALLOW_COPY_AND_ASSIGN(WebTestProxyBase); |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 // WebTestProxy is used during LayoutTests and always instantiated, at time of | 120 // WebTestProxy is used during LayoutTests and always instantiated, at time of |
| 120 // writing with Base=RenderViewImpl. It does not directly inherit from it for | 121 // writing with Base=RenderViewImpl. It does not directly inherit from it for |
| 121 // layering purposes. | 122 // layering purposes. |
| 122 // The intent of that class is to wrap RenderViewImpl for tests purposes in | 123 // The intent of that class is to wrap RenderViewImpl for tests purposes in |
| 123 // order to reduce the amount of test specific code in the production code. | 124 // order to reduce the amount of test specific code in the production code. |
| 124 // WebTestProxy is only doing the glue between RenderViewImpl and | 125 // WebTestProxy is only doing the glue between RenderViewImpl and |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 227 |
| 227 private: | 228 private: |
| 228 virtual ~WebTestProxy() {} | 229 virtual ~WebTestProxy() {} |
| 229 | 230 |
| 230 DISALLOW_COPY_AND_ASSIGN(WebTestProxy); | 231 DISALLOW_COPY_AND_ASSIGN(WebTestProxy); |
| 231 }; | 232 }; |
| 232 | 233 |
| 233 } // namespace test_runner | 234 } // namespace test_runner |
| 234 | 235 |
| 235 #endif // COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ | 236 #endif // COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ |
| OLD | NEW |