[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 13:44:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3af79bfec3c4a95a862ad1c8a8bf1e478cfbf5b3
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 24 20:47:05 2010 +0000

    messages_unittest.py should compare the generated results against expected results
    https://bugs.webkit.org/show_bug.cgi?id=46490
    
    Reviewed by Adam Roben.
    
    * Scripts/webkit2/messages_unittest.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68287 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 3611d09..3bcb4dc 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,12 @@
+2010-09-24  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Adam Roben.
+
+        messages_unittest.py should compare the generated results against expected results
+        https://bugs.webkit.org/show_bug.cgi?id=46490
+
+        * Scripts/webkit2/messages_unittest.py:
+
 2010-09-24  Kenneth Rohde Christiansen  <kenneth.christiansen at openbossa.org>
 
         Reviewed by Antonio Gomes.
diff --git a/WebKit2/Scripts/webkit2/messages_unittest.py b/WebKit2/Scripts/webkit2/messages_unittest.py
index 54bcbbf..1f55ee5 100644
--- a/WebKit2/Scripts/webkit2/messages_unittest.py
+++ b/WebKit2/Scripts/webkit2/messages_unittest.py
@@ -189,30 +189,251 @@ class ParsingTest(MessagesTest):
         for index, message in enumerate(self.receiver.messages):
             self.check_message(message, _expected_results['messages'][index])
 
+_expected_header = """/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
 
-class HeaderTest(MessagesTest):
-    def test_base_class(self):
-        """Base classes for message structs should match expectations"""
-        for index, message in enumerate(self.receiver.messages):
-            self.assertEquals(messages.base_class(message), _expected_results['messages'][index]['base_class'])
-            if message.reply_parameters != None:
-                self.assertEquals(messages.reply_base_class(message), _expected_results['messages'][index]['reply_base_class'])
-                if message.delayed:
-                    self.assertEquals(messages.delayed_reply_base_class(message), _expected_results['messages'][index]['delayed_reply_base_class'])
-            else:
-                self.assertFalse('reply_parameters' in _expected_results['messages'][index])
-
-class ReceiverImplementationTest(unittest.TestCase):
-    def setUp(self):
-        self.file_contents = messages.generate_message_handler(StringIO(_messages_file_contents))
+#ifndef WebPageMessages_h
+#define WebPageMessages_h
+
+#if ENABLE(WEBKIT2)
+
+#include "Arguments.h"
+#include "MessageID.h"
+
+namespace WTF {
+    class String;
+}
+
+namespace WebKit {
+    class WebTouchEvent;
+}
+
+namespace Messages {
+
+namespace WebPage {
+
+enum Kind {
+    LoadURLID,
+#if ENABLE(TOUCH_EVENTS)
+    TouchEventID,
+#endif
+    DidReceivePolicyDecisionID,
+    CloseID,
+    SendDoubleAndFloatID,
+    SendIntsID,
+    RunJavaScriptAlertID,
+    GetPluginsID,
+    GetPluginProcessConnectionID,
+};
+
+struct LoadURL : CoreIPC::Arguments1<const WTF::String&> {
+    static const Kind messageID = LoadURLID;
+    explicit LoadURL(const WTF::String& url)
+        : CoreIPC::Arguments1<const WTF::String&>(url)
+    {
+    }
+};
+
+#if ENABLE(TOUCH_EVENTS)
+struct TouchEvent : CoreIPC::Arguments1<const WebKit::WebTouchEvent&> {
+    static const Kind messageID = TouchEventID;
+    explicit TouchEvent(const WebKit::WebTouchEvent& event)
+        : CoreIPC::Arguments1<const WebKit::WebTouchEvent&>(event)
+    {
+    }
+};
+#endif
+
+struct DidReceivePolicyDecision : CoreIPC::Arguments3<uint64_t, uint64_t, uint32_t> {
+    static const Kind messageID = DidReceivePolicyDecisionID;
+    DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction)
+        : CoreIPC::Arguments3<uint64_t, uint64_t, uint32_t>(frameID, listenerID, policyAction)
+    {
+    }
+};
+
+struct Close : CoreIPC::Arguments0 {
+    static const Kind messageID = CloseID;
+};
+
+struct SendDoubleAndFloat : CoreIPC::Arguments2<double, float> {
+    static const Kind messageID = SendDoubleAndFloatID;
+    SendDoubleAndFloat(double d, float f)
+        : CoreIPC::Arguments2<double, float>(d, f)
+    {
+    }
+};
+
+struct SendInts : CoreIPC::Arguments1<const Vector<uint64_t>&> {
+    static const Kind messageID = SendIntsID;
+    explicit SendInts(const Vector<uint64_t>& ints)
+        : CoreIPC::Arguments1<const Vector<uint64_t>&>(ints)
+    {
+    }
+};
+
+struct RunJavaScriptAlert : CoreIPC::Arguments2<uint64_t, const WTF::String&> {
+    static const Kind messageID = RunJavaScriptAlertID;
+    RunJavaScriptAlert(uint64_t frameID, const WTF::String& message)
+        : CoreIPC::Arguments2<uint64_t, const WTF::String&>(frameID, message)
+    {
+    }
+};
+
+struct GetPlugins : CoreIPC::Arguments1<bool> {
+    static const Kind messageID = GetPluginsID;
+    explicit GetPlugins(bool refresh)
+        : CoreIPC::Arguments1<bool>(refresh)
+    {
+    }
+};
+
+struct GetPluginProcessConnection : CoreIPC::Arguments1<const WTF::String&> {
+    static const Kind messageID = GetPluginProcessConnectionID;
+    explicit GetPluginProcessConnection(const WTF::String& pluginPath)
+        : CoreIPC::Arguments1<const WTF::String&>(pluginPath)
+    {
+    }
+};
+
+} // namespace WebPage
+
+} // namespace Messages
+
+namespace CoreIPC {
+
+template<> struct MessageKindTraits<Messages::WebPage::Kind> {
+    static const MessageClass messageClass = MessageClassWebPage;
+};
+
+} // namespace CoreIPC
+
+#endif // ENABLE(WEBKIT2)
+
+#endif // WebPageMessages_h
+"""
+
+_expected_receiver_implementation = """/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(WEBKIT2)
+
+#include "WebPage.h"
+
+#include "ArgumentDecoder.h"
+#include "HandleMessage.h"
+#include "WebEvent.h"
+#include "WebPageMessages.h"
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+void WebPage::didReceiveWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+    switch (messageID.get<Messages::WebPage::Kind>()) {
+    case Messages::WebPage::LoadURLID:
+        CoreIPC::handleMessage<Messages::WebPage::LoadURL>(arguments, this, &WebPage::loadURL);
+        return;
+#if ENABLE(TOUCH_EVENTS)
+    case Messages::WebPage::TouchEventID:
+        CoreIPC::handleMessage<Messages::WebPage::TouchEvent>(arguments, this, &WebPage::touchEvent);
+        return;
+#endif
+    case Messages::WebPage::DidReceivePolicyDecisionID:
+        CoreIPC::handleMessage<Messages::WebPage::DidReceivePolicyDecision>(arguments, this, &WebPage::didReceivePolicyDecision);
+        return;
+    case Messages::WebPage::CloseID:
+        CoreIPC::handleMessage<Messages::WebPage::Close>(arguments, this, &WebPage::close);
+        return;
+    case Messages::WebPage::SendDoubleAndFloatID:
+        CoreIPC::handleMessage<Messages::WebPage::SendDoubleAndFloat>(arguments, this, &WebPage::sendDoubleAndFloat);
+        return;
+    case Messages::WebPage::SendIntsID:
+        CoreIPC::handleMessage<Messages::WebPage::SendInts>(arguments, this, &WebPage::sendInts);
+        return;
+    case Messages::WebPage::RunJavaScriptAlertID:
+        CoreIPC::handleMessage<Messages::WebPage::RunJavaScriptAlert>(arguments, this, &WebPage::runJavaScriptAlert);
+        return;
+    case Messages::WebPage::GetPluginsID:
+        CoreIPC::handleMessage<Messages::WebPage::GetPlugins>(arguments, this, &WebPage::getPlugins);
+        return;
+    case Messages::WebPage::GetPluginProcessConnectionID:
+        CoreIPC::handleMessage<Messages::WebPage::GetPluginProcessConnection>(arguments, this, &WebPage::getPluginProcessConnection);
+        return;
+    }
+
+    ASSERT_NOT_REACHED();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(WEBKIT2)
+"""
+
+
+class GeneratedFileContentsTest(unittest.TestCase):
+    def assertGeneratedFileContentsEqual(self, first, second):
+        first_list = first.split('\n')
+        second_list = second.split('\n')
+
+        for index, first_line in enumerate(first_list):
+            self.assertEquals(first_line, second_list[index])
+
+        self.assertEquals(len(first_list), len(second_list))
+
+
+class HeaderTest(GeneratedFileContentsTest):
+    def test_header(self):
+        file_contents = messages.generate_messages_header(StringIO(_messages_file_contents))
+        self.assertGeneratedFileContentsEqual(file_contents, _expected_header)
 
-    def test_receiver_header_listed_first(self):
-        """Receiver's header file should be the first included header"""
-        self.assertEquals(self.file_contents.index('#include'), self.file_contents.index('#include "%s.h"' % _expected_results['name']))
 
-    def test_receiver_header_listed_separately(self):
-        """Receiver's header should be in its own paragraph"""
-        self.assertTrue(self.file_contents.find('\n\n#include "%s.h"\n\n' % _expected_results['name']))
+class ReceiverImplementationTest(GeneratedFileContentsTest):
+    def test_receiver_implementation(self):
+        file_contents = messages.generate_message_handler(StringIO(_messages_file_contents))
+        self.assertGeneratedFileContentsEqual(file_contents, _expected_receiver_implementation)
 
 
 if __name__ == '__main__':

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list