summaryrefslogtreecommitdiff
path: root/Tools/TestWebKitAPI
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Tools/TestWebKitAPI
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Tools/TestWebKitAPI')
-rw-r--r--Tools/TestWebKitAPI/Configurations/Base.xcconfig5
-rw-r--r--Tools/TestWebKitAPI/GNUmakefile.am448
-rw-r--r--Tools/TestWebKitAPI/JavaScriptTest.cpp2
-rw-r--r--Tools/TestWebKitAPI/PlatformWebView.h3
-rw-r--r--Tools/TestWebKitAPI/TestWebKitAPI.gyp/.gitignore5
-rw-r--r--Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp4
-rw-r--r--Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj71
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic.cpp148
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp254
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/EvaluateJavaScript.cpp1
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic.cpp2
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp2
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp2
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem.cpp92
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp70
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp8
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent.cpp74
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp65
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/auto-submitting-form.html20
-rw-r--r--Tools/TestWebKitAPI/Tests/mac/Ahem.ttfbin0 -> 12480 bytes
-rw-r--r--Tools/TestWebKitAPI/Tests/mac/AttributedString.mm93
-rw-r--r--Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.html4
-rw-r--r--Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm115
-rw-r--r--Tools/TestWebKitAPI/Tests/mac/MemoryCachePruneWithinResourceLoadDelegate.html14
-rw-r--r--Tools/TestWebKitAPI/Tests/mac/MemoryCachePruneWithinResourceLoadDelegate.mm100
-rw-r--r--Tools/TestWebKitAPI/Tests/mac/SimplifyMarkup.mm111
-rw-r--r--Tools/TestWebKitAPI/Tests/mac/WebViewCanPasteURL.mm54
-rw-r--r--Tools/TestWebKitAPI/Tests/mac/attributedStringCustomFont.html15
-rw-r--r--Tools/TestWebKitAPI/Tests/mac/verboseMarkup.html19
-rw-r--r--Tools/TestWebKitAPI/config.h4
-rw-r--r--Tools/TestWebKitAPI/gtk/InjectedBundleControllerGtk.cpp35
-rw-r--r--Tools/TestWebKitAPI/gtk/PlatformUtilitiesGtk.cpp96
-rw-r--r--Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp149
-rw-r--r--Tools/TestWebKitAPI/gtk/main.cpp36
-rw-r--r--Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm5
35 files changed, 2114 insertions, 12 deletions
diff --git a/Tools/TestWebKitAPI/Configurations/Base.xcconfig b/Tools/TestWebKitAPI/Configurations/Base.xcconfig
index 99caf95ae..c321d194a 100644
--- a/Tools/TestWebKitAPI/Configurations/Base.xcconfig
+++ b/Tools/TestWebKitAPI/Configurations/Base.xcconfig
@@ -26,15 +26,16 @@
HEADER_SEARCH_PATHS = ${BUILT_PRODUCTS_DIR}/usr/local/include $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu;
FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks;
GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) ENABLE_DASHBOARD_SUPPORT WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST GTEST_HAS_TR1_TUPLE=0;
-DEBUG_INFORMATION_FORMAT = dwarf
+DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
PREBINDING = NO
GCC_C_LANGUAGE_STANDARD = gnu99
GCC_ENABLE_CPP_EXCEPTIONS = NO;
+GCC_ENABLE_CPP_RTTI = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES
GCC_TREAT_WARNINGS_AS_ERRORS = YES
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO
GCC_WARN_UNUSED_FUNCTION = YES
GCC_WARN_UNUSED_VARIABLE = YES
-GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO
WARNING_CFLAGS = -Wall -W -Wno-unused-parameter
LINKER_DISPLAYS_MANGLED_NAMES = YES;
VALID_ARCHS = i386 x86_64;
diff --git a/Tools/TestWebKitAPI/GNUmakefile.am b/Tools/TestWebKitAPI/GNUmakefile.am
new file mode 100644
index 000000000..ff92492f3
--- /dev/null
+++ b/Tools/TestWebKitAPI/GNUmakefile.am
@@ -0,0 +1,448 @@
+BUILT_SOURCES += \
+ generate-testwebkitapi-forwarding-headers
+
+wk2_tests_sources = $(shell ls $(srcdir)/Tools/TestWebKitAPI/Tests/WebKit2/*.cpp)
+generate-testwebkitapi-forwarding-headers: $(WebKit2)/Scripts/generate-forwarding-headers.pl $(wk2_tests_sources)
+ $(AM_V_GEN)$(PERL) $< $(srcdir)/Tools/TestWebKitAPI $(GENSOURCES_WEBKIT2)/include gtk
+ $(AM_V_GEN)$(PERL) $< $(srcdir)/Tools/TestWebKitAPI $(GENSOURCES_WEBKIT2)/include soup
+
+TEST_PROGS += \
+ Programs/TestWebKitAPI/WTF/TestCheckedArithmeticOperations \
+ Programs/TestWebKitAPI/WTF/TestFunctional \
+ Programs/TestWebKitAPI/WTF/TestHashMap \
+ Programs/TestWebKitAPI/WTF/TestRedBlackTree \
+ Programs/TestWebKitAPI/WTF/TestStringBuilder \
+ Programs/TestWebKitAPI/WTF/TestStringOperators \
+ Programs/TestWebKitAPI/WTF/TestTemporaryChange \
+ Programs/TestWebKitAPI/WTF/TestVectorBasic \
+ Programs/TestWebKitAPI/WTF/TestVector \
+ Programs/TestWebKitAPI/WTF/TestVectorReverse
+
+if ENABLE_WEBKIT2
+TEST_PROGS += \
+ Programs/TestWebKitAPI/WebKit2/TestCookieManager \
+ Programs/TestWebKitAPI/WebKit2/TestDocumentStartUserScriptAlertCrash \
+ Programs/TestWebKitAPI/WebKit2/TestDownloadDecideDestinationCrash \
+ Programs/TestWebKitAPI/WebKit2/TestEvaluateJavaScript \
+ Programs/TestWebKitAPI/WebKit2/TestFailedLoad \
+ Programs/TestWebKitAPI/WebKit2/TestForceRepaint \
+ Programs/TestWebKitAPI/WebKit2/TestFrameMIMETypeHTML \
+ Programs/TestWebKitAPI/WebKit2/TestFrameMIMETypePNG \
+ Programs/TestWebKitAPI/WebKit2/TestHitTestResultNodeHandle \
+ Programs/TestWebKitAPI/WebKit2/TestInjectedBundleBasic \
+ Programs/TestWebKitAPI/WebKit2/TestLoadAlternateHTMLStringWithNonDirectoryURL \
+ Programs/TestWebKitAPI/WebKit2/TestLoadCanceledNoServerRedirectCallback \
+ Programs/TestWebKitAPI/WebKit2/TestMouseMoveAfterCrash \
+ Programs/TestWebKitAPI/WebKit2/TestNewFirstVisuallyNonEmptyLayout \
+ Programs/TestWebKitAPI/WebKit2/TestNewFirstVisuallyNonEmptyLayoutFails \
+ Programs/TestWebKitAPI/WebKit2/TestNewFirstVisuallyNonEmptyLayoutForImages \
+ Programs/TestWebKitAPI/WebKit2/TestNewFirstVisuallyNonEmptyLayoutFrames \
+ Programs/TestWebKitAPI/WebKit2/TestPageLoadBasic \
+ Programs/TestWebKitAPI/WebKit2/TestPageLoadDidChangeLocationWithinPageForFrame \
+ Programs/TestWebKitAPI/WebKit2/TestParentFrame \
+ Programs/TestWebKitAPI/WebKit2/TestPreventEmptyUserAgent \
+ Programs/TestWebKitAPI/WebKit2/TestPrivateBrowsingPushStateNoHistoryCallback \
+ Programs/TestWebKitAPI/WebKit2/TestResponsivenessTimerDoesntFireEarly \
+ Programs/TestWebKitAPI/WebKit2/TestRestoreSessionStateContainingFormData \
+ Programs/TestWebKitAPI/WebKit2/TestShouldGoToBackForwardListItem \
+ Programs/TestWebKitAPI/WebKit2/TestSpacebarScrolling \
+ Programs/TestWebKitAPI/WebKit2/TestUserMessage \
+ Programs/TestWebKitAPI/WebKit2/TestWKConnection \
+ Programs/TestWebKitAPI/WebKit2/TestWKPreferences \
+ Programs/TestWebKitAPI/WebKit2/TestWKString \
+ Programs/TestWebKitAPI/WebKit2/TestWKStringJSString
+endif
+
+noinst_PROGRAMS += $(TEST_PROGS)
+
+noinst_LTLIBRARIES += \
+ Libraries/libTestWebKitAPIMain.la
+
+Libraries_libTestWebKitAPIMain_la_SOURCES = \
+ Tools/TestWebKitAPI/Test.h \
+ Tools/TestWebKitAPI/TestsController.cpp \
+ Tools/TestWebKitAPI/TestsController.h \
+ Tools/TestWebKitAPI/gtk/main.cpp
+
+# Use -isystem gcc flag so that gcc considers gtest headers as system headers.
+# We need this to avoid a lot of compile warnings due to -Wundef.
+# See http://code.google.com/p/googletest/issues/detail?id=258
+Libraries_libTestWebKitAPIMain_la_CPPFLAGS = \
+ -isystem $(srcdir)/Source/ThirdParty/gtest/include \
+ -I$(srcdir)/Tools/TestWebKitAPI \
+ -I$(srcdir)/Source/ThirdParty/gtest/include \
+ -I$(top_builddir)/DerivedSources/WebKit2/include \
+ $(global_cppflags) \
+ $(javascriptcore_cppflags) \
+ $(GLIB_CFLAGS)
+
+testwebkitapi_wtf_tests_cppflags = \
+ -isystem $(srcdir)/Source/ThirdParty/gtest/include \
+ -I$(srcdir)/Tools/TestWebKitAPI \
+ -I$(srcdir)/Source/ThirdParty/gtest/include \
+ -I$(top_builddir)/DerivedSources/WebKit2/include \
+ $(global_cppflags) \
+ $(javascriptcore_cppflags)
+
+testwebkitapi_wtf_tests_ldadd = \
+ Libraries/libgtest.la \
+ Libraries/libTestWebKitAPIMain.la \
+ libWTF.la
+
+testwebkitapi_wtf_tests_ldflags = \
+ -no-install \
+ -no-fast-install
+
+testwebkitapi_webkit2_tests_cppflags = \
+ $(testwebkitapi_wtf_tests_cppflags) \
+ $(CAIRO_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(LIBSOUP_CFLAGS)
+
+testwebkitapi_webkit2_tests_ldadd = \
+ libjavascriptcoregtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \
+ libwebkit2gtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \
+ Libraries/libgtest.la \
+ Libraries/libTestWebKitAPIMain.la \
+ Libraries/libTestWebKitAPIWebKit2Tests.la \
+ $(CAIRO_LIBS) \
+ $(GTK_LIBS) \
+ $(GLIB_LIBS) \
+ $(LIBSOUP_LIBS)
+
+testwebkitapi_webkit2_tests_ldflags = $(testwebkitapi_wtf_tests_ldflags)
+
+if ENABLE_WEBKIT2
+noinst_LTLIBRARIES += \
+ Libraries/libTestWebKitAPIWebKit2Tests.la \
+ Libraries/libTestWebKitAPIInjectedBundle.la
+endif
+
+# TestWebKitAPIWebKit2Tests
+Libraries_libTestWebKitAPIWebKit2Tests_la_SOURCES = \
+ Tools/TestWebKitAPI/config.h \
+ Tools/TestWebKitAPI/PlatformUtilities.cpp \
+ Tools/TestWebKitAPI/PlatformUtilities.h \
+ Tools/TestWebKitAPI/PlatformWebView.h \
+ Tools/TestWebKitAPI/JavaScriptTest.cpp \
+ Tools/TestWebKitAPI/JavaScriptTest.h \
+ Tools/TestWebKitAPI/gtk/PlatformUtilitiesGtk.cpp \
+ Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp
+
+Libraries_libTestWebKitAPIWebKit2Tests_la_CPPFLAGS = \
+ -isystem $(srcdir)/Source/ThirdParty/gtest/include \
+ -I$(srcdir)/Tools/TestWebKitAPI \
+ -I$(srcdir)/Source/ThirdParty/gtest/include \
+ -I$(top_builddir)/DerivedSources/WebKit2/include \
+ $(global_cppflags) \
+ $(javascriptcore_cppflags) \
+ $(GTK_CFLAGS)
+
+# TestWebKitAPIInjectedBundle
+Libraries_libTestWebKitAPIInjectedBundle_la_SOURCES = \
+ Tools/TestWebKitAPI/InjectedBundleController.cpp \
+ Tools/TestWebKitAPI/InjectedBundleController.h \
+ Tools/TestWebKitAPI/InjectedBundleMain.cpp \
+ Tools/TestWebKitAPI/InjectedBundleTest.h \
+ Tools/TestWebKitAPI/PlatformUtilities.cpp \
+ Tools/TestWebKitAPI/PlatformUtilities.h \
+ Tools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/HitTestResultNodeHandle_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/ParentFrame_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/ResponsivenessTimerDoesntFireEarly_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/UserMessage_Bundle.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/WKConnection_Bundle.cpp \
+ Tools/TestWebKitAPI/gtk/InjectedBundleControllerGtk.cpp \
+ Tools/TestWebKitAPI/gtk/PlatformUtilitiesGtk.cpp
+
+Libraries_libTestWebKitAPIInjectedBundle_la_LDFLAGS = \
+ -rpath ${shell pwd}/$(top_builddir)/Libraries/.libs \
+ $(no_undefined) \
+ -avoid-version \
+ -module
+
+Libraries_libTestWebKitAPIInjectedBundle_la_CPPFLAGS = \
+ -isystem $(srcdir)/Source/ThirdParty/gtest/include \
+ -I$(srcdir)/Tools/TestWebKitAPI \
+ -I$(srcdir)/Source/ThirdParty/gtest/include \
+ -I$(top_builddir)/DerivedSources/InjectedBundle \
+ -I$(top_builddir)/DerivedSources/WebKit2/include \
+ $(global_cppflags) \
+ $(javascriptcore_cppflags) \
+ $(GTK_CFLAGS)
+
+Libraries_libTestWebKitAPIInjectedBundle_la_CXXFLAGS = $(global_cxxflags)
+Libraries_libTestWebKitAPIInjectedBundle_la_CFLAGS = $(global_cflags)
+
+EXTRA_DIST += \
+ Tools/TestWebKitAPI/Tests/WebKit2/18-characters.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/file-with-anchor.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/find.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/icon.png \
+ Tools/TestWebKitAPI/Tests/WebKit2/lots-of-iframes.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/lots-of-images.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/lots-of-text.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/mouse-move-listener.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/push-state.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/simple-accelerated-compositing.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/simple-form.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/simple.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/simple-iframe.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/simple-tall.html \
+ Tools/TestWebKitAPI/Tests/WebKit2/spacebar-scrolling.html
+
+Programs_TestWebKitAPI_WTF_TestCheckedArithmeticOperations_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp
+Programs_TestWebKitAPI_WTF_TestCheckedArithmeticOperations_CPPFLAGS = $(testwebkitapi_wtf_tests_cppflags)
+Programs_TestWebKitAPI_WTF_TestCheckedArithmeticOperations_LDADD = $(testwebkitapi_wtf_tests_ldadd)
+Programs_TestWebKitAPI_WTF_TestCheckedArithmeticOperations_LDFLAGS = $(testwebkitapi_wtf_tests_ldflags)
+
+Programs_TestWebKitAPI_WTF_TestFunctional_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WTF/Functional.cpp
+Programs_TestWebKitAPI_WTF_TestFunctional_CPPFLAGS = $(testwebkitapi_wtf_tests_cppflags)
+Programs_TestWebKitAPI_WTF_TestFunctional_LDADD = $(testwebkitapi_wtf_tests_ldadd)
+Programs_TestWebKitAPI_WTF_TestFunctional_LDFLAGS = $(testwebkitapi_wtf_tests_ldflags)
+
+Programs_TestWebKitAPI_WTF_TestHashMap_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WTF/HashMap.cpp
+Programs_TestWebKitAPI_WTF_TestHashMap_CPPFLAGS = $(testwebkitapi_wtf_tests_cppflags)
+Programs_TestWebKitAPI_WTF_TestHashMap_LDADD = $(testwebkitapi_wtf_tests_ldadd)
+Programs_TestWebKitAPI_WTF_TestHashMap_LDFLAGS = $(testwebkitapi_wtf_tests_ldflags)
+
+Programs_TestWebKitAPI_WTF_TestRedBlackTree_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WTF/RedBlackTree.cpp
+Programs_TestWebKitAPI_WTF_TestRedBlackTree_CPPFLAGS = $(testwebkitapi_wtf_tests_cppflags)
+Programs_TestWebKitAPI_WTF_TestRedBlackTree_LDADD = $(testwebkitapi_wtf_tests_ldadd)
+Programs_TestWebKitAPI_WTF_TestRedBlackTree_LDFLAGS = $(testwebkitapi_wtf_tests_ldflags)
+
+Programs_TestWebKitAPI_WTF_TestStringBuilder_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp \
+ Tools/TestWebKitAPI/WTFStringUtilities.h
+Programs_TestWebKitAPI_WTF_TestStringBuilder_CPPFLAGS = $(testwebkitapi_wtf_tests_cppflags)
+Programs_TestWebKitAPI_WTF_TestStringBuilder_LDADD = $(testwebkitapi_wtf_tests_ldadd)
+Programs_TestWebKitAPI_WTF_TestStringBuilder_LDFLAGS = $(testwebkitapi_wtf_tests_ldflags)
+
+Programs_TestWebKitAPI_WTF_TestStringOperators_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp
+Programs_TestWebKitAPI_WTF_TestStringOperators_CPPFLAGS = $(testwebkitapi_wtf_tests_cppflags)
+Programs_TestWebKitAPI_WTF_TestStringOperators_LDADD = $(testwebkitapi_wtf_tests_ldadd)
+Programs_TestWebKitAPI_WTF_TestStringOperators_LDFLAGS = $(testwebkitapi_wtf_tests_ldflags)
+
+Programs_TestWebKitAPI_WTF_TestTemporaryChange_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WTF/TemporaryChange.cpp
+Programs_TestWebKitAPI_WTF_TestTemporaryChange_CPPFLAGS = $(testwebkitapi_wtf_tests_cppflags)
+Programs_TestWebKitAPI_WTF_TestTemporaryChange_LDADD = $(testwebkitapi_wtf_tests_ldadd)
+Programs_TestWebKitAPI_WTF_TestTemporaryChange_LDFLAGS = $(testwebkitapi_wtf_tests_ldflags)
+
+Programs_TestWebKitAPI_WTF_TestVectorBasic_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WTF/VectorBasic.cpp
+Programs_TestWebKitAPI_WTF_TestVectorBasic_CPPFLAGS = $(testwebkitapi_wtf_tests_cppflags)
+Programs_TestWebKitAPI_WTF_TestVectorBasic_LDADD = $(testwebkitapi_wtf_tests_ldadd)
+Programs_TestWebKitAPI_WTF_TestVectorBasic_LDFLAGS = $(testwebkitapi_wtf_tests_ldflags)
+
+Programs_TestWebKitAPI_WTF_TestVector_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WTF/Vector.cpp
+Programs_TestWebKitAPI_WTF_TestVector_CPPFLAGS = $(testwebkitapi_wtf_tests_cppflags)
+Programs_TestWebKitAPI_WTF_TestVector_LDADD = $(testwebkitapi_wtf_tests_ldadd)
+Programs_TestWebKitAPI_WTF_TestVector_LDFLAGS = $(testwebkitapi_wtf_tests_ldflags)
+
+Programs_TestWebKitAPI_WTF_TestVectorReverse_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WTF/VectorReverse.cpp
+Programs_TestWebKitAPI_WTF_TestVectorReverse_CPPFLAGS = $(testwebkitapi_wtf_tests_cppflags)
+Programs_TestWebKitAPI_WTF_TestVectorReverse_LDADD = $(testwebkitapi_wtf_tests_ldadd)
+Programs_TestWebKitAPI_WTF_TestVectorReverse_LDFLAGS = $(testwebkitapi_wtf_tests_ldflags)
+
+# WebKit2 Tests
+Programs_TestWebKitAPI_WebKit2_TestCookieManager_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/CookieManager.cpp
+Programs_TestWebKitAPI_WebKit2_TestCookieManager_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestCookieManager_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestCookieManager_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestDocumentStartUserScriptAlertCrash_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp
+Programs_TestWebKitAPI_WebKit2_TestDocumentStartUserScriptAlertCrash_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestDocumentStartUserScriptAlertCrash_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestDocumentStartUserScriptAlertCrash_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestDownloadDecideDestinationCrash_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/DownloadDecideDestinationCrash.cpp
+Programs_TestWebKitAPI_WebKit2_TestDownloadDecideDestinationCrash_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestDownloadDecideDestinationCrash_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestDownloadDecideDestinationCrash_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestEvaluateJavaScript_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/EvaluateJavaScript.cpp
+Programs_TestWebKitAPI_WebKit2_TestEvaluateJavaScript_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestEvaluateJavaScript_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestEvaluateJavaScript_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestFailedLoad_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/FailedLoad.cpp
+Programs_TestWebKitAPI_WebKit2_TestFailedLoad_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestFailedLoad_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestFailedLoad_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestForceRepaint_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/ForceRepaint.cpp
+Programs_TestWebKitAPI_WebKit2_TestForceRepaint_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestForceRepaint_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestForceRepaint_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestFrameMIMETypeHTML_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/FrameMIMETypeHTML.cpp
+Programs_TestWebKitAPI_WebKit2_TestFrameMIMETypeHTML_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestFrameMIMETypeHTML_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestFrameMIMETypeHTML_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestFrameMIMETypePNG_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/FrameMIMETypePNG.cpp
+Programs_TestWebKitAPI_WebKit2_TestFrameMIMETypePNG_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestFrameMIMETypePNG_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestFrameMIMETypePNG_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestHitTestResultNodeHandle_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/HitTestResultNodeHandle.cpp
+Programs_TestWebKitAPI_WebKit2_TestHitTestResultNodeHandle_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestHitTestResultNodeHandle_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestHitTestResultNodeHandle_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestInjectedBundleBasic_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic.cpp
+Programs_TestWebKitAPI_WebKit2_TestInjectedBundleBasic_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestInjectedBundleBasic_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestInjectedBundleBasic_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestLoadAlternateHTMLStringWithNonDirectoryURL_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp
+Programs_TestWebKitAPI_WebKit2_TestLoadAlternateHTMLStringWithNonDirectoryURL_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestLoadAlternateHTMLStringWithNonDirectoryURL_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestLoadAlternateHTMLStringWithNonDirectoryURL_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestLoadCanceledNoServerRedirectCallback_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/LoadCanceledNoServerRedirectCallback.cpp
+Programs_TestWebKitAPI_WebKit2_TestLoadCanceledNoServerRedirectCallback_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestLoadCanceledNoServerRedirectCallback_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestLoadCanceledNoServerRedirectCallback_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestMouseMoveAfterCrash_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash.cpp
+Programs_TestWebKitAPI_WebKit2_TestMouseMoveAfterCrash_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestMouseMoveAfterCrash_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestMouseMoveAfterCrash_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayout_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayout_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayout_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayout_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayoutFails_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails.cpp
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayoutFails_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayoutFails_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayoutFails_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayoutForImages_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages.cpp
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayoutForImages_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayoutForImages_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayoutForImages_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayoutFrames_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames.cpp
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayoutFrames_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayoutFrames_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestNewFirstVisuallyNonEmptyLayoutFrames_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestPageLoadBasic_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp
+Programs_TestWebKitAPI_WebKit2_TestPageLoadBasic_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestPageLoadBasic_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestPageLoadBasic_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestPageLoadDidChangeLocationWithinPageForFrame_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/PageLoadDidChangeLocationWithinPageForFrame.cpp
+Programs_TestWebKitAPI_WebKit2_TestPageLoadDidChangeLocationWithinPageForFrame_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestPageLoadDidChangeLocationWithinPageForFrame_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestPageLoadDidChangeLocationWithinPageForFrame_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestParentFrame_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/ParentFrame.cpp
+Programs_TestWebKitAPI_WebKit2_TestParentFrame_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestParentFrame_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestParentFrame_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestPreventEmptyUserAgent_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp
+Programs_TestWebKitAPI_WebKit2_TestPreventEmptyUserAgent_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestPreventEmptyUserAgent_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestPreventEmptyUserAgent_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestPrivateBrowsingPushStateNoHistoryCallback_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp
+Programs_TestWebKitAPI_WebKit2_TestPrivateBrowsingPushStateNoHistoryCallback_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestPrivateBrowsingPushStateNoHistoryCallback_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestPrivateBrowsingPushStateNoHistoryCallback_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestResponsivenessTimerDoesntFireEarly_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/ResponsivenessTimerDoesntFireEarly.cpp
+Programs_TestWebKitAPI_WebKit2_TestResponsivenessTimerDoesntFireEarly_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestResponsivenessTimerDoesntFireEarly_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestResponsivenessTimerDoesntFireEarly_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestRestoreSessionStateContainingFormData_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/RestoreSessionStateContainingFormData.cpp
+Programs_TestWebKitAPI_WebKit2_TestRestoreSessionStateContainingFormData_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestRestoreSessionStateContainingFormData_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestRestoreSessionStateContainingFormData_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestShouldGoToBackForwardListItem_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem.cpp
+Programs_TestWebKitAPI_WebKit2_TestShouldGoToBackForwardListItem_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestShouldGoToBackForwardListItem_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestShouldGoToBackForwardListItem_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestSpacebarScrolling_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp
+Programs_TestWebKitAPI_WebKit2_TestSpacebarScrolling_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestSpacebarScrolling_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestSpacebarScrolling_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestUserMessage_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/UserMessage.cpp
+Programs_TestWebKitAPI_WebKit2_TestUserMessage_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestUserMessage_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestUserMessage_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestWKConnection_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/WKConnection.cpp
+Programs_TestWebKitAPI_WebKit2_TestWKConnection_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestWKConnection_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestWKConnection_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestWKPreferences_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp
+Programs_TestWebKitAPI_WebKit2_TestWKPreferences_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestWKPreferences_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestWKPreferences_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestWKString_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/WKString.cpp
+Programs_TestWebKitAPI_WebKit2_TestWKString_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestWKString_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestWKString_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
+
+Programs_TestWebKitAPI_WebKit2_TestWKStringJSString_SOURCES = \
+ Tools/TestWebKitAPI/Tests/WebKit2/WKStringJSString.cpp
+Programs_TestWebKitAPI_WebKit2_TestWKStringJSString_CPPFLAGS = $(testwebkitapi_webkit2_tests_cppflags)
+Programs_TestWebKitAPI_WebKit2_TestWKStringJSString_LDADD = $(testwebkitapi_webkit2_tests_ldadd)
+Programs_TestWebKitAPI_WebKit2_TestWKStringJSString_LDFLAGS = $(testwebkitapi_webkit2_tests_ldflags)
diff --git a/Tools/TestWebKitAPI/JavaScriptTest.cpp b/Tools/TestWebKitAPI/JavaScriptTest.cpp
index 4f109b659..85be89252 100644
--- a/Tools/TestWebKitAPI/JavaScriptTest.cpp
+++ b/Tools/TestWebKitAPI/JavaScriptTest.cpp
@@ -28,7 +28,7 @@
#include "PlatformUtilities.h"
#include "Test.h"
-#include <JavaScriptCore/JavaScriptCore.h>
+#include <JavaScriptCore/JSContextRef.h>
#include <JavaScriptCore/JSRetainPtr.h>
#include <WebKit2/WKRetainPtr.h>
#include <WebKit2/WKSerializedScriptValue.h>
diff --git a/Tools/TestWebKitAPI/PlatformWebView.h b/Tools/TestWebKitAPI/PlatformWebView.h
index 00720f425..cf0132e4a 100644
--- a/Tools/TestWebKitAPI/PlatformWebView.h
+++ b/Tools/TestWebKitAPI/PlatformWebView.h
@@ -43,6 +43,9 @@ typedef NSWindow *PlatformWindow;
#elif defined(WIN32) || defined(_WIN32)
typedef WKViewRef PlatformWKView;
typedef HWND PlatformWindow;
+#elif PLATFORM(GTK)
+typedef WKViewRef PlatformWKView;
+typedef GtkWidget *PlatformWindow;
#endif
namespace TestWebKitAPI {
diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.gyp/.gitignore b/Tools/TestWebKitAPI/TestWebKitAPI.gyp/.gitignore
new file mode 100644
index 000000000..72f70a29c
--- /dev/null
+++ b/Tools/TestWebKitAPI/TestWebKitAPI.gyp/.gitignore
@@ -0,0 +1,5 @@
+*.Makefile
+*.mk
+*.sln
+*.vcproj*
+*.xcodeproj*
diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp b/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp
index 4babcb23d..9f6681dfe 100644
--- a/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp
+++ b/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp
@@ -55,7 +55,9 @@
'type': 'executable',
'dependencies': [
'<(source_dir)/WebKit/chromium/WebKit.gyp:webkit',
- '<(source_dir)/WebCore/WebCore.gyp/WebCore.gyp:webcore',
+ '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf',
+ '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl',
+ '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8',
'<(chromium_src_dir)/base/base.gyp:test_support_base',
'<(chromium_src_dir)/testing/gtest.gyp:gtest',
'<(chromium_src_dir)/testing/gmock.gyp:gmock',
diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
index e28730acd..85c365cc3 100644
--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
@@ -38,16 +38,27 @@
440A1D3914A0103A008A66F2 /* KURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 440A1D3814A0103A008A66F2 /* KURL.cpp */; };
4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; };
4BFDFFA9131477770061F24B /* HitTestResultNodeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA8131477770061F24B /* HitTestResultNodeHandle.cpp */; };
+ 51393E201523944A005F39C5 /* DOMWindowExtensionBasic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51393E1E1523944A005F39C5 /* DOMWindowExtensionBasic.cpp */; };
+ 51393E221523952D005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51393E1D1523944A005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp */; };
+ 5142B2711517C88B00C32B19 /* ContextMenuCanCopyURL.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5142B2701517C88B00C32B19 /* ContextMenuCanCopyURL.mm */; };
+ 5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */; };
+ 517E7DFC15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */; };
+ 517E7E04151119C100D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */; };
+ 51FBBB4D1513D4E900822738 /* WebViewCanPasteURL.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51FBBB4C1513D4E900822738 /* WebViewCanPasteURL.mm */; };
+ 51FCF79A1534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */; };
+ 51FCF7A11534B2A000104491 /* ShouldGoToBackForwardListItem_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */; };
520BCF4C141EB09E00937EA8 /* WebArchive_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 520BCF4A141EB09E00937EA8 /* WebArchive_Bundle.cpp */; };
520BCF4D141EB09E00937EA8 /* WebArchive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 520BCF4B141EB09E00937EA8 /* WebArchive.cpp */; };
52CB47411448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52CB47401448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp */; };
52E5CE4614D21E9D003B2BD8 /* ParentFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52E5CE4514D21E9D003B2BD8 /* ParentFrame.cpp */; };
52E5CE4914D21EAB003B2BD8 /* ParentFrame_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52E5CE4814D21EAB003B2BD8 /* ParentFrame_Bundle.cpp */; };
+ 76E182DA1547550100F1FADD /* WillSendSubmitEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */; };
+ 76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */; };
+ 76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 76E182DE15475A8300F1FADD /* auto-submitting-form.html */; };
81B50193140F232300D9EB58 /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81B50192140F232300D9EB58 /* StringBuilder.cpp */; };
930AD402150698D00067970F /* lots-of-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 930AD401150698B30067970F /* lots-of-text.html */; };
9361002914DC95A70061379D /* lots-of-iframes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9361002814DC957B0061379D /* lots-of-iframes.html */; };
939BA91714103412001A01BD /* DeviceScaleFactorOnBack.mm in Sources */ = {isa = PBXBuildFile; fileRef = 939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */; };
- 93AF4ECB1506F035007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4ECA1506F035007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages.cpp */; };
93AF4ECE1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4ECD1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp */; };
93AF4ED01506F123007FD57E /* lots-of-images.html in Resources */ = {isa = PBXBuildFile; fileRef = 93AF4ECF1506F123007FD57E /* lots-of-images.html */; };
93AF4ED11506F130007FD57E /* lots-of-images.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93AF4ECF1506F123007FD57E /* lots-of-images.html */; };
@@ -58,6 +69,9 @@
93F7E86C14DC8E4D00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F7E86B14DC8E4D00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames.cpp */; };
93F7E86F14DC8E5C00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F7E86E14DC8E5B00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp */; };
A7A966DB140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */; };
+ B55F11A01516834F00915916 /* AttributedString.mm in Sources */ = {isa = PBXBuildFile; fileRef = B55F119F1516834F00915916 /* AttributedString.mm */; };
+ B55F11B71517D03300915916 /* attributedStringCustomFont.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = B55F11B01517A2C400915916 /* attributedStringCustomFont.html */; };
+ B55F11BE15191A0600915916 /* Ahem.ttf in Copy Resources */ = {isa = PBXBuildFile; fileRef = B55F11B9151916E600915916 /* Ahem.ttf */; };
BC029B181486AD6400817DA9 /* RetainPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC029B161486AD6400817DA9 /* RetainPtr.cpp */; };
BC029B1C1486B25900817DA9 /* RetainPtr.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC029B1B1486B25900817DA9 /* RetainPtr.mm */; };
BC131885117114B600B69727 /* PlatformUtilitiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */; };
@@ -125,6 +139,8 @@
C0C5D3BE14598B6F00A802A6 /* GetBackingScaleFactor.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0C5D3BC14598B6F00A802A6 /* GetBackingScaleFactor.mm */; };
C0C5D3C61459912900A802A6 /* GetBackingScaleFactor_Bundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0C5D3BD14598B6F00A802A6 /* GetBackingScaleFactor_Bundle.mm */; };
C507E8A714C6545B005D6B3B /* InspectorBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = C507E8A614C6545B005D6B3B /* InspectorBar.mm */; };
+ C540F776152E4DA000A40C8C /* SimplifyMarkup.mm in Sources */ = {isa = PBXBuildFile; fileRef = C540F775152E4DA000A40C8C /* SimplifyMarkup.mm */; };
+ C540F784152E5A9A00A40C8C /* verboseMarkup.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C540F783152E5A7800A40C8C /* verboseMarkup.html */; };
E490296814E2E3A4002BEDD1 /* TypingStyleCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */; };
F3FC3EE313678B7300126A65 /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3FC3EE213678B7300126A65 /* libgtest.a */; };
F6F3F29113342FEB00A6BF19 /* CookieManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */; };
@@ -158,6 +174,11 @@
dstPath = TestWebKitAPI.resources;
dstSubfolderSpec = 7;
files = (
+ B55F11BE15191A0600915916 /* Ahem.ttf in Copy Resources */,
+ B55F11B71517D03300915916 /* attributedStringCustomFont.html in Copy Resources */,
+ 76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */,
+ 5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */,
+ 517E7E04151119C100D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html in Copy Resources */,
379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */,
33DC8912141955FE00747EF7 /* simple-iframe.html in Copy Resources */,
1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
@@ -176,6 +197,7 @@
BC2D006412AA04CE00E732A3 /* file-with-anchor.html in Copy Resources */,
37DC6791140D7D7600ABCCDB /* DOMRangeOfString.html in Copy Resources */,
1ADBEFE3130C6AA100D61D19 /* simple-accelerated-compositing.html in Copy Resources */,
+ C540F784152E5A9A00A40C8C /* verboseMarkup.html in Copy Resources */,
);
name = "Copy Resources";
runOnlyForDeploymentPostprocessing = 0;
@@ -214,11 +236,23 @@
44A622C114A0E2B60048515B /* WTFStringUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFStringUtilities.h; sourceTree = "<group>"; };
4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestResultNodeHandle_Bundle.cpp; sourceTree = "<group>"; };
4BFDFFA8131477770061F24B /* HitTestResultNodeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestResultNodeHandle.cpp; sourceTree = "<group>"; };
+ 51393E1D1523944A005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionBasic_Bundle.cpp; sourceTree = "<group>"; };
+ 51393E1E1523944A005F39C5 /* DOMWindowExtensionBasic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionBasic.cpp; sourceTree = "<group>"; };
+ 5142B2701517C88B00C32B19 /* ContextMenuCanCopyURL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuCanCopyURL.mm; sourceTree = "<group>"; };
+ 5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = ContextMenuCanCopyURL.html; sourceTree = "<group>"; };
+ 517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCachePruneWithinResourceLoadDelegate.mm; sourceTree = "<group>"; };
+ 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCachePruneWithinResourceLoadDelegate.html; sourceTree = "<group>"; };
+ 51FBBB4C1513D4E900822738 /* WebViewCanPasteURL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewCanPasteURL.mm; sourceTree = "<group>"; };
+ 51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShouldGoToBackForwardListItem_Bundle.cpp; sourceTree = "<group>"; };
+ 51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShouldGoToBackForwardListItem.cpp; sourceTree = "<group>"; };
520BCF4A141EB09E00937EA8 /* WebArchive_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebArchive_Bundle.cpp; sourceTree = "<group>"; };
520BCF4B141EB09E00937EA8 /* WebArchive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebArchive.cpp; sourceTree = "<group>"; };
52CB47401448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadAlternateHTMLStringWithNonDirectoryURL.cpp; sourceTree = "<group>"; };
52E5CE4514D21E9D003B2BD8 /* ParentFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParentFrame.cpp; sourceTree = "<group>"; };
52E5CE4814D21EAB003B2BD8 /* ParentFrame_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParentFrame_Bundle.cpp; sourceTree = "<group>"; };
+ 76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent.cpp; sourceTree = "<group>"; };
+ 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent_Bundle.cpp; sourceTree = "<group>"; };
+ 76E182DE15475A8300F1FADD /* auto-submitting-form.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "auto-submitting-form.html"; sourceTree = "<group>"; };
81B50192140F232300D9EB58 /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringBuilder.cpp; path = WTF/StringBuilder.cpp; sourceTree = "<group>"; };
8DD76FA10486AA7600D96B5E /* TestWebKitAPI */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestWebKitAPI; sourceTree = BUILT_PRODUCTS_DIR; };
930AD401150698B30067970F /* lots-of-text.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "lots-of-text.html"; sourceTree = "<group>"; };
@@ -234,6 +268,9 @@
93F7E86B14DC8E4D00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayoutFrames.cpp; sourceTree = "<group>"; };
93F7E86E14DC8E5B00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp; sourceTree = "<group>"; };
A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CheckedArithmeticOperations.cpp; path = WTF/CheckedArithmeticOperations.cpp; sourceTree = "<group>"; };
+ B55F119F1516834F00915916 /* AttributedString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AttributedString.mm; sourceTree = "<group>"; };
+ B55F11B01517A2C400915916 /* attributedStringCustomFont.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = attributedStringCustomFont.html; sourceTree = "<group>"; };
+ B55F11B9151916E600915916 /* Ahem.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Ahem.ttf; sourceTree = "<group>"; };
BC029B161486AD6400817DA9 /* RetainPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RetainPtr.cpp; sourceTree = "<group>"; };
BC029B1B1486B25900817DA9 /* RetainPtr.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RetainPtr.mm; path = WTF/ns/RetainPtr.mm; sourceTree = "<group>"; };
BC131883117114A800B69727 /* PlatformUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformUtilities.h; sourceTree = "<group>"; };
@@ -315,6 +352,8 @@
C0C5D3BC14598B6F00A802A6 /* GetBackingScaleFactor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetBackingScaleFactor.mm; sourceTree = "<group>"; };
C0C5D3BD14598B6F00A802A6 /* GetBackingScaleFactor_Bundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetBackingScaleFactor_Bundle.mm; sourceTree = "<group>"; };
C507E8A614C6545B005D6B3B /* InspectorBar.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InspectorBar.mm; sourceTree = "<group>"; };
+ C540F775152E4DA000A40C8C /* SimplifyMarkup.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimplifyMarkup.mm; sourceTree = "<group>"; };
+ C540F783152E5A7800A40C8C /* verboseMarkup.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = verboseMarkup.html; sourceTree = "<group>"; };
E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TypingStyleCrash.mm; sourceTree = "<group>"; };
F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };
F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CookieManager.cpp; sourceTree = "<group>"; };
@@ -460,6 +499,8 @@
BC246D98132F1FE100B56D7C /* CanHandleRequest.cpp */,
BC246D97132F1FE100B56D7C /* CanHandleRequest_Bundle.cpp */,
F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */,
+ 51393E1E1523944A005F39C5 /* DOMWindowExtensionBasic.cpp */,
+ 51393E1D1523944A005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp */,
BCB6803F126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp */,
BCB68041126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp */,
C045F9441385C2E900C0F3CD /* DownloadDecideDestinationCrash.cpp */,
@@ -495,11 +536,15 @@
C0BD669C131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp */,
C0BD669E131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp */,
C0ADBE8212FCA6AA00D2C129 /* RestoreSessionStateContainingFormData.cpp */,
+ 51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */,
+ 51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */,
C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */,
BC22D31314DC689800FFB1DD /* UserMessage.cpp */,
BC22D31714DC68B800FFB1DD /* UserMessage_Bundle.cpp */,
520BCF4B141EB09E00937EA8 /* WebArchive.cpp */,
520BCF4A141EB09E00937EA8 /* WebArchive_Bundle.cpp */,
+ 76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */,
+ 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */,
BC901E221492ADCE0074A667 /* WKConnection.cpp */,
BC901E311492AF390074A667 /* WKConnection_Bundle.cpp */,
BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */,
@@ -547,6 +592,7 @@
BCAA485514A021640088FAC4 /* simple-tall.html */,
BC909778125571AB00083756 /* simple.html */,
C02B7882126615410026BF0F /* spacebar-scrolling.html */,
+ 76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
);
name = Resources;
sourceTree = "<group>";
@@ -587,15 +633,20 @@
children = (
C07E6CB013FD737C0038B22B /* Resources */,
379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */,
+ B55F119F1516834F00915916 /* AttributedString.mm */,
+ 5142B2701517C88B00C32B19 /* ContextMenuCanCopyURL.mm */,
37DC678B140D7C5000ABCCDB /* DOMRangeOfString.mm */,
C07E6CAE13FD67650038B22B /* DynamicDeviceScaleFactor.mm */,
3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */,
939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */,
C507E8A614C6545B005D6B3B /* InspectorBar.mm */,
+ 517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */,
3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */,
+ C540F775152E4DA000A40C8C /* SimplifyMarkup.mm */,
3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */,
37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */,
E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */,
+ 51FBBB4C1513D4E900822738 /* WebViewCanPasteURL.mm */,
);
path = mac;
sourceTree = "<group>";
@@ -603,9 +654,14 @@
C07E6CB013FD737C0038B22B /* Resources */ = {
isa = PBXGroup;
children = (
+ B55F11B9151916E600915916 /* Ahem.ttf */,
+ B55F11B01517A2C400915916 /* attributedStringCustomFont.html */,
379028B814FABE49007E6B43 /* acceptsFirstMouse.html */,
- C07E6CB113FD738A0038B22B /* devicePixelRatio.html */,
+ 5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */,
37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */,
+ C07E6CB113FD738A0038B22B /* devicePixelRatio.html */,
+ 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */,
+ C540F783152E5A7800A40C8C /* verboseMarkup.html */,
);
name = Resources;
sourceTree = "<group>";
@@ -800,6 +856,14 @@
E490296814E2E3A4002BEDD1 /* TypingStyleCrash.mm in Sources */,
379028B614FABD92007E6B43 /* AcceptsFirstMouse.mm in Sources */,
3776BC63150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm in Sources */,
+ B55F11A01516834F00915916 /* AttributedString.mm in Sources */,
+ 517E7DFC15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm in Sources */,
+ 51FBBB4D1513D4E900822738 /* WebViewCanPasteURL.mm in Sources */,
+ 5142B2711517C88B00C32B19 /* ContextMenuCanCopyURL.mm in Sources */,
+ C540F776152E4DA000A40C8C /* SimplifyMarkup.mm in Sources */,
+ 51FCF79A1534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp in Sources */,
+ 51393E201523944A005F39C5 /* DOMWindowExtensionBasic.cpp in Sources */,
+ 76E182DA1547550100F1FADD /* WillSendSubmitEvent.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -828,6 +892,9 @@
93F7E86F14DC8E5C00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp in Sources */,
BC22D31914DC68B900FFB1DD /* UserMessage_Bundle.cpp in Sources */,
93AF4ECE1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp in Sources */,
+ 51FCF7A11534B2A000104491 /* ShouldGoToBackForwardListItem_Bundle.cpp in Sources */,
+ 51393E221523952D005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp in Sources */,
+ 76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic.cpp
new file mode 100644
index 000000000..b78ee91af
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic.cpp
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2012 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"
+#include <WebKit2/WKRetainPtr.h>
+#include <wtf/Vector.h>
+
+namespace TestWebKitAPI {
+
+static bool finished;
+static int liveDOMExtensionCount;
+
+static const char* expectedMessages[] = {
+"GlobalObjectIsAvailableForFrame called",
+"GlobalObjectIsAvailableForFrame called",
+"GlobalObjectIsAvailableForFrame called",
+"GlobalObjectIsAvailableForFrame called",
+"Subframe finished loading",
+"Extension states:\nFirst page, main frame, standard world - Connected\nFirst page, main frame, non-standard world - Connected\nFirst page, subframe, standard world - Connected\nFirst page, subframe, non-standard world - Connected\nSecond page, main frame, standard world - Uncreated\nSecond page, main frame, non-standard world - Uncreated",
+"Main frame finished loading",
+"Extension states:\nFirst page, main frame, standard world - Connected\nFirst page, main frame, non-standard world - Connected\nFirst page, subframe, standard world - Connected\nFirst page, subframe, non-standard world - Connected\nSecond page, main frame, standard world - Uncreated\nSecond page, main frame, non-standard world - Uncreated",
+"WillDisconnectDOMWindowExtensionFromGlobalObject called",
+"WillDisconnectDOMWindowExtensionFromGlobalObject called",
+"WillDisconnectDOMWindowExtensionFromGlobalObject called",
+"WillDisconnectDOMWindowExtensionFromGlobalObject called",
+"GlobalObjectIsAvailableForFrame called",
+"GlobalObjectIsAvailableForFrame called",
+"Main frame finished loading",
+"Extension states:\nFirst page, main frame, standard world - Disconnected\nFirst page, main frame, non-standard world - Disconnected\nFirst page, subframe, standard world - Disconnected\nFirst page, subframe, non-standard world - Disconnected\nSecond page, main frame, standard world - Connected\nSecond page, main frame, non-standard world - Connected",
+"WillDisconnectDOMWindowExtensionFromGlobalObject called",
+"WillDisconnectDOMWindowExtensionFromGlobalObject called",
+"DidReconnectDOMWindowExtensionToGlobalObject called",
+"DidReconnectDOMWindowExtensionToGlobalObject called",
+"DidReconnectDOMWindowExtensionToGlobalObject called",
+"DidReconnectDOMWindowExtensionToGlobalObject called",
+"Main frame finished loading",
+"Extension states:\nFirst page, main frame, standard world - Connected\nFirst page, main frame, non-standard world - Connected\nFirst page, subframe, standard world - Connected\nFirst page, subframe, non-standard world - Connected\nSecond page, main frame, standard world - Disconnected\nSecond page, main frame, non-standard world - Disconnected",
+"WillDestroyGlobalObjectForDOMWindowExtension called",
+"WillDestroyGlobalObjectForDOMWindowExtension called",
+"WillDestroyGlobalObjectForDOMWindowExtension called",
+"WillDestroyGlobalObjectForDOMWindowExtension called",
+"WillDestroyGlobalObjectForDOMWindowExtension called",
+"WillDestroyGlobalObjectForDOMWindowExtension called",
+"Extension states:\nFirst page, main frame, standard world - Destroyed\nFirst page, main frame, non-standard world - Destroyed\nFirst page, subframe, standard world - Destroyed\nFirst page, subframe, non-standard world - Destroyed\nSecond page, main frame, standard world - Destroyed\nSecond page, main frame, non-standard world - Destroyed",
+"TestComplete"
+};
+
+static Vector<WKRetainPtr<WKStringRef> > messages;
+
+static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void*)
+{
+ ASSERT_NOT_NULL(messageBody);
+ EXPECT_EQ(WKStringGetTypeID(), WKGetTypeID(messageBody));
+
+ WKStringRef bodyString = (WKStringRef)messageBody;
+ messages.append(bodyString);
+
+ if (WKStringIsEqualToUTF8CString(messageName, "GlobalObjectIsAvailableForFrame"))
+ liveDOMExtensionCount++;
+ else if (WKStringIsEqualToUTF8CString(messageName, "WillDestroyGlobalObjectForDOMWindowExtension")) {
+ liveDOMExtensionCount--;
+ if (!liveDOMExtensionCount)
+ finished = true;
+ } else if (WKStringIsEqualToUTF8CString(messageName, "DidFinishLoadForMainFrame") || WKStringIsEqualToUTF8CString(messageName, "TestComplete"))
+ finished = true;
+
+}
+
+TEST(WebKit2, DOMWindowExtensionBasic)
+{
+ WKRetainPtr<WKPageGroupRef> pageGroup(AdoptWK, WKPageGroupCreateWithIdentifier(WKStringCreateWithUTF8CString("DOMWindowExtensionBasicPageGroup")));
+
+ WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("DOMWindowExtensionBasic", pageGroup.get()));
+
+ WKContextInjectedBundleClient injectedBundleClient;
+ memset(&injectedBundleClient, 0, sizeof(injectedBundleClient));
+ injectedBundleClient.version = 0;
+ injectedBundleClient.clientInfo = 0;
+ injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle;
+ WKContextSetInjectedBundleClient(context.get(), &injectedBundleClient);
+
+ // The default cache model has a capacity of 0, so it is necessary to switch to a cache
+ // model that actually allows for a page cache.
+ WKContextSetCacheModel(context.get(), kWKCacheModelDocumentBrowser);
+
+ PlatformWebView webView(context.get(), pageGroup.get());
+
+ // Make sure the extensions for each frame are installed in each world.
+ WKRetainPtr<WKURLRef> url1(AdoptWK, Util::createURLForResource("simple-iframe", "html"));
+ WKPageLoadURL(webView.page(), url1.get());
+
+ Util::run(&finished);
+ finished = false;
+
+ // Make sure those first 4 extensions are disconnected, and 2 new ones are installed.
+ WKRetainPtr<WKURLRef> url2(AdoptWK, Util::createURLForResource("simple", "html"));
+ WKPageLoadURL(webView.page(), url2.get());
+
+ Util::run(&finished);
+ finished = false;
+
+ // Make sure those two are disconnected, and the first four are reconnected.
+ WKPageGoBack(webView.page());
+
+ Util::run(&finished);
+ finished = false;
+
+ // Make sure the 2 disconnected extensions in the page cache and the 4 active extensions are all destroyed.
+ WKPageClose(webView.page());
+
+ Util::run(&finished);
+
+ const size_t expectedSize = sizeof(expectedMessages) / sizeof(const char*);
+ EXPECT_EQ(messages.size(), expectedSize);
+
+ if (messages.size() != expectedSize)
+ return;
+
+ for (size_t i = 0; i < messages.size(); ++i)
+ EXPECT_EQ(WKStringIsEqualToUTF8CString(messages[i].get(), expectedMessages[i]), true);
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp
new file mode 100644
index 000000000..61ac1bdeb
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp
@@ -0,0 +1,254 @@
+/*
+ * Copyright (C) 2012 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 "InjectedBundleTest.h"
+#include <WebKit2/WKBundleDOMWindowExtension.h>
+#include <WebKit2/WKBundleFrame.h>
+#include <WebKit2/WKBundlePage.h>
+#include <WebKit2/WKBundlePageGroup.h>
+#include <WebKit2/WKBundlePrivate.h>
+#include <WebKit2/WKBundleScriptWorld.h>
+#include <WebKit2/WKRetainPtr.h>
+#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
+#include <assert.h>
+
+namespace TestWebKitAPI {
+
+static void didFinishLoadForFrameCallback(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void* clientInfo);
+static void globalObjectIsAvailableForFrameCallback(WKBundlePageRef, WKBundleFrameRef, WKBundleScriptWorldRef, const void* clientInfo);
+static void willDisconnectDOMWindowExtensionFromGlobalObjectCallback(WKBundlePageRef, WKBundleDOMWindowExtensionRef, const void* clientInfo);
+static void didReconnectDOMWindowExtensionToGlobalObjectCallback(WKBundlePageRef, WKBundleDOMWindowExtensionRef, const void* clientInfo);
+static void willDestroyGlobalObjectForDOMWindowExtensionCallback(WKBundlePageRef, WKBundleDOMWindowExtensionRef, const void* clientInfo);
+
+
+enum ExtensionState {
+ Uncreated = 0, Connected, Disconnected, Destroyed
+};
+
+const char* stateNames[4] = {
+ "Uncreated",
+ "Connected",
+ "Disconnected",
+ "Destroyed"
+};
+
+typedef struct {
+ const char* name;
+ ExtensionState state;
+} ExtensionRecord;
+
+class DOMWindowExtensionBasic : public InjectedBundleTest {
+public:
+ DOMWindowExtensionBasic(const std::string& identifier);
+
+ virtual void initialize(WKBundleRef, WKTypeRef userData);
+ virtual void didCreatePage(WKBundleRef, WKBundlePageRef);
+
+ void globalObjectIsAvailableForFrame(WKBundleFrameRef, WKBundleScriptWorldRef);
+ void willDisconnectDOMWindowExtensionFromGlobalObject(WKBundleDOMWindowExtensionRef);
+ void didReconnectDOMWindowExtensionToGlobalObject(WKBundleDOMWindowExtensionRef);
+ void willDestroyGlobalObjectForDOMWindowExtension(WKBundleDOMWindowExtensionRef);
+
+ void frameLoadFinished(WKBundleFrameRef);
+
+private:
+ void updateExtensionStateRecord(WKBundleDOMWindowExtensionRef, ExtensionState);
+ void sendExtensionStateMessage();
+ void sendBundleMessage(const char*);
+
+ WKBundlePageGroupRef m_pageGroup;
+ WKBundleRef m_bundle;
+ ExtensionRecord m_extensionRecords[6];
+ HashMap<WKBundleDOMWindowExtensionRef, int> m_extensionToRecordMap;
+ bool m_finishedOneMainFrameLoad;
+ int m_numberOfDestroyedExtensions;
+};
+
+static InjectedBundleTest::Register<DOMWindowExtensionBasic> registrar("DOMWindowExtensionBasic");
+
+DOMWindowExtensionBasic::DOMWindowExtensionBasic(const std::string& identifier)
+ : InjectedBundleTest(identifier)
+ , m_finishedOneMainFrameLoad(false)
+ , m_numberOfDestroyedExtensions(0)
+{
+ m_extensionRecords[0].name = "First page, main frame, standard world";
+ m_extensionRecords[1].name = "First page, main frame, non-standard world";
+ m_extensionRecords[2].name = "First page, subframe, standard world";
+ m_extensionRecords[3].name = "First page, subframe, non-standard world";
+ m_extensionRecords[4].name = "Second page, main frame, standard world";
+ m_extensionRecords[5].name = "Second page, main frame, non-standard world";
+
+ for (size_t i = 0; i < 6; ++i)
+ m_extensionRecords[i].state = Uncreated;
+}
+
+void DOMWindowExtensionBasic::frameLoadFinished(WKBundleFrameRef frame)
+{
+ bool mainFrame = !WKBundleFrameGetParentFrame(frame);
+ if (mainFrame)
+ m_finishedOneMainFrameLoad = true;
+
+ char body[16384];
+ sprintf(body, "%s finished loading", mainFrame ? "Main frame" : "Subframe");
+
+ // Only consider load finished for the main frame
+ const char* name = mainFrame ? "DidFinishLoadForMainFrame" : "DidFinishLoadForFrame";
+
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString(name));
+ WKRetainPtr<WKStringRef> messageBody = adoptWK(WKStringCreateWithUTF8CString(body));
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+
+ sendExtensionStateMessage();
+}
+
+void DOMWindowExtensionBasic::sendExtensionStateMessage()
+{
+ char body[16384];
+ sprintf(body, "Extension states:\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
+ m_extensionRecords[0].name, stateNames[m_extensionRecords[0].state],
+ m_extensionRecords[1].name, stateNames[m_extensionRecords[1].state],
+ m_extensionRecords[2].name, stateNames[m_extensionRecords[2].state],
+ m_extensionRecords[3].name, stateNames[m_extensionRecords[3].state],
+ m_extensionRecords[4].name, stateNames[m_extensionRecords[4].state],
+ m_extensionRecords[5].name, stateNames[m_extensionRecords[5].state]);
+
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("ExtensionStates"));
+ WKRetainPtr<WKStringRef> messageBody = adoptWK(WKStringCreateWithUTF8CString(body));
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+}
+
+void DOMWindowExtensionBasic::initialize(WKBundleRef bundle, WKTypeRef userData)
+{
+ assert(WKGetTypeID(userData) == WKBundlePageGroupGetTypeID());
+ WKBundlePageGroupRef pageGroup = static_cast<WKBundlePageGroupRef>(userData);
+
+ WKRetainPtr<WKStringRef> source(AdoptWK, WKStringCreateWithUTF8CString("alert('Unimportant alert');"));
+ WKBundleAddUserScript(bundle, pageGroup, WKBundleScriptWorldCreateWorld(), source.get(), 0, 0, 0, kWKInjectAtDocumentStart, kWKInjectInAllFrames);
+}
+
+void DOMWindowExtensionBasic::didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
+{
+ m_bundle = bundle;
+
+ WKBundlePageLoaderClient pageLoaderClient;
+ memset(&pageLoaderClient, 0, sizeof(pageLoaderClient));
+
+ pageLoaderClient.version = 1;
+ pageLoaderClient.clientInfo = this;
+ pageLoaderClient.didFinishLoadForFrame = didFinishLoadForFrameCallback;
+ pageLoaderClient.globalObjectIsAvailableForFrame = globalObjectIsAvailableForFrameCallback;
+ pageLoaderClient.willDisconnectDOMWindowExtensionFromGlobalObject = willDisconnectDOMWindowExtensionFromGlobalObjectCallback;
+ pageLoaderClient.didReconnectDOMWindowExtensionToGlobalObject = didReconnectDOMWindowExtensionToGlobalObjectCallback;
+ pageLoaderClient.willDestroyGlobalObjectForDOMWindowExtension = willDestroyGlobalObjectForDOMWindowExtensionCallback;
+
+ WKBundlePageSetPageLoaderClient(page, &pageLoaderClient);
+}
+
+void DOMWindowExtensionBasic::updateExtensionStateRecord(WKBundleDOMWindowExtensionRef extension, ExtensionState state)
+{
+ int index = m_extensionToRecordMap.get(extension);
+ m_extensionRecords[index].state = state;
+}
+
+void DOMWindowExtensionBasic::sendBundleMessage(const char* message)
+{
+ WKRetainPtr<WKStringRef> wkMessage = adoptWK(WKStringCreateWithUTF8CString(message));
+ WKBundlePostMessage(m_bundle, wkMessage.get(), wkMessage.get());
+}
+
+void DOMWindowExtensionBasic::globalObjectIsAvailableForFrame(WKBundleFrameRef frame, WKBundleScriptWorldRef world)
+{
+ WKBundleDOMWindowExtensionRef extension = WKBundleDOMWindowExtensionCreate(frame, world);
+
+ int index;
+ bool standard;
+ standard = world == WKBundleScriptWorldNormalWorld();
+
+ if (WKBundleFrameGetParentFrame(frame))
+ index = standard ? 2 : 3;
+ else
+ index = m_finishedOneMainFrameLoad ? (standard ? 4 : 5) : (standard ? 0 : 1);
+
+ m_extensionToRecordMap.set(extension, index);
+
+ updateExtensionStateRecord(extension, Connected);
+ sendBundleMessage("GlobalObjectIsAvailableForFrame called");
+}
+
+void DOMWindowExtensionBasic::willDisconnectDOMWindowExtensionFromGlobalObject(WKBundleDOMWindowExtensionRef extension)
+{
+ updateExtensionStateRecord(extension, Disconnected);
+ sendBundleMessage("WillDisconnectDOMWindowExtensionFromGlobalObject called");
+}
+
+void DOMWindowExtensionBasic::didReconnectDOMWindowExtensionToGlobalObject(WKBundleDOMWindowExtensionRef extension)
+{
+ updateExtensionStateRecord(extension, Connected);
+ sendBundleMessage("DidReconnectDOMWindowExtensionToGlobalObject called");
+}
+
+void DOMWindowExtensionBasic::willDestroyGlobalObjectForDOMWindowExtension(WKBundleDOMWindowExtensionRef extension)
+{
+ m_numberOfDestroyedExtensions++;
+
+ updateExtensionStateRecord(extension, Destroyed);
+ sendBundleMessage("WillDestroyGlobalObjectForDOMWindowExtension called");
+
+ if (m_numberOfDestroyedExtensions == 6) {
+ sendExtensionStateMessage();
+ sendBundleMessage("TestComplete");
+ }
+
+ WKRelease(extension);
+}
+
+static void didFinishLoadForFrameCallback(WKBundlePageRef, WKBundleFrameRef frame, WKTypeRef*, const void *clientInfo)
+{
+ ((DOMWindowExtensionBasic*)clientInfo)->frameLoadFinished(frame);
+}
+
+static void globalObjectIsAvailableForFrameCallback(WKBundlePageRef, WKBundleFrameRef frame, WKBundleScriptWorldRef world, const void* clientInfo)
+{
+ ((DOMWindowExtensionBasic*)clientInfo)->globalObjectIsAvailableForFrame(frame, world);
+}
+
+static void willDisconnectDOMWindowExtensionFromGlobalObjectCallback(WKBundlePageRef, WKBundleDOMWindowExtensionRef extension, const void* clientInfo)
+{
+ ((DOMWindowExtensionBasic*)clientInfo)->willDisconnectDOMWindowExtensionFromGlobalObject(extension);
+}
+
+static void didReconnectDOMWindowExtensionToGlobalObjectCallback(WKBundlePageRef, WKBundleDOMWindowExtensionRef extension, const void* clientInfo)
+{
+ ((DOMWindowExtensionBasic*)clientInfo)->didReconnectDOMWindowExtensionToGlobalObject(extension);
+}
+
+static void willDestroyGlobalObjectForDOMWindowExtensionCallback(WKBundlePageRef, WKBundleDOMWindowExtensionRef extension , const void* clientInfo)
+{
+ ((DOMWindowExtensionBasic*)clientInfo)->willDestroyGlobalObjectForDOMWindowExtension(extension);
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/EvaluateJavaScript.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/EvaluateJavaScript.cpp
index 99b7ff7f1..90ad04fd1 100644
--- a/Tools/TestWebKitAPI/Tests/WebKit2/EvaluateJavaScript.cpp
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/EvaluateJavaScript.cpp
@@ -27,7 +27,6 @@
#include "PlatformUtilities.h"
#include "PlatformWebView.h"
#include "Test.h"
-#include <JavaScriptCore/JavaScriptCore.h>
#include <WebKit2/WKRetainPtr.h>
#include <WebKit2/WKSerializedScriptValue.h>
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic.cpp
index 40ca269df..083a88f05 100644
--- a/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic.cpp
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic.cpp
@@ -34,7 +34,7 @@ static bool done;
static bool loadDone;
static bool messageReceived;
-void didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
+static void didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
{
messageReceived = true;
if (loadDone)
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp
index c703283f9..f90f3eb2b 100644
--- a/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp
@@ -47,7 +47,7 @@ static void setPageLoaderClient(WKPageRef page)
WKPageSetPageLoaderClient(page, &loaderClient);
}
-TEST(WebKit2, NewFirstVisuallyNonEmptyLayout)
+TEST(WebKit2, DISABLED_NewFirstVisuallyNonEmptyLayout)
{
WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("NewFirstVisuallyNonEmptyLayoutTest"));
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp
index 4c522780d..c5acb6172 100644
--- a/Tools/TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp
@@ -27,7 +27,7 @@
#include "PlatformUtilities.h"
#include "PlatformWebView.h"
#include "Test.h"
-#include <JavaScriptCore/JavaScriptCore.h>
+#include <JavaScriptCore/JSContextRef.h>
#include <WebKit2/WKRetainPtr.h>
#include <WebKit2/WKSerializedScriptValue.h>
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem.cpp
new file mode 100644
index 000000000..c13a5eb49
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2012 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"
+
+#include <WebKit2/WKString.h>
+
+namespace TestWebKitAPI {
+
+static bool finished = false;
+static bool receivedProperBackForwardCallbacks = false;
+
+static void didFinishLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void*)
+{
+ // Only mark finished when the main frame loads
+ if (WKFrameGetParentFrame(frame))
+ return;
+
+ finished = true;
+}
+
+static void willGoToBackForwardListItem(WKPageRef, WKBackForwardListItemRef, WKTypeRef userData, const void*)
+{
+ if (WKGetTypeID(userData) == WKStringGetTypeID()) {
+ if (WKStringIsEqualToUTF8CString((WKStringRef)userData, "shouldGoToBackForwardListItemCallback called as expected"))
+ receivedProperBackForwardCallbacks = true;
+ }
+
+ finished = true;
+}
+
+static void setPageLoaderClient(WKPageRef page)
+{
+ WKPageLoaderClient loaderClient;
+ memset(&loaderClient, 0, sizeof(loaderClient));
+ loaderClient.version = 1;
+ loaderClient.clientInfo = 0;
+ loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+ loaderClient.willGoToBackForwardListItem = willGoToBackForwardListItem;
+
+ WKPageSetPageLoaderClient(page, &loaderClient);
+}
+
+TEST(WebKit2, ShouldGoToBackForwardListItem)
+{
+ WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("ShouldGoToBackForwardListItemTest"));
+ // Enable the page cache so we can test the WKBundleBackForwardListItemIsInPageCache API
+ WKContextSetCacheModel(context.get(), kWKCacheModelDocumentBrowser);
+
+ PlatformWebView webView(context.get());
+ setPageLoaderClient(webView.page());
+
+ WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).get());
+ Util::run(&finished);
+
+ finished = false;
+ WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple-iframe", "html")).get());
+ Util::run(&finished);
+
+ finished = false;
+ WKPageGoBack(webView.page());
+ Util::run(&finished);
+
+ EXPECT_EQ(receivedProperBackForwardCallbacks, true);
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp
new file mode 100644
index 000000000..0f15c477c
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2012 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 "InjectedBundleTest.h"
+
+#include "PlatformUtilities.h"
+#include <WebKit2/WKBundlePage.h>
+#include <WebKit2/WKBundleBackForwardListItem.h>
+
+namespace TestWebKitAPI {
+
+class ShouldGoToBackForwardListItemTest : public InjectedBundleTest {
+public:
+ ShouldGoToBackForwardListItemTest(const std::string& identifier);
+
+ virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page);
+};
+
+static InjectedBundleTest::Register<ShouldGoToBackForwardListItemTest> registrar("ShouldGoToBackForwardListItemTest");
+
+static bool shouldGoToBackForwardListItemCallback(WKBundlePageRef, WKBundleBackForwardListItemRef item, WKTypeRef* userData, const void*)
+{
+ // The item should be in the page cache
+ if (WKBundleBackForwardListItemIsInPageCache(item))
+ *userData = WKStringCreateWithUTF8CString("shouldGoToBackForwardListItemCallback called as expected");
+
+ return true;
+}
+
+ShouldGoToBackForwardListItemTest::ShouldGoToBackForwardListItemTest(const std::string& identifier)
+ : InjectedBundleTest(identifier)
+{
+}
+
+void ShouldGoToBackForwardListItemTest::didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
+{
+ WKBundlePageLoaderClient pageLoaderClient;
+ memset(&pageLoaderClient, 0, sizeof(pageLoaderClient));
+
+ pageLoaderClient.version = 1;
+ pageLoaderClient.clientInfo = this;
+ pageLoaderClient.shouldGoToBackForwardListItem = shouldGoToBackForwardListItemCallback;
+
+ WKBundlePageSetPageLoaderClient(page, &pageLoaderClient);
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp
index 2a181ddea..5af01ebb4 100644
--- a/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp
@@ -57,6 +57,14 @@ TEST(WebKit2, WKPreferencesDefaults)
static const char* expectedCursiveFontFamily = "Apple Chancery";
static const char* expectedFantasyFontFamily = "Papyrus";
static const char* expectedPictographFontFamily = "Apple Color Emoji";
+#elif PLATFORM(GTK)
+ static const char* expectedStandardFontFamily = "Times";
+ static const char* expectedFixedFontFamily = "Courier New";
+ static const char* expectedSerifFontFamily = "Times";
+ static const char* expectedSansSerifFontFamily = "Helvetica";
+ static const char* expectedCursiveFontFamily = "Comic Sans MS";
+ static const char* expectedFantasyFontFamily = "Impact";
+ static const char* expectedPictographFontFamily = "Times";
#endif
WKPreferencesRef preference = WKPreferencesCreate();
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent.cpp
new file mode 100644
index 000000000..671c72943
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2012 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 didReceiveMessage;
+
+static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef body, const void*)
+{
+ didReceiveMessage = true;
+
+ EXPECT_WK_STREQ("DidReceiveWillSendSubmitEvent", messageName);
+
+ EXPECT_EQ(WKDictionaryGetTypeID(), WKGetTypeID(body));
+ WKDictionaryRef values = static_cast<WKDictionaryRef>(body);
+
+ WKStringRef textFieldValueWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(values, WKStringCreateWithUTF8CString("textField")));
+ EXPECT_WK_STREQ("text field", textFieldValueWK);
+
+ WKStringRef passwordFieldValueWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(values, WKStringCreateWithUTF8CString("passwordField")));
+ EXPECT_WK_STREQ("password field", passwordFieldValueWK);
+
+ // <input type="hidden"> fields are not sent.
+ WKStringRef hiddenFieldValueWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(values, WKStringCreateWithUTF8CString("hiddenField")));
+ EXPECT_NULL(hiddenFieldValueWK);
+}
+
+static void setInjectedBundleClient(WKContextRef context)
+{
+ WKContextInjectedBundleClient injectedBundleClient;
+ memset(&injectedBundleClient, 0, sizeof(injectedBundleClient));
+ injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle;
+
+ WKContextSetInjectedBundleClient(context, &injectedBundleClient);
+}
+
+TEST(WebKit2, WillSendSubmitEvent)
+{
+ WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("WillSendSubmitEventTest"));
+ setInjectedBundleClient(context.get());
+
+ PlatformWebView webView(context.get());
+ WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("auto-submitting-form", "html")).get());
+ Util::run(&didReceiveMessage);
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp
new file mode 100644
index 000000000..7bbbcaf10
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2012 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 "InjectedBundleTest.h"
+
+#include "PlatformUtilities.h"
+#include <WebKit2/WKBundlePage.h>
+
+namespace TestWebKitAPI {
+
+class WillSendSubmitEventTest : public InjectedBundleTest {
+public:
+ WillSendSubmitEventTest(const std::string& identifier);
+
+ virtual void didCreatePage(WKBundleRef, WKBundlePageRef);
+};
+
+static InjectedBundleTest::Register<WillSendSubmitEventTest> registrar("WillSendSubmitEventTest");
+
+static void willSendSubmitEvent(WKBundlePageRef, WKBundleNodeHandleRef, WKBundleFrameRef, WKBundleFrameRef, WKDictionaryRef values, const void*)
+{
+ WKBundlePostMessage(InjectedBundleController::shared().bundle(), Util::toWK("DidReceiveWillSendSubmitEvent").get(), values);
+}
+
+WillSendSubmitEventTest::WillSendSubmitEventTest(const std::string& identifier)
+ : InjectedBundleTest(identifier)
+{
+}
+
+void WillSendSubmitEventTest::didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
+{
+ WKBundlePageFormClient formClient;
+ memset(&formClient, 0, sizeof(formClient));
+
+ formClient.version = 1;
+ formClient.clientInfo = this;
+ formClient.willSendSubmitEvent = willSendSubmitEvent;
+
+ WKBundlePageSetFormClient(page, &formClient);
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/auto-submitting-form.html b/Tools/TestWebKitAPI/Tests/WebKit2/auto-submitting-form.html
new file mode 100644
index 000000000..9ed815e03
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/auto-submitting-form.html
@@ -0,0 +1,20 @@
+<html>
+ <head>
+ <script>
+ function submitFormIfNecessary()
+ {
+ if (window.location.search)
+ return;
+ document.forms[0].submit.click();
+ }
+ </script>
+ </head>
+ <body onload="submitFormIfNecessary()">
+ <form action="#" method="GET">
+ <input type="text" name="textField" value="text field">
+ <input type="password" name="passwordField" value="password field">
+ <input type="hidden" name="hiddenField" value="hidden field">
+ <input type="submit" name="submit">
+ </form>
+ </body>
+</html>
diff --git a/Tools/TestWebKitAPI/Tests/mac/Ahem.ttf b/Tools/TestWebKitAPI/Tests/mac/Ahem.ttf
new file mode 100644
index 000000000..ac81cb031
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/mac/Ahem.ttf
Binary files differ
diff --git a/Tools/TestWebKitAPI/Tests/mac/AttributedString.mm b/Tools/TestWebKitAPI/Tests/mac/AttributedString.mm
new file mode 100644
index 000000000..18cce9c2d
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/mac/AttributedString.mm
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2012 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 <wtf/RetainPtr.h>
+
+
+@interface AttributedStringTest : NSObject {
+}
+@end
+
+static bool didFinishLoad;
+
+@implementation AttributedStringTest
+
+- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+{
+ didFinishLoad = true;
+}
+@end
+
+namespace TestWebKitAPI {
+
+static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
+{
+ didFinishLoad = true;
+}
+
+TEST(WebKit1, AttributedStringTest)
+{
+ RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+ RetainPtr<AttributedStringTest> testController(AdoptNS, [AttributedStringTest new]);
+
+ webView.get().frameLoadDelegate = testController.get();
+ [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"attributedStringCustomFont" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+
+ Util::run(&didFinishLoad);
+ didFinishLoad = false;
+
+ NSAttributedString *attrString = [(NSView <NSTextInput> *)[[[webView.get() mainFrame] frameView] documentView] attributedSubstringFromRange:NSMakeRange(0, 5)];
+
+ EXPECT_WK_STREQ("Lorem", [attrString string]);
+}
+
+TEST(WebKit2, AttributedStringTest)
+{
+ WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
+ PlatformWebView webView(context.get());
+
+ WKPageLoaderClient loaderClient;
+ memset(&loaderClient, 0, sizeof(loaderClient));
+ loaderClient.version = 0;
+ loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+ WKPageSetPageLoaderClient(webView.page(), &loaderClient);
+
+ WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("attributedStringCustomFont", "html")).get());
+
+ Util::run(&didFinishLoad);
+ didFinishLoad = false;
+
+ NSRange range = NSMakeRange(0, 5);
+ NSRange actualRange;
+ NSAttributedString *attrString = [webView.platformView() attributedSubstringForProposedRange:range actualRange:&actualRange];
+
+ EXPECT_WK_STREQ("Lorem", [attrString string]);
+}
+
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.html b/Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.html
new file mode 100644
index 000000000..3147603ce
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.html
@@ -0,0 +1,4 @@
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+</head>
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href='http://www.webkit.org/'>Click me</a>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href='http://xn--ls8h.la/'>http://💩.la</a>.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \ No newline at end of file
diff --git a/Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm b/Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm
new file mode 100644
index 000000000..40ac377e1
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#import "config.h"
+#import "PlatformUtilities.h"
+#import "PlatformWebView.h"
+#import "WTFStringUtilities.h"
+
+#import <WebKit/WebViewPrivate.h>
+#import <WebKit/WebURLsWithTitles.h>
+#import <WebKit/DOM.h>
+#import <Carbon/Carbon.h>
+#import <wtf/RetainPtr.h>
+
+
+@interface ContextMenuCanCopyURLDelegate : NSObject {
+}
+@end
+
+static bool didFinishLoad;
+
+@implementation ContextMenuCanCopyURLDelegate
+
+- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+{
+ didFinishLoad = true;
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+static void contextMenuCopyLink(WebView* webView, int itemIndex)
+{
+ [[[[webView mainFrame] frameView] documentView] layout];
+
+ DOMDocument *document = [[webView mainFrame] DOMDocument];
+ DOMElement *documentElement = [document documentElement];
+ DOMHTMLAnchorElement *anchor = (DOMHTMLAnchorElement *)[[documentElement querySelectorAll:@"a"] item:itemIndex];
+
+ NSWindow *window = [webView window];
+ NSEvent *event = [NSEvent mouseEventWithType:NSRightMouseDown
+ location:NSMakePoint(anchor.offsetLeft + anchor.offsetWidth / 2, window.frame.size.height - (anchor.offsetTop + anchor.offsetHeight / 2))
+ modifierFlags:0
+ timestamp:GetCurrentEventTime()
+ windowNumber:[window windowNumber]
+ context:[NSGraphicsContext currentContext]
+ eventNumber:0
+ clickCount:0
+ pressure:0.0];
+
+ NSView *subView = [webView hitTest:[event locationInWindow]];
+ if (!subView)
+ return;
+
+ NSMenu* menu = [subView menuForEvent:event];
+ for (int i = 0; i < [menu numberOfItems]; ++i) {
+ NSMenuItem* menuItem = [menu itemAtIndex:i];
+ if ([menuItem tag] != WebMenuItemTagCopyLinkToClipboard)
+ continue;
+
+ [menu performActionForItemAtIndex:i];
+ }
+}
+
+
+TEST(WebKit1, ContextMenuCanCopyURL)
+{
+ RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0,0,800,600) frameName:nil groupName:nil]);
+ RetainPtr<NSWindow> window(AdoptNS, [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 800, 600) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+ RetainPtr<ContextMenuCanCopyURLDelegate> delegate(AdoptNS, [[ContextMenuCanCopyURLDelegate alloc] init]);
+
+ [window.get().contentView addSubview:webView.get()];
+ webView.get().frameLoadDelegate = delegate.get();
+
+ [webView.get().mainFrame loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"ContextMenuCanCopyURL" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+
+ Util::run(&didFinishLoad);
+
+ contextMenuCopyLink(webView.get(), 0);
+
+ NSURL *url = [NSURL URLFromPasteboard:[NSPasteboard generalPasteboard]];
+ EXPECT_EQ(String("http://www.webkit.org/"), String([url absoluteString]));
+
+ contextMenuCopyLink(webView.get(), 1);
+
+ NSArray * urls = [WebURLsWithTitles URLsFromPasteboard: [NSPasteboard generalPasteboard]];
+ NSArray * titles = [WebURLsWithTitles titlesFromPasteboard: [NSPasteboard generalPasteboard]];
+ EXPECT_WK_STREQ(@"http://xn--ls8h.la/", [[urls objectAtIndex:0] absoluteString]);
+ EXPECT_WK_STREQ(@"http://💩.la", [titles objectAtIndex:0]);
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/mac/MemoryCachePruneWithinResourceLoadDelegate.html b/Tools/TestWebKitAPI/Tests/mac/MemoryCachePruneWithinResourceLoadDelegate.html
new file mode 100644
index 000000000..7f4fd33b9
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/mac/MemoryCachePruneWithinResourceLoadDelegate.html
@@ -0,0 +1,14 @@
+<script>
+
+function loaded()
+{
+ var request = new XMLHttpRequest();
+ request.open('GET', 'http://www.iana.org/domains/example/', true);
+ request.send(null);
+}
+
+</script>
+
+<body onload="loaded();">
+We will do some XHR'ing now!
+</body> \ No newline at end of file
diff --git a/Tools/TestWebKitAPI/Tests/mac/MemoryCachePruneWithinResourceLoadDelegate.mm b/Tools/TestWebKitAPI/Tests/mac/MemoryCachePruneWithinResourceLoadDelegate.mm
new file mode 100644
index 000000000..b178abd63
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/mac/MemoryCachePruneWithinResourceLoadDelegate.mm
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#import "config.h"
+#import "PlatformUtilities.h"
+#import <wtf/RetainPtr.h>
+
+@interface MemoryCachePruneTestResourceLoadDelegate : NSObject {
+@public
+ NSWindow *_window;
+}
+@end
+
+static bool didFinishLoad;
+
+@implementation MemoryCachePruneTestResourceLoadDelegate
+
+- (id)webView:(WebView *)sender identifierForInitialRequest:(NSURLRequest *)request fromDataSource:(WebDataSource *)dataSource
+{
+ // We only care about an http request, which is our test XHR
+ if ([[[request URL] scheme] isEqualToString:@"http"])
+ return self;
+
+ return nil;
+}
+
+- (NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource
+{
+ if (identifier == nil)
+ return request;
+
+ [_window close];
+ return request;
+}
+
+- (void)webView:(WebView *)sender resource:(id)identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource
+{
+ if (identifier == nil)
+ return;
+
+ didFinishLoad = true;
+}
+
+- (void)webView:(WebView *)sender resource:(id)identifier didFailLoadingWithError:(NSError *)error fromDataSource:(WebDataSource *)dataSource
+{
+ if (identifier == nil)
+ return;
+
+ didFinishLoad = true;
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(WebKit1, MemoryCachePruneWithinResourceLoadDelegate)
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ RetainPtr<WebView> webView1(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+ RetainPtr<WebView> webView2(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+
+ NSWindow* window = [[NSWindow alloc] initWithContentRect:webView2.get().frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
+ [window.contentView addSubview:webView2.get()];
+
+ RetainPtr<MemoryCachePruneTestResourceLoadDelegate> resourceLoadDelegate(AdoptNS, [[MemoryCachePruneTestResourceLoadDelegate alloc] init]);
+ resourceLoadDelegate.get()->_window = window;
+ webView1.get().resourceLoadDelegate = resourceLoadDelegate.get();
+
+ [[webView1.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"MemoryCachePruneWithinResourceLoadDelegate" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+
+ Util::run(&didFinishLoad);
+
+ [pool drain];
+ // If we finished without crashing, the test passed.
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/mac/SimplifyMarkup.mm b/Tools/TestWebKitAPI/Tests/mac/SimplifyMarkup.mm
new file mode 100644
index 000000000..70ec47d57
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/mac/SimplifyMarkup.mm
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2012 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 <wtf/RetainPtr.h>
+
+#import <WebKit/DOM.h>
+#import <WebKit/WebViewPrivate.h>
+
+@interface SimplifyMarkupTest : NSObject {
+}
+@end
+
+static bool didFinishLoad;
+
+@implementation SimplifyMarkupTest
+
+- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+{
+ didFinishLoad = true;
+}
+@end
+
+namespace TestWebKitAPI {
+
+TEST(WebKit1, SimplifyMarkupTest)
+{
+ RetainPtr<WebView> webView1(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+ RetainPtr<WebView> webView2(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+ RetainPtr<SimplifyMarkupTest> testController(AdoptNS, [SimplifyMarkupTest new]);
+
+ webView1.get().frameLoadDelegate = testController.get();
+ [[webView1.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"verboseMarkup" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+
+ Util::run(&didFinishLoad);
+ didFinishLoad = false;
+
+ webView2.get().frameLoadDelegate = testController.get();
+ [[webView2.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"verboseMarkup" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+
+ Util::run(&didFinishLoad);
+ didFinishLoad = false;
+
+ DOMDocument *document1 = webView1.get().mainFrameDocument;
+ NSString* markupBefore = [[document1 body] innerHTML];
+ DOMDocument *document2 = webView2.get().mainFrameDocument;
+
+ // If start is after end, nothing is done
+ DOMNode *start = [document1 getElementById:@"test2"];
+ DOMNode *end = [document1 getElementById:@"test1"];
+
+ [webView1.get() _simplifyMarkup:[document1 body] endNode:end];
+ NSString* markupAfter = [[document1 body] innerHTML];
+
+ EXPECT_WK_STREQ(markupBefore, markupAfter);
+ EXPECT_EQ([markupBefore length], [markupAfter length]);
+
+ // If the two nodes are not in the same webView, nothing is done.
+ start = [document1 getElementById:@"test1"];
+ end = [document2 getElementById:@"test2"];
+ [webView1.get() _simplifyMarkup:start endNode:end];
+ markupAfter = [[document1 body] innerHTML];
+
+ EXPECT_WK_STREQ(markupBefore, markupAfter);
+ EXPECT_EQ([markupBefore length], [markupAfter length]);
+
+ // If the two nodes are not in the same document, nothing is done.
+ DOMHTMLFrameElement* frame = (DOMHTMLFrameElement *)[document1 getElementById:@"test3"];
+ end = [[frame contentDocument] firstChild];
+
+ [webView1.get() _simplifyMarkup:start endNode:end];
+ markupAfter = [[document1 body] innerHTML];
+
+ EXPECT_WK_STREQ(markupBefore, markupAfter);
+ EXPECT_EQ([markupBefore length], [markupAfter length]);
+
+ // If the nodes are in the same webView, same document and in the right order,
+ // we should have a simplified markup.
+ [webView1.get() _simplifyMarkup:[document1 body] endNode:nil];
+ markupAfter = [[document1 body] innerHTML];
+ // We only verify that the markup has changed and that it is less verbose
+ // then the original version.
+ // The accuracy of the operation is tested by the DRT tests already.
+ EXPECT_GT([markupBefore length], [markupAfter length]);
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/mac/WebViewCanPasteURL.mm b/Tools/TestWebKitAPI/Tests/mac/WebViewCanPasteURL.mm
new file mode 100644
index 000000000..d4bc83bf9
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/mac/WebViewCanPasteURL.mm
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#import "config.h"
+#import "PlatformUtilities.h"
+#import "WTFStringUtilities.h"
+
+#import <WebKit/WebViewPrivate.h>
+#import <WebKit/DOM.h>
+
+namespace TestWebKitAPI {
+
+TEST(WebKit1, WebViewCanPasteURL)
+{
+ WebView *webView = [[WebView alloc] initWithFrame:NSZeroRect frameName:nil groupName:nil];
+ [webView setEditable:YES];
+
+ [[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSURLPboardType] owner:nil];
+ [[NSURL URLWithString:@"http://www.webkit.org/"] writeToPasteboard:[NSPasteboard generalPasteboard]];
+ [webView paste:nil];
+
+ DOMDocument *document = [[webView mainFrame] DOMDocument];
+ DOMElement *documentElement = [document documentElement];
+ DOMHTMLAnchorElement *anchor = (DOMHTMLAnchorElement *)[documentElement querySelector:@"a"];
+ NSString *text = [anchor href];
+
+ EXPECT_EQ(String("http://www.webkit.org/"), String(text));
+
+ [webView release];
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/Tests/mac/attributedStringCustomFont.html b/Tools/TestWebKitAPI/Tests/mac/attributedStringCustomFont.html
new file mode 100644
index 000000000..1e6b90a82
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/mac/attributedStringCustomFont.html
@@ -0,0 +1,15 @@
+<html>
+ <head>
+ <style>
+ @font-face {
+ font-family: customFont;
+ src: url(Ahem.ttf);
+ }
+ </style>
+ </head>
+ <body contenteditable style="font-family: customFont; font-size: 48px;">Lorem Ipsum
+ <script>
+ document.body.focus();
+ </script>
+ </body>
+</html>
diff --git a/Tools/TestWebKitAPI/Tests/mac/verboseMarkup.html b/Tools/TestWebKitAPI/Tests/mac/verboseMarkup.html
new file mode 100644
index 000000000..c8a24487e
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/mac/verboseMarkup.html
@@ -0,0 +1,19 @@
+<html>
+ <body contenteditable="true">
+ <div>Hello</div>
+ <div id="test1"><b><i>Hello</i></b></div>
+ <div><b><i><span style="font-weight: normal"><b><i>Hello</i></b></span></i></b></div>
+ <div><div><div>Hello</div></div></div>
+ <div><b><div><i>Hello</i></div></b></div>
+ <div><div style="text-align: center;"><b>Hello</b></div></div>
+ <div id="test2"><b><i><span style="font-weight: normal"><b><i>hello</i></b></span></i></b></div><div><b><i><span style="font-weight: normal"><b><i>world</i></b></span></i></b></div>
+ <div><b><i><span style="font-weight: normal;"><b><i>hello1</i></b><b><i> hello2</i></b></span></i></b></div>
+ <div><i style="margin: 10px;"><b><i style="margin: 10px;">hello</i></b></i></div>
+ <div><b><i><span style="font-weight: normal"><b><i>Hello <!-- comment -->world</i></b></span></i></b></div>
+ <div><b><i><span style="font-weight: normal">plain text<b><i>bold italic text</i></b></span></i></b></div>
+ <iframe id="test3" src="data:text/html,
+ <div>This is another document.</div>
+ ">
+ </iframe>
+ </body>
+</html>
diff --git a/Tools/TestWebKitAPI/config.h b/Tools/TestWebKitAPI/config.h
index b26a5477d..4ffcb8bc4 100644
--- a/Tools/TestWebKitAPI/config.h
+++ b/Tools/TestWebKitAPI/config.h
@@ -29,7 +29,7 @@
#include <runtime/JSExportMacros.h>
#endif
-#if __APPLE__
+#if defined(__APPLE__) && __APPLE__
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
@@ -43,7 +43,7 @@
#include <stdint.h>
-#if !PLATFORM(CHROMIUM)
+#if !PLATFORM(CHROMIUM) || (PLATFORM(GTK) && defined(BUILDING_WEBKIT2__))
#include <WebKit2/WebKit2.h>
#endif
diff --git a/Tools/TestWebKitAPI/gtk/InjectedBundleControllerGtk.cpp b/Tools/TestWebKitAPI/gtk/InjectedBundleControllerGtk.cpp
new file mode 100644
index 000000000..5d55002cc
--- /dev/null
+++ b/Tools/TestWebKitAPI/gtk/InjectedBundleControllerGtk.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * 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 "InjectedBundleController.h"
+
+namespace TestWebKitAPI {
+
+void InjectedBundleController::platformInitialize()
+{
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/gtk/PlatformUtilitiesGtk.cpp b/Tools/TestWebKitAPI/gtk/PlatformUtilitiesGtk.cpp
new file mode 100644
index 000000000..6fd05f5f3
--- /dev/null
+++ b/Tools/TestWebKitAPI/gtk/PlatformUtilitiesGtk.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * 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 <gtk/gtk.h>
+#include <wtf/gobject/GOwnPtr.h>
+#include <wtf/gobject/GRefPtr.h>
+
+namespace TestWebKitAPI {
+namespace Util {
+
+static gboolean checkTestFinished(gpointer userData)
+{
+ bool* done = static_cast<bool*>(userData);
+
+ if (*done)
+ gtk_main_quit();
+
+ return !*done;
+}
+
+void run(bool* done)
+{
+ g_idle_add(checkTestFinished, done);
+ gtk_main();
+}
+
+void sleep(double seconds)
+{
+ g_usleep(seconds * 1000000);
+}
+
+static char* getFilenameFromEnvironmentVariableAsUTF8(const char* variableName)
+{
+ const char* value = g_getenv(variableName);
+ if (!value) {
+ g_printerr("%s environment variable not found\n", variableName);
+ exit(1);
+ }
+ gsize bytesWritten;
+ return g_filename_to_utf8(value, -1, 0, &bytesWritten, 0);
+}
+
+WKStringRef createInjectedBundlePath()
+{
+ GOwnPtr<char> injectedBundlePath(getFilenameFromEnvironmentVariableAsUTF8("TEST_WEBKIT_API_WEBKIT2_INJECTED_BUNDLE_PATH"));
+ GOwnPtr<char> injectedBundleFilename(g_build_filename(injectedBundlePath.get(), "libTestWebKitAPIInjectedBundle.la", NULL));
+ return WKStringCreateWithUTF8CString(injectedBundleFilename.get());
+}
+
+WKURLRef createURLForResource(const char* resource, const char* extension)
+{
+ GOwnPtr<char> testResourcesPath(getFilenameFromEnvironmentVariableAsUTF8("TEST_WEBKIT_API_WEBKIT2_RESOURCES_PATH"));
+ GOwnPtr<char> resourceBasename(g_strdup_printf("%s.%s", resource, extension));
+ GOwnPtr<char> resourceFilename(g_build_filename(testResourcesPath.get(), resourceBasename.get(), NULL));
+ GRefPtr<GFile> resourceFile = adoptGRef(g_file_new_for_path(resourceFilename.get()));
+ GOwnPtr<char> resourceURI(g_file_get_uri(resourceFile.get()));
+ return WKURLCreateWithUTF8CString(resourceURI.get());
+}
+
+WKURLRef URLForNonExistentResource()
+{
+ return WKURLCreateWithUTF8CString("file:///does-not-exist.html");
+}
+
+bool isKeyDown(WKNativeEventPtr event)
+{
+ return event->type == GDK_KEY_PRESS;
+}
+
+} // namespace Util
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp b/Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp
new file mode 100644
index 000000000..84d740776
--- /dev/null
+++ b/Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * 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 "PlatformWebView.h"
+
+#include <WebCore/GOwnPtrGtk.h>
+#include <gtk/gtk.h>
+#include <wtf/gobject/GOwnPtr.h>
+
+namespace TestWebKitAPI {
+
+PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+{
+ gtk_init(0, 0);
+ m_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ m_view = WKViewCreate(contextRef, pageGroupRef);
+ gtk_container_add(GTK_CONTAINER(m_window), GTK_WIDGET(m_view));
+ gtk_widget_show(GTK_WIDGET(m_view));
+ gtk_widget_show(m_window);
+}
+
+PlatformWebView::~PlatformWebView()
+{
+ gtk_widget_destroy(m_window);
+}
+
+WKPageRef PlatformWebView::page() const
+{
+ return WKViewGetPage(m_view);
+}
+
+void PlatformWebView::resizeTo(unsigned width, unsigned height)
+{
+ gtk_window_resize(GTK_WINDOW(m_window), width, height);
+}
+
+static void doKeyStroke(GtkWidget* viewWidget, unsigned int keyVal)
+{
+ GOwnPtr<GdkEvent> event(gdk_event_new(GDK_KEY_PRESS));
+ event->key.keyval = keyVal;
+ event->key.time = GDK_CURRENT_TIME;
+ event->key.state = 0;
+ event->key.window = gtk_widget_get_window(viewWidget);
+ g_object_ref(event->key.window);
+ gdk_event_set_device(event.get(), gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gtk_widget_get_display(viewWidget))));
+
+ // When synthesizing an event, an invalid hardware_keycode value can cause it to be badly processed by GTK+.
+ GOwnPtr<GdkKeymapKey> keys;
+ int keysCount;
+ if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), keyVal, &keys.outPtr(), &keysCount))
+ event->key.hardware_keycode = keys.get()[0].keycode;
+
+ gtk_main_do_event(event.get());
+ event->key.type = GDK_KEY_RELEASE;
+ gtk_main_do_event(event.get());
+}
+
+void PlatformWebView::simulateSpacebarKeyPress()
+{
+ GtkWidget* viewWidget = GTK_WIDGET(m_view);
+ if (!gtk_widget_get_realized(viewWidget))
+ gtk_widget_show(m_window);
+ doKeyStroke(viewWidget, GDK_KEY_KP_Space);
+}
+
+void PlatformWebView::simulateAltKeyPress()
+{
+ GtkWidget* viewWidget = GTK_WIDGET(m_view);
+ if (!gtk_widget_get_realized(viewWidget))
+ gtk_widget_show(m_window);
+ doKeyStroke(viewWidget, GDK_KEY_Alt_L);
+}
+
+static void doMouseButtonEvent(GtkWidget* viewWidget, GdkEventType eventType, int x, int y, unsigned int button)
+{
+ GOwnPtr<GdkEvent> event(gdk_event_new(eventType));
+ event->button.x = x;
+ event->button.y = y;
+ event->button.button = button;
+ event->button.time = GDK_CURRENT_TIME;
+ event->button.axes = 0;
+ event->button.state = 0;
+ event->button.window = gtk_widget_get_window(viewWidget);
+ g_object_ref(event->button.window);
+ event->button.device = gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gtk_widget_get_display(viewWidget)));
+
+ int xRoot, yRoot;
+ gdk_window_get_root_coords(gtk_widget_get_window(viewWidget), x, y, &xRoot, &yRoot);
+ event->button.x_root = xRoot;
+ event->button.y_root = yRoot;
+ gtk_main_do_event(event.get());
+}
+
+void PlatformWebView::simulateRightClick(unsigned x, unsigned y)
+{
+ GtkWidget* viewWidget = GTK_WIDGET(m_view);
+ if (!gtk_widget_get_realized(viewWidget))
+ gtk_widget_show(m_window);
+ doMouseButtonEvent(viewWidget, GDK_BUTTON_PRESS, x, y, 3);
+ doMouseButtonEvent(viewWidget, GDK_BUTTON_RELEASE, x, y, 3);
+}
+
+void PlatformWebView::simulateMouseMove(unsigned x, unsigned y)
+{
+ GOwnPtr<GdkEvent> event(gdk_event_new(GDK_MOTION_NOTIFY));
+ event->motion.x = x;
+ event->motion.y = y;
+ event->motion.time = GDK_CURRENT_TIME;
+ event->motion.state = 0;
+ event->motion.axes = 0;
+
+ GtkWidget* viewWidget = GTK_WIDGET(m_view);
+ if (!gtk_widget_get_realized(viewWidget))
+ gtk_widget_show(m_window);
+ event->motion.window = gtk_widget_get_window(viewWidget);
+ g_object_ref(event->motion.window);
+ event->motion.device = gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gtk_widget_get_display(viewWidget)));
+
+ int xRoot, yRoot;
+ gdk_window_get_root_coords(gtk_widget_get_window(viewWidget), x, y, &xRoot, &yRoot);
+ event->motion.x_root = xRoot;
+ event->motion.y_root = yRoot;
+ gtk_main_do_event(event.get());
+}
+
+} // namespace TestWebKitAPI
diff --git a/Tools/TestWebKitAPI/gtk/main.cpp b/Tools/TestWebKitAPI/gtk/main.cpp
new file mode 100644
index 000000000..56099ccc9
--- /dev/null
+++ b/Tools/TestWebKitAPI/gtk/main.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * 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 "TestsController.h"
+
+#include <glib-object.h>
+
+int main(int argc, char** argv)
+{
+ g_type_init();
+
+ return TestWebKitAPI::TestsController::shared().run(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm b/Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm
index f98dbb580..65891ce81 100644
--- a/Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm
+++ b/Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "InjectedBundleController.h"
#import <Foundation/Foundation.h>
@@ -39,7 +40,11 @@ void InjectedBundleController::platformInitialize()
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInteger:4], @"AppleAntiAliasingThreshold",
[NSNumber numberWithInteger:0], @"AppleFontSmoothing",
+#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+ [NSNumber numberWithBool:NO], @"NSScrollAnimationEnabled",
+#else
[NSNumber numberWithBool:NO], @"AppleScrollAnimationEnabled",
+#endif
[NSNumber numberWithBool:NO], @"NSOverlayScrollersEnabled",
@"Always", @"AppleShowScrollBars",
nil];