|
64 | 64 | #include "virinterfaceobj.h"
|
65 | 65 | #include "virhostcpu.h"
|
66 | 66 | #include "virdomainsnapshotobjlist.h"
|
| 67 | +#include "virkeycode.h" |
67 | 68 |
|
68 | 69 | #define VIR_FROM_THIS VIR_FROM_TEST
|
69 | 70 |
|
@@ -6004,6 +6005,45 @@ testDomainScreenshot(virDomainPtr dom ATTRIBUTE_UNUSED,
|
6004 | 6005 | return ret;
|
6005 | 6006 | }
|
6006 | 6007 |
|
| 6008 | + |
| 6009 | +static int |
| 6010 | +testDomainSendKey(virDomainPtr domain, |
| 6011 | + unsigned int codeset, |
| 6012 | + unsigned int holdtime ATTRIBUTE_UNUSED, |
| 6013 | + unsigned int *keycodes, |
| 6014 | + int nkeycodes, |
| 6015 | + unsigned int flags) |
| 6016 | +{ |
| 6017 | + int ret = -1; |
| 6018 | + size_t i; |
| 6019 | + virDomainObjPtr vm = NULL; |
| 6020 | + |
| 6021 | + virCheckFlags(0, -1); |
| 6022 | + |
| 6023 | + if (!(vm = testDomObjFromDomain(domain))) |
| 6024 | + goto cleanup; |
| 6025 | + |
| 6026 | + if (virDomainObjCheckActive(vm) < 0) |
| 6027 | + goto cleanup; |
| 6028 | + |
| 6029 | + for (i = 0; i < nkeycodes; i++) { |
| 6030 | + if (virKeycodeValueTranslate(codeset, codeset, keycodes[i]) < 0) { |
| 6031 | + virReportError(VIR_ERR_INTERNAL_ERROR, |
| 6032 | + _("invalid keycode %u of %s codeset"), |
| 6033 | + keycodes[i], |
| 6034 | + virKeycodeSetTypeToString(codeset)); |
| 6035 | + goto cleanup; |
| 6036 | + } |
| 6037 | + } |
| 6038 | + |
| 6039 | + ret = 0; |
| 6040 | + |
| 6041 | + cleanup: |
| 6042 | + virDomainObjEndAPI(&vm); |
| 6043 | + return ret; |
| 6044 | +} |
| 6045 | + |
| 6046 | + |
6007 | 6047 | static int
|
6008 | 6048 | testConnectGetCPUModelNames(virConnectPtr conn ATTRIBUTE_UNUSED,
|
6009 | 6049 | const char *archName,
|
@@ -7025,6 +7065,7 @@ static virHypervisorDriver testHypervisorDriver = {
|
7025 | 7065 | .nodeGetCPUMap = testNodeGetCPUMap, /* 1.0.0 */
|
7026 | 7066 | .domainRename = testDomainRename, /* 4.1.0 */
|
7027 | 7067 | .domainScreenshot = testDomainScreenshot, /* 1.0.5 */
|
| 7068 | + .domainSendKey = testDomainSendKey, /* 5.5.0 */ |
7028 | 7069 | .domainGetMetadata = testDomainGetMetadata, /* 1.1.3 */
|
7029 | 7070 | .domainSetMetadata = testDomainSetMetadata, /* 1.1.3 */
|
7030 | 7071 | .connectGetCPUModelNames = testConnectGetCPUModelNames, /* 1.1.3 */
|
|
0 commit comments