Title: [142371] trunk/Tools
Revision
142371
Author
[email protected]
Date
2013-02-09 11:01:43 -0800 (Sat, 09 Feb 2013)

Log Message

[chromium] move context menu data tracking to TestRunner library
https://bugs.webkit.org/show_bug.cgi?id=109313

Reviewed by Adam Barth.

* DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
(WebKit):
(WebTestDelegate):
* DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:
(WebKit):
(WebTestRunner::WebTestProxy::showContextMenu):
* DumpRenderTree/chromium/TestRunner/src/EventSender.cpp:
(WebTestRunner):
(WebTestRunner::EventSender::setContextMenuData):
(WebTestRunner::EventSender::contextClick):
* DumpRenderTree/chromium/TestRunner/src/EventSender.h:
(WebKit):
(EventSender):
* DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp:
(WebTestRunner::WebTestProxyBase::showContextMenu):
(WebTestRunner):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::showContextMenu):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (142370 => 142371)


--- trunk/Tools/ChangeLog	2013-02-09 18:55:36 UTC (rev 142370)
+++ trunk/Tools/ChangeLog	2013-02-09 19:01:43 UTC (rev 142371)
@@ -1,5 +1,33 @@
 2013-02-09  Jochen Eisinger  <[email protected]>
 
+        [chromium] move context menu data tracking to TestRunner library
+        https://bugs.webkit.org/show_bug.cgi?id=109313
+
+        Reviewed by Adam Barth.
+
+        * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
+        (WebKit):
+        (WebTestDelegate):
+        * DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:
+        (WebKit):
+        (WebTestRunner::WebTestProxy::showContextMenu):
+        * DumpRenderTree/chromium/TestRunner/src/EventSender.cpp:
+        (WebTestRunner):
+        (WebTestRunner::EventSender::setContextMenuData):
+        (WebTestRunner::EventSender::contextClick):
+        * DumpRenderTree/chromium/TestRunner/src/EventSender.h:
+        (WebKit):
+        (EventSender):
+        * DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp:
+        (WebTestRunner::WebTestProxyBase::showContextMenu):
+        (WebTestRunner):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::showContextMenu):
+        * DumpRenderTree/chromium/WebViewHost.h:
+        (WebViewHost):
+
+2013-02-09  Jochen Eisinger  <[email protected]>
+
         [chromium] move methods that change initial testRunner state to TestRunner library
         https://bugs.webkit.org/show_bug.cgi?id=109043
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h (142370 => 142371)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h	2013-02-09 18:55:36 UTC (rev 142370)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h	2013-02-09 19:01:43 UTC (rev 142371)
@@ -40,7 +40,6 @@
 class WebDeviceOrientation;
 class WebGamepads;
 class WebIntentRequest;
-struct WebContextMenuData;
 struct WebRect;
 struct WebURLError;
 }
@@ -52,10 +51,8 @@
 
 class WebTestDelegate {
 public:
-    virtual void clearContextMenuData() = 0;
     virtual void clearEditCommand() = 0;
     virtual void setEditCommand(const std::string& name, const std::string& value) = 0;
-    virtual WebKit::WebContextMenuData* lastContextMenuData() const = 0;
     virtual void setGamepadData(const WebKit::WebGamepads&) = 0;
     virtual void printMessage(const std::string& message) = 0;
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h (142370 => 142371)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h	2013-02-09 18:55:36 UTC (rev 142370)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h	2013-02-09 19:01:43 UTC (rev 142371)
@@ -67,6 +67,7 @@
 class WebURLResponse;
 class WebView;
 struct WebConsoleMessage;
+struct WebContextMenuData;
 struct WebPluginParams;
 struct WebPoint;
 struct WebSize;
@@ -127,6 +128,7 @@
     void didStopLoading();
     bool isSmartInsertDeleteEnabled();
     bool isSelectTrailingWhitespaceEnabled();
+    void showContextMenu(WebKit::WebFrame*, const WebKit::WebContextMenuData&);
 
     void willPerformClientRedirect(WebKit::WebFrame*, const WebKit::WebURL& from, const WebKit::WebURL& to, double interval, double fire_time);
     void didCancelClientRedirect(WebKit::WebFrame*);
@@ -329,6 +331,11 @@
     {
         return WebTestProxyBase::isSelectTrailingWhitespaceEnabled();
     }
+    void showContextMenu(WebKit::WebFrame* frame, const WebKit::WebContextMenuData& contextMenuData)
+    {
+        WebTestProxyBase::showContextMenu(frame, contextMenuData);
+        Base::showContextMenu(frame, contextMenuData);
+    }
 
     // WebFrameClient implementation.
     virtual void willPerformClientRedirect(WebKit::WebFrame* frame, const WebKit::WebURL& from, const WebKit::WebURL& to, double interval, double fireTime)

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp (142370 => 142371)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp	2013-02-09 18:55:36 UTC (rev 142370)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp	2013-02-09 19:01:43 UTC (rev 142371)
@@ -319,6 +319,11 @@
 #endif
 }
 
+void EventSender::setContextMenuData(const WebContextMenuData& contextMenuData)
+{
+    m_lastContextMenuData = auto_ptr<WebContextMenuData>(new WebContextMenuData(contextMenuData));
+}
+
 void EventSender::reset()
 {
     // The test should have finished a drag and the mouse button state.
@@ -849,7 +854,7 @@
 
     // Clears last context menu data because we need to know if the context menu be requested 
     // after following mouse events.
-    m_delegate->clearContextMenuData();
+    m_lastContextMenuData.reset();
 
     // Generate right mouse down and up.
     WebMouseEvent event;
@@ -867,8 +872,7 @@
     pressedButton = WebMouseEvent::ButtonNone;
 #endif
 
-    WebContextMenuData* lastContextMenu = m_delegate->lastContextMenuData();
-    result->set(WebBindings::makeStringArray(makeMenuItemStringsFor(lastContextMenu, m_delegate)));
+    result->set(WebBindings::makeStringArray(makeMenuItemStringsFor(m_lastContextMenuData.get(), m_delegate)));
 }
 
 class MouseDownTask: public WebMethodTask<EventSender> {

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h (142370 => 142371)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h	2013-02-09 18:55:36 UTC (rev 142370)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h	2013-02-09 19:01:43 UTC (rev 142371)
@@ -41,11 +41,13 @@
 #include "WebDragOperation.h"
 #include "WebInputEvent.h"
 #include "WebTask.h"
+#include <memory>
 #include <public/WebPoint.h>
 
 namespace WebKit {
 class WebDragData;
 class WebView;
+struct WebContextMenuData;
 }
 
 namespace WebTestRunner {
@@ -59,6 +61,8 @@
     void setDelegate(WebTestDelegate* delegate) { m_delegate = delegate; }
     void setWebView(WebKit::WebView* webView) { m_webView = webView; }
 
+    void setContextMenuData(const WebKit::WebContextMenuData&);
+
     // Resets some static variable state.
     void reset();
 
@@ -174,6 +178,8 @@
     WebTestDelegate* m_delegate;
     WebKit::WebView* m_webView;
 
+    std::auto_ptr<WebKit::WebContextMenuData> m_lastContextMenuData;
+
     // Location of the touch point that initiated a gesture.
     WebKit::WebPoint m_currentGestureLocation;
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp (142370 => 142371)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp	2013-02-09 18:55:36 UTC (rev 142370)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp	2013-02-09 19:01:43 UTC (rev 142371)
@@ -627,6 +627,11 @@
     return m_testInterfaces->testRunner()->isSelectTrailingWhitespaceEnabled();
 }
 
+void WebTestProxyBase::showContextMenu(WebFrame*, const WebContextMenuData& contextMenuData)
+{
+    m_testInterfaces->eventSender()->setContextMenuData(contextMenuData);
+}
+
 void WebTestProxyBase::willPerformClientRedirect(WebFrame* frame, const WebURL&, const WebURL& to, double, double)
 {
     if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) {

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (142370 => 142371)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-02-09 18:55:36 UTC (rev 142370)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-02-09 19:01:43 UTC (rev 142371)
@@ -236,7 +236,6 @@
 
 void WebViewHost::showContextMenu(WebFrame*, const WebContextMenuData& contextMenuData)
 {
-    m_lastContextMenuData = adoptPtr(new WebContextMenuData(contextMenuData));
 }
 
 void WebViewHost::didUpdateLayout()
@@ -638,16 +637,6 @@
 
 // WebTestDelegate ------------------------------------------------------------
 
-WebContextMenuData* WebViewHost::lastContextMenuData() const
-{
-    return m_lastContextMenuData.get();
-}
-
-void WebViewHost::clearContextMenuData()
-{
-    m_lastContextMenuData.clear();
-}
-
 void WebViewHost::setEditCommand(const string& name, const string& value)
 {
     m_editCommandName = name;

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.h (142370 => 142371)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-02-09 18:55:36 UTC (rev 142370)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-02-09 19:01:43 UTC (rev 142371)
@@ -109,8 +109,6 @@
 #endif
 
     // WebTestDelegate.
-    virtual WebKit::WebContextMenuData* lastContextMenuData() const OVERRIDE;
-    virtual void clearContextMenuData() OVERRIDE;
     virtual void setEditCommand(const std::string& name, const std::string& value) OVERRIDE;
     virtual void clearEditCommand() OVERRIDE;
     virtual void setGamepadData(const WebKit::WebGamepads&) OVERRIDE;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to