Title: [161473] trunk/Source/WebKit2
Revision
161473
Author
simon.fra...@apple.com
Date
2014-01-07 17:03:46 -0800 (Tue, 07 Jan 2014)

Log Message

Add message-generation test for non-legacy message receiver
https://bugs.webkit.org/show_bug.cgi?id=126603

Reviewed by Anders Carlsson.

Add expected output files for a non-legacy message receiver, and add
testing for same.

* Scripts/webkit2/LegacyMessageReceiver-expected.cpp: Copied from Source/WebKit2/Scripts/webkit2/MessageReceiver-expected.cpp.
* Scripts/webkit2/LegacyMessages-expected.h: Added.
* Scripts/webkit2/MessageReceiver-expected.cpp:
(WebKit::WebPage::didReceiveMessage):
(WebKit::WebPage::didReceiveSyncMessage):
* Scripts/webkit2/messages_unittest.py:
(MessagesTest.setUp):
(ParsingTest.test_receiver):
(HeaderTest.test_header):
(ReceiverImplementationTest.test_receiver_implementation):
* Scripts/webkit2/test-legacy-messages.in: Copied from Source/WebKit2/Scripts/webkit2/test-messages.in.
* Scripts/webkit2/test-messages.in:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (161472 => 161473)


--- trunk/Source/WebKit2/ChangeLog	2014-01-08 01:03:44 UTC (rev 161472)
+++ trunk/Source/WebKit2/ChangeLog	2014-01-08 01:03:46 UTC (rev 161473)
@@ -1,5 +1,28 @@
 2014-01-07  Simon Fraser  <simon.fra...@apple.com>
 
+        Add message-generation test for non-legacy message receiver
+        https://bugs.webkit.org/show_bug.cgi?id=126603
+
+        Reviewed by Anders Carlsson.
+        
+        Add expected output files for a non-legacy message receiver, and add
+        testing for same.
+
+        * Scripts/webkit2/LegacyMessageReceiver-expected.cpp: Copied from Source/WebKit2/Scripts/webkit2/MessageReceiver-expected.cpp.
+        * Scripts/webkit2/LegacyMessages-expected.h: Added.
+        * Scripts/webkit2/MessageReceiver-expected.cpp:
+        (WebKit::WebPage::didReceiveMessage):
+        (WebKit::WebPage::didReceiveSyncMessage):
+        * Scripts/webkit2/messages_unittest.py:
+        (MessagesTest.setUp):
+        (ParsingTest.test_receiver):
+        (HeaderTest.test_header):
+        (ReceiverImplementationTest.test_receiver_implementation):
+        * Scripts/webkit2/test-legacy-messages.in: Copied from Source/WebKit2/Scripts/webkit2/test-messages.in.
+        * Scripts/webkit2/test-messages.in:
+
+2014-01-07  Simon Fraser  <simon.fra...@apple.com>
+
         Move expected results out of messages_unittest.py into separate files
         https://bugs.webkit.org/show_bug.cgi?id=126602
 

Copied: trunk/Source/WebKit2/Scripts/webkit2/LegacyMessageReceiver-expected.cpp (from rev 161472, trunk/Source/WebKit2/Scripts/webkit2/MessageReceiver-expected.cpp) (0 => 161473)


--- trunk/Source/WebKit2/Scripts/webkit2/LegacyMessageReceiver-expected.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/Scripts/webkit2/LegacyMessageReceiver-expected.cpp	2014-01-08 01:03:46 UTC (rev 161473)
@@ -0,0 +1,218 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+
+#if (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
+
+#include "WebPage.h"
+
+#include "ArgumentCoders.h"
+#include "Connection.h"
+#if ENABLE(DEPRECATED_FEATURE) || ENABLE(EXPERIMENTAL_FEATURE)
+#include "DummyType.h"
+#endif
+#include "HandleMessage.h"
+#if PLATFORM(MAC)
+#include "MachPort.h"
+#endif
+#include "MessageDecoder.h"
+#include "Plugin.h"
+#include "WebCoreArgumentCoders.h"
+#if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION)) || (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))
+#include "WebEvent.h"
+#endif
+#include "WebPageMessages.h"
+#include "WebPreferencesStore.h"
+#if PLATFORM(MAC)
+#include <WebCore/KeyboardEvent.h>
+#endif
+#include <WebCore/PluginData.h>
+#include <utility>
+#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace Messages {
+
+namespace WebPage {
+
+GetPluginProcessConnection::DelayedReply::DelayedReply(PassRefPtr<IPC::Connection> connection, std::unique_ptr<IPC::MessageEncoder> encoder)
+    : m_connection(connection)
+    , m_encoder(std::move(encoder))
+{
+}
+
+GetPluginProcessConnection::DelayedReply::~DelayedReply()
+{
+    ASSERT(!m_connection);
+}
+
+bool GetPluginProcessConnection::DelayedReply::send(const IPC::Connection::Handle& connectionHandle)
+{
+    ASSERT(m_encoder);
+    *m_encoder << connectionHandle;
+    bool result = m_connection->sendSyncReply(std::move(m_encoder));
+    m_connection = nullptr;
+    return result;
+}
+
+TestMultipleAttributes::DelayedReply::DelayedReply(PassRefPtr<IPC::Connection> connection, std::unique_ptr<IPC::MessageEncoder> encoder)
+    : m_connection(connection)
+    , m_encoder(std::move(encoder))
+{
+}
+
+TestMultipleAttributes::DelayedReply::~DelayedReply()
+{
+    ASSERT(!m_connection);
+}
+
+bool TestMultipleAttributes::DelayedReply::send()
+{
+    ASSERT(m_encoder);
+    bool result = m_connection->sendSyncReply(std::move(m_encoder));
+    m_connection = nullptr;
+    return result;
+}
+
+} // namespace WebPage
+
+} // namespace Messages
+
+namespace WebKit {
+
+void WebPage::didReceiveWebPageMessage(IPC::Connection*, IPC::MessageDecoder& decoder)
+{
+    if (decoder.messageName() == Messages::WebPage::LoadURL::name()) {
+        IPC::handleMessage<Messages::WebPage::LoadURL>(decoder, this, &WebPage::loadURL);
+        return;
+    }
+#if ENABLE(TOUCH_EVENTS)
+    if (decoder.messageName() == Messages::WebPage::LoadSomething::name()) {
+        IPC::handleMessage<Messages::WebPage::LoadSomething>(decoder, this, &WebPage::loadSomething);
+        return;
+    }
+#endif
+#if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))
+    if (decoder.messageName() == Messages::WebPage::TouchEvent::name()) {
+        IPC::handleMessage<Messages::WebPage::TouchEvent>(decoder, this, &WebPage::touchEvent);
+        return;
+    }
+#endif
+#if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION))
+    if (decoder.messageName() == Messages::WebPage::AddEvent::name()) {
+        IPC::handleMessage<Messages::WebPage::AddEvent>(decoder, this, &WebPage::addEvent);
+        return;
+    }
+#endif
+#if ENABLE(TOUCH_EVENTS)
+    if (decoder.messageName() == Messages::WebPage::LoadSomethingElse::name()) {
+        IPC::handleMessage<Messages::WebPage::LoadSomethingElse>(decoder, this, &WebPage::loadSomethingElse);
+        return;
+    }
+#endif
+    if (decoder.messageName() == Messages::WebPage::DidReceivePolicyDecision::name()) {
+        IPC::handleMessage<Messages::WebPage::DidReceivePolicyDecision>(decoder, this, &WebPage::didReceivePolicyDecision);
+        return;
+    }
+    if (decoder.messageName() == Messages::WebPage::Close::name()) {
+        IPC::handleMessage<Messages::WebPage::Close>(decoder, this, &WebPage::close);
+        return;
+    }
+    if (decoder.messageName() == Messages::WebPage::PreferencesDidChange::name()) {
+        IPC::handleMessage<Messages::WebPage::PreferencesDidChange>(decoder, this, &WebPage::preferencesDidChange);
+        return;
+    }
+    if (decoder.messageName() == Messages::WebPage::SendDoubleAndFloat::name()) {
+        IPC::handleMessage<Messages::WebPage::SendDoubleAndFloat>(decoder, this, &WebPage::sendDoubleAndFloat);
+        return;
+    }
+    if (decoder.messageName() == Messages::WebPage::SendInts::name()) {
+        IPC::handleMessage<Messages::WebPage::SendInts>(decoder, this, &WebPage::sendInts);
+        return;
+    }
+    if (decoder.messageName() == Messages::WebPage::TestParameterAttributes::name()) {
+        IPC::handleMessage<Messages::WebPage::TestParameterAttributes>(decoder, this, &WebPage::testParameterAttributes);
+        return;
+    }
+    if (decoder.messageName() == Messages::WebPage::TemplateTest::name()) {
+        IPC::handleMessage<Messages::WebPage::TemplateTest>(decoder, this, &WebPage::templateTest);
+        return;
+    }
+#if PLATFORM(MAC)
+    if (decoder.messageName() == Messages::WebPage::DidCreateWebProcessConnection::name()) {
+        IPC::handleMessage<Messages::WebPage::DidCreateWebProcessConnection>(decoder, this, &WebPage::didCreateWebProcessConnection);
+        return;
+    }
+#endif
+#if ENABLE(DEPRECATED_FEATURE)
+    if (decoder.messageName() == Messages::WebPage::DeprecatedOperation::name()) {
+        IPC::handleMessage<Messages::WebPage::DeprecatedOperation>(decoder, this, &WebPage::deprecatedOperation);
+        return;
+    }
+#endif
+#if ENABLE(EXPERIMENTAL_FEATURE)
+    if (decoder.messageName() == Messages::WebPage::ExperimentalOperation::name()) {
+        IPC::handleMessage<Messages::WebPage::ExperimentalOperation>(decoder, this, &WebPage::experimentalOperation);
+        return;
+    }
+#endif
+    ASSERT_NOT_REACHED();
+}
+
+void WebPage::didReceiveSyncWebPageMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder, std::unique_ptr<IPC::MessageEncoder>& replyEncoder)
+{
+    if (decoder.messageName() == Messages::WebPage::CreatePlugin::name()) {
+        IPC::handleMessage<Messages::WebPage::CreatePlugin>(decoder, *replyEncoder, this, &WebPage::createPlugin);
+        return;
+    }
+    if (decoder.messageName() == Messages::WebPage::RunJavaScriptAlert::name()) {
+        IPC::handleMessage<Messages::WebPage::RunJavaScriptAlert>(decoder, *replyEncoder, this, &WebPage::runJavaScriptAlert);
+        return;
+    }
+    if (decoder.messageName() == Messages::WebPage::GetPlugins::name()) {
+        IPC::handleMessage<Messages::WebPage::GetPlugins>(decoder, *replyEncoder, this, &WebPage::getPlugins);
+        return;
+    }
+    if (decoder.messageName() == Messages::WebPage::GetPluginProcessConnection::name()) {
+        IPC::handleMessageDelayed<Messages::WebPage::GetPluginProcessConnection>(connection, decoder, replyEncoder, this, &WebPage::getPluginProcessConnection);
+        return;
+    }
+    if (decoder.messageName() == Messages::WebPage::TestMultipleAttributes::name()) {
+        IPC::handleMessageDelayed<Messages::WebPage::TestMultipleAttributes>(connection, decoder, replyEncoder, this, &WebPage::testMultipleAttributes);
+        return;
+    }
+#if PLATFORM(MAC)
+    if (decoder.messageName() == Messages::WebPage::InterpretKeyEvent::name()) {
+        IPC::handleMessage<Messages::WebPage::InterpretKeyEvent>(decoder, *replyEncoder, this, &WebPage::interpretKeyEvent);
+        return;
+    }
+#endif
+    ASSERT_NOT_REACHED();
+}
+
+} // namespace WebKit
+
+#endif // (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))

Added: trunk/Source/WebKit2/Scripts/webkit2/LegacyMessages-expected.h (0 => 161473)


--- trunk/Source/WebKit2/Scripts/webkit2/LegacyMessages-expected.h	                        (rev 0)
+++ trunk/Source/WebKit2/Scripts/webkit2/LegacyMessages-expected.h	2014-01-08 01:03:46 UTC (rev 161473)
@@ -0,0 +1,567 @@
+/*
+ * 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.
+ */
+
+#ifndef WebPageMessages_h
+#define WebPageMessages_h
+
+#if (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
+
+#include "Arguments.h"
+#include "Connection.h"
+#include "MessageEncoder.h"
+#include "Plugin.h"
+#include "StringReference.h"
+#include <WebCore/KeyboardEvent.h>
+#include <WebCore/PluginData.h>
+#include <utility>
+#include <wtf/HashMap.h>
+#include <wtf/ThreadSafeRefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace IPC {
+    class Connection;
+    class DummyType;
+    class MachPort;
+}
+
+namespace WTF {
+    class String;
+}
+
+namespace WebKit {
+    struct WebPreferencesStore;
+    class WebTouchEvent;
+}
+
+namespace Messages {
+namespace WebPage {
+
+static inline IPC::StringReference messageReceiverName()
+{
+    return IPC::StringReference("WebPage");
+}
+
+class LoadURL {
+public:
+    typedef std::tuple<String> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("LoadURL"); }
+    static const bool isSync = false;
+
+    explicit LoadURL(const String& url)
+        : m_arguments(url)
+    {
+    }
+
+    const std::tuple<const String&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<const String&> m_arguments;
+};
+
+#if ENABLE(TOUCH_EVENTS)
+class LoadSomething {
+public:
+    typedef std::tuple<String> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("LoadSomething"); }
+    static const bool isSync = false;
+
+    explicit LoadSomething(const String& url)
+        : m_arguments(url)
+    {
+    }
+
+    const std::tuple<const String&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<const String&> m_arguments;
+};
+#endif
+
+#if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))
+class TouchEvent {
+public:
+    typedef std::tuple<WebKit::WebTouchEvent> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("TouchEvent"); }
+    static const bool isSync = false;
+
+    explicit TouchEvent(const WebKit::WebTouchEvent& event)
+        : m_arguments(event)
+    {
+    }
+
+    const std::tuple<const WebKit::WebTouchEvent&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<const WebKit::WebTouchEvent&> m_arguments;
+};
+#endif
+
+#if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION))
+class AddEvent {
+public:
+    typedef std::tuple<WebKit::WebTouchEvent> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("AddEvent"); }
+    static const bool isSync = false;
+
+    explicit AddEvent(const WebKit::WebTouchEvent& event)
+        : m_arguments(event)
+    {
+    }
+
+    const std::tuple<const WebKit::WebTouchEvent&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<const WebKit::WebTouchEvent&> m_arguments;
+};
+#endif
+
+#if ENABLE(TOUCH_EVENTS)
+class LoadSomethingElse {
+public:
+    typedef std::tuple<String> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("LoadSomethingElse"); }
+    static const bool isSync = false;
+
+    explicit LoadSomethingElse(const String& url)
+        : m_arguments(url)
+    {
+    }
+
+    const std::tuple<const String&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<const String&> m_arguments;
+};
+#endif
+
+class DidReceivePolicyDecision {
+public:
+    typedef std::tuple<uint64_t, uint64_t, uint32_t> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("DidReceivePolicyDecision"); }
+    static const bool isSync = false;
+
+    DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction)
+        : m_arguments(frameID, listenerID, policyAction)
+    {
+    }
+
+    const std::tuple<uint64_t, uint64_t, uint32_t> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<uint64_t, uint64_t, uint32_t> m_arguments;
+};
+
+class Close {
+public:
+    typedef std::tuple<> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("Close"); }
+    static const bool isSync = false;
+
+    const std::tuple<> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<> m_arguments;
+};
+
+class PreferencesDidChange {
+public:
+    typedef std::tuple<WebKit::WebPreferencesStore> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("PreferencesDidChange"); }
+    static const bool isSync = false;
+
+    explicit PreferencesDidChange(const WebKit::WebPreferencesStore& store)
+        : m_arguments(store)
+    {
+    }
+
+    const std::tuple<const WebKit::WebPreferencesStore&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<const WebKit::WebPreferencesStore&> m_arguments;
+};
+
+class SendDoubleAndFloat {
+public:
+    typedef std::tuple<double, float> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("SendDoubleAndFloat"); }
+    static const bool isSync = false;
+
+    SendDoubleAndFloat(double d, float f)
+        : m_arguments(d, f)
+    {
+    }
+
+    const std::tuple<double, float> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<double, float> m_arguments;
+};
+
+class SendInts {
+public:
+    typedef std::tuple<Vector<uint64_t>, Vector<Vector<uint64_t>>> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("SendInts"); }
+    static const bool isSync = false;
+
+    SendInts(const Vector<uint64_t>& ints, const Vector<Vector<uint64_t>>& intVectors)
+        : m_arguments(ints, intVectors)
+    {
+    }
+
+    const std::tuple<const Vector<uint64_t>&, const Vector<Vector<uint64_t>>&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<const Vector<uint64_t>&, const Vector<Vector<uint64_t>>&> m_arguments;
+};
+
+class CreatePlugin {
+public:
+    typedef std::tuple<uint64_t, WebKit::Plugin::Parameters> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("CreatePlugin"); }
+    static const bool isSync = true;
+
+    typedef IPC::Arguments1<bool&> Reply;
+    CreatePlugin(uint64_t pluginInstanceID, const WebKit::Plugin::Parameters& parameters)
+        : m_arguments(pluginInstanceID, parameters)
+    {
+    }
+
+    const std::tuple<uint64_t, const WebKit::Plugin::Parameters&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<uint64_t, const WebKit::Plugin::Parameters&> m_arguments;
+};
+
+class RunJavaScriptAlert {
+public:
+    typedef std::tuple<uint64_t, String> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("RunJavaScriptAlert"); }
+    static const bool isSync = true;
+
+    typedef IPC::Arguments0 Reply;
+    RunJavaScriptAlert(uint64_t frameID, const String& message)
+        : m_arguments(frameID, message)
+    {
+    }
+
+    const std::tuple<uint64_t, const String&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<uint64_t, const String&> m_arguments;
+};
+
+class GetPlugins {
+public:
+    typedef std::tuple<bool> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("GetPlugins"); }
+    static const bool isSync = true;
+
+    typedef IPC::Arguments1<Vector<WebCore::PluginInfo>&> Reply;
+    explicit GetPlugins(bool refresh)
+        : m_arguments(refresh)
+    {
+    }
+
+    const std::tuple<bool> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<bool> m_arguments;
+};
+
+class GetPluginProcessConnection {
+public:
+    typedef std::tuple<String> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("GetPluginProcessConnection"); }
+    static const bool isSync = true;
+
+    struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> {
+        DelayedReply(PassRefPtr<IPC::Connection>, std::unique_ptr<IPC::MessageEncoder>);
+        ~DelayedReply();
+
+        bool send(const IPC::Connection::Handle& connectionHandle);
+
+    private:
+        RefPtr<IPC::Connection> m_connection;
+        std::unique_ptr<IPC::MessageEncoder> m_encoder;
+    };
+
+    typedef IPC::Arguments1<IPC::Connection::Handle&> Reply;
+    explicit GetPluginProcessConnection(const String& pluginPath)
+        : m_arguments(pluginPath)
+    {
+    }
+
+    const std::tuple<const String&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<const String&> m_arguments;
+};
+
+class TestMultipleAttributes {
+public:
+    typedef std::tuple<> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("TestMultipleAttributes"); }
+    static const bool isSync = true;
+
+    struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> {
+        DelayedReply(PassRefPtr<IPC::Connection>, std::unique_ptr<IPC::MessageEncoder>);
+        ~DelayedReply();
+
+        bool send();
+
+    private:
+        RefPtr<IPC::Connection> m_connection;
+        std::unique_ptr<IPC::MessageEncoder> m_encoder;
+    };
+
+    typedef IPC::Arguments0 Reply;
+    const std::tuple<> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<> m_arguments;
+};
+
+class TestParameterAttributes {
+public:
+    typedef std::tuple<uint64_t, double, double> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("TestParameterAttributes"); }
+    static const bool isSync = false;
+
+    TestParameterAttributes(uint64_t foo, double bar, double baz)
+        : m_arguments(foo, bar, baz)
+    {
+    }
+
+    const std::tuple<uint64_t, double, double> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<uint64_t, double, double> m_arguments;
+};
+
+class TemplateTest {
+public:
+    typedef std::tuple<HashMap<String, std::pair<String, uint64_t>>> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("TemplateTest"); }
+    static const bool isSync = false;
+
+    explicit TemplateTest(const HashMap<String, std::pair<String, uint64_t>>& a)
+        : m_arguments(a)
+    {
+    }
+
+    const std::tuple<const HashMap<String, std::pair<String, uint64_t>>&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<const HashMap<String, std::pair<String, uint64_t>>&> m_arguments;
+};
+
+#if PLATFORM(MAC)
+class DidCreateWebProcessConnection {
+public:
+    typedef std::tuple<IPC::MachPort> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("DidCreateWebProcessConnection"); }
+    static const bool isSync = false;
+
+    explicit DidCreateWebProcessConnection(const IPC::MachPort& connectionIdentifier)
+        : m_arguments(connectionIdentifier)
+    {
+    }
+
+    const std::tuple<const IPC::MachPort&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<const IPC::MachPort&> m_arguments;
+};
+#endif
+
+#if PLATFORM(MAC)
+class InterpretKeyEvent {
+public:
+    typedef std::tuple<uint32_t> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("InterpretKeyEvent"); }
+    static const bool isSync = true;
+
+    typedef IPC::Arguments1<Vector<WebCore::KeypressCommand>&> Reply;
+    explicit InterpretKeyEvent(uint32_t type)
+        : m_arguments(type)
+    {
+    }
+
+    const std::tuple<uint32_t> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<uint32_t> m_arguments;
+};
+#endif
+
+#if ENABLE(DEPRECATED_FEATURE)
+class DeprecatedOperation {
+public:
+    typedef std::tuple<IPC::DummyType> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("DeprecatedOperation"); }
+    static const bool isSync = false;
+
+    explicit DeprecatedOperation(const IPC::DummyType& dummy)
+        : m_arguments(dummy)
+    {
+    }
+
+    const std::tuple<const IPC::DummyType&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<const IPC::DummyType&> m_arguments;
+};
+#endif
+
+#if ENABLE(EXPERIMENTAL_FEATURE)
+class ExperimentalOperation {
+public:
+    typedef std::tuple<IPC::DummyType> DecodeType;
+
+    static IPC::StringReference receiverName() { return messageReceiverName(); }
+    static IPC::StringReference name() { return IPC::StringReference("ExperimentalOperation"); }
+    static const bool isSync = false;
+
+    explicit ExperimentalOperation(const IPC::DummyType& dummy)
+        : m_arguments(dummy)
+    {
+    }
+
+    const std::tuple<const IPC::DummyType&> arguments() const
+    {
+        return m_arguments;
+    }
+
+private:
+    std::tuple<const IPC::DummyType&> m_arguments;
+};
+#endif
+
+} // namespace WebPage
+} // namespace Messages
+
+#endif // (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
+
+#endif // WebPageMessages_h
Property changes on: trunk/Source/WebKit2/Scripts/webkit2/LegacyMessages-expected.h
___________________________________________________________________

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebKit2/Scripts/webkit2/MessageReceiver-expected.cpp (161472 => 161473)


--- trunk/Source/WebKit2/Scripts/webkit2/MessageReceiver-expected.cpp	2014-01-08 01:03:44 UTC (rev 161472)
+++ trunk/Source/WebKit2/Scripts/webkit2/MessageReceiver-expected.cpp	2014-01-08 01:03:46 UTC (rev 161473)
@@ -103,7 +103,7 @@
 
 namespace WebKit {
 
-void WebPage::didReceiveWebPageMessage(IPC::Connection*, IPC::MessageDecoder& decoder)
+void WebPage::didReceiveMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder)
 {
     if (decoder.messageName() == Messages::WebPage::LoadURL::name()) {
         IPC::handleMessage<Messages::WebPage::LoadURL>(decoder, this, &WebPage::loadURL);
@@ -179,10 +179,11 @@
         return;
     }
 #endif
+    UNUSED_PARAM(connection);
     ASSERT_NOT_REACHED();
 }
 
-void WebPage::didReceiveSyncWebPageMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder, std::unique_ptr<IPC::MessageEncoder>& replyEncoder)
+void WebPage::didReceiveSyncMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder, std::unique_ptr<IPC::MessageEncoder>& replyEncoder)
 {
     if (decoder.messageName() == Messages::WebPage::CreatePlugin::name()) {
         IPC::handleMessage<Messages::WebPage::CreatePlugin>(decoder, *replyEncoder, this, &WebPage::createPlugin);
@@ -210,6 +211,7 @@
         return;
     }
 #endif
+    UNUSED_PARAM(connection);
     ASSERT_NOT_REACHED();
 }
 

Modified: trunk/Source/WebKit2/Scripts/webkit2/messages_unittest.py (161472 => 161473)


--- trunk/Source/WebKit2/Scripts/webkit2/messages_unittest.py	2014-01-08 01:03:44 UTC (rev 161472)
+++ trunk/Source/WebKit2/Scripts/webkit2/messages_unittest.py	2014-01-08 01:03:46 UTC (rev 161473)
@@ -31,15 +31,24 @@
 
 script_directory = os.path.dirname(os.path.realpath(__file__))
 
+with open(os.path.join(script_directory, 'test-legacy-messages.in')) as file:
+    _legacy_messages_file_contents = file.read()
+
 with open(os.path.join(script_directory, 'test-messages.in')) as file:
     _messages_file_contents = file.read()
 
+with open(os.path.join(script_directory, 'LegacyMessages-expected.h')) as file:
+    _expected_legacy_receiver_header = file.read()
+
 with open(os.path.join(script_directory, 'Messages-expected.h')) as file:
-    _expected_header = file.read()
+    _expected_receiver_header = file.read()
 
 with open(os.path.join(script_directory, 'MessageReceiver-expected.cpp')) as file:
     _expected_receiver_implementation = file.read()
 
+with open(os.path.join(script_directory, 'LegacyMessageReceiver-expected.cpp')) as file:
+    _expected_legacy_receiver_implementation = file.read()
+
 _expected_results = {
     'name': 'WebPage',
     'conditions': ('(ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))'),
@@ -218,6 +227,7 @@
 class MessagesTest(unittest.TestCase):
     def setUp(self):
         self.receiver = parser.parse(StringIO(_messages_file_contents))
+        self.legacy_receiver = parser.parse(StringIO(_legacy_messages_file_contents))
 
 
 class ParsingTest(MessagesTest):
@@ -250,8 +260,14 @@
         for index, message in enumerate(self.receiver.messages):
             self.check_message(message, _expected_results['messages'][index])
 
+        self.assertEquals(self.legacy_receiver.name, _expected_results['name'])
+        self.assertEquals(self.legacy_receiver.condition, _expected_results['conditions'])
+        self.assertEquals(len(self.legacy_receiver.messages), len(_expected_results['messages']))
+        for index, message in enumerate(self.legacy_receiver.messages):
+            self.check_message(message, _expected_results['messages'][index])
 
 
+
 class GeneratedFileContentsTest(unittest.TestCase):
     def assertGeneratedFileContentsEqual(self, first, second):
         first_list = first.split('\n')
@@ -265,12 +281,18 @@
 
 class HeaderTest(GeneratedFileContentsTest):
     def test_header(self):
+        legacy_file_contents = messages.generate_messages_header(StringIO(_legacy_messages_file_contents))
+        self.assertGeneratedFileContentsEqual(legacy_file_contents, _expected_legacy_receiver_header)
+
         file_contents = messages.generate_messages_header(StringIO(_messages_file_contents))
-        self.assertGeneratedFileContentsEqual(file_contents, _expected_header)
+        self.assertGeneratedFileContentsEqual(file_contents, _expected_receiver_header)
 
 
 class ReceiverImplementationTest(GeneratedFileContentsTest):
     def test_receiver_implementation(self):
+        legacy_file_contents = messages.generate_message_handler(StringIO(_legacy_messages_file_contents))
+        self.assertGeneratedFileContentsEqual(legacy_file_contents, _expected_legacy_receiver_implementation)
+
         file_contents = messages.generate_message_handler(StringIO(_messages_file_contents))
         self.assertGeneratedFileContentsEqual(file_contents, _expected_receiver_implementation)
 

Copied: trunk/Source/WebKit2/Scripts/webkit2/test-legacy-messages.in (from rev 161472, trunk/Source/WebKit2/Scripts/webkit2/test-messages.in) (0 => 161473)


--- trunk/Source/WebKit2/Scripts/webkit2/test-legacy-messages.in	                        (rev 0)
+++ trunk/Source/WebKit2/Scripts/webkit2/test-legacy-messages.in	2014-01-08 01:03:46 UTC (rev 161473)
@@ -0,0 +1,75 @@
+# 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)
+#if NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND
+
+messages -> WebPage LegacyReceiver {
+    LoadURL(String url)
+#if ENABLE(TOUCH_EVENTS)
+    LoadSomething(String url)
+#if NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION
+    TouchEvent(WebKit::WebTouchEvent event)
+#endif
+#if NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION
+    AddEvent(WebKit::WebTouchEvent event)
+#endif
+    LoadSomethingElse(String url)
+#endif
+    DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction)
+    Close()
+
+    PreferencesDidChange(WebKit::WebPreferencesStore store)
+    SendDoubleAndFloat(double d, float f)
+    SendInts(Vector<uint64_t> ints, Vector<Vector<uint64_t>> intVectors)
+
+    CreatePlugin(uint64_t pluginInstanceID, WebKit::Plugin::Parameters parameters) -> (bool result)
+    RunJavaScriptAlert(uint64_t frameID, String message) -> ()
+    GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins)
+    GetPluginProcessConnection(String pluginPath) -> (IPC::Connection::Handle connectionHandle) Delayed
+
+    TestMultipleAttributes() -> () WantsConnection Delayed
+
+    TestParameterAttributes([AttributeOne AttributeTwo] uint64_t foo, double bar, [AttributeThree] double baz)
+
+    TemplateTest(HashMap<String, std::pair<String, uint64_t>> a)
+
+#if PLATFORM(MAC)
+    DidCreateWebProcessConnection(IPC::MachPort connectionIdentifier)
+#endif
+
+#if PLATFORM(MAC)
+    # Keyboard support
+    InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName)
+#endif
+
+#if ENABLE(DEPRECATED_FEATURE)
+    DeprecatedOperation(IPC::DummyType dummy)
+#endif
+
+#if ENABLE(EXPERIMENTAL_FEATURE)
+    ExperimentalOperation(IPC::DummyType dummy)
+#endif
+}
+
+#endif
+#endif

Modified: trunk/Source/WebKit2/Scripts/webkit2/test-messages.in (161472 => 161473)


--- trunk/Source/WebKit2/Scripts/webkit2/test-messages.in	2014-01-08 01:03:44 UTC (rev 161472)
+++ trunk/Source/WebKit2/Scripts/webkit2/test-messages.in	2014-01-08 01:03:46 UTC (rev 161473)
@@ -23,7 +23,7 @@
 #if ENABLE(WEBKIT2)
 #if NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND
 
-messages -> WebPage LegacyReceiver {
+messages -> WebPage {
     LoadURL(String url)
 #if ENABLE(TOUCH_EVENTS)
     LoadSomething(String url)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to