Web Inspector: fix DRT to deliver simulated events to devtools front-end

https://bugs.webkit.org/show_bug.cgi?id=106650

Patch by Andrey Lushnikov <lushnikov@chromium.org> on 2013-01-14
Reviewed by Pavel Feldman.

Add separated m_devToolsTestInterfaces object to testShell which is
bind to devTools webview.

* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::initialize):
(TestShell::createMainWindow):
(TestShell::~TestShell):
(TestShell::showDevTools):
(TestShell::resetTestController):
(TestShell::bindJSObjectsToWindow):
(TestShell::createNewWindow):
* DumpRenderTree/chromium/TestShell.h:
(TestShell):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139606 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d6cefd63
2013-01-14 Andrey Lushnikov <lushnikov@chromium.org>
Web Inspector: fix DRT to deliver simulated events to devtools front-end
https://bugs.webkit.org/show_bug.cgi?id=106650
Reviewed by Pavel Feldman.
Add separated m_devToolsTestInterfaces object to testShell which is
bind to devTools webview.
* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::initialize):
(TestShell::createMainWindow):
(TestShell::~TestShell):
(TestShell::showDevTools):
(TestShell::resetTestController):
(TestShell::bindJSObjectsToWindow):
(TestShell::createNewWindow):
* DumpRenderTree/chromium/TestShell.h:
(TestShell):
2013-01-14 Alan Cutter <alancutter@chromium.org>
Sheriffbot command aliases need test cases
......
......@@ -161,8 +161,10 @@ TestShell::TestShell()
void TestShell::initialize()
{
m_testInterfaces = adoptPtr(new WebTestInterfaces());
m_devToolsTestInterfaces = adoptPtr(new WebTestInterfaces());
m_testRunner = adoptPtr(new DRTTestRunner(this));
m_testInterfaces->setTestRunner(m_testRunner.get());
m_devToolsTestInterfaces->setTestRunner(m_testRunner.get());
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
m_notificationPresenter = adoptPtr(new NotificationPresenter(this));
#endif
......@@ -182,7 +184,7 @@ void TestShell::initialize()
void TestShell::createMainWindow()
{
m_drtDevToolsAgent = adoptPtr(new DRTDevToolsAgent);
m_webViewHost = adoptPtr(createNewWindow(WebURL(), m_drtDevToolsAgent.get()));
m_webViewHost = adoptPtr(createNewWindow(WebURL(), m_drtDevToolsAgent.get(), m_testInterfaces.get()));
m_webView = m_webViewHost->webView();
m_testInterfaces->setDelegate(m_webViewHost.get());
m_testInterfaces->setWebView(m_webView);
......@@ -195,6 +197,8 @@ TestShell::~TestShell()
{
m_testInterfaces->setDelegate(0);
m_testInterfaces->setWebView(0);
m_devToolsTestInterfaces->setDelegate(0);
m_devToolsTestInterfaces->setWebView(0);
m_testRunner->setDelegate(0);
m_testRunner->setWebView(0);
m_drtDevToolsAgent->setWebView(0);
......@@ -213,9 +217,11 @@ void TestShell::showDevTools()
ASSERT(false);
return;
}
m_devTools = createNewWindow(url);
m_devTools = createNewWindow(url, 0, m_devToolsTestInterfaces.get());
m_devTools->webView()->settings()->setMemoryInfoEnabled(true);
m_devTools->setLogConsoleOutput(false);
m_devToolsTestInterfaces->setDelegate(m_devTools);
m_devToolsTestInterfaces->setWebView(m_devTools->webView());
ASSERT(m_devTools);
createDRTDevToolsClient(m_drtDevToolsAgent.get());
}
......@@ -317,6 +323,7 @@ void TestShell::resetTestController()
{
resetWebSettings(*webView());
m_testInterfaces->resetAll();
m_devToolsTestInterfaces->resetAll();
m_testRunner->reset();
m_webViewHost->reset();
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
......@@ -740,27 +747,30 @@ void TestShell::dumpImage(SkCanvas* canvas) const
void TestShell::bindJSObjectsToWindow(WebFrame* frame)
{
WebTestingSupport::injectInternalsObject(frame);
m_testInterfaces->bindTo(frame);
if (m_devTools && m_devTools->webView() == frame->view())
m_devToolsTestInterfaces->bindTo(frame);
else
m_testInterfaces->bindTo(frame);
m_testRunner->bindToJavascript(frame, WebString::fromUTF8("testRunner"));
m_testRunner->bindToJavascript(frame, WebString::fromUTF8("layoutTestController"));
}
WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url)
{
return createNewWindow(url, 0);
return createNewWindow(url, 0, m_testInterfaces.get());
}
WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url, DRTDevToolsAgent* devToolsAgent)
WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url, DRTDevToolsAgent* devToolsAgent, WebTestInterfaces *testInterfaces)
{
WebTestProxy<WebViewHost, TestShell*>* host = new WebTestProxy<WebViewHost, TestShell*>(this);
host->setInterfaces(m_testInterfaces.get());
host->setInterfaces(testInterfaces);
if (m_webViewHost)
host->setDelegate(m_webViewHost.get());
else
host->setDelegate(host);
host->setProxy(host);
WebView* view = WebView::create(host);
view->setPermissionClient(m_testInterfaces->testRunner()->webPermissions());
view->setPermissionClient(testInterfaces->testRunner()->webPermissions());
view->setDevToolsAgentClient(devToolsAgent);
host->setWebWidget(view);
m_prefs.applyTo(view);
......
......@@ -189,7 +189,7 @@ public:
std::string normalizeLayoutTestURL(const std::string&);
private:
WebViewHost* createNewWindow(const WebKit::WebURL&, DRTDevToolsAgent*);
WebViewHost* createNewWindow(const WebKit::WebURL&, DRTDevToolsAgent*, WebTestRunner::WebTestInterfaces*);
void createMainWindow();
void createDRTDevToolsClient(DRTDevToolsAgent*);
......@@ -210,6 +210,7 @@ private:
OwnPtr<DRTDevToolsAgent> m_drtDevToolsAgent;
OwnPtr<DRTDevToolsClient> m_drtDevToolsClient;
OwnPtr<WebTestRunner::WebTestInterfaces> m_testInterfaces;
OwnPtr<WebTestRunner::WebTestInterfaces> m_devToolsTestInterfaces;
OwnPtr<DRTTestRunner> m_testRunner;
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
OwnPtr<NotificationPresenter> m_notificationPresenter;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment