VirtualBox

Changeset 82447 in vbox for trunk


Ignore:
Timestamp:
Dec 6, 2019 10:33:15 AM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboar/HostService: Fixed testcase.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceHost.cpp

    r81820 r82447  
    127127#endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
    128128
    129 static void testMsgAddOld(PSHCLCLIENT pClient, uint32_t uMsg, uint32_t uParm1)
    130 {
    131     PSHCLCLIENTMSG pMsg = shClSvcMsgAlloc(uMsg, 2 /* cParms */); /* The old protocol (v0) has a fixed parameter count of 2. */
    132     RTTESTI_CHECK_RETV(pMsg != NULL);
    133 
    134     HGCMSvcSetU32(&pMsg->paParms[0], uMsg);
    135     HGCMSvcSetU32(&pMsg->paParms[1], uParm1);
    136 
    137     int rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    138     RTTESTI_CHECK_RC_OK(rc);
    139     rc = shClSvcClientWakeup(pClient);
     129/* Adds a host data read request message to the client's message queue. */
     130static void testMsgAddReadData(PSHCLCLIENT pClient, uint32_t uFormat)
     131{
     132    SHCLDATAREQ dataReq;
     133    RT_ZERO(dataReq);
     134
     135    dataReq.uFmt = uFormat;
     136
     137    int rc = ShClSvcDataReadRequest(pClient, &dataReq, NULL /* puEvent */);
    140138    RTTESTI_CHECK_RC_OK(rc);
    141139}
     
    167165    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, 2, parms, 0);
    168166    RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This should get updated only when the guest call completes. */
    169     testMsgAddOld(&g_Client, VBOX_SHCL_HOST_MSG_READ_DATA, VBOX_SHCL_FMT_UNICODETEXT);
     167    testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_UNICODETEXT);
    170168    RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    171169    RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_UNICODETEXT);
     
    177175    RTTestISub("Testing one format, no waiting guest calls.");
    178176    shClSvcClientReset(&g_Client);
    179     testMsgAddOld(&g_Client, VBOX_SHCL_HOST_MSG_READ_DATA, VBOX_SHCL_FMT_HTML);
     177    testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_HTML);
    180178    HGCMSvcSetU32(&parms[0], 0);
    181179    HGCMSvcSetU32(&parms[1], 0);
     
    196194    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, 2, parms, 0);
    197195    RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This should get updated only when the guest call completes. */
    198     testMsgAddOld(&g_Client, VBOX_SHCL_HOST_MSG_READ_DATA, VBOX_SHCL_FMT_UNICODETEXT | VBOX_SHCL_FMT_HTML);
     196    testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_UNICODETEXT | VBOX_SHCL_FMT_HTML);
    199197    RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    200198    RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_UNICODETEXT);
     
    211209    RTTestISub("Testing two formats, no waiting guest calls.");
    212210    shClSvcClientReset(&g_Client);
    213     testMsgAddOld(&g_Client, VBOX_SHCL_HOST_MSG_READ_DATA, VBOX_SHCL_FMT_UNICODETEXT | VBOX_SHCL_FMT_HTML);
     211    testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_UNICODETEXT | VBOX_SHCL_FMT_HTML);
    214212    HGCMSvcSetU32(&parms[0], 0);
    215213    HGCMSvcSetU32(&parms[1], 0);
     
    316314int ShClSvcImplReadData(PSHCLCLIENT, PSHCLCLIENTCMDCTX, PSHCLDATABLOCK, unsigned int *) { AssertFailed(); return VERR_WRONG_ORDER; }
    317315int ShClSvcImplWriteData(PSHCLCLIENT, PSHCLCLIENTCMDCTX, PSHCLDATABLOCK) { AssertFailed(); return VINF_SUCCESS; }
    318 int ShClSvcImplSync(PSHCLCLIENT) { AssertFailed(); return VERR_WRONG_ORDER; }
     316int ShClSvcImplSync(PSHCLCLIENT) { return VINF_SUCCESS; }
    319317
    320318#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette