diff options
Diffstat (limited to 'WebKitTools/DumpRenderTree/win')
5 files changed, 64 insertions, 9 deletions
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp index 451ff86..a1b72e1 100644 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp @@ -134,7 +134,15 @@ bool setAlwaysAcceptCookies(bool alwaysAcceptCookies) wstring urlSuitableForTestResult(const wstring& url) { - if (!url.c_str() || url.find(L"file://") == wstring::npos) + if (url.find(L"file://") == wstring::npos) + return url; + + return lastPathComponent(url); +} + +wstring lastPathComponent(const wstring& url) +{ + if (url.empty()) return url; return PathFindFileNameW(url.c_str()); @@ -723,10 +731,11 @@ void dump() fflush(stderr); } - if (dumpPixels) { - if (!gLayoutTestController->dumpAsText() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive()) - dumpWebViewAsPixelsAndCompareWithExpected(gLayoutTestController->expectedPixelHash()); - } + if (dumpPixels + && gLayoutTestController->generatePixelResults() + && !gLayoutTestController->dumpDOMAsWebArchive() + && !gLayoutTestController->dumpSourceAsWebArchive()) + dumpWebViewAsPixelsAndCompareWithExpected(gLayoutTestController->expectedPixelHash()); printf("#EOF\n"); // terminate the (possibly empty) pixels block fflush(stdout); diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h b/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h index cc4337b..e3497c9 100644 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h +++ b/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h @@ -49,6 +49,7 @@ extern HWND webViewWindow; #include <wtf/Vector.h> std::wstring urlSuitableForTestResult(const std::wstring& url); +std::wstring lastPathComponent(const std::wstring&); std::string toUTF8(BSTR); std::string toUTF8(const std::wstring&); IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow = 0); diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp index b79bb2a..a29623e 100644 --- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -196,8 +196,29 @@ JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const { - // FIXME: Implement me. - return JSRetainPtr<JSStringRef>(); + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return 0; + + COMPtr<IWebViewPrivate> webViewPrivate(Query, webView); + if (!webViewPrivate) + return 0; + + COMPtr<IDOMElement> element; + if (FAILED(webViewPrivate->elementFromJS(context, nodeObject, &element))) + return 0; + + COMPtr<IDOMElementPrivate> elementPrivate(Query, element); + if (!elementPrivate) + return 0; + + BSTR textBSTR = 0; + if (FAILED(elementPrivate->markerTextForListItem(&textBSTR))) + return 0; + + JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithBSTR(textBSTR)); + SysFreeString(textBSTR); + return markerText; } void LayoutTestController::waitForPolicyDelegate() diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp index ce01933..825366a 100644 --- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp +++ b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp @@ -250,6 +250,13 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::willSendRequest( descriptionSuitableForTestResult(redirectResponse).c_str()); } + if (!done && !gLayoutTestController->deferMainResourceDataLoad()) { + COMPtr<IWebDataSourcePrivate> dataSourcePrivate(Query, dataSource); + if (!dataSourcePrivate) + return E_FAIL; + dataSourcePrivate->setDeferMainResourceDataLoad(FALSE); + } + if (!done && gLayoutTestController->willSendRequestReturnsNull()) { *newRequest = 0; return S_OK; @@ -285,6 +292,7 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didReceiveAuthenticationChalleng return E_FAIL; if (!gLayoutTestController->handlesAuthenticationChallenges()) { + printf("%S - didReceiveAuthenticationChallenge - Simulating cancelled authentication sheet\n", descriptionSuitableForTestResult(identifier).c_str()); sender->continueWithoutCredentialForAuthenticationChallenge(challenge); return S_OK; } @@ -326,10 +334,10 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didReceiveResponse( if (FAILED(response->URL(&urlBSTR))) E_FAIL; - wstring url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); + wstring url = wstringFromBSTR(urlBSTR); ::SysFreeString(urlBSTR); - printf("%S has MIME type %S\n", url.c_str(), mimeType.c_str()); + printf("%S has MIME type %S\n", lastPathComponent(url).c_str(), mimeType.c_str()); } return S_OK; diff --git a/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp b/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp index 7c60d3d..a24ca37 100644 --- a/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp +++ b/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp @@ -81,6 +81,22 @@ bool LoadItem::invoke() const return true; } +bool LoadHTMLStringItem::invoke() const +{ + wstring content = jsStringRefToWString(m_content.get()); + wstring baseURL = jsStringRefToWString(m_baseURL.get()); + + BSTR contentBSTR = SysAllocString(content.c_str()); + BSTR baseURLBSTR = SysAllocString(baseURL.c_str()); + + frame->loadHTMLString(contentBSTR, baseURLBSTR); + + SysFreeString(contentBSTR); + SysFreeString(baseURLBSTR); + + return true; +} + bool ReloadItem::invoke() const { COMPtr<IWebView> webView; |