Changeset 37455 in vbox for trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceHost.cpp
- Timestamp:
- Jun 14, 2011 8:09:32 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceHost.cpp
r37437 r37455 36 36 } 37 37 38 static struct38 static void testSetMode(void) 39 39 { 40 uint32_t cParms; 41 uint32_t type1; 42 uint32_t val1; 43 int rcExp; 44 } s_testHostFnSetMode[] = 40 struct VBOXHGCMSVCPARM parms[2]; 41 VBOXHGCMSVCFNTABLE table; 42 uint32_t u32Mode; 43 int rc; 44 45 RTTestISub("Testing HOST_FN_SET_MODE"); 46 rc = setupTable(&table); 47 RTTESTI_CHECK_MSG_RETV(RT_SUCCESS(rc), ("rc=%Rrc\n", rc)); 48 /* Reset global variable which doesn't reset itself. */ 49 parms[0].setUInt32(VBOX_SHARED_CLIPBOARD_MODE_OFF); 50 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE, 51 1, parms); 52 RTTESTI_CHECK_RC_OK(rc); 53 u32Mode = testClipSvcGetMode(); 54 RTTESTI_CHECK_MSG(u32Mode == VBOX_SHARED_CLIPBOARD_MODE_OFF, 55 ("u32Mode=%u\n", (unsigned) u32Mode)); 56 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE, 57 0, parms); 58 RTTESTI_CHECK_RC(rc, VERR_INVALID_PARAMETER); 59 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE, 60 2, parms); 61 RTTESTI_CHECK_RC(rc, VERR_INVALID_PARAMETER); 62 parms[0].setUInt64(99); 63 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE, 64 1, parms); 65 RTTESTI_CHECK_RC(rc, VERR_INVALID_PARAMETER); 66 parms[0].setUInt32(VBOX_SHARED_CLIPBOARD_MODE_HOST_TO_GUEST); 67 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE, 68 1, parms); 69 RTTESTI_CHECK_RC_OK(rc); 70 u32Mode = testClipSvcGetMode(); 71 RTTESTI_CHECK_MSG(u32Mode == VBOX_SHARED_CLIPBOARD_MODE_HOST_TO_GUEST, 72 ("u32Mode=%u\n", (unsigned) u32Mode)); 73 parms[0].setUInt32(99); 74 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE, 75 1, parms); 76 RTTESTI_CHECK_RC_OK(rc); 77 u32Mode = testClipSvcGetMode(); 78 RTTESTI_CHECK_MSG(u32Mode == VBOX_SHARED_CLIPBOARD_MODE_OFF, 79 ("u32Mode=%u\n", (unsigned) u32Mode)); 80 } 81 82 static void testSetHeadless(void) 45 83 { 46 { 0, VBOX_HGCM_SVC_PARM_32BIT, 99, VERR_INVALID_PARAMETER }, 47 { 2, VBOX_HGCM_SVC_PARM_32BIT, 99, VERR_INVALID_PARAMETER }, 48 { 1, VBOX_HGCM_SVC_PARM_64BIT, 99, VERR_INVALID_PARAMETER }, 49 { 1, VBOX_HGCM_SVC_PARM_32BIT, 99, VINF_SUCCESS } 50 }; 84 struct VBOXHGCMSVCPARM parms[2]; 85 VBOXHGCMSVCFNTABLE table; 86 bool fHeadless; 87 int rc; 88 89 RTTestISub("Testing HOST_FN_SET_HEADLESS"); 90 rc = setupTable(&table); 91 RTTESTI_CHECK_MSG_RETV(RT_SUCCESS(rc), ("rc=%Rrc\n", rc)); 92 /* Reset global variable which doesn't reset itself. */ 93 parms[0].setUInt32(false); 94 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS, 95 1, parms); 96 RTTESTI_CHECK_RC_OK(rc); 97 fHeadless = vboxSvcClipboardGetHeadless(); 98 RTTESTI_CHECK_MSG(fHeadless == false, ("fHeadless=%RTbool\n", fHeadless)); 99 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS, 100 0, parms); 101 RTTESTI_CHECK_RC(rc, VERR_INVALID_PARAMETER); 102 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS, 103 2, parms); 104 RTTESTI_CHECK_RC(rc, VERR_INVALID_PARAMETER); 105 parms[0].setUInt64(99); 106 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS, 107 1, parms); 108 RTTESTI_CHECK_RC(rc, VERR_INVALID_PARAMETER); 109 parms[0].setUInt32(true); 110 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS, 111 1, parms); 112 RTTESTI_CHECK_RC_OK(rc); 113 fHeadless = vboxSvcClipboardGetHeadless(); 114 RTTESTI_CHECK_MSG(fHeadless == true, ("fHeadless=%RTbool\n", fHeadless)); 115 parms[0].setUInt32(99); 116 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS, 117 1, parms); 118 RTTESTI_CHECK_RC_OK(rc); 119 fHeadless = vboxSvcClipboardGetHeadless(); 120 RTTESTI_CHECK_MSG(fHeadless == true, ("fHeadless=%RTbool\n", fHeadless)); 121 } 51 122 52 static void testHostCall( RTTEST hTest)123 static void testHostCall(void) 53 124 { 54 VBOXHGCMSVCFNTABLE table; 55 56 RTTestSub(hTest, "Testing HOST_FN_SET_MODE"); 57 for (unsigned i = 0; i < RT_ELEMENTS(s_testHostFnSetMode); ++i) 58 { 59 struct VBOXHGCMSVCPARM parms[2]; 60 61 int rc = setupTable(&table); 62 RTTESTI_CHECK_MSG_RETV(RT_SUCCESS(rc), ("i=%u, rc=%Rrc\n", i, rc)); 63 parms[0].type = s_testHostFnSetMode[i].type1; 64 parms[0].u.uint32 = s_testHostFnSetMode[i].val1; 65 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE, 66 s_testHostFnSetMode[i].cParms, parms); 67 RTTESTI_CHECK_MSG(rc == s_testHostFnSetMode[i].rcExp, 68 ("i=%u, rc=%Rrc\n", i, rc)); 69 } 125 testSetMode(); 126 testSetHeadless(); 70 127 } 71 128 … … 89 146 * Run the tests. 90 147 */ 91 testHostCall( hTest);148 testHostCall(); 92 149 93 150 /*
Note:
See TracChangeset
for help on using the changeset viewer.