Changeset 104
- Timestamp:
- 07/05/11 11:10:35 (13 years ago)
- Location:
- trunk/MFCtooling/replay
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MFCtooling/replay/LogParser.cpp
r32 r104 6 6 #include "WindowFinder.h" 7 7 8 LogParser::LogParser( void)8 LogParser::LogParser(_TCHAR* runCommand, unsigned int startupTime, bool useDefaultDelay) : runCommand(runCommand), startupTime(startupTime), useDefaultDelay(useDefaultDelay) 9 9 { 10 10 … … 28 28 std::wstring localName(pwchLocalName); 29 29 if( localName.compare(L"session")==0 ) { 30 // TODO 30 std::wstring sessionId = GetAttributeValue(pAttributes, L"id", L""); 31 std::wcout << L"================================================" << std::endl; 32 std::wcout << L"starting session " << sessionId << std::endl; 33 std::wcout << L"executing " << runCommand << std::endl; 34 PROCESS_INFORMATION pi; 35 STARTUPINFO si; 36 ZeroMemory(&pi, sizeof(pi)); 37 ZeroMemory(&si, sizeof(si)); 38 CreateProcess(NULL, runCommand, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); 39 hProcess = pi.hProcess; 40 CloseHandle(pi.hThread); 41 std::wcout << L"waiting " << startupTime << L" ms for application under test to intialize" << std::endl; 42 Sleep(startupTime); 43 std::wcout << L"replay starting..." << std::endl; 31 44 } 32 45 else if( localName.compare(L"msg")==0 ) { … … 76 89 std::wstring localName(pwchLocalName); 77 90 if( localName.compare(L"session")==0 ) { 78 // TODO 91 std::wcout << L"session completed" << std::endl; 92 BOOL retVal = TerminateProcess(hProcess, 0); 93 if( retVal!=0 ) { 94 std::wcout << L"application terminated" << std::endl; 95 } 96 CloseHandle(hProcess); 79 97 } 80 98 else if( localName.compare(L"msg")==0 ) { … … 129 147 130 148 void LogParser::sendMessage(HWND hwnd) { 131 std::wcout << L" Sending " << msgType << L" to " << hwnd << "L - LPARAM: " << lParam << L" - WPARAM: " << wParam << std::endl;149 std::wcout << L" Sending " << msgType << L" to " << hwnd << "L - LPARAM: " << lParam << L" - WPARAM: " << wParam << std::endl; 132 150 PostMessage(hwnd, msgType, wParam, lParam); 133 Sleep(defaultMsgDelay); 134 //Sleep(delay); 151 if( useDefaultDelay ) { 152 Sleep(defaultMsgDelay); 153 } else { 154 Sleep(delay); 155 } 135 156 } -
trunk/MFCtooling/replay/LogParser.h
r32 r104 17 17 WPARAM wParam; 18 18 19 boolean useDefaultDelay; 19 20 int delay; 20 21 21 22 void sendMessage(HWND hwnd); 22 23 24 _TCHAR * runCommand; 25 unsigned int startupTime; 26 HANDLE hProcess; 27 23 28 public: 24 LogParser( void);29 LogParser(_TCHAR * runCommand, unsigned int startupChar, bool useDefaultDelay = false); 25 30 ~LogParser(void); 26 31 -
trunk/MFCtooling/replay/replay.cpp
r65 r104 10 10 int _tmain(int argc, _TCHAR* argv[]) 11 11 { 12 if (argc< 2)12 if (argc<3) 13 13 { 14 wprintf(L"no argument provided\n");14 std::wcout << "Usage: " << argv[0] << "<replayfile> <applicationundertest>" << std::endl; 15 15 return 0; 16 16 } 17 17 18 18 // execute application to be replayed 19 if (argc>2) {19 /*if (argc>2) { 20 20 std::wcout << "executing " << argv[2] << std::endl; 21 21 PROCESS_INFORMATION pi; … … 25 25 CreateProcess(NULL, argv[2], NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); 26 26 Sleep(10000); 27 } 27 }*/ 28 28 29 29 … … 41 41 42 42 if( !FAILED(hr) ) { 43 LogParser * parser = new LogParser(); 43 std::wcout << L"replaying sessions in " << argv[1] << std::endl; 44 LogParser * parser = new LogParser(argv[2], 5000, true); 44 45 pXMLReader->putContentHandler(parser); 45 46 hr = pXMLReader->parseURL(argv[1]); 46 47 47 pXMLReader->Release(); 48 std::wcout << L"================================================" << std::endl; 49 std::wcout << L"replay completed" << std::endl; 48 50 } 49 51 50 52 CoUninitialize(); 51 53 52 std::wcout << "Press enter to exit ...";54 std::wcout << L"press enter to exit ..."; 53 55 getchar(); 54 56
Note: See TracChangeset
for help on using the changeset viewer.