Index: components/html_viewer/layout_test_content_handler_impl.cc |
diff --git a/components/html_viewer/layout_test_content_handler_impl.cc b/components/html_viewer/layout_test_content_handler_impl.cc |
index a4441778386bb1a9487f99d0fc382ab0999edf09..fab67ebc68e8ec28effb70980a83bd6f6aee224c 100644 |
--- a/components/html_viewer/layout_test_content_handler_impl.cc |
+++ b/components/html_viewer/layout_test_content_handler_impl.cc |
@@ -14,6 +14,23 @@ |
namespace html_viewer { |
+class TestHTMLFrame : public HTMLFrame { |
+ public: |
+ explicit TestHTMLFrame(HTMLFrame::CreateParams* params) : HTMLFrame(params) {} |
+ |
+ protected: |
+ ~TestHTMLFrame() override {} |
+ |
+ private: |
+ // blink::WebFrameClient:: |
+ void didClearWindowObject(blink::WebLocalFrame* frame) override { |
+ HTMLFrame::didClearWindowObject(frame); |
+ blink::WebTestingSupport::injectInternalsObject(frame); |
+ } |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TestHTMLFrame); |
+}; |
+ |
LayoutTestContentHandlerImpl::LayoutTestContentHandlerImpl( |
GlobalState* global_state, |
mojo::ApplicationImpl* app, |
@@ -46,8 +63,10 @@ void LayoutTestContentHandlerImpl::StartApplication( |
HTMLFrame* LayoutTestContentHandlerImpl::CreateHTMLFrame( |
HTMLFrame::CreateParams* params) { |
+ if (params->parent) |
sky
2015/08/18 20:51:44
Yes, this is what I had in mind. How about a comme
|
+ return new HTMLFrame(params); |
using ProxyType = test_runner::WebTestProxy< |
- test_runner::WebFrameTestProxy<HTMLFrame, HTMLFrame::CreateParams*>, |
+ test_runner::WebFrameTestProxy<TestHTMLFrame, HTMLFrame::CreateParams*>, |
HTMLFrame::CreateParams*>; |
// TODO(sky): this isn't right for all frame types, eg remote frames. |
ProxyType* proxy = new ProxyType(params); |
@@ -57,8 +76,6 @@ HTMLFrame* LayoutTestContentHandlerImpl::CreateHTMLFrame( |
test_delegate_->set_test_proxy(proxy); |
test_interfaces_->SetWebView(proxy->web_view(), proxy); |
proxy->set_widget(proxy->web_view()); |
- blink::WebTestingSupport::injectInternalsObject( |
- proxy->web_view()->mainFrame()->toWebLocalFrame()); |
test_interfaces_->BindTo(proxy->web_view()->mainFrame()); |
return proxy; |
} |