WebKitTools: Fix layout test failures after r47312.
authorjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Aug 2009 11:25:19 +0000 (11:25 +0000)
committerjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Aug 2009 11:25:19 +0000 (11:25 +0000)
Reviewed by Cameron Zwarich.

* DumpRenderTree/AccessibilityController.h:
Replaced logFocusEvents() with setLogFocusEvents(), which takes a
boolean argument to turn logging of focus events on or off.
Added a function to reset the AccessibilityController to a consistent
state.

* DumpRenderTree/AccessibilityController.cpp:
(logFocusEventsCallback):
Call setLogFocusEvents() to enable logging.
(AccessibilityController::resetToConsistentState):
Call setLogFocusEvents() to disable logging.

* DumpRenderTree/gtk/AccessibilityControllerGtk.cpp:
(AccessibilityController::setLogFocusEvents):
Update stub.

* DumpRenderTree/mac/AccessibilityControllerMac.mm:
(AccessibilityController::setLogFocusEvents):
Update stub.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentStateBeforeTesting):
Call the FrameLoadDelegate's resetToConsistentState method.

* DumpRenderTree/mac/FrameLoadDelegate.h:
Declare the resetToConsistentState method.

* DumpRenderTree/mac/FrameLoadDelegate.mm:
(-[FrameLoadDelegate resetToConsistentState]):
Call the AccessibilityController's resetToConsistentState() function.

* DumpRenderTree/win/AccessibilityControllerWin.cpp:
(AccessibilityController::~AccessibilityController):
Turn off focus event logging when the controller is destroyed.
(AccessibilityController::setLogFocusEvents):
If the caller passes false, unhook the focus event, and clear
m_focusEventHook.

* DumpRenderTree/win/DumpRenderTree.cpp:
(resetWebViewToConsistentStateBeforeTesting):
Call the FrameLoadDelegate's resetToConsistentState function.

* DumpRenderTree/win/FrameLoadDelegate.h:
Declare the resetToConsistentState() function.

* DumpRenderTree/win/FrameLoadDelegate.cpp:
(FrameLoadDelegate::resetToConsistentState):
Call the AccessibilityController's resetToConsistentState() function.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@47320 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/AccessibilityController.cpp
WebKitTools/DumpRenderTree/AccessibilityController.h
WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp
WebKitTools/DumpRenderTree/mac/AccessibilityControllerMac.mm
WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.h
WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.mm
WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp
WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp
WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h

index 6c7980f..494a2df 100644 (file)
@@ -1,3 +1,59 @@
+2009-08-15  Jon Honeycutt  <jhoneycutt@apple.com>
+
+        Fix layout test failures after r47312.
+
+        Reviewed by Cameron Zwarich.
+
+        * DumpRenderTree/AccessibilityController.h:
+        Replaced logFocusEvents() with setLogFocusEvents(), which takes a
+        boolean argument to turn logging of focus events on or off.
+        Added a function to reset the AccessibilityController to a consistent
+        state.
+
+        * DumpRenderTree/AccessibilityController.cpp:
+        (logFocusEventsCallback):
+        Call setLogFocusEvents() to enable logging.
+        (AccessibilityController::resetToConsistentState):
+        Call setLogFocusEvents() to disable logging.
+
+        * DumpRenderTree/gtk/AccessibilityControllerGtk.cpp:
+        (AccessibilityController::setLogFocusEvents):
+        Update stub.
+
+        * DumpRenderTree/mac/AccessibilityControllerMac.mm:
+        (AccessibilityController::setLogFocusEvents):
+        Update stub.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebViewToConsistentStateBeforeTesting):
+        Call the FrameLoadDelegate's resetToConsistentState method.
+
+        * DumpRenderTree/mac/FrameLoadDelegate.h:
+        Declare the resetToConsistentState method.
+
+        * DumpRenderTree/mac/FrameLoadDelegate.mm:
+        (-[FrameLoadDelegate resetToConsistentState]):
+        Call the AccessibilityController's resetToConsistentState() function.
+
+        * DumpRenderTree/win/AccessibilityControllerWin.cpp:
+        (AccessibilityController::~AccessibilityController):
+        Turn off focus event logging when the controller is destroyed.
+        (AccessibilityController::setLogFocusEvents):
+        If the caller passes false, unhook the focus event, and clear
+        m_focusEventHook.
+
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (resetWebViewToConsistentStateBeforeTesting):
+        Call the FrameLoadDelegate's resetToConsistentState function.
+
+        * DumpRenderTree/win/FrameLoadDelegate.h:
+        Declare the resetToConsistentState() function.
+
+        * DumpRenderTree/win/FrameLoadDelegate.cpp:
+        (FrameLoadDelegate::resetToConsistentState):
+        Call the AccessibilityController's resetToConsistentState() function.
+
+
 2009-08-14  Jon Honeycutt  <jhoneycutt@apple.com>
 
         Add a mechanism for logging MSAA focus events.
index 0a4c0e8..fcca3b0 100644 (file)
@@ -55,7 +55,7 @@ void AccessibilityController::makeWindowObject(JSContextRef context, JSObjectRef
 static JSValueRef logFocusEventsCallback(JSContextRef ctx, JSObjectRef, JSObjectRef thisObject, size_t, const JSValueRef[], JSValueRef*)
 {
     AccessibilityController* controller = static_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
-    controller->logFocusEvents();
+    controller->setLogFocusEvents(true);
     return JSValueMakeUndefined(ctx);
 }
 
@@ -80,3 +80,8 @@ JSClassRef AccessibilityController::getJSClass()
     static JSClassRef accessibilityControllerClass = JSClassCreate(&classDefinition);
     return accessibilityControllerClass;
 }
+
+void AccessibilityController::resetToConsistentState()
+{
+    setLogFocusEvents(false);
+}
index a7ba4ac..64c37e4 100644 (file)
@@ -44,7 +44,9 @@ public:
     AccessibilityUIElement rootElement();
     AccessibilityUIElement focusedElement();
 
-    void logFocusEvents();
+    void setLogFocusEvents(bool);
+
+    void resetToConsistentState();
 
 private:
     static JSClassRef getJSClass();
index 8b1eec0..566f605 100644 (file)
@@ -62,6 +62,6 @@ AccessibilityUIElement AccessibilityController::rootElement()
     return AccessibilityUIElement(axObject);
 }
 
-void AccessibilityController::logFocusEvents()
+void AccessibilityController::setLogFocusEvents(bool)
 {
 }
index 4b14d75..dc7f52e 100644 (file)
@@ -54,6 +54,6 @@ AccessibilityUIElement AccessibilityController::rootElement()
     return AccessibilityUIElement(accessibilityObject);
 }
 
-void AccessibilityController::logFocusEvents()
+void AccessibilityController::setLogFocusEvents(bool)
 {
 }
index b4dcdba..0acff77 100644 (file)
@@ -1071,6 +1071,7 @@ static void resetWebViewToConsistentStateBeforeTesting()
     [webView setPolicyDelegate:nil];
     [policyDelegate setPermissive:NO];
     [policyDelegate setControllerToNotifyDone:0];
+    [frameLoadDelegate resetToConsistentState];
     [webView _setDashboardBehavior:WebDashboardBehaviorUseBackwardCompatibilityMode to:NO];
     [webView _clearMainFrameName];
     [[webView undoManager] removeAllActions];
index 6c3cbdb..390a881 100644 (file)
@@ -36,4 +36,7 @@ class GCController;
     AccessibilityController* accessibilityController;
     GCController* gcController;
 }
+
+- (void)resetToConsistentState;
+
 @end
index 4bf02ed..5f1c0fe 100644 (file)
         dump();
 }
 
+- (void)resetToConsistentState
+{
+    accessibilityController->resetToConsistentState();
+}
+
 - (void)webView:(WebView *)c locationChangeDone:(NSError *)error forDataSource:(WebDataSource *)dataSource
 {
     if ([dataSource webFrame] == topLoadingFrame) {
index 24b4659..880239b 100644 (file)
@@ -43,8 +43,7 @@ AccessibilityController::AccessibilityController()
 
 AccessibilityController::~AccessibilityController()
 {
-    if (m_focusEventHook)
-        UnhookWinEvent(m_focusEventHook);
+    setLogFocusEvents(false);
 }
 
 AccessibilityUIElement AccessibilityController::focusedElement()
@@ -112,9 +111,16 @@ static void CALLBACK logFocusEventProc(HWINEVENTHOOK hWinEventHook, DWORD event,
     printf("Received focus event for object '%S'.\n", name.c_str());
 }
 
-void AccessibilityController::logFocusEvents()
+void AccessibilityController::setLogFocusEvents(bool logFocusEvents)
 {
-    ASSERT(!m_focusEventHook);
+    if (!!m_focusEventHook == logFocusEvents)
+        return;
+
+    if (!logFocusEvents) {
+        UnhookWinEvent(m_focusEventHook);
+        m_focusEventHook = 0;
+        return;
+    }
 
     // Ensure that accessibility is initialized for the WebView by querying for
     // the root accessible object.
index f4e374c..0228905 100644 (file)
@@ -757,6 +757,8 @@ static void resetWebViewToConsistentStateBeforeTesting()
     webViewPrivate->clearMainFrameName();
 
     sharedUIDelegate->resetUndoManager();
+
+    sharedFrameLoadDelegate->resetToConsistentState();
 }
 
 static void runTest(const string& testPathOrURL)
index 5f0e02b..e97e313 100644 (file)
@@ -196,6 +196,11 @@ void FrameLoadDelegate::processWork()
         dump();
 }
 
+void FrameLoadDelegate::resetToConsistentState()
+{
+    m_accessibilityController->resetToConsistentState();
+}
+
 static void CALLBACK processWorkTimer(HWND, UINT, UINT_PTR id, DWORD)
 {
     ::KillTimer(0, id);
index 526e1b4..ca60941 100644 (file)
@@ -42,6 +42,8 @@ public:
 
     void processWork();
 
+    void resetToConsistentState();
+
     // IUnknown
     virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
     virtual ULONG STDMETHODCALLTYPE AddRef(void);