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..931a1bb4e2872377b5ac78fdfdca576d3032b99d 100644 |
--- a/components/html_viewer/layout_test_content_handler_impl.cc |
+++ b/components/html_viewer/layout_test_content_handler_impl.cc |
@@ -14,6 +14,21 @@ |
namespace html_viewer { |
+class TestHTMLFrame : public HTMLFrame { |
+ public: |
+ explicit TestHTMLFrame(HTMLFrame::CreateParams* params) : HTMLFrame(params) {} |
+ |
+ ~TestHTMLFrame() override {} |
+ |
+ private: |
+ // blink::WebFrameClient:: |
+ void didClearWindowObject(blink::WebLocalFrame* frame) override { |
+ blink::WebTestingSupport::injectInternalsObject(frame); |
sky
2015/08/18 18:13:57
Should you call through to the base class?
sadrul
2015/08/18 20:06:34
Done.
|
+ } |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TestHTMLFrame); |
+}; |
+ |
LayoutTestContentHandlerImpl::LayoutTestContentHandlerImpl( |
GlobalState* global_state, |
mojo::ApplicationImpl* app, |
@@ -47,19 +62,21 @@ void LayoutTestContentHandlerImpl::StartApplication( |
HTMLFrame* LayoutTestContentHandlerImpl::CreateHTMLFrame( |
HTMLFrame::CreateParams* 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); |
+ blink::WebView* web_view = proxy->web_view(); |
+ if (!web_view) |
+ web_view = params->manager->GetWebView(); |
sadrul
2015/08/18 08:00:13
This does avoid a crash on start-up below (line ~7
sky
2015/08/18 18:13:57
Are you trying to run a test that creates multiple
sadrul
2015/08/18 20:06:34
Indeed, the test this was failing on did have an i
|
+ CHECK(web_view); |
proxy->SetInterfaces(test_interfaces_); |
proxy->SetDelegate(test_delegate_); |
proxy->set_base_proxy(proxy); |
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()); |
+ test_interfaces_->SetWebView(web_view, proxy); |
+ proxy->set_widget(web_view); |
+ test_interfaces_->BindTo(web_view->mainFrame()); |
return proxy; |
} |