VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceHost.cpp@ 37435

Last change on this file since 37435 was 37435, checked in by vboxsync, 14 years ago

GuestHost/SharedClipboard: moved the RTEnvGet("DISPLAY") hack out into the host-specific code, missed files

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/* $Id: tstClipboardServiceHost.cpp 37435 2011-06-14 13:17:28Z vboxsync $ */
2/** @file
3 * Shared Clipboard host service test case.
4 */
5
6/*
7 * Copyright (C) 2011 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#include "../VBoxClipboard.h"
19
20#include <VBox/HostServices/VBoxClipboardSvc.h>
21
22#include <VBox/vmm/ssm.h>
23
24#include <iprt/assert.h>
25#include <iprt/string.h>
26#include <iprt/test.h>
27
28extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad (VBOXHGCMSVCFNTABLE *ptable);
29
30static int setupTable(VBOXHGCMSVCFNTABLE *pTable)
31{
32 pTable->cbSize = sizeof(*pTable);
33 pTable->u32Version = VBOX_HGCM_SVC_VERSION;
34 return VBoxHGCMSvcLoad(pTable);
35}
36
37static struct
38{
39 uint32_t cParms;
40 uint32_t type1;
41 uint32_t val1;
42 int rcExp;
43} s_testHostFnSetMode[] =
44{
45 { 0, VBOX_HGCM_SVC_PARM_32BIT, 99, VERR_INVALID_PARAMETER },
46 { 2, VBOX_HGCM_SVC_PARM_32BIT, 99, VERR_INVALID_PARAMETER },
47 { 1, VBOX_HGCM_SVC_PARM_64BIT, 99, VERR_INVALID_PARAMETER },
48 { 1, VBOX_HGCM_SVC_PARM_32BIT, 99, VINF_SUCCESS }
49};
50
51static void testHostCall(RTTEST hTest)
52{
53 VBOXHGCMSVCFNTABLE table;
54
55 RTTestSub(hTest, "Testing HOST_FN_SET_MODE");
56 for (unsigned i = 0; i < RT_ELEMENTS(s_testHostFnSetMode); ++i)
57 {
58 struct VBOXHGCMSVCPARM parms[2];
59
60 int rc = setupTable(&table);
61 RTTESTI_CHECK_MSG_RETV(RT_SUCCESS(rc), ("i=%u, rc=%Rrc\n", i, rc));
62 parms[0].type = s_testHostFnSetMode[i].type1;
63 parms[0].u.uint32 = s_testHostFnSetMode[i].val1;
64 rc = table.pfnHostCall(NULL, VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE,
65 s_testHostFnSetMode[i].cParms, parms);
66 RTTESTI_CHECK_MSG(rc == s_testHostFnSetMode[i].rcExp,
67 ("i=%u, rc=%Rrc\n", i, rc));
68 }
69}
70
71
72int main(int argc, char *argv[])
73{
74 /*
75 * Init the runtime, test and say hello.
76 */
77 const char *pcszExecName;
78 NOREF(argc);
79 pcszExecName = strrchr(argv[0], '/');
80 pcszExecName = pcszExecName ? pcszExecName + 1 : argv[0];
81 RTTEST hTest;
82 RTEXITCODE rcExit = RTTestInitAndCreate(pcszExecName, &hTest);
83 if (rcExit != RTEXITCODE_SUCCESS)
84 return rcExit;
85 RTTestBanner(hTest);
86
87 /*
88 * Run the tests.
89 */
90 testHostCall(hTest);
91
92 /*
93 * Summary
94 */
95 return RTTestSummaryAndDestroy(hTest);
96}
97
98int vboxClipboardInit() { return VINF_SUCCESS; }
99void vboxClipboardDestroy() { AssertFailed(); }
100void vboxClipboardDisconnect(_VBOXCLIPBOARDCLIENTDATA*) { AssertFailed(); }
101int vboxClipboardConnect(_VBOXCLIPBOARDCLIENTDATA*)
102{ AssertFailed(); return VERR_WRONG_ORDER; }
103void vboxClipboardFormatAnnounce(_VBOXCLIPBOARDCLIENTDATA*, unsigned int)
104{ AssertFailed(); }
105int vboxClipboardReadData(_VBOXCLIPBOARDCLIENTDATA*, unsigned int, void*, unsigned int, unsigned int*)
106{ AssertFailed(); return VERR_WRONG_ORDER; }
107void vboxClipboardWriteData(_VBOXCLIPBOARDCLIENTDATA*, void*, unsigned int, unsigned int) { AssertFailed(); }
108VMMR3DECL(int) SSMR3PutU32(PSSMHANDLE pSSM, uint32_t u32)
109{ AssertFailed(); return VERR_WRONG_ORDER; }
110VMMR3DECL(int) SSMR3PutStructEx(PSSMHANDLE pSSM, const void *pvStruct, size_t cbStruct, uint32_t fFlags, PCSSMFIELD paFields, void *pvUser)
111{ AssertFailed(); return VERR_WRONG_ORDER; }
112VMMR3DECL(int) SSMR3GetU32(PSSMHANDLE pSSM, uint32_t *pu32)
113{ AssertFailed(); return VERR_WRONG_ORDER; }
114VMMR3DECL(uint32_t) SSMR3HandleHostBits(PSSMHANDLE pSSM)
115{ AssertFailed(); return 0; }
116VMMR3DECL(int) SSMR3GetStructEx(PSSMHANDLE pSSM, void *pvStruct, size_t cbStruct, uint32_t fFlags, PCSSMFIELD paFields, void *pvUser)
117{ AssertFailed(); return VERR_WRONG_ORDER; }
118int vboxClipboardSync(_VBOXCLIPBOARDCLIENTDATA*)
119{ AssertFailed(); return VERR_WRONG_ORDER; }
Note: See TracBrowser for help on using the repository browser.

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