ipc/ipdl/test/cxx/TestRacyInterruptReplies.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/ipdl/test/cxx/TestRacyInterruptReplies.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,73 @@
     1.4 +#ifndef mozilla__ipdltest_TestRacyInterruptReplies_h
     1.5 +#define mozilla__ipdltest_TestRacyInterruptReplies_h 1
     1.6 +
     1.7 +#include "mozilla/_ipdltest/IPDLUnitTests.h"
     1.8 +
     1.9 +#include "mozilla/_ipdltest/PTestRacyInterruptRepliesParent.h"
    1.10 +#include "mozilla/_ipdltest/PTestRacyInterruptRepliesChild.h"
    1.11 +
    1.12 +namespace mozilla {
    1.13 +namespace _ipdltest {
    1.14 +
    1.15 +
    1.16 +class TestRacyInterruptRepliesParent :
    1.17 +    public PTestRacyInterruptRepliesParent
    1.18 +{
    1.19 +public:
    1.20 +    TestRacyInterruptRepliesParent();
    1.21 +    virtual ~TestRacyInterruptRepliesParent();
    1.22 +
    1.23 +    static bool RunTestInProcesses() { return true; }
    1.24 +    static bool RunTestInThreads() { return true; }
    1.25 +
    1.26 +    void Main();
    1.27 +
    1.28 +protected:    
    1.29 +    virtual bool RecvA_() MOZ_OVERRIDE;
    1.30 +
    1.31 +    virtual bool Answer_R(int* replyNum) MOZ_OVERRIDE;
    1.32 +
    1.33 +    virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
    1.34 +    {
    1.35 +        if (NormalShutdown != why)
    1.36 +            fail("unexpected destruction!");  
    1.37 +        passed("ok");
    1.38 +        QuitParent();
    1.39 +    }
    1.40 +
    1.41 +private:
    1.42 +    int mReplyNum;
    1.43 +};
    1.44 +
    1.45 +
    1.46 +class TestRacyInterruptRepliesChild :
    1.47 +    public PTestRacyInterruptRepliesChild
    1.48 +{
    1.49 +public:
    1.50 +    TestRacyInterruptRepliesChild();
    1.51 +    virtual ~TestRacyInterruptRepliesChild();
    1.52 +
    1.53 +protected:
    1.54 +    virtual bool AnswerR_(int* replyNum) MOZ_OVERRIDE;
    1.55 +
    1.56 +    virtual bool RecvChildTest() MOZ_OVERRIDE;
    1.57 +
    1.58 +    virtual bool Recv_A() MOZ_OVERRIDE;
    1.59 +
    1.60 +    virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
    1.61 +    {
    1.62 +        if (NormalShutdown != why)
    1.63 +            fail("unexpected destruction!");
    1.64 +        QuitChild();
    1.65 +    }
    1.66 +
    1.67 +private:
    1.68 +    int mReplyNum;
    1.69 +};
    1.70 +
    1.71 +
    1.72 +} // namespace _ipdltest
    1.73 +} // namespace mozilla
    1.74 +
    1.75 +
    1.76 +#endif // ifndef mozilla__ipdltest_TestRacyInterruptReplies_h

mercurial