Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: components/html_viewer/layout_test_content_handler_impl.cc

Issue 1297173002: html_viewer: Make sure window.internals is set-up correctly in layout-tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/html_viewer/web_test_delegate_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | components/html_viewer/web_test_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698