WebKitTools:
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Nov 2007 02:42:32 +0000 (02:42 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Nov 2007 02:42:32 +0000 (02:42 +0000)
        Reviewed by Sam.

        <rdar://problem/5230478>
        FrameLoadDelegate callbacks are not dumped in DRT.

        * DumpRenderTree/win/DumpRenderTree.cpp:
        (shouldLogFrameLoadDelegates):
        (runTest):
        (main):
        * DumpRenderTree/win/FrameLoaderDelegate.cpp:
        (BSTRtoString):
        (descriptionSuitableForTestResult):
        (FrameLoadDelegate::QueryInterface):
        (FrameLoadDelegate::didStartProvisionalLoadForFrame):
        (FrameLoadDelegate::didFailProvisionalLoadWithError):
        (FrameLoadDelegate::didCommitLoadForFrame):
        (FrameLoadDelegate::didFinishLoadForFrame):
        (FrameLoadDelegate::willCloseFrame):
        (FrameLoadDelegate::didClearWindowObject):
        (FrameLoadDelegate::didFinishDocumentLoadForFrame):
        (FrameLoadDelegate::didHandleOnloadEventsForFrame):
        * DumpRenderTree/win/FrameLoaderDelegate.h:
        (FrameLoadDelegate::windowScriptObjectAvailable):
        (FrameLoadDelegate::didFirstLayoutInFrame):

LayoutTests:

        Reviewed by Sam.

        <rdar://problem/5230478>
        FrameLoadDelegate callbacks are not dumped in DRT.

        Remove now passing tests.

        * platform/win/Skipped:

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

LayoutTests/ChangeLog
LayoutTests/platform/win/Skipped
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
WebKitTools/DumpRenderTree/win/FrameLoaderDelegate.cpp
WebKitTools/DumpRenderTree/win/FrameLoaderDelegate.h

index 0c4f05e133bdff603636992d7740bab749eb4123..8829270b566d7d56ae6ca74488172036b87168cb 100644 (file)
@@ -1,3 +1,14 @@
+2007-11-29  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Sam.
+
+        <rdar://problem/5230478>
+        FrameLoadDelegate callbacks are not dumped in DRT.        
+
+        Remove now passing tests.
+
+        * platform/win/Skipped:
+
 2007-11-29  Alice Liu  <alice.liu@apple.com>
 
         Reviewed by Adam.
index 8d8cf333cb7ff8f37660a621c2738626a11ff6c1..c1b6848b06b2d23848effa25056f82f85c7534f8 100644 (file)
@@ -376,9 +376,6 @@ fast/events/focusingUnloadedFrame.html
 # <rdar://problem/5230396> layoutTestController.addFileToPasteboardOnDrag is unimplemented
 fast/forms/dragging-to-file-input.html
 
-# <rdar://problem/5230478> FrameLoadDelegate callbacks are not dumped in DRT
-http/tests/loading
-
 # Need to add functionality to DumpRenderTree to test IDN <rdar://problem/5301954>
 fast/encoding/idn-security.html
 
index d6d20deef984befe7210127a4093b2ef01154db1..0dc128db31de88b94c38ef2bdcdce145cc961d2c 100644 (file)
@@ -1,3 +1,30 @@
+2007-11-29  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Sam.
+
+        <rdar://problem/5230478>
+        FrameLoadDelegate callbacks are not dumped in DRT.
+        
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (shouldLogFrameLoadDelegates):
+        (runTest):
+        (main):
+        * DumpRenderTree/win/FrameLoaderDelegate.cpp:
+        (BSTRtoString):
+        (descriptionSuitableForTestResult):
+        (FrameLoadDelegate::QueryInterface):
+        (FrameLoadDelegate::didStartProvisionalLoadForFrame):
+        (FrameLoadDelegate::didFailProvisionalLoadWithError):
+        (FrameLoadDelegate::didCommitLoadForFrame):
+        (FrameLoadDelegate::didFinishLoadForFrame):
+        (FrameLoadDelegate::willCloseFrame):
+        (FrameLoadDelegate::didClearWindowObject):
+        (FrameLoadDelegate::didFinishDocumentLoadForFrame):
+        (FrameLoadDelegate::didHandleOnloadEventsForFrame):
+        * DumpRenderTree/win/FrameLoaderDelegate.h:
+        (FrameLoadDelegate::windowScriptObjectAvailable):
+        (FrameLoadDelegate::didFirstLayoutInFrame):
+
 2007-11-29  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Anders.
index e7ed6c7f67de83d1d3a4ecad0b3ef1f690d43fac..ea46a2aa1efaa8d197b05d747e2317268d33e60a 100644 (file)
@@ -583,6 +583,11 @@ fail:
     done = true;
 }
 
+static bool shouldLogFrameLoadDelegates(const char* pathOrURL)
+{
+    return strstr(pathOrURL, "loading/");
+}
+
 static void runTest(const char* pathOrURL)
 {
     static BSTR methodBStr = SysAllocString(TEXT("GET"));
@@ -615,6 +620,9 @@ static void runTest(const char* pathOrURL)
     topLoadingFrame = 0;
     timedOut = false;
 
+    if (shouldLogFrameLoadDelegates(pathOrURL))
+        layoutTestController->setDumpFrameLoadCallbacks(true);
+
     COMPtr<IWebHistory> history(Create, CLSID_WebHistory);
     if (history)
         history->setOptionalSharedHistory(0);
@@ -667,6 +675,9 @@ static void runTest(const char* pathOrURL)
         if (printSeparators)
             puts("#EOF");
     }
+
+    frame->stopLoading();
+
 exit:
     SysFreeString(urlBStr);
     delete ::layoutTestController;
@@ -887,6 +898,8 @@ int main(int argc, char* argv[])
     frameLoadDelegate.adoptRef(new FrameLoadDelegate);
     if (FAILED(webView->setFrameLoadDelegate(frameLoadDelegate.get())))
         return -1;
+    if (FAILED(viewPrivate->setFrameLoadDelegatePrivate(frameLoadDelegate.get())))
+        return -1;
 
     policyDelegate = new PolicyDelegate();
 
index 600643ded63ea7c032aed058a7f0a2d004b9edad..9093c0acad4a3c7f7fe7ae35e431d36e6a43c473 100644 (file)
 #include <JavaScriptCore/JavaScriptCore.h>
 #include <WebKit/IWebFramePrivate.h>
 #include <WebKit/IWebViewPrivate.h>
+#include <wtf/Vector.h>
 #include <stdio.h>
+#include <string>
+
+using std::string;
 
 static FrameLoadDelegate* g_delegateWaitingOnTimer;
 
+string BSTRtoString(BSTR bstr)
+{
+    int result = WideCharToMultiByte(CP_UTF8, 0, bstr, SysStringLen(bstr) + 1, 0, 0, 0, 0);
+    Vector<char> utf8Vector(result);
+    result = WideCharToMultiByte(CP_UTF8, 0, bstr, SysStringLen(bstr) + 1, utf8Vector.data(), result, 0, 0);
+    if (!result)
+        return string();
+
+    return string(utf8Vector.data(), utf8Vector.size() - 1);
+}
+
+string descriptionSuitableForTestResult(IWebFrame* webFrame)
+{
+    COMPtr<IWebView> webView;
+    if (FAILED(webFrame->webView(&webView)))
+        return string();
+
+    COMPtr<IWebFrame> mainFrame;
+    if (FAILED(webView->mainFrame(&mainFrame)))
+        return string();
+
+    if (webFrame == mainFrame)
+        return "main frame";
+
+    BSTR frameNameBSTR;
+    if (FAILED(webFrame->name(&frameNameBSTR)))
+        return string();
+
+    string frameName = "frame \"" + BSTRtoString(frameNameBSTR) + "\"";
+    SysFreeString(frameNameBSTR);
+
+    return frameName;
+}
+
 FrameLoadDelegate::FrameLoadDelegate()
     : m_refCount(1)
     , m_gcController(new GCController)
@@ -60,6 +98,10 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::QueryInterface(REFIID riid, void**
         *ppvObject = static_cast<IWebFrameLoadDelegate*>(this);
     else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegate))
         *ppvObject = static_cast<IWebFrameLoadDelegate*>(this);
+    else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegate2))
+        *ppvObject = static_cast<IWebFrameLoadDelegate*>(this);
+    else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegatePrivate))
+        *ppvObject = static_cast<IWebFrameLoadDelegatePrivate*>(this);
     else
         return E_NOINTERFACE;
 
@@ -86,6 +128,10 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didStartProvisionalLoadForFrame(
         /* [in] */ IWebView* webView,
         /* [in] */ IWebFrame* frame) 
 {
+    if (!done && layoutTestController->dumpFrameLoadCallbacks())
+        printf("%s - didStartProvisionalLoadForFrame\n",
+                descriptionSuitableForTestResult(frame).c_str());
+
     // Make sure we only set this once per test.  If it gets cleared, and then set again, we might
     // end up doing two dumps for one test.
     if (!topLoadingFrame && !done)
@@ -94,6 +140,18 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didStartProvisionalLoadForFrame(
     return S_OK; 
 }
 
+HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFailProvisionalLoadWithError( 
+    /* [in] */ IWebView *webView,
+    /* [in] */ IWebError *error,
+    /* [in] */ IWebFrame *frame)
+{
+    if (!done && layoutTestController->dumpFrameLoadCallbacks())
+        printf("%s - didFailProvisionalLoadWithError\n",
+                descriptionSuitableForTestResult(frame).c_str());
+
+    return S_OK;
+}
+
 HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didCommitLoadForFrame( 
     /* [in] */ IWebView *webView,
     /* [in] */ IWebFrame *frame)
@@ -103,6 +161,12 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didCommitLoadForFrame(
     if (FAILED(hr))
         return hr;
     webViewPrivate->updateActiveState();
+
+    if (!done && layoutTestController->dumpFrameLoadCallbacks())
+        printf("%s - didCommitLoadForFrame\n",
+                descriptionSuitableForTestResult(frame).c_str());
+
+
     return S_OK;
 }
 
@@ -163,6 +227,10 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFinishLoadForFrame(
         /* [in] */ IWebView* webView,
         /* [in] */ IWebFrame* frame)
 {
+    if (!done && layoutTestController->dumpFrameLoadCallbacks())
+        printf("%s - didFinishLoadForFrame\n",
+                descriptionSuitableForTestResult(frame).c_str());
+
     locationChangeDone(0, frame);
     return S_OK;
 }
@@ -176,11 +244,27 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFailLoadWithError(
     return S_OK;
 }
 
-HRESULT STDMETHODCALLTYPE FrameLoadDelegate::windowScriptObjectAvailable( 
-        /* [in] */ IWebView *sender,
+HRESULT STDMETHODCALLTYPE FrameLoadDelegate::willCloseFrame( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ IWebFrame *frame)
+{
+    if (!done && layoutTestController->dumpFrameLoadCallbacks())
+        printf("%s - willCloseFrame\n",
+                descriptionSuitableForTestResult(frame).c_str());
+
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didClearWindowObject( 
+        /* [in] */ IWebView*webView,
         /* [in] */ JSContextRef context,
-        /* [in] */ JSObjectRef windowObject)
+        /* [in] */ JSObjectRef windowObject,
+        /* [in] */ IWebFrame* frame)
 {
+    if (!done && layoutTestController->dumpFrameLoadCallbacks())
+        printf("%s - didClearWindowObjectForFrame\n",
+                descriptionSuitableForTestResult(frame).c_str());
+
     JSValueRef exception = 0;
 
     ::layoutTestController->makeWindowObject(context, windowObject, &exception);
@@ -196,3 +280,26 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::windowScriptObjectAvailable(
 
     return S_OK;
 }
+
+HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFinishDocumentLoadForFrame( 
+    /* [in] */ IWebView *sender,
+    /* [in] */ IWebFrame *frame)
+{
+    if (!done && layoutTestController->dumpFrameLoadCallbacks())
+        printf("%s - didFinishDocumentLoadForFrame\n",
+                descriptionSuitableForTestResult(frame).c_str());
+
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didHandleOnloadEventsForFrame( 
+    /* [in] */ IWebView *sender,
+    /* [in] */ IWebFrame *frame)
+{
+    if (!done && layoutTestController->dumpFrameLoadCallbacks())
+        printf("%s - didHandleOnloadEventsForFrame\n",
+                descriptionSuitableForTestResult(frame).c_str());
+
+    return S_OK;
+}
+
index e1a026f2fe6394deadd3b8d1024e66b08c6e5495..c52c1abb36633b5b855940e29942947cf91ae7e3 100644 (file)
 #define FrameLoaderDelegate_h
 
 #include <WebKit/IWebFrameLoadDelegate.h>
+#include <WebKit/IWebFrameLoadDelegatePrivate.h>
 #include <wtf/OwnPtr.h>
 
 class GCController;
 
-class FrameLoadDelegate : public IWebFrameLoadDelegate {
+class FrameLoadDelegate : public IWebFrameLoadDelegate2, public IWebFrameLoadDelegatePrivate {
 public:
     FrameLoadDelegate();
     virtual ~FrameLoadDelegate();
@@ -58,7 +59,7 @@ public:
     virtual HRESULT STDMETHODCALLTYPE didFailProvisionalLoadWithError( 
         /* [in] */ IWebView *webView,
         /* [in] */ IWebError *error,
-        /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } 
+        /* [in] */ IWebFrame *frame);
 
     virtual HRESULT STDMETHODCALLTYPE didCommitLoadForFrame( 
         /* [in] */ IWebView *webView,
@@ -100,12 +101,32 @@ public:
 
     virtual HRESULT STDMETHODCALLTYPE willCloseFrame( 
         /* [in] */ IWebView *webView,
-        /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } 
+        /* [in] */ IWebFrame *frame);
 
     virtual HRESULT STDMETHODCALLTYPE windowScriptObjectAvailable( 
         /* [in] */ IWebView *sender,
         /* [in] */ JSContextRef context,
-        /* [in] */ JSObjectRef windowObject);
+        /* [in] */ JSObjectRef windowObject) { return E_NOTIMPL; }
+
+    // IWebFrameLoadDelegatePrivate
+    virtual HRESULT STDMETHODCALLTYPE didFinishDocumentLoadForFrame( 
+        /* [in] */ IWebView *sender,
+        /* [in] */ IWebFrame *frame);
+        
+    virtual HRESULT STDMETHODCALLTYPE didFirstLayoutInFrame( 
+        /* [in] */ IWebView *sender,
+        /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } 
+        
+    virtual HRESULT STDMETHODCALLTYPE didHandleOnloadEventsForFrame( 
+        /* [in] */ IWebView *sender,
+        /* [in] */ IWebFrame *frame);
+
+    // IWebFrameLoadDelegate2
+    virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject( 
+        /* [in] */ IWebView* webView,
+        /* [in] */ JSContextRef context,
+        /* [in] */ JSObjectRef windowObject,
+        /* [in] */ IWebFrame* frame);
 
 protected:
     void locationChangeDone(IWebError*, IWebFrame*);