| 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 <utility> |
| 9 |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "components/test_runner/test_runner_export.h" |
| 14 #include "components/test_runner/web_frame_test_client.h" |
| 10 #include "third_party/WebKit/public/platform/WebString.h" | 15 #include "third_party/WebKit/public/platform/WebString.h" |
| 11 #include "third_party/WebKit/public/web/WebFrameClient.h" | 16 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 12 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 17 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 13 | 18 |
| 14 namespace test_runner { | 19 namespace test_runner { |
| 15 | 20 |
| 16 class WebFrameTestProxyBase { | 21 class TEST_RUNNER_EXPORT WebFrameTestProxyBase { |
| 17 public: | 22 public: |
| 18 void set_test_client(blink::WebFrameClient* client) { | 23 void set_test_client(scoped_ptr<WebFrameTestClient> client) { |
| 19 DCHECK(client); | 24 DCHECK(client); |
| 20 DCHECK(!test_client_); | 25 DCHECK(!test_client_); |
| 21 test_client_ = client; | 26 test_client_ = std::move(client); |
| 22 } | 27 } |
| 23 | 28 |
| 24 protected: | 29 protected: |
| 25 WebFrameTestProxyBase() : test_client_(nullptr) {} | 30 WebFrameTestProxyBase(); |
| 26 blink::WebFrameClient* test_client() { return test_client_; } | 31 ~WebFrameTestProxyBase(); |
| 32 blink::WebFrameClient* test_client() { return test_client_.get(); } |
| 27 | 33 |
| 28 private: | 34 private: |
| 29 blink::WebFrameClient* test_client_; | 35 scoped_ptr<WebFrameTestClient> test_client_; |
| 30 | 36 |
| 31 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxyBase); | 37 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxyBase); |
| 32 }; | 38 }; |
| 33 | 39 |
| 34 // WebTestProxy is used during LayoutTests and always instantiated, at time of | 40 // WebTestProxy is used during LayoutTests and always instantiated, at time of |
| 35 // writing with Base=RenderFrameImpl. It does not directly inherit from it for | 41 // writing with Base=RenderFrameImpl. It does not directly inherit from it for |
| 36 // layering purposes. | 42 // layering purposes. |
| 37 template <class Base, typename P> | 43 template <class Base, typename P> |
| 38 class WebFrameTestProxy : public Base, public WebFrameTestProxyBase { | 44 class WebFrameTestProxy : public Base, public WebFrameTestProxyBase { |
| 39 public: | 45 public: |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 sink_id, security_origin, web_callbacks); | 286 sink_id, security_origin, web_callbacks); |
| 281 } | 287 } |
| 282 | 288 |
| 283 private: | 289 private: |
| 284 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxy); | 290 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxy); |
| 285 }; | 291 }; |
| 286 | 292 |
| 287 } // namespace test_runner | 293 } // namespace test_runner |
| 288 | 294 |
| 289 #endif // COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ | 295 #endif // COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ |
| OLD | NEW |