Title: [140271] trunk/Tools
Revision
140271
Author
[email protected]
Date
2013-01-20 02:50:07 -0800 (Sun, 20 Jan 2013)

Log Message

[chromium] move notification related methods to TestRunner
https://bugs.webkit.org/show_bug.cgi?id=107269

Reviewed by Adam Barth.

* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::DRTTestRunner):
* DumpRenderTree/chromium/DRTTestRunner.h:
(DRTTestRunner):
* DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
(WebTestDelegate):
(WebTestRunner::WebTestDelegate::grantWebNotificationPermission):
(WebTestRunner::WebTestDelegate::simulateLegacyWebNotificationClick):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
(WebTestRunner::TestRunner::TestRunner):
(WebTestRunner):
(WebTestRunner::TestRunner::grantWebNotificationPermission):
(WebTestRunner::TestRunner::simulateLegacyWebNotificationClick):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(TestRunner):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::grantWebNotificationPermission):
(WebViewHost::simulateLegacyWebNotificationClick):
* DumpRenderTree/chromium/WebViewHost.h:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (140270 => 140271)


--- trunk/Tools/ChangeLog	2013-01-20 10:35:00 UTC (rev 140270)
+++ trunk/Tools/ChangeLog	2013-01-20 10:50:07 UTC (rev 140271)
@@ -1,5 +1,32 @@
 2013-01-20  Jochen Eisinger  <[email protected]>
 
+        [chromium] move notification related methods to TestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=107269
+
+        Reviewed by Adam Barth.
+
+        * DumpRenderTree/chromium/DRTTestRunner.cpp:
+        (DRTTestRunner::DRTTestRunner):
+        * DumpRenderTree/chromium/DRTTestRunner.h:
+        (DRTTestRunner):
+        * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
+        (WebTestDelegate):
+        (WebTestRunner::WebTestDelegate::grantWebNotificationPermission):
+        (WebTestRunner::WebTestDelegate::simulateLegacyWebNotificationClick):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
+        (WebTestRunner::TestRunner::TestRunner):
+        (WebTestRunner):
+        (WebTestRunner::TestRunner::grantWebNotificationPermission):
+        (WebTestRunner::TestRunner::simulateLegacyWebNotificationClick):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
+        (TestRunner):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::grantWebNotificationPermission):
+        (WebViewHost::simulateLegacyWebNotificationClick):
+        * DumpRenderTree/chromium/WebViewHost.h:
+
+2013-01-20  Jochen Eisinger  <[email protected]>
+
         [chromium] move geolocation related methods to TestRunner
         https://bugs.webkit.org/show_bug.cgi?id=107267
 

Modified: trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp (140270 => 140271)


--- trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp	2013-01-20 10:35:00 UTC (rev 140270)
+++ trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp	2013-01-20 10:50:07 UTC (rev 140271)
@@ -48,7 +48,6 @@
 #include "WebIDBFactory.h"
 #include "WebInputElement.h"
 #include "WebKit.h"
-#include "WebNotificationPresenter.h"
 #include "WebPrintParams.h"
 #include "WebScriptSource.h"
 #include "WebSecurityPolicy.h"
@@ -102,9 +101,6 @@
 #endif
     bindMethod("display", &DRTTestRunner::display);
     bindMethod("displayInvalidatedRegion", &DRTTestRunner::displayInvalidatedRegion);
-#if ENABLE(NOTIFICATIONS)
-    bindMethod("grantWebNotificationPermission", &DRTTestRunner::grantWebNotificationPermission);
-#endif
     bindMethod("notifyDone", &DRTTestRunner::notifyDone);
     bindMethod("queueBackNavigation", &DRTTestRunner::queueBackNavigation);
     bindMethod("queueForwardNavigation", &DRTTestRunner::queueForwardNavigation);
@@ -118,9 +114,6 @@
     bindMethod("setWillSendRequestClearHeader", &DRTTestRunner::setWillSendRequestClearHeader);
     bindMethod("setWillSendRequestReturnsNull", &DRTTestRunner::setWillSendRequestReturnsNull);
     bindMethod("setWillSendRequestReturnsNullOnRedirect", &DRTTestRunner::setWillSendRequestReturnsNullOnRedirect);
-#if ENABLE(NOTIFICATIONS)
-    bindMethod("simulateLegacyWebNotificationClick", &DRTTestRunner::simulateLegacyWebNotificationClick);
-#endif
     bindMethod("waitForPolicyDelegate", &DRTTestRunner::waitForPolicyDelegate);
     bindMethod("waitUntilDone", &DRTTestRunner::waitUntilDone);
     bindMethod("windowCount", &DRTTestRunner::windowCount);
@@ -450,35 +443,6 @@
     result->setNull();
 }
 
-
-#if ENABLE(NOTIFICATIONS)
-void DRTTestRunner::grantWebNotificationPermission(const CppArgumentList& arguments, CppVariant* result)
-{
-    if (arguments.size() != 1 || !arguments[0].isString()) {
-        result->set(false);
-        return;
-    }
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-    m_shell->notificationPresenter()->grantPermission(cppVariantToWebString(arguments[0]));
-#endif
-    result->set(true);
-}
-
-void DRTTestRunner::simulateLegacyWebNotificationClick(const CppArgumentList& arguments, CppVariant* result)
-{
-    if (arguments.size() != 1 || !arguments[0].isString()) {
-        result->set(false);
-        return;
-    }
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-    if (m_shell->notificationPresenter()->simulateClick(cppVariantToWebString(arguments[0])))
-        result->set(true);
-    else
-#endif
-        result->set(false);
-}
-#endif
-
 void DRTTestRunner::display(const CppArgumentList& arguments, CppVariant* result)
 {
     WebViewHost* host = m_shell->webViewHost();

Modified: trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h (140270 => 140271)


--- trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h	2013-01-20 10:35:00 UTC (rev 140270)
+++ trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h	2013-01-20 10:50:07 UTC (rev 140271)
@@ -107,13 +107,6 @@
     // Causes WillSendRequest to return an empty request.
     void setWillSendRequestReturnsNull(const CppArgumentList&, CppVariant*);
 
-#if ENABLE(NOTIFICATIONS)
-    // Grants permission for desktop notifications to an origin
-    void grantWebNotificationPermission(const CppArgumentList&, CppVariant*);
-    // Simulates a click on a desktop notification.
-    void simulateLegacyWebNotificationClick(const CppArgumentList&, CppVariant*);
-#endif
-
     void display(const CppArgumentList&, CppVariant*);
     void displayInvalidatedRegion(const CppArgumentList&, CppVariant*);
 

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


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h	2013-01-20 10:35:00 UTC (rev 140270)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h	2013-01-20 10:50:07 UTC (rev 140271)
@@ -103,6 +103,10 @@
     virtual void setGeolocationPermission(bool) { }
     virtual void setMockGeolocationPosition(double, double, double) { }
     virtual void setMockGeolocationPositionUnavailableError(const std::string&) { }
+#if ENABLE(NOTIFICATIONS)
+    virtual void grantWebNotificationPermission(const std::string&) { }
+    virtual bool simulateLegacyWebNotificationClick(const std::string&) { return false; }
+#endif
 };
 
 }

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp (140270 => 140271)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2013-01-20 10:35:00 UTC (rev 140270)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2013-01-20 10:50:07 UTC (rev 140271)
@@ -221,6 +221,10 @@
     bindMethod("setGeolocationPermission", &TestRunner::setGeolocationPermission);
     bindMethod("setMockGeolocationPositionUnavailableError", &TestRunner::setMockGeolocationPositionUnavailableError);
     bindMethod("setMockGeolocationPosition", &TestRunner::setMockGeolocationPosition);
+#if ENABLE(NOTIFICATIONS)
+    bindMethod("grantWebNotificationPermission", &TestRunner::grantWebNotificationPermission);
+    bindMethod("simulateLegacyWebNotificationClick", &TestRunner::simulateLegacyWebNotificationClick);
+#endif
 
     // Properties.
     bindProperty("workerThreadCount", &TestRunner::workerThreadCount);
@@ -1462,6 +1466,27 @@
     m_delegate->setMockGeolocationPositionUnavailableError(arguments[0].toString());
 }
 
+#if ENABLE(NOTIFICATIONS)
+void TestRunner::grantWebNotificationPermission(const CppArgumentList& arguments, CppVariant* result)
+{
+    if (arguments.size() != 1 || !arguments[0].isString()) {
+        result->set(false);
+        return;
+    }
+    m_delegate->grantWebNotificationPermission(arguments[0].toString());
+    result->set(true);
+}
+
+void TestRunner::simulateLegacyWebNotificationClick(const CppArgumentList& arguments, CppVariant* result)
+{
+    if (arguments.size() != 1 || !arguments[0].isString()) {
+        result->set(false);
+        return;
+    }
+    result->set(m_delegate->simulateLegacyWebNotificationClick(arguments[0].toString()));
+}
+#endif
+
 void TestRunner::dumpEditingCallbacks(const CppArgumentList&, CppVariant* result)
 {
     m_dumpEditingCallbacks = true;

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h (140270 => 140271)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-01-20 10:35:00 UTC (rev 140270)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-01-20 10:50:07 UTC (rev 140271)
@@ -376,6 +376,13 @@
     void setMockGeolocationPosition(const CppArgumentList&, CppVariant*);
     void setMockGeolocationPositionUnavailableError(const CppArgumentList&, CppVariant*);
 
+#if ENABLE(NOTIFICATIONS)
+    // Grants permission for desktop notifications to an origin
+    void grantWebNotificationPermission(const CppArgumentList&, CppVariant*);
+    // Simulates a click on a desktop notification.
+    void simulateLegacyWebNotificationClick(const CppArgumentList&, CppVariant*);
+#endif
+
     ///////////////////////////////////////////////////////////////////////////
     // Properties
     void workerThreadCount(CppVariant*);

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (140270 => 140271)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-01-20 10:35:00 UTC (rev 140270)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-01-20 10:50:07 UTC (rev 140271)
@@ -1171,6 +1171,18 @@
         windowList[i]->geolocationClientMock()->setPositionUnavailableError(WebString::fromUTF8(message));
 }
 
+#if ENABLE(NOTIFICATIONS)
+void WebViewHost::grantWebNotificationPermission(const std::string& origin)
+{
+    m_shell->notificationPresenter()->grantPermission(WebString::fromUTF8(origin));
+}
+
+bool WebViewHost::simulateLegacyWebNotificationClick(const std::string& notificationIdentifier)
+{
+    return m_shell->notificationPresenter()->simulateClick(WebString::fromUTF8(notificationIdentifier));
+}
+#endif
+
 // Public functions -----------------------------------------------------------
 
 WebViewHost::WebViewHost(TestShell* shell)

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.h (140270 => 140271)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-01-20 10:35:00 UTC (rev 140270)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-01-20 10:50:07 UTC (rev 140271)
@@ -164,6 +164,10 @@
     virtual void setGeolocationPermission(bool) OVERRIDE;
     virtual void setMockGeolocationPosition(double, double, double) OVERRIDE;
     virtual void setMockGeolocationPositionUnavailableError(const std::string&) OVERRIDE;
+#if ENABLE(NOTIFICATIONS)
+    virtual void grantWebNotificationPermission(const std::string&) OVERRIDE;
+    virtual bool simulateLegacyWebNotificationClick(const std::string&) OVERRIDE;
+#endif
 
     // NavigationHost
     virtual bool navigate(const TestNavigationEntry&, bool reload);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to