+2014-08-29 Tim Horton <timothy_horton@apple.com>
+
+ Remove Windows WebKit2 code from TestWebKitAPI
+ https://bugs.webkit.org/show_bug.cgi?id=136385
+
+ Reviewed by Alexey Proskuryakov.
+
+ * TestWebKitAPI/PlatformUtilities.h:
+ * TestWebKitAPI/PlatformWebView.h:
+ (TestWebKitAPI::PlatformWebView::setParentWindowMessageObserver): Deleted.
+ * TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash.cpp:
+ (TestWebKitAPI::TEST): Deleted.
+ * TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp:
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp:
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit2/win/AltKeyGeneratesWMSysCommand.cpp: Removed.
+ * TestWebKitAPI/Tests/WebKit2/win/DoNotCopyANullCFURLResponse.cpp: Removed.
+ * TestWebKitAPI/Tests/WebKit2/win/HideFindIndicator.cpp: Removed.
+ * TestWebKitAPI/Tests/WebKit2/win/ResizeViewWhileHidden.cpp: Removed.
+ * TestWebKitAPI/Tests/WebKit2/win/TranslateMessageGeneratesWMChar.cpp: Removed.
+ * TestWebKitAPI/Tests/WebKit2/win/WMCloseCallsUIClientClose.cpp: Removed.
+ * TestWebKitAPI/Tests/WebKit2/win/WMPrint.cpp: Removed.
+
2014-08-29 Carlos Alberto Lopez Perez <clopez@igalia.com>
[JSC] Some JSC tests are dependent on the machine time zone.
// Runs a platform runloop until the 'done' is true.
void run(bool* done);
-#if PLATFORM(WIN)
-bool shouldTranslateMessage(const MSG&);
-#endif
-
void sleep(double seconds);
WKContextRef createContextWithInjectedBundle();
#endif
typedef WKView *PlatformWKView;
typedef NSWindow *PlatformWindow;
-#elif defined(WIN32) || defined(_WIN32)
-typedef WKViewRef PlatformWKView;
-typedef HWND PlatformWindow;
#elif PLATFORM(GTK)
typedef WKViewRef PlatformWKView;
typedef GtkWidget *PlatformWindow;
namespace TestWebKitAPI {
-#if PLATFORM(WIN)
-class WindowMessageObserver;
-#endif
-
class PlatformWebView {
public:
PlatformWebView(WKContextRef, WKPageGroupRef = 0);
void simulateRightClick(unsigned x, unsigned y);
void simulateMouseMove(unsigned x, unsigned y);
-#if PLATFORM(WIN)
- void simulateAKeyDown();
- void setParentWindowMessageObserver(WindowMessageObserver* observer) { m_parentWindowMessageObserver = observer; }
-#endif
-
private:
-#if PLATFORM(WIN)
- static void registerWindowClass();
- static LRESULT CALLBACK wndProc(HWND, UINT message, WPARAM, LPARAM);
-#endif
-
PlatformWKView m_view;
PlatformWindow m_window;
-
-#if PLATFORM(WIN)
- WindowMessageObserver* m_parentWindowMessageObserver;
-#endif
};
} // namespace TestWebKitAPI
WKPageSetPageLoaderClient(page, &loaderClient.base);
}
-#if PLATFORM(WIN)
-TEST(WebKit2, DISABLED_MouseMoveAfterCrash)
-#else
TEST(WebKit2, MouseMoveAfterCrash)
-#endif
{
WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("MouseMoveAfterCrashTest"));
EXPECT_JS_FALSE(webView.page(), "isDocumentScrolled()");
EXPECT_JS_TRUE(webView.page(), "textFieldContainsSpace()");
- // On Mac, a key down event represents both a raw key down and a key press. On Windows, a key
- // down event only represents a raw key down. We expect the key press to be handled (because it
- // inserts text into the text field). But the raw key down should not be handled.
+ // On Mac, a key down event represents both a raw key down and a key press.
+ // We expect the key press to be handled (because it inserts text into the text field),
+ // but the raw key down should not be handled.
#if PLATFORM(COCOA)
EXPECT_FALSE(didNotHandleKeyDownEvent);
-#elif PLATFORM(WIN)
- EXPECT_TRUE(didNotHandleKeyDownEvent);
#endif
EXPECT_JS_EQ(webView.page(), "blurTextField()", "undefined");
didNotHandleKeyDownEvent = false;
webView.simulateSpacebarKeyPress();
- // This EXPECT_JS_TRUE test fails on Windows port
- // https://bugs.webkit.org/show_bug.cgi?id=84961
-#if !PLATFORM(WIN)
EXPECT_JS_TRUE(webView.page(), "isDocumentScrolled()");
-#endif
EXPECT_JS_TRUE(webView.page(), "textFieldContainsSpace()");
#if PLATFORM(COCOA)
EXPECT_FALSE(didNotHandleKeyDownEvent);
-#elif PLATFORM(WIN)
- EXPECT_TRUE(didNotHandleKeyDownEvent);
#endif
}
TEST(WebKit2, WKPreferencesDefaults)
{
-#if PLATFORM(WIN)
- static const char* expectedStandardFontFamily = "Times New Roman";
- static const char* expectedFixedFontFamily = "Courier New";
- static const char* expectedSerifFontFamily = "Times New Roman";
- static const char* expectedSansSerifFontFamily = "Arial";
- static const char* expectedCursiveFontFamily = "Comic Sans MS";
- static const char* expectedFantasyFontFamily = "Comic Sans MS";
- static const char* expectedPictographFontFamily = "Times New Roman";
-#elif PLATFORM(MAC)
+#if PLATFORM(MAC)
static const char* expectedStandardFontFamily = "Times";
static const char* expectedFixedFontFamily = "Courier";
static const char* expectedSerifFontFamily = "Times";
EXPECT_FALSE(WKPreferencesGetDeveloperExtrasEnabled(preference));
EXPECT_TRUE(WKPreferencesGetTextAreasAreResizable(preference));
-#if PLATFORM(WIN)
- EXPECT_EQ(kWKFontSmoothingLevelWindows, WKPreferencesGetFontSmoothingLevel(preference));
-#else
EXPECT_EQ(kWKFontSmoothingLevelMedium, WKPreferencesGetFontSmoothingLevel(preference));
-#endif
EXPECT_TRUE(WKPreferencesGetAcceleratedCompositingEnabled(preference));
EXPECT_FALSE(WKPreferencesGetCompositingBordersVisible(preference));
+++ /dev/null
-/*
- * Copyright (C) 2010 Apple Inc. 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 "PlatformUtilities.h"
-#include "PlatformWebView.h"
-#include "WindowMessageObserver.h"
-#include <WebKit/WKRetainPtr.h>
-
-namespace TestWebKitAPI {
-
-class WMSysCommandObserver : public WindowMessageObserver {
-public:
- WMSysCommandObserver() : m_windowDidReceiveWMSysCommand(false) { }
-
- bool windowDidReceiveWMSysCommand() const { return m_windowDidReceiveWMSysCommand; }
-
-private:
- virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM)
- {
- if (message == WM_SYSCOMMAND)
- m_windowDidReceiveWMSysCommand = true;
- }
-
- bool m_windowDidReceiveWMSysCommand;
-};
-
-static bool didNotHandleWMSysKeyUp;
-
-static void didNotHandleKeyEventCallback(WKPageRef, WKNativeEventPtr event, const void*)
-{
- if (event->message != WM_SYSKEYUP)
- return;
-
- didNotHandleWMSysKeyUp = true;
-}
-
-TEST(WebKit2, AltKeyGeneratesWMSysCommand)
-{
- WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
- PlatformWebView webView(context.get());
-
- WKPageUIClient uiClient;
- memset(&uiClient, 0, sizeof(uiClient));
-
- uiClient.didNotHandleKeyEvent = didNotHandleKeyEventCallback;
- WKPageSetPageUIClient(webView.page(), &uiClient);
-
- WMSysCommandObserver observer;
- webView.setParentWindowMessageObserver(&observer);
-
- webView.simulateAltKeyPress();
-
- Util::run(&didNotHandleWMSysKeyUp);
-
- webView.setParentWindowMessageObserver(0);
-
- // The WM_SYSKEYUP message should have generated a WM_SYSCOMMAND message that was sent to the
- // WKView's parent window.
- EXPECT_TRUE(observer.windowDidReceiveWMSysCommand());
-}
-
-} // namespace TestWebKitAPI
+++ /dev/null
-/*
- * Copyright (C) 2011 Apple Inc. 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 <WebKit/WKRetainPtr.h>
-#include <WebKit/WKURLResponseCF.h>
-#include <wtf/RetainPtr.h>
-
-namespace TestWebKitAPI {
-
-TEST(WebKit2, DoNotCopyANullCFURLResponse)
-{
- // Neither of these calls should cause a crash.
- WKRetainPtr<WKURLResponseRef> nullWKResponse(AdoptWK, WKURLResponseCreateWithCFURLResponse(0));
- RetainPtr<CFURLResponseRef> nullCFResponse = adoptCF(WKURLResponseCopyCFURLResponse(kCFAllocatorDefault, nullWKResponse.get()));
-}
-
-} // namespace TestWebKitAPI
+++ /dev/null
-/*
- * Copyright (C) 2010 Apple Inc. 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 "PlatformUtilities.h"
-#include "PlatformWebView.h"
-#include "Test.h"
-
-namespace TestWebKitAPI {
-
-static bool didFinishLoad;
-static bool findIndicatorCallbackWasCalled;
-static HBITMAP bitmap;
-
-static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
-{
- didFinishLoad = true;
-}
-
-static void findIndicatorCallback(WKViewRef, HBITMAP selectionBitmap, RECT, bool, void*)
-{
- findIndicatorCallbackWasCalled = true;
- bitmap = selectionBitmap;
-}
-
-static void initialize(const PlatformWebView& webView)
-{
- WKPageLoaderClient loaderClient;
- memset(&loaderClient, 0, sizeof(loaderClient));
-
- loaderClient.version = 0;
- loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
- WKPageSetPageLoaderClient(webView.page(), &loaderClient);
-
- WKViewSetFindIndicatorCallback(webView.platformView(), findIndicatorCallback, 0);
-}
-
-TEST(WebKit2, HideFindIndicator)
-{
- WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
- PlatformWebView webView(context.get());
- initialize(webView);
-
- WKRetainPtr<WKURLRef> url = adoptWK(Util::createURLForResource("find", "html"));
- WKPageLoadURL(webView.page(), url.get());
- Util::run(&didFinishLoad);
- didFinishLoad = false;
-
- WKPageFindString(webView.page(), Util::toWK("Hello").get(), kWKFindOptionsShowFindIndicator, 100);
- Util::run(&findIndicatorCallbackWasCalled);
- findIndicatorCallbackWasCalled = false;
-
- EXPECT_NOT_NULL(bitmap);
- ::DeleteObject(bitmap);
- bitmap = 0;
-
- WKPageHideFindUI(webView.page());
- Util::run(&findIndicatorCallbackWasCalled);
-
- EXPECT_NULL(bitmap);
-}
-
-} // namespace TestWebKitAPI
+++ /dev/null
-/*
- * Copyright (C) 2011 Apple Inc. 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 "PlatformUtilities.h"
-#include "PlatformWebView.h"
-#include <WebKit/WKRetainPtr.h>
-
-namespace TestWebKitAPI {
-
-static bool didFinishLoad;
-
-static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
-{
- didFinishLoad = true;
-}
-
-static void setPageLoaderClient(WKPageRef page)
-{
- WKPageLoaderClient loaderClient;
- memset(&loaderClient, 0, sizeof(loaderClient));
- loaderClient.version = 0;
- loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
-
- WKPageSetPageLoaderClient(page, &loaderClient);
-}
-
-static void flushMessages(WKPageRef page)
-{
- // In order to ensure all pending messages have been handled by the UI and web processes, we
- // load a URL and wait for the load to finish.
-
- setPageLoaderClient(page);
-
- WKPageLoadURL(page, adoptWK(Util::createURLForResource("simple", "html")).get());
- Util::run(&didFinishLoad);
- didFinishLoad = false;
-
- WKPageSetPageLoaderClient(page, 0);
-}
-
-static bool timerFired;
-static void CALLBACK timerCallback(HWND hwnd, UINT, UINT_PTR timerID, DWORD)
-{
- ::KillTimer(hwnd, timerID);
- timerFired = true;
-}
-
-static void runForDuration(double seconds)
-{
- ::SetTimer(0, 0, seconds * 1000, timerCallback);
- Util::run(&timerFired);
- timerFired = false;
-}
-
-static void waitForBackingStoreUpdate(WKPageRef page)
-{
- // Wait for the web process to handle the changes we just made, to perform a display (which
- // happens on a timer), and to tell the UI process about the display (which updates the backing
- // store).
- // FIXME: It would be much less fragile (and maybe faster) to have an explicit way to wait
- // until the backing store is updated.
- runForDuration(0.5);
- flushMessages(page);
-}
-
-TEST(WebKit2, ResizeViewWhileHidden)
-{
- WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
- PlatformWebView webView(context.get());
-
- HWND window = WKViewGetWindow(webView.platformView());
-
- RECT originalRect;
- ::GetClientRect(window, &originalRect);
- RECT newRect = originalRect;
- ::InflateRect(&newRect, 1, 1);
-
- // Show the WKView and resize it so that the WKView's backing store will be created. Ideally
- // we'd have some more explicit way of forcing the backing store to be created.
- ::ShowWindow(window, SW_SHOW);
- webView.resizeTo(newRect.right - newRect.left, newRect.bottom - newRect.top);
-
- waitForBackingStoreUpdate(webView.page());
-
- // Resize the window while hidden and show it again so that it will update its backing store at
- // the new size.
- ::ShowWindow(window, SW_HIDE);
- webView.resizeTo(originalRect.right - originalRect.left, originalRect.bottom - originalRect.top);
- ::ShowWindow(window, SW_SHOW);
-
- // Force the WKView to paint to try to trigger <http://webkit.org/b/54142>.
- ::SendMessage(window, WM_PAINT, 0, 0);
-
- // In Debug builds without the fix for <http://webkit.org/b/54141>, the web process will assert
- // at this point.
- // FIXME: It would be good to have a way to check that our behavior is correct in Release
- // builds, too!
- waitForBackingStoreUpdate(webView.page());
-}
-
-} // namespace TestWebKitAPI
+++ /dev/null
-/*
- * Copyright (C) 2011 Apple Inc. 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 "PlatformUtilities.h"
-#include "PlatformWebView.h"
-#include "WindowMessageObserver.h"
-#include <WebKit/WKRetainPtr.h>
-
-namespace TestWebKitAPI {
-
-static bool didSeeWMChar;
-static bool didNotHandleKeyEventCalled;
-
-static void didNotHandleKeyEventCallback(WKPageRef, WKNativeEventPtr event, const void*)
-{
- if (event->message != WM_KEYDOWN)
- return;
-
- // Don't call TranslateMessage() here so a WM_CHAR isn't generated.
- didNotHandleKeyEventCalled = true;
-}
-
-static void runAndWatchForWMChar(bool* done)
-{
- while (!*done) {
- MSG msg;
- BOOL result = ::GetMessageW(&msg, 0, 0, 0);
- if (!result || result == -1)
- break;
-
- if (msg.message == WM_CHAR)
- didSeeWMChar = true;
-
- if (Util::shouldTranslateMessage(msg))
- ::TranslateMessage(&msg);
-
- ::DispatchMessage(&msg);
- }
-}
-
-TEST(WebKit2, TranslateMessageGeneratesWMChar)
-{
- WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
- PlatformWebView webView(context.get());
-
- webView.simulateAKeyDown();
-
- // WebKit should call TranslateMessage() on the WM_KEYDOWN message to generate the WM_CHAR message.
- runAndWatchForWMChar(&didSeeWMChar);
-
- didSeeWMChar = false;
-
- WKPageUIClient uiClient;
- memset(&uiClient, 0, sizeof(uiClient));
-
- uiClient.didNotHandleKeyEvent = didNotHandleKeyEventCallback;
- WKPageSetPageUIClient(webView.page(), &uiClient);
-
- webView.simulateAKeyDown();
-
- runAndWatchForWMChar(&didNotHandleKeyEventCalled);
-
- // WebKit should not have called TranslateMessage() on the WM_KEYDOWN message since we installed a didNotHandleKeyEvent callback.
- EXPECT_FALSE(didSeeWMChar);
-}
-
-} // namespace TestWebKitAPI
+++ /dev/null
-/*
- * Copyright (C) 2010 Apple Inc. 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 "PlatformUtilities.h"
-#include "PlatformWebView.h"
-#include <WebKit/WKRetainPtr.h>
-
-namespace TestWebKitAPI {
-
-static bool didReceiveClose;
-
-static void close(WKPageRef, const void*)
-{
- didReceiveClose = true;
-}
-
-TEST(WebKit2, WMCloseCallsUIClientClose)
-{
- WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
- PlatformWebView webView(context.get());
-
- WKPageUIClient uiClient;
- memset(&uiClient, 0, sizeof(uiClient));
-
- uiClient.close = close;
- WKPageSetPageUIClient(webView.page(), &uiClient);
-
- ::SendMessageW(WKViewGetWindow(webView.platformView()), WM_CLOSE, 0, 0);
-
- Util::run(&didReceiveClose);
-}
-
-} // namespace TestWebKitAPI
+++ /dev/null
-/*
- * Copyright (C) 2011 Apple Inc. 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 "PlatformUtilities.h"
-#include "PlatformWebView.h"
-#include <WebKit/WKRetainPtr.h>
-
-namespace TestWebKitAPI {
-
-TEST(WebKit2, WMPrint)
-{
- WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
- PlatformWebView webView(context.get());
-
- HWND window = WKViewGetWindow(webView.platformView());
- HDC dc = ::CreateCompatibleDC(0);
- // FIXME: It would be nice to test that this actually paints the view into dc.
- ::SendMessage(window, WM_PRINT, reinterpret_cast<WPARAM>(dc), PRF_CLIENT | PRF_CHILDREN);
- ::DeleteDC(dc);
-}
-
-} // namespace TestWebKitAPI