tstHeadless.cpp revision bff1915a855c5b71d76f6391549eadda348e33b0
/** @file
*
* VBox frontends: VBoxHeadless frontend:
* Testcases
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* innotek GmbH confidential
* All rights reserved
*/
using namespace com;
////////////////////////////////////////////////////////////////////////////////
/**
* Entry point.
*/
{
// initialize VBox Runtime
RTR3Init();
// the below cannot be Bstr because on Linux Bstr doesn't work
// until XPCOM (nsMemory) is initialized
// parse the command line
if (argc > 1)
if (argc > 2)
{
RTPrintf ("\nUsage:\n\n"
"%s <machine_name> [on|off|pause|resume]\n\n",
argv [0]);
return -1;
}
RTPrintf ("\n");
RTPrintf ("tstHeadless STARTED.\n");
RTPrintf ("VM name : {%s}\n"
"Operation : %s\n\n",
do
{
RTPrintf ("Creating VirtualBox object...\n");
RTPrintf ("Creating Session object...\n");
// create the event queue
// after the session is closed)
// find ID by name
{
}
{
RTPrintf ("Opening a new (remote) session...\n");
RTPrintf ("Waiting for the remote session to open...\n");
if (FAILED (resultCode))
{
}
else
{
RTPrintf ("Remote session has been successfully opened.\n");
}
}
else
{
RTPrintf ("Opening an existing session...\n");
{
RTPrintf ("Powering the VM off...\n");
}
else
{
RTPrintf ("Pausing the VM...\n");
}
else
{
RTPrintf ("Resuming the VM...\n");
}
else
{
RTPrintf ("Invalid operation!\n");
}
}
RTPrintf ("Closing the session (may fail after power off)...\n");
}
while (0);
RTPrintf ("\n");
RTPrintf ("tstHeadless FINISHED.\n");
return rc;
}