diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-29 12:18:48 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-29 12:18:57 +0100 |
| commit | 4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064 (patch) | |
| tree | bed2fe914fe0f7ec70abfb47d2d84af8a3604d09 /Tools/TestWebKitAPI | |
| parent | 01485457c9a5da3f1121015afd25bb53af77662e (diff) | |
| download | qtwebkit-4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064.tar.gz | |
Imported WebKit commit c60cfe0fc09efd257aa0111d7b133b02deb8a63e (http://svn.webkit.org/repository/webkit/trunk@136119)
New snapshot that includes the fix for installing the QtWebProcess into libexec
Change-Id: I01344e079cbdac5678c4cba6ffcc05f4597cf0d7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Tools/TestWebKitAPI')
| -rw-r--r-- | Tools/TestWebKitAPI/PlatformEfl.cmake | 2 | ||||
| -rw-r--r-- | Tools/TestWebKitAPI/Tests/WebCore/win/BitmapImage.cpp | 59 | ||||
| -rw-r--r-- | Tools/TestWebKitAPI/Tests/WebKit2/AboutBlankLoad.cpp | 16 | ||||
| -rw-r--r-- | Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp | 1 | ||||
| -rw-r--r-- | Tools/TestWebKitAPI/config.h | 13 | ||||
| -rw-r--r-- | Tools/TestWebKitAPI/efl/PlatformUtilities.cpp | 2 | ||||
| -rw-r--r-- | Tools/TestWebKitAPI/efl/PlatformWebView.cpp | 22 | ||||
| -rw-r--r-- | Tools/TestWebKitAPI/mac/InstanceMethodSwizzler.h | 2 | ||||
| -rw-r--r-- | Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj | 12 |
9 files changed, 117 insertions, 12 deletions
diff --git a/Tools/TestWebKitAPI/PlatformEfl.cmake b/Tools/TestWebKitAPI/PlatformEfl.cmake index 88f424e66..e301968fe 100644 --- a/Tools/TestWebKitAPI/PlatformEfl.cmake +++ b/Tools/TestWebKitAPI/PlatformEfl.cmake @@ -59,6 +59,7 @@ SET(test_webkit2_api_BINARIES InjectedBundleInitializationUserDataCallbackWins LoadAlternateHTMLStringWithNonDirectoryURL LoadCanceledNoServerRedirectCallback + MouseMoveAfterCrash NewFirstVisuallyNonEmptyLayout NewFirstVisuallyNonEmptyLayoutFails PageLoadBasic @@ -90,7 +91,6 @@ ADD_DEFINITIONS(-DTHEME_DIR="${THEME_BINARY_DIR}") # Tests disabled because of missing features on the test harness: # # HitTestResultNodeHandle -# MouseMoveAfterCrash # ResponsivenessTimerDoesntFireEarly # SpacebarScrolling # diff --git a/Tools/TestWebKitAPI/Tests/WebCore/win/BitmapImage.cpp b/Tools/TestWebKitAPI/Tests/WebCore/win/BitmapImage.cpp new file mode 100644 index 000000000..d0d1bf29e --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebCore/win/BitmapImage.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * Copyright (C) 2012 peavo@outlook.com All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include <WebCore/BitmapImage.h> + +using namespace WebCore; + +namespace TestWebKitAPI { + +// Test that there is no crash when BitmapImage::getHBITMAPOfSize() is called +// for an image with empty frames (BitmapImage::frameAtIndex(i) return null), WebKit Bug 102689. + +class BitmapImageTest : public WebCore::BitmapImage { +public: + BitmapImageTest() + { + m_frames.grow(1); + } + + virtual size_t frameCount() + { + return 1; + } +}; + +TEST(WebCore, BitmapImageEmptyFrameTest) +{ + SIZE sz = {16, 16}; + BitmapImageTest bitmapImageTest; + int bits[256]; + HBITMAP hBitmap = CreateBitmap(16, 16, 1, 32, bits); + bitmapImageTest.getHBITMAPOfSize(hBitmap, &sz); +} + +} // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/AboutBlankLoad.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/AboutBlankLoad.cpp index ff36a0b18..42939dd2d 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/AboutBlankLoad.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/AboutBlankLoad.cpp @@ -31,11 +31,10 @@ namespace TestWebKitAPI { static bool done; -static void decidePolicyForResponse(WKPageRef, WKFrameRef, WKURLResponseRef response, WKURLRequestRef, WKFramePolicyListenerRef listener, WKTypeRef, const void*) +static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) { - EXPECT_WK_STREQ("text/html", Util::MIMETypeForWKURLResponse(response)); - - WKFramePolicyListenerUse(listener); + WKRetainPtr<WKStringRef> mimeType = adoptWK(WKFrameCopyMIMEType(frame)); + EXPECT_WK_STREQ("text/html", mimeType); done = true; } @@ -44,11 +43,10 @@ TEST(WebKit2, AboutBlankLoad) WKRetainPtr<WKContextRef> context = adoptWK(WKContextCreate()); PlatformWebView webView(context.get()); - WKPagePolicyClient policyClient; - memset(&policyClient, 0, sizeof(policyClient)); - - policyClient.decidePolicyForResponse = decidePolicyForResponse; - WKPageSetPagePolicyClient(webView.page(), &policyClient); + WKPageLoaderClient loaderClient; + memset(&loaderClient, 0 , sizeof(loaderClient)); + loaderClient.didFinishLoadForFrame = didFinishLoadForFrame; + WKPageSetPageLoaderClient(webView.page(), &loaderClient); WKPageLoadURL(webView.page(), adoptWK(WKURLCreateWithUTF8CString("about:blank")).get()); diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp index 3c4bedaf4..976e7041b 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp @@ -102,6 +102,7 @@ TEST(WebKit2, WKPreferencesDefaults) EXPECT_FALSE(WKPreferencesGetCompositingRepaintCountersVisible(preference)); EXPECT_FALSE(WKPreferencesGetNeedsSiteSpecificQuirks(preference)); EXPECT_EQ(kWKAllowAllStorage, WKPreferencesGetStorageBlockingPolicy(preference)); + EXPECT_FALSE(WKPreferencesGetTextAutosizingEnabled(preference)); WKRelease(preference); } diff --git a/Tools/TestWebKitAPI/config.h b/Tools/TestWebKitAPI/config.h index e796ebc98..dd240a585 100644 --- a/Tools/TestWebKitAPI/config.h +++ b/Tools/TestWebKitAPI/config.h @@ -47,6 +47,19 @@ #define NOMINMAX #endif +#if PLATFORM(WIN_CAIRO) +#undef WTF_USE_CG +#define WTF_USE_CAIRO 1 +#define WTF_USE_CURL 1 +#ifndef _WINSOCKAPI_ +#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h +#endif +#elif !OS(WINCE) +#define WTF_USE_CG 1 +#undef WTF_USE_CAIRO +#undef WTF_USE_CURL +#endif + #endif #include <stdint.h> diff --git a/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp b/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp index 50f586d60..65c54e1a7 100644 --- a/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp +++ b/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp @@ -42,7 +42,7 @@ void run(bool* done) void sleep(double seconds) { - sleep(seconds); + usleep(seconds * 1000000); } WKURLRef createURLForResource(const char* resource, const char* extension) diff --git a/Tools/TestWebKitAPI/efl/PlatformWebView.cpp b/Tools/TestWebKitAPI/efl/PlatformWebView.cpp index 2e87f7087..cdc97bd13 100644 --- a/Tools/TestWebKitAPI/efl/PlatformWebView.cpp +++ b/Tools/TestWebKitAPI/efl/PlatformWebView.cpp @@ -54,12 +54,19 @@ static Ecore_Evas* initEcoreEvas() return ecoreEvas; } +static void onWebProcessCrashed(void*, Evas_Object*, void* eventInfo) +{ + bool* handled = static_cast<bool*>(eventInfo); + *handled = true; +} + PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef) { m_window = initEcoreEvas(); Evas* evas = ecore_evas_get(m_window); m_view = toImpl(WKViewCreate(evas, contextRef, pageGroupRef)); ewk_view_theme_set(m_view, THEME_DIR"/default.edj"); + evas_object_smart_callback_add(m_view, "webprocess,crashed", onWebProcessCrashed, 0); resizeTo(600, 800); } @@ -80,4 +87,19 @@ WKPageRef PlatformWebView::page() const return WKViewGetPage(toAPI(m_view)); } +void PlatformWebView::simulateSpacebarKeyPress() +{ + Evas* evas = ecore_evas_get(m_window); + evas_object_focus_set(m_view, true); + evas_event_feed_key_down(evas, "space", "space", " ", 0, 0, 0); + evas_event_feed_key_up(evas, "space", "space", " ", 0, 1, 0); +} + +void PlatformWebView::simulateMouseMove(unsigned x, unsigned y) +{ + Evas* evas = ecore_evas_get(m_window); + evas_object_show(m_view); + evas_event_feed_mouse_move(evas, x, y, 0, 0); +} + } // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/mac/InstanceMethodSwizzler.h b/Tools/TestWebKitAPI/mac/InstanceMethodSwizzler.h index 20d9f0afa..fe31a8aa9 100644 --- a/Tools/TestWebKitAPI/mac/InstanceMethodSwizzler.h +++ b/Tools/TestWebKitAPI/mac/InstanceMethodSwizzler.h @@ -26,7 +26,7 @@ #ifndef InstanceMethodSwizzler_h #define InstanceMethodSwizzler_h -#include <objc/objc-runtime.h> +#include <objc/runtime.h> #include <wtf/Noncopyable.h> namespace TestWebKitAPI { diff --git a/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj b/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj index a2a90f4f2..96b2d256e 100644 --- a/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj +++ b/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj @@ -421,6 +421,18 @@ Name="Tests"
>
<Filter
+ Name="WebCore"
+ >
+ <Filter
+ Name="win"
+ >
+ <File
+ RelativePath="..\Tests\WebCore\win\BitmapImage.cpp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
Name="WebKit2"
>
<File
|
