Author: gadamopoulos
Date: Thu Jan 13 09:58:04 2011
New Revision: 50381
URL:
http://svn.reactos.org/svn/reactos?rev=50381&view=rev
Log:
[rosautotest]
-Implement closing any dialog that shows and stays visible for some time. This way
rosautotest can now continue if a test application crashes or asserts.
Added:
trunk/rostests/rosautotest/CDialogSurpass.cpp (with props)
trunk/rostests/rosautotest/CDialogSurpass.h (with props)
Modified:
trunk/rostests/rosautotest/main.cpp
trunk/rostests/rosautotest/precomp.h
trunk/rostests/rosautotest/rosautotest.rbuild
Added: trunk/rostests/rosautotest/CDialogSurpass.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/CDialogSurpas…
==============================================================================
--- trunk/rostests/rosautotest/CDialogSurpass.cpp (added)
+++ trunk/rostests/rosautotest/CDialogSurpass.cpp [iso-8859-1] Thu Jan 13 09:58:04 2011
@@ -1,0 +1,97 @@
+/*
+ * PROJECT: ReactOS Automatic Testing Utility
+ * LICENSE: GNU GPLv2 or any later version as published by the Free Software
Foundation
+ * PURPOSE: Class for managing all the configuration parameters
+ * COPYRIGHT: Copyright 2011
+ */
+
+#include "precomp.h"
+
+BOOL CALLBACK PrintWindow(HWND hwnd, LPARAM lParam)
+{
+ CHAR WindowTitle[100];
+ int lenght;
+
+ lenght = GetWindowTextA(hwnd, WindowTitle, 100);
+ if(lenght == 0)
+ return TRUE;
+
+ StringOut( string(WindowTitle) + "\n" );
+
+ return TRUE;
+}
+
+
+void CALLBACK WinEventProc(HWINEVENTHOOK hWinEventHook,
+ DWORD event,
+ HWND hwnd,
+ LONG idObject,
+ LONG idChild,
+ DWORD dwEventThread,
+ DWORD dwmsEventTime)
+{
+ /* make sure we got the correct event */
+ if(event == EVENT_SYSTEM_DIALOGSTART)
+ {
+ /* wait for some time to make sure that the dialog is hung */
+ Sleep(30 * 1000);
+
+ /* Check if it is still open */
+ if(IsWindow(hwnd))
+ {
+ /* Print an error message */
+ StringOut("Closing following dialog box:\n");
+ PrintWindow(hwnd, NULL);
+ EnumChildWindows(hwnd, PrintWindow, NULL);
+
+ /* Close the dialog */
+ SendMessage(hwnd, WM_CLOSE, 0, 0);
+ }
+ }
+}
+
+
+DWORD WINAPI DialogSurpassThread(LPVOID lpThreadParameter)
+{
+ MSG dummy;
+
+ /* Install event notifications */
+ SetWinEventHook(EVENT_SYSTEM_DIALOGSTART,
+ EVENT_SYSTEM_DIALOGSTART,
+ NULL,
+ WinEventProc,
+ 0,
+ 0,
+ WINEVENT_OUTOFCONTEXT);
+
+ while(GetMessage(&dummy, 0,0,0))
+ {
+ /* There is no need to dispatch messages here */
+ /* Actually this block will never be executed */
+ }
+
+ return 0;
+}
+
+CDialogSurpass::CDialogSurpass()
+{
+ /* Creat the trhead that will receive notifications */
+ hThread = CreateThread(NULL,
+ 0,
+ DialogSurpassThread,
+ NULL,
+ 0,
+ &ThreadID);
+}
+
+CDialogSurpass::~CDialogSurpass()
+{
+ /* Notify the thread to close */
+ PostThreadMessage(ThreadID, WM_QUIT, 0, 0);
+
+ /* Wait for it close */
+ WaitForSingleObject(hThread, INFINITE);
+
+ /* Now close its handle*/
+ CloseHandle(hThread);
+}
Propchange: trunk/rostests/rosautotest/CDialogSurpass.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/rosautotest/CDialogSurpass.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/CDialogSurpas…
==============================================================================
--- trunk/rostests/rosautotest/CDialogSurpass.h (added)
+++ trunk/rostests/rosautotest/CDialogSurpass.h [iso-8859-1] Thu Jan 13 09:58:04 2011
@@ -1,0 +1,17 @@
+/*
+ * PROJECT: ReactOS Automatic Testing Utility
+ * LICENSE: GNU GPLv2 or any later version as published by the Free Software
Foundation
+ * PURPOSE: Class for managing all the configuration parameters
+ * COPYRIGHT: Copyright 2011
+ */
+
+class CDialogSurpass
+{
+private:
+
+ DWORD ThreadID;
+ HANDLE hThread;
+public:
+ CDialogSurpass();
+ ~CDialogSurpass();
+};
Propchange: trunk/rostests/rosautotest/CDialogSurpass.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/rosautotest/main.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/main.cpp?rev=…
==============================================================================
--- trunk/rostests/rosautotest/main.cpp [iso-8859-1] (original)
+++ trunk/rostests/rosautotest/main.cpp [iso-8859-1] Thu Jan 13 09:58:04 2011
@@ -48,6 +48,7 @@
{
CWineTest WineTest;
int ReturnValue = 1;
+ CDialogSurpass s;
try
{
Modified: trunk/rostests/rosautotest/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/precomp.h?rev…
==============================================================================
--- trunk/rostests/rosautotest/precomp.h [iso-8859-1] (original)
+++ trunk/rostests/rosautotest/precomp.h [iso-8859-1] Thu Jan 13 09:58:04 2011
@@ -20,6 +20,7 @@
/* Class includes */
#include "auto_array_ptr.h"
#include "CConfiguration.h"
+#include "CDialogSurpass.h"
#include "CFatalException.h"
#include "CInvalidParameterException.h"
#include "CProcess.h"
Modified: trunk/rostests/rosautotest/rosautotest.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/rosautotest.r…
==============================================================================
--- trunk/rostests/rosautotest/rosautotest.rbuild [iso-8859-1] (original)
+++ trunk/rostests/rosautotest/rosautotest.rbuild [iso-8859-1] Thu Jan 13 09:58:04 2011
@@ -8,6 +8,7 @@
<library>user32</library>
<library>wininet</library>
<file>CConfiguration.cpp</file>
+ <file>CDialogSurpass.cpp</file>
<file>CFatalException.cpp</file>
<file>CInvalidParameterException.cpp</file>
<file>CJournaledTestList.cpp</file>