Changeset 161472 in webkit


Ignore:
Timestamp:
Jan 7, 2014 5:03:44 PM (10 years ago)
Author:
Simon Fraser
Message:

Move expected results out of messages_unittest.py into separate files
https://bugs.webkit.org/show_bug.cgi?id=126602

Reviewed by Anders Carlsson.

Uninline the test input and output from messages_unittest.py to make
it easier to add more tests.

  • Scripts/webkit2/MessageReceiver-expected.cpp: Added.

(WebKit::WebPage::didReceiveWebPageMessage):
(WebKit::WebPage::didReceiveSyncWebPageMessage):

  • Scripts/webkit2/Messages-expected.h: Added.
  • Scripts/webkit2/messages_unittest.py:

(ParsingTest.test_receiver):

  • Scripts/webkit2/test-messages.in: Added.
Location:
trunk/Source/WebKit2
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r161452 r161472  
     12014-01-07  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Move expected results out of messages_unittest.py into separate files
     4        https://bugs.webkit.org/show_bug.cgi?id=126602
     5
     6        Reviewed by Anders Carlsson.
     7       
     8        Uninline the test input and output from messages_unittest.py to make
     9        it easier to add more tests.
     10
     11        * Scripts/webkit2/MessageReceiver-expected.cpp: Added.
     12        (WebKit::WebPage::didReceiveWebPageMessage):
     13        (WebKit::WebPage::didReceiveSyncWebPageMessage):
     14        * Scripts/webkit2/Messages-expected.h: Added.
     15        * Scripts/webkit2/messages_unittest.py:
     16        (ParsingTest.test_receiver):
     17        * Scripts/webkit2/test-messages.in: Added.
     18
    1192014-01-07  Commit Queue  <commit-queue@webkit.org>
    220
  • trunk/Source/WebKit2/Scripts/webkit2/messages_unittest.py

    r161148 r161472  
    2121# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2222
     23import os
    2324import unittest
    2425from StringIO import StringIO
     
    2728import parser
    2829
    29 _messages_file_contents = """# Copyright (C) 2010 Apple Inc. All rights reserved.
    30 #
    31 # Redistribution and use in source and binary forms, with or without
    32 # modification, are permitted provided that the following conditions
    33 # are met:
    34 # 1.  Redistributions of source code must retain the above copyright
    35 #     notice, this list of conditions and the following disclaimer.
    36 # 2.  Redistributions in binary form must reproduce the above copyright
    37 #     notice, this list of conditions and the following disclaimer in the
    38 #     documentation and/or other materials provided with the distribution.
    39 #
    40 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
    41 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    42 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    43 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
    44 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    45 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    46 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    47 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    48 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    49 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    50 
    51 #if ENABLE(WEBKIT2)
    52 #if NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND
    53 
    54 messages -> WebPage LegacyReceiver {
    55     LoadURL(String url)
    56 #if ENABLE(TOUCH_EVENTS)
    57     LoadSomething(String url)
    58 #if NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION
    59     TouchEvent(WebKit::WebTouchEvent event)
    60 #endif
    61 #if NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION
    62     AddEvent(WebKit::WebTouchEvent event)
    63 #endif
    64     LoadSomethingElse(String url)
    65 #endif
    66     DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction)
    67     Close()
    68 
    69     PreferencesDidChange(WebKit::WebPreferencesStore store)
    70     SendDoubleAndFloat(double d, float f)
    71     SendInts(Vector<uint64_t> ints, Vector<Vector<uint64_t>> intVectors)
    72 
    73     CreatePlugin(uint64_t pluginInstanceID, WebKit::Plugin::Parameters parameters) -> (bool result)
    74     RunJavaScriptAlert(uint64_t frameID, String message) -> ()
    75     GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins)
    76     GetPluginProcessConnection(String pluginPath) -> (IPC::Connection::Handle connectionHandle) Delayed
    77 
    78     TestMultipleAttributes() -> () WantsConnection Delayed
    79 
    80     TestParameterAttributes([AttributeOne AttributeTwo] uint64_t foo, double bar, [AttributeThree] double baz)
    81 
    82     TemplateTest(HashMap<String, std::pair<String, uint64_t>> a)
    83 
    84 #if PLATFORM(MAC)
    85     DidCreateWebProcessConnection(IPC::MachPort connectionIdentifier)
    86 #endif
    87 
    88 #if PLATFORM(MAC)
    89     # Keyboard support
    90     InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName)
    91 #endif
    92 
    93 #if ENABLE(DEPRECATED_FEATURE)
    94     DeprecatedOperation(IPC::DummyType dummy)
    95 #endif
    96 
    97 #if ENABLE(EXPERIMENTAL_FEATURE)
    98     ExperimentalOperation(IPC::DummyType dummy)
    99 #endif
    100 }
    101 
    102 #endif
    103 #endif
    104 """
     30print os.getcwd()
     31
     32script_directory = os.path.dirname(os.path.realpath(__file__))
     33
     34with open(os.path.join(script_directory, 'test-messages.in')) as file:
     35    _messages_file_contents = file.read()
     36
     37with open(os.path.join(script_directory, 'Messages-expected.h')) as file:
     38    _expected_header = file.read()
     39
     40with open(os.path.join(script_directory, 'MessageReceiver-expected.cpp')) as file:
     41    _expected_receiver_implementation = file.read()
    10542
    10643_expected_results = {
     
    314251            self.check_message(message, _expected_results['messages'][index])
    315252
    316 _expected_header = """/*
    317  * Copyright (C) 2010 Apple Inc. All rights reserved.
    318  *
    319  * Redistribution and use in source and binary forms, with or without
    320  * modification, are permitted provided that the following conditions
    321  * are met:
    322  * 1.  Redistributions of source code must retain the above copyright
    323  *     notice, this list of conditions and the following disclaimer.
    324  * 2.  Redistributions in binary form must reproduce the above copyright
    325  *     notice, this list of conditions and the following disclaimer in the
    326  *     documentation and/or other materials provided with the distribution.
    327  *
    328  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
    329  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    330  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    331  * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
    332  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    333  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    334  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    335  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    336  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    337  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    338  */
    339 
    340 #ifndef WebPageMessages_h
    341 #define WebPageMessages_h
    342 
    343 #if (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
    344 
    345 #include "Arguments.h"
    346 #include "Connection.h"
    347 #include "MessageEncoder.h"
    348 #include "Plugin.h"
    349 #include "StringReference.h"
    350 #include <WebCore/KeyboardEvent.h>
    351 #include <WebCore/PluginData.h>
    352 #include <utility>
    353 #include <wtf/HashMap.h>
    354 #include <wtf/ThreadSafeRefCounted.h>
    355 #include <wtf/Vector.h>
    356 #include <wtf/text/WTFString.h>
    357 
    358 namespace IPC {
    359     class Connection;
    360     class DummyType;
    361     class MachPort;
    362 }
    363 
    364 namespace WTF {
    365     class String;
    366 }
    367 
    368 namespace WebKit {
    369     struct WebPreferencesStore;
    370     class WebTouchEvent;
    371 }
    372 
    373 namespace Messages {
    374 namespace WebPage {
    375 
    376 static inline IPC::StringReference messageReceiverName()
    377 {
    378     return IPC::StringReference("WebPage");
    379 }
    380 
    381 class LoadURL {
    382 public:
    383     typedef std::tuple<String> DecodeType;
    384 
    385     static IPC::StringReference receiverName() { return messageReceiverName(); }
    386     static IPC::StringReference name() { return IPC::StringReference("LoadURL"); }
    387     static const bool isSync = false;
    388 
    389     explicit LoadURL(const String& url)
    390         : m_arguments(url)
    391     {
    392     }
    393 
    394     const std::tuple<const String&> arguments() const
    395     {
    396         return m_arguments;
    397     }
    398 
    399 private:
    400     std::tuple<const String&> m_arguments;
    401 };
    402 
    403 #if ENABLE(TOUCH_EVENTS)
    404 class LoadSomething {
    405 public:
    406     typedef std::tuple<String> DecodeType;
    407 
    408     static IPC::StringReference receiverName() { return messageReceiverName(); }
    409     static IPC::StringReference name() { return IPC::StringReference("LoadSomething"); }
    410     static const bool isSync = false;
    411 
    412     explicit LoadSomething(const String& url)
    413         : m_arguments(url)
    414     {
    415     }
    416 
    417     const std::tuple<const String&> arguments() const
    418     {
    419         return m_arguments;
    420     }
    421 
    422 private:
    423     std::tuple<const String&> m_arguments;
    424 };
    425 #endif
    426 
    427 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))
    428 class TouchEvent {
    429 public:
    430     typedef std::tuple<WebKit::WebTouchEvent> DecodeType;
    431 
    432     static IPC::StringReference receiverName() { return messageReceiverName(); }
    433     static IPC::StringReference name() { return IPC::StringReference("TouchEvent"); }
    434     static const bool isSync = false;
    435 
    436     explicit TouchEvent(const WebKit::WebTouchEvent& event)
    437         : m_arguments(event)
    438     {
    439     }
    440 
    441     const std::tuple<const WebKit::WebTouchEvent&> arguments() const
    442     {
    443         return m_arguments;
    444     }
    445 
    446 private:
    447     std::tuple<const WebKit::WebTouchEvent&> m_arguments;
    448 };
    449 #endif
    450 
    451 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION))
    452 class AddEvent {
    453 public:
    454     typedef std::tuple<WebKit::WebTouchEvent> DecodeType;
    455 
    456     static IPC::StringReference receiverName() { return messageReceiverName(); }
    457     static IPC::StringReference name() { return IPC::StringReference("AddEvent"); }
    458     static const bool isSync = false;
    459 
    460     explicit AddEvent(const WebKit::WebTouchEvent& event)
    461         : m_arguments(event)
    462     {
    463     }
    464 
    465     const std::tuple<const WebKit::WebTouchEvent&> arguments() const
    466     {
    467         return m_arguments;
    468     }
    469 
    470 private:
    471     std::tuple<const WebKit::WebTouchEvent&> m_arguments;
    472 };
    473 #endif
    474 
    475 #if ENABLE(TOUCH_EVENTS)
    476 class LoadSomethingElse {
    477 public:
    478     typedef std::tuple<String> DecodeType;
    479 
    480     static IPC::StringReference receiverName() { return messageReceiverName(); }
    481     static IPC::StringReference name() { return IPC::StringReference("LoadSomethingElse"); }
    482     static const bool isSync = false;
    483 
    484     explicit LoadSomethingElse(const String& url)
    485         : m_arguments(url)
    486     {
    487     }
    488 
    489     const std::tuple<const String&> arguments() const
    490     {
    491         return m_arguments;
    492     }
    493 
    494 private:
    495     std::tuple<const String&> m_arguments;
    496 };
    497 #endif
    498 
    499 class DidReceivePolicyDecision {
    500 public:
    501     typedef std::tuple<uint64_t, uint64_t, uint32_t> DecodeType;
    502 
    503     static IPC::StringReference receiverName() { return messageReceiverName(); }
    504     static IPC::StringReference name() { return IPC::StringReference("DidReceivePolicyDecision"); }
    505     static const bool isSync = false;
    506 
    507     DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction)
    508         : m_arguments(frameID, listenerID, policyAction)
    509     {
    510     }
    511 
    512     const std::tuple<uint64_t, uint64_t, uint32_t> arguments() const
    513     {
    514         return m_arguments;
    515     }
    516 
    517 private:
    518     std::tuple<uint64_t, uint64_t, uint32_t> m_arguments;
    519 };
    520 
    521 class Close {
    522 public:
    523     typedef std::tuple<> DecodeType;
    524 
    525     static IPC::StringReference receiverName() { return messageReceiverName(); }
    526     static IPC::StringReference name() { return IPC::StringReference("Close"); }
    527     static const bool isSync = false;
    528 
    529     const std::tuple<> arguments() const
    530     {
    531         return m_arguments;
    532     }
    533 
    534 private:
    535     std::tuple<> m_arguments;
    536 };
    537 
    538 class PreferencesDidChange {
    539 public:
    540     typedef std::tuple<WebKit::WebPreferencesStore> DecodeType;
    541 
    542     static IPC::StringReference receiverName() { return messageReceiverName(); }
    543     static IPC::StringReference name() { return IPC::StringReference("PreferencesDidChange"); }
    544     static const bool isSync = false;
    545 
    546     explicit PreferencesDidChange(const WebKit::WebPreferencesStore& store)
    547         : m_arguments(store)
    548     {
    549     }
    550 
    551     const std::tuple<const WebKit::WebPreferencesStore&> arguments() const
    552     {
    553         return m_arguments;
    554     }
    555 
    556 private:
    557     std::tuple<const WebKit::WebPreferencesStore&> m_arguments;
    558 };
    559 
    560 class SendDoubleAndFloat {
    561 public:
    562     typedef std::tuple<double, float> DecodeType;
    563 
    564     static IPC::StringReference receiverName() { return messageReceiverName(); }
    565     static IPC::StringReference name() { return IPC::StringReference("SendDoubleAndFloat"); }
    566     static const bool isSync = false;
    567 
    568     SendDoubleAndFloat(double d, float f)
    569         : m_arguments(d, f)
    570     {
    571     }
    572 
    573     const std::tuple<double, float> arguments() const
    574     {
    575         return m_arguments;
    576     }
    577 
    578 private:
    579     std::tuple<double, float> m_arguments;
    580 };
    581 
    582 class SendInts {
    583 public:
    584     typedef std::tuple<Vector<uint64_t>, Vector<Vector<uint64_t>>> DecodeType;
    585 
    586     static IPC::StringReference receiverName() { return messageReceiverName(); }
    587     static IPC::StringReference name() { return IPC::StringReference("SendInts"); }
    588     static const bool isSync = false;
    589 
    590     SendInts(const Vector<uint64_t>& ints, const Vector<Vector<uint64_t>>& intVectors)
    591         : m_arguments(ints, intVectors)
    592     {
    593     }
    594 
    595     const std::tuple<const Vector<uint64_t>&, const Vector<Vector<uint64_t>>&> arguments() const
    596     {
    597         return m_arguments;
    598     }
    599 
    600 private:
    601     std::tuple<const Vector<uint64_t>&, const Vector<Vector<uint64_t>>&> m_arguments;
    602 };
    603 
    604 class CreatePlugin {
    605 public:
    606     typedef std::tuple<uint64_t, WebKit::Plugin::Parameters> DecodeType;
    607 
    608     static IPC::StringReference receiverName() { return messageReceiverName(); }
    609     static IPC::StringReference name() { return IPC::StringReference("CreatePlugin"); }
    610     static const bool isSync = true;
    611 
    612     typedef IPC::Arguments1<bool&> Reply;
    613     CreatePlugin(uint64_t pluginInstanceID, const WebKit::Plugin::Parameters& parameters)
    614         : m_arguments(pluginInstanceID, parameters)
    615     {
    616     }
    617 
    618     const std::tuple<uint64_t, const WebKit::Plugin::Parameters&> arguments() const
    619     {
    620         return m_arguments;
    621     }
    622 
    623 private:
    624     std::tuple<uint64_t, const WebKit::Plugin::Parameters&> m_arguments;
    625 };
    626 
    627 class RunJavaScriptAlert {
    628 public:
    629     typedef std::tuple<uint64_t, String> DecodeType;
    630 
    631     static IPC::StringReference receiverName() { return messageReceiverName(); }
    632     static IPC::StringReference name() { return IPC::StringReference("RunJavaScriptAlert"); }
    633     static const bool isSync = true;
    634 
    635     typedef IPC::Arguments0 Reply;
    636     RunJavaScriptAlert(uint64_t frameID, const String& message)
    637         : m_arguments(frameID, message)
    638     {
    639     }
    640 
    641     const std::tuple<uint64_t, const String&> arguments() const
    642     {
    643         return m_arguments;
    644     }
    645 
    646 private:
    647     std::tuple<uint64_t, const String&> m_arguments;
    648 };
    649 
    650 class GetPlugins {
    651 public:
    652     typedef std::tuple<bool> DecodeType;
    653 
    654     static IPC::StringReference receiverName() { return messageReceiverName(); }
    655     static IPC::StringReference name() { return IPC::StringReference("GetPlugins"); }
    656     static const bool isSync = true;
    657 
    658     typedef IPC::Arguments1<Vector<WebCore::PluginInfo>&> Reply;
    659     explicit GetPlugins(bool refresh)
    660         : m_arguments(refresh)
    661     {
    662     }
    663 
    664     const std::tuple<bool> arguments() const
    665     {
    666         return m_arguments;
    667     }
    668 
    669 private:
    670     std::tuple<bool> m_arguments;
    671 };
    672 
    673 class GetPluginProcessConnection {
    674 public:
    675     typedef std::tuple<String> DecodeType;
    676 
    677     static IPC::StringReference receiverName() { return messageReceiverName(); }
    678     static IPC::StringReference name() { return IPC::StringReference("GetPluginProcessConnection"); }
    679     static const bool isSync = true;
    680 
    681     struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> {
    682         DelayedReply(PassRefPtr<IPC::Connection>, std::unique_ptr<IPC::MessageEncoder>);
    683         ~DelayedReply();
    684 
    685         bool send(const IPC::Connection::Handle& connectionHandle);
    686 
    687     private:
    688         RefPtr<IPC::Connection> m_connection;
    689         std::unique_ptr<IPC::MessageEncoder> m_encoder;
    690     };
    691 
    692     typedef IPC::Arguments1<IPC::Connection::Handle&> Reply;
    693     explicit GetPluginProcessConnection(const String& pluginPath)
    694         : m_arguments(pluginPath)
    695     {
    696     }
    697 
    698     const std::tuple<const String&> arguments() const
    699     {
    700         return m_arguments;
    701     }
    702 
    703 private:
    704     std::tuple<const String&> m_arguments;
    705 };
    706 
    707 class TestMultipleAttributes {
    708 public:
    709     typedef std::tuple<> DecodeType;
    710 
    711     static IPC::StringReference receiverName() { return messageReceiverName(); }
    712     static IPC::StringReference name() { return IPC::StringReference("TestMultipleAttributes"); }
    713     static const bool isSync = true;
    714 
    715     struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> {
    716         DelayedReply(PassRefPtr<IPC::Connection>, std::unique_ptr<IPC::MessageEncoder>);
    717         ~DelayedReply();
    718 
    719         bool send();
    720 
    721     private:
    722         RefPtr<IPC::Connection> m_connection;
    723         std::unique_ptr<IPC::MessageEncoder> m_encoder;
    724     };
    725 
    726     typedef IPC::Arguments0 Reply;
    727     const std::tuple<> arguments() const
    728     {
    729         return m_arguments;
    730     }
    731 
    732 private:
    733     std::tuple<> m_arguments;
    734 };
    735 
    736 class TestParameterAttributes {
    737 public:
    738     typedef std::tuple<uint64_t, double, double> DecodeType;
    739 
    740     static IPC::StringReference receiverName() { return messageReceiverName(); }
    741     static IPC::StringReference name() { return IPC::StringReference("TestParameterAttributes"); }
    742     static const bool isSync = false;
    743 
    744     TestParameterAttributes(uint64_t foo, double bar, double baz)
    745         : m_arguments(foo, bar, baz)
    746     {
    747     }
    748 
    749     const std::tuple<uint64_t, double, double> arguments() const
    750     {
    751         return m_arguments;
    752     }
    753 
    754 private:
    755     std::tuple<uint64_t, double, double> m_arguments;
    756 };
    757 
    758 class TemplateTest {
    759 public:
    760     typedef std::tuple<HashMap<String, std::pair<String, uint64_t>>> DecodeType;
    761 
    762     static IPC::StringReference receiverName() { return messageReceiverName(); }
    763     static IPC::StringReference name() { return IPC::StringReference("TemplateTest"); }
    764     static const bool isSync = false;
    765 
    766     explicit TemplateTest(const HashMap<String, std::pair<String, uint64_t>>& a)
    767         : m_arguments(a)
    768     {
    769     }
    770 
    771     const std::tuple<const HashMap<String, std::pair<String, uint64_t>>&> arguments() const
    772     {
    773         return m_arguments;
    774     }
    775 
    776 private:
    777     std::tuple<const HashMap<String, std::pair<String, uint64_t>>&> m_arguments;
    778 };
    779 
    780 #if PLATFORM(MAC)
    781 class DidCreateWebProcessConnection {
    782 public:
    783     typedef std::tuple<IPC::MachPort> DecodeType;
    784 
    785     static IPC::StringReference receiverName() { return messageReceiverName(); }
    786     static IPC::StringReference name() { return IPC::StringReference("DidCreateWebProcessConnection"); }
    787     static const bool isSync = false;
    788 
    789     explicit DidCreateWebProcessConnection(const IPC::MachPort& connectionIdentifier)
    790         : m_arguments(connectionIdentifier)
    791     {
    792     }
    793 
    794     const std::tuple<const IPC::MachPort&> arguments() const
    795     {
    796         return m_arguments;
    797     }
    798 
    799 private:
    800     std::tuple<const IPC::MachPort&> m_arguments;
    801 };
    802 #endif
    803 
    804 #if PLATFORM(MAC)
    805 class InterpretKeyEvent {
    806 public:
    807     typedef std::tuple<uint32_t> DecodeType;
    808 
    809     static IPC::StringReference receiverName() { return messageReceiverName(); }
    810     static IPC::StringReference name() { return IPC::StringReference("InterpretKeyEvent"); }
    811     static const bool isSync = true;
    812 
    813     typedef IPC::Arguments1<Vector<WebCore::KeypressCommand>&> Reply;
    814     explicit InterpretKeyEvent(uint32_t type)
    815         : m_arguments(type)
    816     {
    817     }
    818 
    819     const std::tuple<uint32_t> arguments() const
    820     {
    821         return m_arguments;
    822     }
    823 
    824 private:
    825     std::tuple<uint32_t> m_arguments;
    826 };
    827 #endif
    828 
    829 #if ENABLE(DEPRECATED_FEATURE)
    830 class DeprecatedOperation {
    831 public:
    832     typedef std::tuple<IPC::DummyType> DecodeType;
    833 
    834     static IPC::StringReference receiverName() { return messageReceiverName(); }
    835     static IPC::StringReference name() { return IPC::StringReference("DeprecatedOperation"); }
    836     static const bool isSync = false;
    837 
    838     explicit DeprecatedOperation(const IPC::DummyType& dummy)
    839         : m_arguments(dummy)
    840     {
    841     }
    842 
    843     const std::tuple<const IPC::DummyType&> arguments() const
    844     {
    845         return m_arguments;
    846     }
    847 
    848 private:
    849     std::tuple<const IPC::DummyType&> m_arguments;
    850 };
    851 #endif
    852 
    853 #if ENABLE(EXPERIMENTAL_FEATURE)
    854 class ExperimentalOperation {
    855 public:
    856     typedef std::tuple<IPC::DummyType> DecodeType;
    857 
    858     static IPC::StringReference receiverName() { return messageReceiverName(); }
    859     static IPC::StringReference name() { return IPC::StringReference("ExperimentalOperation"); }
    860     static const bool isSync = false;
    861 
    862     explicit ExperimentalOperation(const IPC::DummyType& dummy)
    863         : m_arguments(dummy)
    864     {
    865     }
    866 
    867     const std::tuple<const IPC::DummyType&> arguments() const
    868     {
    869         return m_arguments;
    870     }
    871 
    872 private:
    873     std::tuple<const IPC::DummyType&> m_arguments;
    874 };
    875 #endif
    876 
    877 } // namespace WebPage
    878 } // namespace Messages
    879 
    880 #endif // (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
    881 
    882 #endif // WebPageMessages_h
    883 """
    884 
    885 _expected_receiver_implementation = """/*
    886  * Copyright (C) 2010 Apple Inc. All rights reserved.
    887  *
    888  * Redistribution and use in source and binary forms, with or without
    889  * modification, are permitted provided that the following conditions
    890  * are met:
    891  * 1.  Redistributions of source code must retain the above copyright
    892  *     notice, this list of conditions and the following disclaimer.
    893  * 2.  Redistributions in binary form must reproduce the above copyright
    894  *     notice, this list of conditions and the following disclaimer in the
    895  *     documentation and/or other materials provided with the distribution.
    896  *
    897  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
    898  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    899  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    900  * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
    901  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    902  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    903  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    904  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    905  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    906  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    907  */
    908 
    909 #include "config.h"
    910 
    911 #if (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
    912 
    913 #include "WebPage.h"
    914 
    915 #include "ArgumentCoders.h"
    916 #include "Connection.h"
    917 #if ENABLE(DEPRECATED_FEATURE) || ENABLE(EXPERIMENTAL_FEATURE)
    918 #include "DummyType.h"
    919 #endif
    920 #include "HandleMessage.h"
    921 #if PLATFORM(MAC)
    922 #include "MachPort.h"
    923 #endif
    924 #include "MessageDecoder.h"
    925 #include "Plugin.h"
    926 #include "WebCoreArgumentCoders.h"
    927 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION)) || (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))
    928 #include "WebEvent.h"
    929 #endif
    930 #include "WebPageMessages.h"
    931 #include "WebPreferencesStore.h"
    932 #if PLATFORM(MAC)
    933 #include <WebCore/KeyboardEvent.h>
    934 #endif
    935 #include <WebCore/PluginData.h>
    936 #include <utility>
    937 #include <wtf/HashMap.h>
    938 #include <wtf/Vector.h>
    939 #include <wtf/text/WTFString.h>
    940 
    941 namespace Messages {
    942 
    943 namespace WebPage {
    944 
    945 GetPluginProcessConnection::DelayedReply::DelayedReply(PassRefPtr<IPC::Connection> connection, std::unique_ptr<IPC::MessageEncoder> encoder)
    946     : m_connection(connection)
    947     , m_encoder(std::move(encoder))
    948 {
    949 }
    950 
    951 GetPluginProcessConnection::DelayedReply::~DelayedReply()
    952 {
    953     ASSERT(!m_connection);
    954 }
    955 
    956 bool GetPluginProcessConnection::DelayedReply::send(const IPC::Connection::Handle& connectionHandle)
    957 {
    958     ASSERT(m_encoder);
    959     *m_encoder << connectionHandle;
    960     bool result = m_connection->sendSyncReply(std::move(m_encoder));
    961     m_connection = nullptr;
    962     return result;
    963 }
    964 
    965 TestMultipleAttributes::DelayedReply::DelayedReply(PassRefPtr<IPC::Connection> connection, std::unique_ptr<IPC::MessageEncoder> encoder)
    966     : m_connection(connection)
    967     , m_encoder(std::move(encoder))
    968 {
    969 }
    970 
    971 TestMultipleAttributes::DelayedReply::~DelayedReply()
    972 {
    973     ASSERT(!m_connection);
    974 }
    975 
    976 bool TestMultipleAttributes::DelayedReply::send()
    977 {
    978     ASSERT(m_encoder);
    979     bool result = m_connection->sendSyncReply(std::move(m_encoder));
    980     m_connection = nullptr;
    981     return result;
    982 }
    983 
    984 } // namespace WebPage
    985 
    986 } // namespace Messages
    987 
    988 namespace WebKit {
    989 
    990 void WebPage::didReceiveWebPageMessage(IPC::Connection*, IPC::MessageDecoder& decoder)
    991 {
    992     if (decoder.messageName() == Messages::WebPage::LoadURL::name()) {
    993         IPC::handleMessage<Messages::WebPage::LoadURL>(decoder, this, &WebPage::loadURL);
    994         return;
    995     }
    996 #if ENABLE(TOUCH_EVENTS)
    997     if (decoder.messageName() == Messages::WebPage::LoadSomething::name()) {
    998         IPC::handleMessage<Messages::WebPage::LoadSomething>(decoder, this, &WebPage::loadSomething);
    999         return;
    1000     }
    1001 #endif
    1002 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))
    1003     if (decoder.messageName() == Messages::WebPage::TouchEvent::name()) {
    1004         IPC::handleMessage<Messages::WebPage::TouchEvent>(decoder, this, &WebPage::touchEvent);
    1005         return;
    1006     }
    1007 #endif
    1008 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION))
    1009     if (decoder.messageName() == Messages::WebPage::AddEvent::name()) {
    1010         IPC::handleMessage<Messages::WebPage::AddEvent>(decoder, this, &WebPage::addEvent);
    1011         return;
    1012     }
    1013 #endif
    1014 #if ENABLE(TOUCH_EVENTS)
    1015     if (decoder.messageName() == Messages::WebPage::LoadSomethingElse::name()) {
    1016         IPC::handleMessage<Messages::WebPage::LoadSomethingElse>(decoder, this, &WebPage::loadSomethingElse);
    1017         return;
    1018     }
    1019 #endif
    1020     if (decoder.messageName() == Messages::WebPage::DidReceivePolicyDecision::name()) {
    1021         IPC::handleMessage<Messages::WebPage::DidReceivePolicyDecision>(decoder, this, &WebPage::didReceivePolicyDecision);
    1022         return;
    1023     }
    1024     if (decoder.messageName() == Messages::WebPage::Close::name()) {
    1025         IPC::handleMessage<Messages::WebPage::Close>(decoder, this, &WebPage::close);
    1026         return;
    1027     }
    1028     if (decoder.messageName() == Messages::WebPage::PreferencesDidChange::name()) {
    1029         IPC::handleMessage<Messages::WebPage::PreferencesDidChange>(decoder, this, &WebPage::preferencesDidChange);
    1030         return;
    1031     }
    1032     if (decoder.messageName() == Messages::WebPage::SendDoubleAndFloat::name()) {
    1033         IPC::handleMessage<Messages::WebPage::SendDoubleAndFloat>(decoder, this, &WebPage::sendDoubleAndFloat);
    1034         return;
    1035     }
    1036     if (decoder.messageName() == Messages::WebPage::SendInts::name()) {
    1037         IPC::handleMessage<Messages::WebPage::SendInts>(decoder, this, &WebPage::sendInts);
    1038         return;
    1039     }
    1040     if (decoder.messageName() == Messages::WebPage::TestParameterAttributes::name()) {
    1041         IPC::handleMessage<Messages::WebPage::TestParameterAttributes>(decoder, this, &WebPage::testParameterAttributes);
    1042         return;
    1043     }
    1044     if (decoder.messageName() == Messages::WebPage::TemplateTest::name()) {
    1045         IPC::handleMessage<Messages::WebPage::TemplateTest>(decoder, this, &WebPage::templateTest);
    1046         return;
    1047     }
    1048 #if PLATFORM(MAC)
    1049     if (decoder.messageName() == Messages::WebPage::DidCreateWebProcessConnection::name()) {
    1050         IPC::handleMessage<Messages::WebPage::DidCreateWebProcessConnection>(decoder, this, &WebPage::didCreateWebProcessConnection);
    1051         return;
    1052     }
    1053 #endif
    1054 #if ENABLE(DEPRECATED_FEATURE)
    1055     if (decoder.messageName() == Messages::WebPage::DeprecatedOperation::name()) {
    1056         IPC::handleMessage<Messages::WebPage::DeprecatedOperation>(decoder, this, &WebPage::deprecatedOperation);
    1057         return;
    1058     }
    1059 #endif
    1060 #if ENABLE(EXPERIMENTAL_FEATURE)
    1061     if (decoder.messageName() == Messages::WebPage::ExperimentalOperation::name()) {
    1062         IPC::handleMessage<Messages::WebPage::ExperimentalOperation>(decoder, this, &WebPage::experimentalOperation);
    1063         return;
    1064     }
    1065 #endif
    1066     ASSERT_NOT_REACHED();
    1067 }
    1068 
    1069 void WebPage::didReceiveSyncWebPageMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder, std::unique_ptr<IPC::MessageEncoder>& replyEncoder)
    1070 {
    1071     if (decoder.messageName() == Messages::WebPage::CreatePlugin::name()) {
    1072         IPC::handleMessage<Messages::WebPage::CreatePlugin>(decoder, *replyEncoder, this, &WebPage::createPlugin);
    1073         return;
    1074     }
    1075     if (decoder.messageName() == Messages::WebPage::RunJavaScriptAlert::name()) {
    1076         IPC::handleMessage<Messages::WebPage::RunJavaScriptAlert>(decoder, *replyEncoder, this, &WebPage::runJavaScriptAlert);
    1077         return;
    1078     }
    1079     if (decoder.messageName() == Messages::WebPage::GetPlugins::name()) {
    1080         IPC::handleMessage<Messages::WebPage::GetPlugins>(decoder, *replyEncoder, this, &WebPage::getPlugins);
    1081         return;
    1082     }
    1083     if (decoder.messageName() == Messages::WebPage::GetPluginProcessConnection::name()) {
    1084         IPC::handleMessageDelayed<Messages::WebPage::GetPluginProcessConnection>(connection, decoder, replyEncoder, this, &WebPage::getPluginProcessConnection);
    1085         return;
    1086     }
    1087     if (decoder.messageName() == Messages::WebPage::TestMultipleAttributes::name()) {
    1088         IPC::handleMessageDelayed<Messages::WebPage::TestMultipleAttributes>(connection, decoder, replyEncoder, this, &WebPage::testMultipleAttributes);
    1089         return;
    1090     }
    1091 #if PLATFORM(MAC)
    1092     if (decoder.messageName() == Messages::WebPage::InterpretKeyEvent::name()) {
    1093         IPC::handleMessage<Messages::WebPage::InterpretKeyEvent>(decoder, *replyEncoder, this, &WebPage::interpretKeyEvent);
    1094         return;
    1095     }
    1096 #endif
    1097     ASSERT_NOT_REACHED();
    1098 }
    1099 
    1100 } // namespace WebKit
    1101 
    1102 #endif // (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
    1103 """
    1104253
    1105254
Note: See TracChangeset for help on using the changeset viewer.