| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "components/html_viewer/layout_test_content_handler_impl.h" | 5 #include "components/html_viewer/layout_test_content_handler_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "components/html_viewer/html_document_application_delegate.h" | 8 #include "components/html_viewer/html_document_application_delegate.h" |
| 9 #include "components/html_viewer/html_widget.h" | 9 #include "components/html_viewer/html_widget.h" |
| 10 #include "components/html_viewer/web_test_delegate_impl.h" | 10 #include "components/html_viewer/web_test_delegate_impl.h" |
| 11 #include "components/test_runner/web_frame_test_proxy.h" | 11 #include "components/test_runner/web_frame_test_proxy.h" |
| 12 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 12 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 13 #include "third_party/WebKit/public/web/WebTestingSupport.h" | 13 #include "third_party/WebKit/public/web/WebTestingSupport.h" |
| 14 #include "third_party/WebKit/public/web/WebView.h" | 14 #include "third_party/WebKit/public/web/WebView.h" |
| 15 | 15 |
| 16 namespace html_viewer { | 16 namespace html_viewer { |
| 17 | 17 |
| 18 class TestHTMLFrame : public HTMLFrame { | 18 class TestHTMLFrame : public HTMLFrame { |
| 19 public: | 19 public: |
| 20 explicit TestHTMLFrame(HTMLFrame::CreateParams* params) | 20 explicit TestHTMLFrame(HTMLFrame::CreateParams* params) |
| 21 : HTMLFrame(params), test_interfaces_(nullptr) {} | 21 : HTMLFrame(params), test_interfaces_(nullptr) {} |
| 22 | 22 |
| 23 void set_test_interfaces(test_runner::WebTestInterfaces* test_interfaces) { | 23 void set_test_interfaces(test_runner::WebTestInterfaces* test_interfaces) { |
| 24 test_interfaces_ = test_interfaces; | 24 test_interfaces_ = test_interfaces; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // WebFrameTestProxy expects to be able to get a WebLocalFrame from |
| 28 // Base::GetWebFrame(). |
| 29 blink::WebLocalFrame* GetWebFrame() { |
| 30 return web_frame()->isWebLocalFrame() ? |
| 31 web_frame()->toWebLocalFrame() : NULL; |
| 32 } |
| 33 |
| 27 protected: | 34 protected: |
| 28 ~TestHTMLFrame() override {} | 35 ~TestHTMLFrame() override {} |
| 29 | 36 |
| 30 private: | 37 private: |
| 31 // blink::WebFrameClient:: | 38 // blink::WebFrameClient:: |
| 32 void didClearWindowObject(blink::WebLocalFrame* frame) override { | 39 void didClearWindowObject(blink::WebLocalFrame* frame) override { |
| 33 HTMLFrame::didClearWindowObject(frame); | 40 HTMLFrame::didClearWindowObject(frame); |
| 34 blink::WebTestingSupport::injectInternalsObject(frame); | 41 blink::WebTestingSupport::injectInternalsObject(frame); |
| 35 DCHECK(test_interfaces_); | 42 DCHECK(test_interfaces_); |
| 36 test_interfaces_->BindTo(frame); | 43 test_interfaces_->BindTo(frame); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 proxy->set_base_proxy(web_widget_proxy_); | 100 proxy->set_base_proxy(web_widget_proxy_); |
| 94 test_delegate_->set_test_proxy(web_widget_proxy_); | 101 test_delegate_->set_test_proxy(web_widget_proxy_); |
| 95 test_interfaces_->SetWebView(web_widget_proxy_->web_view(), | 102 test_interfaces_->SetWebView(web_widget_proxy_->web_view(), |
| 96 web_widget_proxy_); | 103 web_widget_proxy_); |
| 97 web_widget_proxy_->set_widget(web_widget_proxy_->web_view()); | 104 web_widget_proxy_->set_widget(web_widget_proxy_->web_view()); |
| 98 test_interfaces_->BindTo(web_widget_proxy_->web_view()->mainFrame()); | 105 test_interfaces_->BindTo(web_widget_proxy_->web_view()->mainFrame()); |
| 99 return proxy; | 106 return proxy; |
| 100 } | 107 } |
| 101 | 108 |
| 102 } // namespace html_viewer | 109 } // namespace html_viewer |
| OLD | NEW |