2008-01-04 Alp Toker <alp@atoker.com>
[WebKit-https.git] / WebKitTools / DumpRenderTree / gtk / LayoutTestControllerGtk.cpp
index 6e18da9aac8631e1247d4a6881489ddb0ecdcf9c..82af22ec082bf0b4d9233f4151d7730a4da8c11b 100644 (file)
@@ -35,6 +35,8 @@
 #include <JavaScriptCore/JSRetainPtr.h>
 #include <JavaScriptCore/JSStringRef.h>
 
+#include <glib.h>
+
 LayoutTestController::~LayoutTestController()
 {
     // FIXME: implement
@@ -151,10 +153,26 @@ void LayoutTestController::setWindowIsKey(bool windowIsKey)
     // FIXME: implement
 }
 
+static gboolean waitToDumpWatchdogFired(void*)
+{
+    const char* message = "FAIL: Timed out waiting for notifyDone to be called\n";
+    fprintf(stderr, "%s", message);
+    fprintf(stdout, "%s", message);
+    dump();
+    return FALSE;
+}
+
 void LayoutTestController::setWaitToDump(bool waitUntilDone)
 {
+    static const int timeoutSeconds = 10;
+
     m_waitToDump = waitUntilDone;
-    // FIXME: Should have some sort of watchdog timer here
+    if (m_waitToDump && !waitToDumpWatchdog)
+#if GLIB_CHECK_VERSION(2,14,0)
+        waitToDumpWatchdog = g_timeout_add_seconds(timeoutSeconds, waitToDumpWatchdogFired, 0);
+#else
+        waitToDumpWatchdog = g_timeout_add(timeoutSeconds * 1000, waitToDumpWatchdogFired, 0);
+#endif
 }
 
 int LayoutTestController::windowCount()
@@ -173,3 +191,8 @@ void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag)
     // FIXME: implement
 }
 
+void LayoutTestController::execCommand(JSStringRef name, JSStringRef value)
+{
+    // FIXME: implement
+}
+