| 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_FRAME_TEST_PROXY_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ |
| 6 #define COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ | 6 #define COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "components/test_runner/test_runner_export.h" | 13 #include "components/test_runner/test_runner_export.h" |
| 14 #include "components/test_runner/web_frame_test_client.h" | 14 #include "components/test_runner/web_frame_test_client.h" |
| 15 #include "third_party/WebKit/public/platform/WebString.h" | 15 #include "third_party/WebKit/public/platform/WebString.h" |
| 16 #include "third_party/WebKit/public/web/WebFrameClient.h" | 16 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 17 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 17 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 18 | 18 |
| 19 namespace test_runner { | 19 namespace test_runner { |
| 20 | 20 |
| 21 class EventSender; |
| 22 class WebTestProxyBase; |
| 23 |
| 21 class TEST_RUNNER_EXPORT WebFrameTestProxyBase { | 24 class TEST_RUNNER_EXPORT WebFrameTestProxyBase { |
| 22 public: | 25 public: |
| 23 void set_test_client(std::unique_ptr<WebFrameTestClient> client) { | 26 void set_test_client(std::unique_ptr<WebFrameTestClient> client) { |
| 24 DCHECK(client); | 27 DCHECK(client); |
| 25 DCHECK(!test_client_); | 28 DCHECK(!test_client_); |
| 26 test_client_ = std::move(client); | 29 test_client_ = std::move(client); |
| 27 } | 30 } |
| 28 | 31 |
| 29 blink::WebLocalFrame* web_frame() const { return web_frame_; } | 32 blink::WebLocalFrame* web_frame() const { return web_frame_; } |
| 30 void set_web_frame(blink::WebLocalFrame* frame) { | 33 void set_web_frame(blink::WebLocalFrame* frame) { |
| 31 DCHECK(frame); | 34 DCHECK(frame); |
| 32 DCHECK(!web_frame_); | 35 DCHECK(!web_frame_); |
| 33 web_frame_ = frame; | 36 web_frame_ = frame; |
| 34 } | 37 } |
| 35 | 38 |
| 39 WebTestProxyBase* web_test_proxy_base() const { return web_test_proxy_base_; } |
| 40 void set_web_test_proxy_base(WebTestProxyBase* web_test_proxy_base) { |
| 41 DCHECK(web_test_proxy_base); |
| 42 DCHECK(!web_test_proxy_base_); |
| 43 web_test_proxy_base_ = web_test_proxy_base; |
| 44 } |
| 45 |
| 46 EventSender* event_sender() { return event_sender_.get(); } |
| 47 void SetSendWheelGestures(bool send_gestures); |
| 48 |
| 49 void Reset(); // DO NOT SUBMIT - not called anywhere... :-/ |
| 50 void BindTo(blink::WebLocalFrame* frame); |
| 51 |
| 36 protected: | 52 protected: |
| 37 WebFrameTestProxyBase(); | 53 WebFrameTestProxyBase(); |
| 38 ~WebFrameTestProxyBase(); | 54 ~WebFrameTestProxyBase(); |
| 39 blink::WebFrameClient* test_client() { return test_client_.get(); } | 55 blink::WebFrameClient* test_client() { return test_client_.get(); } |
| 40 | 56 |
| 41 private: | 57 private: |
| 58 blink::WebLocalFrame* web_frame_; |
| 59 WebTestProxyBase* web_test_proxy_base_; |
| 42 std::unique_ptr<WebFrameTestClient> test_client_; | 60 std::unique_ptr<WebFrameTestClient> test_client_; |
| 43 blink::WebLocalFrame* web_frame_; | 61 std::unique_ptr<EventSender> event_sender_; |
| 44 | 62 |
| 45 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxyBase); | 63 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxyBase); |
| 46 }; | 64 }; |
| 47 | 65 |
| 48 // WebTestProxy is used during LayoutTests and always instantiated, at time of | 66 // WebTestProxy is used during LayoutTests and always instantiated, at time of |
| 49 // writing with Base=RenderFrameImpl. It does not directly inherit from it for | 67 // writing with Base=RenderFrameImpl. It does not directly inherit from it for |
| 50 // layering purposes. | 68 // layering purposes. |
| 51 template <class Base, typename P> | 69 template <class Base, typename P> |
| 52 class WebFrameTestProxy : public Base, public WebFrameTestProxyBase { | 70 class WebFrameTestProxy : public Base, public WebFrameTestProxyBase { |
| 53 public: | 71 public: |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 Base::didClearWindowObject(frame); | 310 Base::didClearWindowObject(frame); |
| 293 } | 311 } |
| 294 | 312 |
| 295 private: | 313 private: |
| 296 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxy); | 314 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxy); |
| 297 }; | 315 }; |
| 298 | 316 |
| 299 } // namespace test_runner | 317 } // namespace test_runner |
| 300 | 318 |
| 301 #endif // COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ | 319 #endif // COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ |
| OLD | NEW |