summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/html_viewer/layout_test_content_handler_impl.cc25
-rw-r--r--components/html_viewer/web_test_delegate_impl.cc10
-rw-r--r--components/html_viewer/web_test_delegate_impl.h2
-rw-r--r--components/test_runner/web_test_delegate.h2
-rw-r--r--components/test_runner/web_test_proxy.cc1
-rw-r--r--content/shell/renderer/layout_test/blink_test_runner.cc4
-rw-r--r--content/shell/renderer/layout_test/blink_test_runner.h1
7 files changed, 41 insertions, 4 deletions
diff --git a/components/html_viewer/layout_test_content_handler_impl.cc b/components/html_viewer/layout_test_content_handler_impl.cc
index a444177..aa11737 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,12 @@ void LayoutTestContentHandlerImpl::StartApplication(
HTMLFrame* LayoutTestContentHandlerImpl::CreateHTMLFrame(
HTMLFrame::CreateParams* params) {
+ // The test harness isn't correctly set-up for iframes yet. So return a normal
+ // HTMLFrame for iframes.
+ if (params->parent)
+ 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 +78,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;
}
diff --git a/components/html_viewer/web_test_delegate_impl.cc b/components/html_viewer/web_test_delegate_impl.cc
index 12474ec5..5385a660 100644
--- a/components/html_viewer/web_test_delegate_impl.cc
+++ b/components/html_viewer/web_test_delegate_impl.cc
@@ -228,7 +228,8 @@ void WebTestDelegateImpl::SetLocale(const std::string& locale) {
void WebTestDelegateImpl::TestFinished() {
test_interfaces_->SetTestIsRunning(false);
- fprintf(stderr, "%s", proxy_->CaptureTree(false, false).c_str());
+ fprintf(stderr, "%s", proxy_ ? proxy_->CaptureTree(false, false).c_str()
+ : dump_tree_.c_str());
}
void WebTestDelegateImpl::CloseRemainingWindows() {
@@ -324,4 +325,11 @@ blink::WebPlugin* WebTestDelegateImpl::CreatePluginPlaceholder(
return nullptr;
}
+void WebTestDelegateImpl::OnWebTestProxyBaseDestroy(
+ test_runner::WebTestProxyBase* base) {
+ DCHECK_EQ(proxy_, base);
+ dump_tree_ = proxy_->CaptureTree(false, false);
+ proxy_ = nullptr;
+}
+
} // namespace html_viewer
diff --git a/components/html_viewer/web_test_delegate_impl.h b/components/html_viewer/web_test_delegate_impl.h
index 023b532..3125d68 100644
--- a/components/html_viewer/web_test_delegate_impl.h
+++ b/components/html_viewer/web_test_delegate_impl.h
@@ -112,10 +112,12 @@ class WebTestDelegateImpl : public test_runner::WebTestDelegate {
blink::WebPlugin* CreatePluginPlaceholder(
blink::WebLocalFrame* frame,
const blink::WebPluginParams& params) override;
+ void OnWebTestProxyBaseDestroy(test_runner::WebTestProxyBase* base) override;
test_runner::TestPreferences prefs_;
test_runner::WebTestInterfaces* test_interfaces_;
test_runner::WebTestProxyBase* proxy_;
+ std::string dump_tree_;
DISALLOW_COPY_AND_ASSIGN(WebTestDelegateImpl);
};
diff --git a/components/test_runner/web_test_delegate.h b/components/test_runner/web_test_delegate.h
index cbef50a..a59416f 100644
--- a/components/test_runner/web_test_delegate.h
+++ b/components/test_runner/web_test_delegate.h
@@ -258,6 +258,8 @@ class WebTestDelegate {
virtual blink::WebPlugin* CreatePluginPlaceholder(
blink::WebLocalFrame* frame,
const blink::WebPluginParams& params) = 0;
+
+ virtual void OnWebTestProxyBaseDestroy(WebTestProxyBase* proxy) = 0;
};
} // namespace test_runner
diff --git a/components/test_runner/web_test_proxy.cc b/components/test_runner/web_test_proxy.cc
index 23f020d..d4e21fc 100644
--- a/components/test_runner/web_test_proxy.cc
+++ b/components/test_runner/web_test_proxy.cc
@@ -392,6 +392,7 @@ WebTestProxyBase::WebTestProxyBase()
WebTestProxyBase::~WebTestProxyBase() {
test_interfaces_->WindowClosed(this);
+ delegate_->OnWebTestProxyBaseDestroy(this);
}
void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) {
diff --git a/content/shell/renderer/layout_test/blink_test_runner.cc b/content/shell/renderer/layout_test/blink_test_runner.cc
index 7e23c03..a3cd68c 100644
--- a/content/shell/renderer/layout_test/blink_test_runner.cc
+++ b/content/shell/renderer/layout_test/blink_test_runner.cc
@@ -700,6 +700,10 @@ blink::WebPlugin* BlinkTestRunner::CreatePluginPlaceholder(
return placeholder->plugin();
}
+void BlinkTestRunner::OnWebTestProxyBaseDestroy(
+ test_runner::WebTestProxyBase* proxy) {
+}
+
// RenderViewObserver --------------------------------------------------------
void BlinkTestRunner::DidClearWindowObject(WebLocalFrame* frame) {
diff --git a/content/shell/renderer/layout_test/blink_test_runner.h b/content/shell/renderer/layout_test/blink_test_runner.h
index a70ee0f..f1b45a6 100644
--- a/content/shell/renderer/layout_test/blink_test_runner.h
+++ b/content/shell/renderer/layout_test/blink_test_runner.h
@@ -139,6 +139,7 @@ class BlinkTestRunner : public RenderViewObserver,
blink::WebPlugin* CreatePluginPlaceholder(
blink::WebLocalFrame* frame,
const blink::WebPluginParams& params) override;
+ void OnWebTestProxyBaseDestroy(test_runner::WebTestProxyBase* proxy) override;
void Reset();