VirtualBox

Ignore:
Timestamp:
Oct 22, 2019 1:03:29 PM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboard/tstClipboardServiceHost: Added initial tests for setting host transfer mode.

Location:
trunk/src/VBox/HostServices/SharedClipboard/testcase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedClipboard/testcase/Makefile.kmk

    r81439 r81449  
    3232
    3333 if defined(VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS)
     34  tstClipboardServiceHost_DEFS    += VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     35  tstClipboardServiceHost_SOURCES += \
     36        ../VBoxSharedClipboardSvc-transfers.cpp \
     37        $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp \
     38        $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardArea.cpp
     39 endif
     40
     41 if defined(VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS)
    3442  PROGRAMS += tstClipboardTransfers
    3543  tstClipboardTransfers_TEMPLATE = VBOXR3TSTEXE
    36   tstClipboardTransfers_DEFS     = VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     44  tstClipboardTransfers_DEFS     = VBOX_WITH_HGCM UNIT_TEST VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    3745  tstClipboardTransfers_SOURCES  = \
    3846        $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp \
  • trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceHost.cpp

    r81448 r81449  
    5959    int rc;
    6060
    61     RTTestISub("Testing HOST_FN_SET_MODE");
     61    RTTestISub("Testing VBOX_SHCL_HOST_FN_SET_MODE");
    6262    rc = setupTable(&table);
    6363    RTTESTI_CHECK_MSG_RETV(RT_SUCCESS(rc), ("rc=%Rrc\n", rc));
     
    9494    table.pfnUnload(NULL);
    9595}
     96
     97#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     98static void testSetTransferMode(void)
     99{
     100    struct VBOXHGCMSVCPARM parms[2];
     101    VBOXHGCMSVCFNTABLE table;
     102
     103    RTTestISub("Testing VBOX_SHCL_HOST_FN_SET_TRANSFER_MODE");
     104    int rc = setupTable(&table);
     105    RTTESTI_CHECK_MSG_RETV(RT_SUCCESS(rc), ("rc=%Rrc\n", rc));
     106
     107    /* Invalid parameter. */
     108    HGCMSvcSetU64(&parms[0], 99);
     109    rc = table.pfnHostCall(NULL, VBOX_SHCL_HOST_FN_SET_TRANSFER_MODE, 1, parms);
     110    RTTESTI_CHECK_RC(rc, VERR_INVALID_PARAMETER);
     111
     112    /* Invalid mode. */
     113    HGCMSvcSetU32(&parms[0], 99);
     114    rc = table.pfnHostCall(NULL, VBOX_SHCL_HOST_FN_SET_TRANSFER_MODE, 1, parms);
     115    RTTESTI_CHECK_RC(rc, VERR_INVALID_FLAGS);
     116
     117    /* Enable transfers. */
     118    HGCMSvcSetU32(&parms[0], VBOX_SHCL_TRANSFER_MODE_ENABLED);
     119    rc = table.pfnHostCall(NULL, VBOX_SHCL_HOST_FN_SET_TRANSFER_MODE, 1, parms);
     120    RTTESTI_CHECK_RC(rc, VINF_SUCCESS);
     121
     122    /* Disable transfers again. */
     123    HGCMSvcSetU32(&parms[0], VBOX_SHCL_TRANSFER_MODE_DISABLED);
     124    rc = table.pfnHostCall(NULL, VBOX_SHCL_HOST_FN_SET_TRANSFER_MODE, 1, parms);
     125    RTTESTI_CHECK_RC(rc, VINF_SUCCESS);
     126}
     127#endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
    96128
    97129static void testMsgAddOld(PSHCLCLIENT pClient, uint32_t uMsg, uint32_t uParm1)
     
    244276{
    245277    testSetMode();
     278#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     279    testSetTransferMode();
     280#endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
    246281    testSetHeadless();
    247282}
     
    276311int ShClSvcImplInit() { return VINF_SUCCESS; }
    277312void ShClSvcImplDestroy() { }
    278 int ShClSvcImplDisconnect(PSHCLCLIENT)
    279 { return VINF_SUCCESS; }
    280 int ShClSvcImplConnect(PSHCLCLIENT, bool)
    281 { return VINF_SUCCESS; }
    282 int ShClSvcImplFormatAnnounce(PSHCLCLIENT, PSHCLCLIENTCMDCTX, PSHCLFORMATDATA)
    283 { AssertFailed(); return VINF_SUCCESS; }
    284 int ShClSvcImplReadData(PSHCLCLIENT, PSHCLCLIENTCMDCTX, PSHCLDATABLOCK, unsigned int *)
    285 { AssertFailed(); return VERR_WRONG_ORDER; }
    286 int ShClSvcImplWriteData(PSHCLCLIENT, PSHCLCLIENTCMDCTX, PSHCLDATABLOCK)
    287 { AssertFailed(); return VINF_SUCCESS; }
    288 int ShClSvcImplSync(PSHCLCLIENT)
    289 { AssertFailed(); return VERR_WRONG_ORDER; }
    290 
     313int ShClSvcImplDisconnect(PSHCLCLIENT) { return VINF_SUCCESS; }
     314int ShClSvcImplConnect(PSHCLCLIENT, bool) { return VINF_SUCCESS; }
     315int ShClSvcImplFormatAnnounce(PSHCLCLIENT, PSHCLCLIENTCMDCTX, PSHCLFORMATDATA) { AssertFailed(); return VINF_SUCCESS; }
     316int ShClSvcImplReadData(PSHCLCLIENT, PSHCLCLIENTCMDCTX, PSHCLDATABLOCK, unsigned int *) { AssertFailed(); return VERR_WRONG_ORDER; }
     317int ShClSvcImplWriteData(PSHCLCLIENT, PSHCLCLIENTCMDCTX, PSHCLDATABLOCK) { AssertFailed(); return VINF_SUCCESS; }
     318int ShClSvcImplSync(PSHCLCLIENT) { AssertFailed(); return VERR_WRONG_ORDER; }
     319
     320#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     321int ShClSvcImplTransferCreate(PSHCLCLIENT, PSHCLTRANSFER) { return VINF_SUCCESS; }
     322int ShClSvcImplTransferDestroy(PSHCLCLIENT, PSHCLTRANSFER) { return VINF_SUCCESS; }
     323int ShClSvcImplTransferGetRoots(PSHCLCLIENT, PSHCLTRANSFER) { return VINF_SUCCESS; }
     324#endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
     325
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