/*++ Copyright (c) 1995 Microsoft Corporation Module Name: itlupak.c Abstract: This module contains the test functions for lineUnpark Author: Xiao Ying Ding (XiaoD) 31-Jan-1996 Revision History: Rama Koneru (a-ramako) 4/8/96 added unicode support --*/ #include "windows.h" #include "malloc.h" #include "string.h" #include "tapi.h" #include "trapper.h" #include "tcore.h" #include "ttest.h" #include "doline.h" #include "vars.h" #include "sline.h" // lineUnpark // // The following tests are made: // // Tested Notes // ------------------------------------------------------------------------- // Go/No-Go test // // * = Stand-alone test case // // BOOL TestLineUnpark(BOOL fQuietMode, BOOL fStandAlone) { LPTAPILINETESTINFO lpTapiLineTestInfo; INT n; LPCALLBACKPARAMS lpCallbackParams; ESPDEVSPECIFICINFO info; BOOL fTestPassed = TRUE; BOOL fUnimdm; #ifdef WUNICODE WCHAR wszValidAddress[] = L"55555"; #else CHAR szValidAddress[] = "55555"; #endif InitTestNumber(); TapiLineTestInit(); lpTapiLineTestInfo = GetLineTestInfo(); lpCallbackParams = GetCallbackParams(); OutputTAPIDebugInfo( DBUG_SHOW_DETAIL, "\n*****************************************************************************************"); TapiLogDetail( DBUG_SHOW_PASS, ">>>>>>>> Begin testing lineUnpark <<<<<<<<" ); /* // Initialize a line app if(! DoLineInitializeEx (lpTapiLineTestInfo, TAPISUCCESS)) { TLINE_FAIL(); } lpTapiLineTestInfo->dwDeviceID = 0; lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion; lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0; lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION; lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION; if(IsUNIMDMLineDevice(lpTapiLineTestInfo)) { fUnimdm = TRUE; } else fUnimdm = FALSE; if(fUnimdm) { TapiLogDetail( DBUG_SHOW_DETAIL, "### Unimdm does not supported these apis"); // Shutdown and end the tests if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS)) { TLINE_FAIL(); } return fTestPassed; } // Shutdown and end the tests if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS)) { TLINE_FAIL(); } */ lpTapiLineTestInfo->dwAddressID = 0; lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1; lpTapiLineTestInfo->lpLineInitializeExParams = (LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap ( sizeof(LINEINITIALIZEEXPARAMS)); lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize = sizeof(LINEINITIALIZEEXPARAMS); lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions = LINEINITIALIZEEXOPTION_USEHIDDENWINDOW; #ifdef WUNICODE lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress; #else lpTapiLineTestInfo->lpszDestAddress = szValidAddress; #endif TapiLogDetail( DBUG_SHOW_PASS, ">> Test Case %ld: invalid hLine values", dwTestCase + 1 ); lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1; lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion; lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0; lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION; lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION; lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL; lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER; lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM; if (! DoTapiLineFuncs( lpTapiLineTestInfo, LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN | LMAKECALL )) { TLINE_FAIL(); } lpTapiLineTestInfo->hLine_Orig = *(lpTapiLineTestInfo->lphLine); for (n = 0; n < NUMINVALIDHANDLES; n++) { TapiLogDetail( DBUG_SHOW_DETAIL, "n= %ld", n); *(lpTapiLineTestInfo->lphLine) = (HLINE) gdwInvalidHandles[n]; if (! DoLineUnpark(lpTapiLineTestInfo, LINEERR_INVALLINEHANDLE, TRUE)) { TLINE_FAIL(); } } fTestPassed = ShowTestCase(fTestPassed); *(lpTapiLineTestInfo->lphLine) = lpTapiLineTestInfo->hLine_Orig; // Shutdown to isolate the test case if (! DoTapiLineFuncs( lpTapiLineTestInfo, LCLOSE | LSHUTDOWN )) { TLINE_FAIL(); } TapiLogDetail( DBUG_SHOW_PASS, ">> Test Case %ld: invalid lphCall values", dwTestCase + 1 ); lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1; lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion; lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0; lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION; lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION; lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL; lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER; lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM; if (! DoTapiLineFuncs( lpTapiLineTestInfo, LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN | LMAKECALL )) { TLINE_FAIL(); } for (n = 0; n < NUMINVALIDHANDLES; n++) { TapiLogDetail( DBUG_SHOW_DETAIL, "n= %ld", n); lpTapiLineTestInfo->lphCall = (LPHCALL) gdwInvalidHandles[n]; if (! DoLineUnpark(lpTapiLineTestInfo, LINEERR_INVALPOINTER, TRUE)) { TLINE_FAIL(); } } fTestPassed = ShowTestCase(fTestPassed); lpTapiLineTestInfo->hCall1 = 0; lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1; // Shutdown to isolate the test case if (! DoTapiLineFuncs( lpTapiLineTestInfo, LCLOSE | LSHUTDOWN )) { TLINE_FAIL(); } #ifdef WUNICODE TapiLogDetail( DBUG_SHOW_PASS, ">> Test Case %ld: invalid lpwszDestAddress values", dwTestCase + 1 ); #else TapiLogDetail( DBUG_SHOW_PASS, ">> Test Case %ld: invalid lpszDestAddress values", dwTestCase + 1 ); #endif lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1; lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion; lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0; lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION; lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION; lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL; lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER; lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM; if (! DoTapiLineFuncs( lpTapiLineTestInfo, LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN | LMAKECALL )) { TLINE_FAIL(); } for (n = 0; n < NUMINVALIDHANDLES; n++) { TapiLogDetail( DBUG_SHOW_DETAIL, "n= %ld", n); #ifdef WUNICODE lpTapiLineTestInfo->lpwszDestAddress = (LPWSTR) gdwInvalidHandles[n]; #else lpTapiLineTestInfo->lpszDestAddress = (LPSTR) gdwInvalidHandles[n]; #endif if (! DoLineUnpark(lpTapiLineTestInfo, LINEERR_INVALPOINTER, TRUE)) { TLINE_FAIL(); } } fTestPassed = ShowTestCase(fTestPassed); #ifdef WUNICODE lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress; #else lpTapiLineTestInfo->lpszDestAddress = szValidAddress; #endif // Shutdown to isolate the test case if (! DoTapiLineFuncs( lpTapiLineTestInfo, LCLOSE | LSHUTDOWN )) { TLINE_FAIL(); } TapiLogDetail( DBUG_SHOW_PASS, ">> Test Case %ld: Verify hCall can't be used when fail", dwTestCase + 1 ); lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1; lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion; lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0; lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION; lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION; lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL; lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER; lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM; if (! DoTapiLineFuncs( lpTapiLineTestInfo, LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN | LMAKECALL )) { TLINE_FAIL(); } #ifdef WUNICODE lpTapiLineTestInfo->lpwszDestAddress = NULL; #else lpTapiLineTestInfo->lpszDestAddress = NULL; #endif lpTapiLineTestInfo->hCall1 = 0; lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1; if (! DoLineUnpark(lpTapiLineTestInfo, LINEERR_INVALPOINTER, TRUE)) { TLINE_FAIL(); } #ifdef WUNICODE lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress; #else lpTapiLineTestInfo->lpszDestAddress = szValidAddress; #endif lpTapiLineTestInfo->dwCountryCode = 0; if (! DoLineDial(lpTapiLineTestInfo, LINEERR_INVALCALLHANDLE, TRUE)) { TLINE_FAIL(); } fTestPassed = ShowTestCase(fTestPassed); // Shutdown to isolate the test case if (! DoTapiLineFuncs( lpTapiLineTestInfo, LCLOSE | LSHUTDOWN )) { TLINE_FAIL(); } TapiLogDetail( DBUG_SHOW_PASS, ">> Test Case %ld: Success, verify LINE_CALLSTATE msg", dwTestCase + 1 ); lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1; lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion; lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0; lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION; lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION; lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL; lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER; lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM; if (! DoTapiLineFuncs( lpTapiLineTestInfo, LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN | LMAKECALL )) { TLINE_FAIL(); } if(IsESPLineDevice(lpTapiLineTestInfo)) { if (! DoLineUnpark(lpTapiLineTestInfo, TAPISUCCESS, TRUE)) { TLINE_FAIL(); } if(fTestPassed) { AddMessage( LINE_CALLSTATE, (DWORD) lpTapiLineTestInfo->hCall1, (DWORD) lpCallbackParams, LINECALLSTATE_ONHOLD, 0x00000000, 0x00000000, TAPIMSG_DWMSG | TAPIMSG_HDEVCALL | TAPIMSG_DWCALLBACKINST | TAPIMSG_DWPARAM1 ); if (! WaitForAllMessages()) { TLINE_FAIL(); fTestPassed = FALSE; } else fTestPassed = TRUE; } } else { if (! DoLineUnpark(lpTapiLineTestInfo, LINEERR_OPERATIONUNAVAIL, TRUE)) { TLINE_FAIL(); } } fTestPassed = ShowTestCase(fTestPassed); // Shutdown to isolate the test case if (! DoTapiLineFuncs( lpTapiLineTestInfo, LCLOSE | LSHUTDOWN )) { TLINE_FAIL(); } FreeTestHeap(); for(n = ESP_RESULT_CALLCOMPLPROCSYNC; n <= ESP_RESULT_CALLCOMPLPROCASYNC; n++) { TapiLogDetail( DBUG_SHOW_PASS, ">> Test Case %ld: Success, completionID = %d", dwTestCase + 1, n ); TapiLineTestInit(); lpTapiLineTestInfo = GetLineTestInfo(); lpCallbackParams = GetCallbackParams(); lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1; lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1; lpTapiLineTestInfo->lpLineInitializeExParams = (LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap ( sizeof(LINEINITIALIZEEXPARAMS)); lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize = sizeof(LINEINITIALIZEEXPARAMS); lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions = LINEINITIALIZEEXOPTION_USEHIDDENWINDOW; lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion; lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0; lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION; lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION; lpTapiLineTestInfo->lpLineDevCaps = (LPLINEDEVCAPS) AllocFromTestHeap( sizeof(LINEDEVCAPS) ); lpTapiLineTestInfo->lpLineDevCaps->dwTotalSize = sizeof(LINEDEVCAPS); lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM; lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER; lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS; // Init a line if (! DoTapiLineFuncs( lpTapiLineTestInfo, LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN )) { TLINE_FAIL(); } if(IsESPLineDevice(lpTapiLineTestInfo)) { info.dwKey = ESPDEVSPECIFIC_KEY; info.dwType = ESP_DEVSPEC_RESULT; info.u.EspResult.lResult = TAPISUCCESS; info.u.EspResult.dwCompletionType = n; lpTapiLineTestInfo->lpParams = (LPVOID)&info; lpTapiLineTestInfo->dwSize = sizeof(info); if(! DoLineDevSpecific(lpTapiLineTestInfo, TAPISUCCESS, TRUE)) { TLINE_FAIL(); } #ifdef WUNICODE lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress; #else lpTapiLineTestInfo->lpszDestAddress = szValidAddress; #endif if ( ! DoLineUnpark(lpTapiLineTestInfo, info.u.EspResult.lResult, TRUE)) { TLINE_FAIL(); } } fTestPassed = ShowTestCase(fTestPassed); if (! DoLineClose(lpTapiLineTestInfo, TAPISUCCESS)) { TLINE_FAIL(); } // Shutdown to isolate the test case if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS)) { TLINE_FAIL(); } // Free the memory allocated during the tests FreeTestHeap(); } for(n = ESP_RESULT_RETURNRESULT; n <= ESP_RESULT_CALLCOMPLPROCASYNC; n++) { TapiLogDetail( DBUG_SHOW_PASS, ">> Test Case %ld: Error, completionID = %d", dwTestCase + 1, n ); TapiLineTestInit(); lpTapiLineTestInfo = GetLineTestInfo(); lpCallbackParams = GetCallbackParams(); lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1; lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1; lpTapiLineTestInfo->lpLineInitializeExParams = (LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap ( sizeof(LINEINITIALIZEEXPARAMS)); lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize = sizeof(LINEINITIALIZEEXPARAMS); lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions = LINEINITIALIZEEXOPTION_USEHIDDENWINDOW; lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion; lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0; lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION; lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION; lpTapiLineTestInfo->lpLineDevCaps = (LPLINEDEVCAPS) AllocFromTestHeap( sizeof(LINEDEVCAPS) ); lpTapiLineTestInfo->lpLineDevCaps->dwTotalSize = sizeof(LINEDEVCAPS); lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM; lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER; lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS; // Init a line if (! DoTapiLineFuncs( lpTapiLineTestInfo, LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN )) { TLINE_FAIL(); } if(IsESPLineDevice(lpTapiLineTestInfo)) { info.dwKey = ESPDEVSPECIFIC_KEY; info.dwType = ESP_DEVSPEC_RESULT; info.u.EspResult.lResult = LINEERR_INVALADDRESSID; info.u.EspResult.dwCompletionType = n; lpTapiLineTestInfo->lpParams = (LPVOID)&info; lpTapiLineTestInfo->dwSize = sizeof(info); if(! DoLineDevSpecific(lpTapiLineTestInfo, TAPISUCCESS, TRUE)) { TLINE_FAIL(); } #ifdef WUNICODE lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress; #else lpTapiLineTestInfo->lpszDestAddress = szValidAddress; #endif lpTapiLineTestInfo->fCompletionModeSet = TRUE; if ( ! DoLineUnpark(lpTapiLineTestInfo, info.u.EspResult.lResult, FALSE)) { TLINE_FAIL(); } AddMessage( LINE_REPLY, (DWORD) lpTapiLineTestInfo->hCall1, (DWORD) lpCallbackParams, 0x00000000, info.u.EspResult.lResult, 0x00000000, TAPIMSG_DWMSG | TAPIMSG_DWPARAM2 ); if( !WaitForAllMessages()) { TLINE_FAIL(); } lpTapiLineTestInfo->fCompletionModeSet = FALSE; } fTestPassed = ShowTestCase(fTestPassed); if (! DoLineClose(lpTapiLineTestInfo, TAPISUCCESS)) { TLINE_FAIL(); } // Shutdown to isolate the test case if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS)) { TLINE_FAIL(); } // Free the memory allocated during the tests FreeTestHeap(); } TapiLogDetail( DBUG_SHOW_PASS, "@@ lineUnpark: Total Test Case = %ld, Passed = %ld, Failed = %ld", dwTestCase, dwTestCasePassed, dwTestCaseFailed); TapiLogDetail( DBUG_SHOW_PASS, "@@ Total Test Case = %ld, Passed = %ld, Failed = %ld", dwglTestCase, dwglTestCasePassed, dwglTestCaseFailed); if(dwTestCaseFailed > 0) fTestPassed = FALSE; TapiLogDetail( DBUG_SHOW_PASS, ">>>>>>>> End testing lineUnpark <<<<<<<<" ); return fTestPassed; }