From 4576aa36e9a9671459299c7963ac95aa94beaea9 Mon Sep 17 00:00:00 2001 From: "Shimeng (Simon) Wang" Date: Tue, 7 Dec 2010 17:22:45 -0800 Subject: Merge WebKit at r73109: Initial merge by git. Change-Id: I61f1a66d9642e3d8405d3ac6ccab2a53421c75d8 --- .../Configurations/TestWebKitAPICFLite.vsprops | 22 +- .../Configurations/TestWebKitAPICommon.vsprops | 42 +- .../TestWebKitAPICoreFoundation.vsprops | 22 +- .../TestWebKitAPI/InjectedBundleController.cpp | 22 +- .../TestWebKitAPI/InjectedBundleController.h | 9 +- WebKitTools/TestWebKitAPI/InjectedBundleTest.h | 3 +- WebKitTools/TestWebKitAPI/PlatformUtilities.cpp | 12 +- WebKitTools/TestWebKitAPI/PlatformUtilities.h | 2 +- WebKitTools/TestWebKitAPI/PlatformWebView.h | 2 +- .../TestWebKitAPI.xcodeproj/project.pbxproj | 14 +- .../WebKit2/DocumentStartUserScriptAlertCrash.cpp | 6 +- .../DocumentStartUserScriptAlertCrash_Bundle.cpp | 14 +- .../TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp | 98 ++ .../TestWebKitAPI/mac/PlatformWebViewMac.mm | 4 +- .../TestWebKitAPI/win/PlatformUtilitiesWin.cpp | 2 +- .../TestWebKitAPI/win/PlatformWebViewWin.cpp | 4 +- WebKitTools/TestWebKitAPI/win/TestWebKitAPI.sln | 108 +- WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj | 1112 ++++++++++---------- .../win/TestWebKitAPIGenerated.vcproj | 129 ++- .../win/TestWebKitAPIGeneratedCommon.vsprops | 13 + .../TestWebKitAPI/win/TestWebKitAPIPostBuild.cmd | 1 + .../TestWebKitAPI/win/TestWebKitAPIPreBuild.cmd | 6 + 22 files changed, 885 insertions(+), 762 deletions(-) create mode 100644 WebKitTools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp create mode 100644 WebKitTools/TestWebKitAPI/win/TestWebKitAPIGeneratedCommon.vsprops create mode 100644 WebKitTools/TestWebKitAPI/win/TestWebKitAPIPostBuild.cmd create mode 100644 WebKitTools/TestWebKitAPI/win/TestWebKitAPIPreBuild.cmd (limited to 'WebKitTools/TestWebKitAPI') diff --git a/WebKitTools/TestWebKitAPI/Configurations/TestWebKitAPICFLite.vsprops b/WebKitTools/TestWebKitAPI/Configurations/TestWebKitAPICFLite.vsprops index 61b6614..cfbcfad 100644 --- a/WebKitTools/TestWebKitAPI/Configurations/TestWebKitAPICFLite.vsprops +++ b/WebKitTools/TestWebKitAPI/Configurations/TestWebKitAPICFLite.vsprops @@ -1,11 +1,11 @@ - - - - + + + + diff --git a/WebKitTools/TestWebKitAPI/Configurations/TestWebKitAPICommon.vsprops b/WebKitTools/TestWebKitAPI/Configurations/TestWebKitAPICommon.vsprops index 1de3506..43927f2 100644 --- a/WebKitTools/TestWebKitAPI/Configurations/TestWebKitAPICommon.vsprops +++ b/WebKitTools/TestWebKitAPI/Configurations/TestWebKitAPICommon.vsprops @@ -1,25 +1,17 @@ - - - - - - - + + + + + diff --git a/WebKitTools/TestWebKitAPI/Configurations/TestWebKitAPICoreFoundation.vsprops b/WebKitTools/TestWebKitAPI/Configurations/TestWebKitAPICoreFoundation.vsprops index ee139c0..1260b1a 100644 --- a/WebKitTools/TestWebKitAPI/Configurations/TestWebKitAPICoreFoundation.vsprops +++ b/WebKitTools/TestWebKitAPI/Configurations/TestWebKitAPICoreFoundation.vsprops @@ -1,11 +1,11 @@ - - - - + + + + diff --git a/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp b/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp index 5942ec8..e438afd 100644 --- a/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp +++ b/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp @@ -54,15 +54,20 @@ void InjectedBundleController::initialize(WKBundleRef bundle, WKTypeRef initiali this, didCreatePage, willDestroyPage, + didInitializePageGroup, didReceiveMessage }; WKBundleSetClient(m_bundle, &client); // Initialize the test from the "initializationUserData". - assert(WKGetTypeID(initializationUserData) == WKStringGetTypeID()); - WKStringRef testName = static_cast(initializationUserData); - initializeTestNamed(bundle, Util::toSTD(testName)); + assert(WKGetTypeID(initializationUserData) == WKDictionaryGetTypeID()); + WKDictionaryRef initializationDictionary = static_cast(initializationUserData); + + WKStringRef testName = static_cast(WKDictionaryGetItemForKey(initializationDictionary, WKStringCreateWithUTF8CString("TestName"))); + WKTypeRef userData = WKDictionaryGetItemForKey(initializationDictionary, WKStringCreateWithUTF8CString("UserData")); + + initializeTestNamed(bundle, Util::toSTD(testName), userData); } void InjectedBundleController::didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo) @@ -79,6 +84,13 @@ void InjectedBundleController::willDestroyPage(WKBundleRef bundle, WKBundlePageR self->m_currentTest->willDestroyPage(bundle, page); } +void InjectedBundleController::didInitializePageGroup(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, const void* clientInfo) +{ + InjectedBundleController* self = static_cast(const_cast(clientInfo)); + assert(self->m_currentTest); + self->m_currentTest->didInitializePageGroup(bundle, pageGroup); +} + void InjectedBundleController::didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo) { InjectedBundleController* self = static_cast(const_cast(clientInfo)); @@ -94,7 +106,7 @@ void InjectedBundleController::dumpTestNames() printf("%s\n", (*it).first.c_str()); } -void InjectedBundleController::initializeTestNamed(WKBundleRef bundle, const std::string& identifier) +void InjectedBundleController::initializeTestNamed(WKBundleRef bundle, const std::string& identifier, WKTypeRef userData) { CreateInjectedBundleTestFunction createTestFunction = m_createInjectedBundleTestFunctions[identifier]; if (!createTestFunction) { @@ -103,7 +115,7 @@ void InjectedBundleController::initializeTestNamed(WKBundleRef bundle, const std } m_currentTest = createTestFunction(identifier); - m_currentTest->initialize(bundle); + m_currentTest->initialize(bundle, userData); } void InjectedBundleController::registerCreateInjectedBundleTestFunction(const std::string& identifier, CreateInjectedBundleTestFunction function) diff --git a/WebKitTools/TestWebKitAPI/InjectedBundleController.h b/WebKitTools/TestWebKitAPI/InjectedBundleController.h index 91c571e..b84be4b 100644 --- a/WebKitTools/TestWebKitAPI/InjectedBundleController.h +++ b/WebKitTools/TestWebKitAPI/InjectedBundleController.h @@ -41,7 +41,7 @@ public: void initialize(WKBundleRef, WKTypeRef); void dumpTestNames(); - void initializeTestNamed(WKBundleRef bundle, const std::string&); + void initializeTestNamed(WKBundleRef bundle, const std::string&, WKTypeRef userData); typedef InjectedBundleTest* (*CreateInjectedBundleTestFunction)(const std::string&); void registerCreateInjectedBundleTestFunction(const std::string&, CreateInjectedBundleTestFunction); @@ -50,9 +50,10 @@ private: InjectedBundleController(); ~InjectedBundleController(); - static void didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo); - static void willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo); - static void didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo); + static void didCreatePage(WKBundleRef, WKBundlePageRef, const void* clientInfo); + static void willDestroyPage(WKBundleRef, WKBundlePageRef, const void* clientInfo); + static void didInitializePageGroup(WKBundleRef, WKBundlePageGroupRef, const void* clientInfo); + static void didReceiveMessage(WKBundleRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo); std::map m_createInjectedBundleTestFunctions; WKBundleRef m_bundle; diff --git a/WebKitTools/TestWebKitAPI/InjectedBundleTest.h b/WebKitTools/TestWebKitAPI/InjectedBundleTest.h index b0224f2..5285cdf 100644 --- a/WebKitTools/TestWebKitAPI/InjectedBundleTest.h +++ b/WebKitTools/TestWebKitAPI/InjectedBundleTest.h @@ -34,10 +34,11 @@ class InjectedBundleTest { public: virtual ~InjectedBundleTest() { } - virtual void initialize(WKBundleRef) { } + virtual void initialize(WKBundleRef, WKTypeRef) { } virtual void didCreatePage(WKBundleRef, WKBundlePageRef) { } virtual void willDestroyPage(WKBundleRef, WKBundlePageRef) { } + virtual void didInitializePageGroup(WKBundleRef, WKBundlePageGroupRef) { } virtual void didReceiveMessage(WKBundleRef, WKStringRef messageName, WKTypeRef messageBody) { } std::string name() const { return m_identifier; } diff --git a/WebKitTools/TestWebKitAPI/PlatformUtilities.cpp b/WebKitTools/TestWebKitAPI/PlatformUtilities.cpp index 281fb13..23678a0 100644 --- a/WebKitTools/TestWebKitAPI/PlatformUtilities.cpp +++ b/WebKitTools/TestWebKitAPI/PlatformUtilities.cpp @@ -33,13 +33,21 @@ namespace TestWebKitAPI { namespace Util { -WKContextRef createContextForInjectedBundleTest(const std::string& testName) +WKContextRef createContextForInjectedBundleTest(const std::string& testName, WKTypeRef userData) { WKRetainPtr injectedBundlePath(AdoptWK, createInjectedBundlePath()); WKContextRef context = WKContextCreateWithInjectedBundlePath(injectedBundlePath.get()); + WKRetainPtr initializationDictionary(AdoptWK, WKMutableDictionaryCreate()); + + WKRetainPtr testNameKey(AdoptWK, WKStringCreateWithUTF8CString("TestName")); WKRetainPtr testNameString(AdoptWK, WKStringCreateWithUTF8CString(testName.c_str())); - WKContextSetInitializationUserDataForInjectedBundle(context, testNameString.get()); + WKDictionaryAddItem(initializationDictionary.get(), testNameKey.get(), testNameString.get()); + + WKRetainPtr userDataKey(AdoptWK, WKStringCreateWithUTF8CString("UserData")); + WKDictionaryAddItem(initializationDictionary.get(), userDataKey.get(), userData); + + WKContextSetInitializationUserDataForInjectedBundle(context, initializationDictionary.get()); return context; } diff --git a/WebKitTools/TestWebKitAPI/PlatformUtilities.h b/WebKitTools/TestWebKitAPI/PlatformUtilities.h index 8ae347c..0e67dfd 100644 --- a/WebKitTools/TestWebKitAPI/PlatformUtilities.h +++ b/WebKitTools/TestWebKitAPI/PlatformUtilities.h @@ -35,7 +35,7 @@ namespace Util { // Runs a platform runloop until the 'done' is true. void run(bool* done); -WKContextRef createContextForInjectedBundleTest(const std::string&); +WKContextRef createContextForInjectedBundleTest(const std::string&, WKTypeRef userData = 0); WKStringRef createInjectedBundlePath(); WKURLRef createURLForResource(const char* resource, const char* extension); diff --git a/WebKitTools/TestWebKitAPI/PlatformWebView.h b/WebKitTools/TestWebKitAPI/PlatformWebView.h index 7f4f057..349d855 100644 --- a/WebKitTools/TestWebKitAPI/PlatformWebView.h +++ b/WebKitTools/TestWebKitAPI/PlatformWebView.h @@ -51,7 +51,7 @@ class WindowMessageObserver; class PlatformWebView { public: - PlatformWebView(WKPageNamespaceRef); + PlatformWebView(WKPageNamespaceRef, WKPageGroupRef = 0); ~PlatformWebView(); WKPageRef page(); diff --git a/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj index ef55b28..69ce4dc 100644 --- a/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj +++ b/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj @@ -24,6 +24,7 @@ BC575BC0126F5752006F0F12 /* PlatformUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575BBF126F5752006F0F12 /* PlatformUtilities.cpp */; }; BC575BD9126F58E2006F0F12 /* PlatformUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575BBF126F5752006F0F12 /* PlatformUtilities.cpp */; }; BC575BE0126F590D006F0F12 /* PlatformUtilitiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */; }; + BC7B61AA129A038700D174A4 /* WKPreferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */; }; BC90955D125548AA00083756 /* PlatformWebViewMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC90955C125548AA00083756 /* PlatformWebViewMac.mm */; }; BC90964C125561BF00083756 /* VectorBasic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC90964B125561BF00083756 /* VectorBasic.cpp */; }; BC90964E1255620C00083756 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC90964D1255620C00083756 /* JavaScriptCore.framework */; }; @@ -101,6 +102,7 @@ BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleBasic_Bundle.cpp; sourceTree = ""; }; BC575AE2126E88B1006F0F12 /* InjectedBundle.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = InjectedBundle.xcconfig; sourceTree = ""; }; BC575BBF126F5752006F0F12 /* PlatformUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformUtilities.cpp; sourceTree = ""; }; + BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPreferences.cpp; sourceTree = ""; }; BC90951B125533D700083756 /* PlatformWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformWebView.h; sourceTree = ""; }; BC90955C125548AA00083756 /* PlatformWebViewMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformWebViewMac.mm; sourceTree = ""; }; BC90957E12554CF900083756 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = ""; }; @@ -227,20 +229,21 @@ isa = PBXGroup; children = ( BC90977B125571AE00083756 /* Resources */, + BCB6803F126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp */, + BCB68041126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp */, 1A5FEFDC1270E2A3000E2921 /* EvaluateJavaScript.cpp */, + BCC8B95A12611F4700DE46A4 /* FailedLoad.cpp */, 1A02C84E125D4A8400E3F4BD /* Find.cpp */, BCBD370F125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp */, BCBD3760125ABCFE00D2C29F /* FrameMIMETypePNG.cpp */, + BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */, + BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */, BC909779125571AB00083756 /* PageLoadBasic.cpp */, 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */, C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */, + BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */, BC90995D12567BC100083756 /* WKString.cpp */, BC9099931256ACF100083756 /* WKStringJSString.cpp */, - BCC8B95A12611F4700DE46A4 /* FailedLoad.cpp */, - BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */, - BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */, - BCB6803F126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp */, - BCB68041126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp */, ); path = WebKit2; sourceTree = ""; @@ -381,6 +384,7 @@ BCB68040126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp in Sources */, 1A5FEFDD1270E2A3000E2921 /* EvaluateJavaScript.cpp in Sources */, 333B9CE21277F23100FEFCE3 /* PreventEmptyUserAgent.cpp in Sources */, + BC7B61AA129A038700D174A4 /* WKPreferences.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp index 5e0655e..b935b6f 100644 --- a/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp +++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp @@ -45,9 +45,11 @@ static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef TEST(WebKit2, DocumentStartUserScriptAlertCrashTest) { - WKRetainPtr context(AdoptWK, Util::createContextForInjectedBundleTest("DocumentStartUserScriptAlertCrashTest")); + WKRetainPtr pageGroup(AdoptWK, WKPageGroupCreateWithIdentifier(WKStringCreateWithUTF8CString("DocumentStartUserScriptAlertCrashTestPageGroup"))); + + WKRetainPtr context(AdoptWK, Util::createContextForInjectedBundleTest("DocumentStartUserScriptAlertCrashTest", pageGroup.get())); WKRetainPtr pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get())); - PlatformWebView webView(pageNamespace.get()); + PlatformWebView webView(pageNamespace.get(), pageGroup.get()); WKPageUIClient uiClient; memset(&uiClient, 0, sizeof(uiClient)); diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp index a96bef2..dbd5d21 100644 --- a/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp +++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp @@ -24,10 +24,12 @@ */ #include "InjectedBundleTest.h" -#include +#include #include #include #include +#include +#include namespace TestWebKitAPI { @@ -38,11 +40,17 @@ public: { } - virtual void initialize(WKBundleRef bundle) + virtual void initialize(WKBundleRef bundle, WKTypeRef userData) { + assert(WKGetTypeID(userData) == WKBundlePageGroupGetTypeID()); + WKBundlePageGroupRef pageGroup = static_cast(userData); + WKRetainPtr source(AdoptWK, WKStringCreateWithUTF8CString("alert('an alert');")); - WKBundleAddUserScript(bundle, WKBundleScriptWorldNormalWorld(), source.get(), 0, 0, 0, kWKInjectAtDocumentStart, kWKInjectInAllFrames); + WKBundleAddUserScript(bundle, pageGroup, WKBundleScriptWorldNormalWorld(), source.get(), 0, 0, 0, kWKInjectAtDocumentStart, kWKInjectInAllFrames); } + +private: + WKBundlePageGroupRef m_pageGroup; }; static InjectedBundleTest::Register registrar("DocumentStartUserScriptAlertCrashTest"); diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp new file mode 100644 index 0000000..d4cd4b7 --- /dev/null +++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Test.h" + +#include +#include +#include +#include +#include + +namespace TestWebKitAPI { + +TEST(WebKit2, WKPreferencesBasic) +{ + WKPreferencesRef preference = WKPreferencesCreate(); + + TEST_ASSERT(WKGetTypeID(preference) == WKPreferencesGetTypeID()); + + WKRelease(preference); +} + +TEST(WebKit2, WKPreferencesDefaults) +{ +#if PLATFORM(WIN) + static const char* expectedStandardFontFamily = "Times New Roman"; + static const char* expectedFixedFontFamily = "Courier New"; + static const char* expectedSerifFontFamily = "Times New Roman"; + static const char* expectedSansSerifFontFamily = "Arial"; + static const char* expectedCursiveFontFamily = "Comic Sans MS"; + static const char* expectedFantasyFontFamily = "Comic Sans MS"; +#elif PLATFORM(MAC) + static const char* expectedStandardFontFamily = "Times"; + static const char* expectedFixedFontFamily = "Courier"; + static const char* expectedSerifFontFamily = "Times"; + static const char* expectedSansSerifFontFamily = "Helvetica"; + static const char* expectedCursiveFontFamily = "Apple Chancery"; + static const char* expectedFantasyFontFamily = "Papyrus"; +#endif + + WKPreferencesRef preference = WKPreferencesCreate(); + + TEST_ASSERT(WKPreferencesGetJavaScriptEnabled(preference) == true); + TEST_ASSERT(WKPreferencesGetLoadsImagesAutomatically(preference) == true); + TEST_ASSERT(WKPreferencesGetOfflineWebApplicationCacheEnabled(preference) == false); + TEST_ASSERT(WKPreferencesGetLocalStorageEnabled(preference) == true); + TEST_ASSERT(WKPreferencesGetXSSAuditorEnabled(preference) == true); + TEST_ASSERT(WKPreferencesGetFrameFlatteningEnabled(preference) == false); + TEST_ASSERT(WKPreferencesGetPluginsEnabled(preference) == true); + TEST_ASSERT(WKPreferencesGetJavaEnabled(preference) == true); + WKRetainPtr standardFontFamily(AdoptWK, WKPreferencesCopyStandardFontFamily(preference)); + TEST_ASSERT(WKStringIsEqualToUTF8CString(standardFontFamily.get(), expectedStandardFontFamily)); + WKRetainPtr fixedFontFamily(AdoptWK, WKPreferencesCopyFixedFontFamily(preference)); + TEST_ASSERT(WKStringIsEqualToUTF8CString(fixedFontFamily.get(), expectedFixedFontFamily)); + WKRetainPtr serifFontFamily(AdoptWK, WKPreferencesCopySerifFontFamily(preference)); + TEST_ASSERT(WKStringIsEqualToUTF8CString(serifFontFamily.get(), expectedSerifFontFamily)); + WKRetainPtr sansSerifFontFamily(AdoptWK, WKPreferencesCopySansSerifFontFamily(preference)); + TEST_ASSERT(WKStringIsEqualToUTF8CString(sansSerifFontFamily.get(), expectedSansSerifFontFamily)); + WKRetainPtr cursiveFontFamily(AdoptWK, WKPreferencesCopyCursiveFontFamily(preference)); + TEST_ASSERT(WKStringIsEqualToUTF8CString(cursiveFontFamily.get(), expectedCursiveFontFamily)); + WKRetainPtr fantasyFontFamily(AdoptWK, WKPreferencesCopyFantasyFontFamily(preference)); + TEST_ASSERT(WKStringIsEqualToUTF8CString(fantasyFontFamily.get(), expectedFantasyFontFamily)); + TEST_ASSERT(WKPreferencesGetMinimumFontSize(preference) == 0); + TEST_ASSERT(WKPreferencesGetPrivateBrowsingEnabled(preference) == false); + TEST_ASSERT(WKPreferencesGetDeveloperExtrasEnabled(preference) == false); + TEST_ASSERT(WKPreferencesGetTextAreasAreResizable(preference) == true); + TEST_ASSERT(WKPreferencesGetFontSmoothingLevel(preference) == kWKFontSmoothingLevelMedium); + TEST_ASSERT(WKPreferencesGetAcceleratedCompositingEnabled(preference) == true); + TEST_ASSERT(WKPreferencesGetCompositingBordersVisible(preference) == false); + TEST_ASSERT(WKPreferencesGetCompositingRepaintCountersVisible(preference) == false); + TEST_ASSERT(WKPreferencesGetNeedsSiteSpecificQuirks(preference) == false); + + WKRelease(preference); +} + +} // namespace TestWebKitAPI diff --git a/WebKitTools/TestWebKitAPI/mac/PlatformWebViewMac.mm b/WebKitTools/TestWebKitAPI/mac/PlatformWebViewMac.mm index d4c31eb..e06e2e6 100644 --- a/WebKitTools/TestWebKitAPI/mac/PlatformWebViewMac.mm +++ b/WebKitTools/TestWebKitAPI/mac/PlatformWebViewMac.mm @@ -29,10 +29,10 @@ namespace TestWebKitAPI { -PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef) +PlatformWebView::PlatformWebView(WKPageNamespaceRef pageNamespaceRef, WKPageGroupRef pageGroupRef) { NSRect rect = NSMakeRect(0, 0, 800, 600); - m_view = [[WKView alloc] initWithFrame:rect pageNamespaceRef:namespaceRef]; + m_view = [[WKView alloc] initWithFrame:rect pageNamespaceRef:pageNamespaceRef pageGroupRef:pageGroupRef]; NSRect windowRect = NSOffsetRect(rect, -10000, [[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000); m_window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]; diff --git a/WebKitTools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp b/WebKitTools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp index 17d8dad..6efc9ea 100644 --- a/WebKitTools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp +++ b/WebKitTools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp @@ -32,7 +32,7 @@ namespace TestWebKitAPI { namespace Util { -#if !defined(NDEBUG) && (!defined(DEBUG_INTERNAL) || defined(DEBUG_ALL)) +#ifdef DEBUG_ALL const char* injectedBundleDLL = "\\InjectedBundle_debug.dll"; #else const char* injectedBundleDLL = "\\InjectedBundle.dll"; diff --git a/WebKitTools/TestWebKitAPI/win/PlatformWebViewWin.cpp b/WebKitTools/TestWebKitAPI/win/PlatformWebViewWin.cpp index 65bdbc6..0a4060c 100644 --- a/WebKitTools/TestWebKitAPI/win/PlatformWebViewWin.cpp +++ b/WebKitTools/TestWebKitAPI/win/PlatformWebViewWin.cpp @@ -56,14 +56,14 @@ void PlatformWebView::registerWindowClass() ::RegisterClassExW(&wndClass); } -PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef) +PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef, WKPageGroupRef pageGroupRef) : m_parentWindowMessageObserver(0) { registerWindowClass(); RECT viewRect = {0, 0, 800, 600}; m_window = CreateWindowExW(0, hostWindowClassName, L"TestWebKitAPI", WS_OVERLAPPEDWINDOW, viewRect.left, viewRect.top, viewRect.right, viewRect.bottom, 0, 0, 0, this); - m_view = WKViewCreate(viewRect, namespaceRef, m_window); + m_view = WKViewCreate(viewRect, namespaceRef, pageGroupRef, m_window); } PlatformWebView::~PlatformWebView() diff --git a/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.sln b/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.sln index e323372..5354271 100644 --- a/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.sln +++ b/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.sln @@ -1,54 +1,54 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestWebKitAPI", "TestWebKitAPI.vcproj", "{3E48AB23-D249-488F-A1C4-43CDF52FBD28}" - ProjectSection(ProjectDependencies) = postProject - {45C45411-7F0E-404D-919A-4EE9BB60BE86} = {45C45411-7F0E-404D-919A-4EE9BB60BE86} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestWebKitAPIGenerated", "TestWebKitAPIGenerated.vcproj", "{45C45411-7F0E-404D-919A-4EE9BB60BE86}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - all|Win32 = all|Win32 - Debug_All|Win32 = Debug_All|Win32 - Debug_CFLite|Win32 = Debug_CFLite|Win32 - Debug_Internal|Win32 = Debug_Internal|Win32 - Debug|Win32 = Debug|Win32 - Release_CFLite|Win32 = Release_CFLite|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.all|Win32.ActiveCfg = Release_CFLite|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.all|Win32.Build.0 = Release_CFLite|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug_All|Win32.ActiveCfg = Debug_All|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug_All|Win32.Build.0 = Debug_All|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug_CFLite|Win32.ActiveCfg = Debug_CFLite|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug_CFLite|Win32.Build.0 = Debug_CFLite|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug|Win32.ActiveCfg = Debug|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug|Win32.Build.0 = Debug|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Release_CFLite|Win32.ActiveCfg = Release_CFLite|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Release_CFLite|Win32.Build.0 = Release_CFLite|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Release|Win32.ActiveCfg = Release|Win32 - {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Release|Win32.Build.0 = Release|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.all|Win32.ActiveCfg = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.all|Win32.Build.0 = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug_All|Win32.ActiveCfg = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug_All|Win32.Build.0 = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug_CFLite|Win32.ActiveCfg = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug_CFLite|Win32.Build.0 = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug_Internal|Win32.ActiveCfg = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug_Internal|Win32.Build.0 = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug|Win32.ActiveCfg = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug|Win32.Build.0 = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Release_CFLite|Win32.ActiveCfg = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Release_CFLite|Win32.Build.0 = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Release|Win32.ActiveCfg = all|Win32 - {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Release|Win32.Build.0 = all|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestWebKitAPI", "TestWebKitAPI.vcproj", "{3E48AB23-D249-488F-A1C4-43CDF52FBD28}" + ProjectSection(ProjectDependencies) = postProject + {45C45411-7F0E-404D-919A-4EE9BB60BE86} = {45C45411-7F0E-404D-919A-4EE9BB60BE86} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestWebKitAPIGenerated", "TestWebKitAPIGenerated.vcproj", "{45C45411-7F0E-404D-919A-4EE9BB60BE86}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + all|Win32 = all|Win32 + Debug_All|Win32 = Debug_All|Win32 + Debug_Cairo_CFLite|Win32 = Debug_Cairo_CFLite|Win32 + Debug|Win32 = Debug|Win32 + Release_Cairo_CFLite|Win32 = Release_Cairo_CFLite|Win32 + Release_LTCG|Win32 = Release_LTCG|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.all|Win32.ActiveCfg = Release_Cairo_CFLite|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.all|Win32.Build.0 = Release_Cairo_CFLite|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug_All|Win32.ActiveCfg = Debug_All|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug_All|Win32.Build.0 = Debug_All|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug_Cairo_CFLite|Win32.ActiveCfg = Debug_Cairo_CFLite|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug_Cairo_CFLite|Win32.Build.0 = Debug_Cairo_CFLite|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug|Win32.ActiveCfg = Debug|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Debug|Win32.Build.0 = Debug|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Release_Cairo_CFLite|Win32.ActiveCfg = Release_Cairo_CFLite|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Release_Cairo_CFLite|Win32.Build.0 = Release_Cairo_CFLite|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Release|Win32.ActiveCfg = Release|Win32 + {3E48AB23-D249-488F-A1C4-43CDF52FBD28}.Release|Win32.Build.0 = Release|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.all|Win32.ActiveCfg = Debug_Cairo_CFLite|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.all|Win32.Build.0 = Debug_Cairo_CFLite|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug_All|Win32.ActiveCfg = Debug_All|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug_All|Win32.Build.0 = Debug_All|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug_Cairo_CFLite|Win32.ActiveCfg = Debug_Cairo_CFLite|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug_Cairo_CFLite|Win32.Build.0 = Debug_Cairo_CFLite|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug|Win32.ActiveCfg = Debug|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Debug|Win32.Build.0 = Debug|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Release_Cairo_CFLite|Win32.ActiveCfg = Release_Cairo_CFLite|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Release_Cairo_CFLite|Win32.Build.0 = Release_Cairo_CFLite|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Release|Win32.ActiveCfg = Release|Win32 + {45C45411-7F0E-404D-919A-4EE9BB60BE86}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj b/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj index 2041155..28c9c6b 100644 --- a/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj +++ b/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj @@ -1,585 +1,527 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebKitTools/TestWebKitAPI/win/TestWebKitAPIGenerated.vcproj b/WebKitTools/TestWebKitAPI/win/TestWebKitAPIGenerated.vcproj index ce5afeb..3f30a05 100644 --- a/WebKitTools/TestWebKitAPI/win/TestWebKitAPIGenerated.vcproj +++ b/WebKitTools/TestWebKitAPI/win/TestWebKitAPIGenerated.vcproj @@ -1,47 +1,82 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebKitTools/TestWebKitAPI/win/TestWebKitAPIGeneratedCommon.vsprops b/WebKitTools/TestWebKitAPI/win/TestWebKitAPIGeneratedCommon.vsprops new file mode 100644 index 0000000..7e1587b --- /dev/null +++ b/WebKitTools/TestWebKitAPI/win/TestWebKitAPIGeneratedCommon.vsprops @@ -0,0 +1,13 @@ + + + + diff --git a/WebKitTools/TestWebKitAPI/win/TestWebKitAPIPostBuild.cmd b/WebKitTools/TestWebKitAPI/win/TestWebKitAPIPostBuild.cmd new file mode 100644 index 0000000..f011495 --- /dev/null +++ b/WebKitTools/TestWebKitAPI/win/TestWebKitAPIPostBuild.cmd @@ -0,0 +1 @@ +if exist "%WEBKITOUTPUTDIR%\buildfailed" del "%WEBKITOUTPUTDIR%\buildfailed" diff --git a/WebKitTools/TestWebKitAPI/win/TestWebKitAPIPreBuild.cmd b/WebKitTools/TestWebKitAPI/win/TestWebKitAPIPreBuild.cmd new file mode 100644 index 0000000..3a84c26 --- /dev/null +++ b/WebKitTools/TestWebKitAPI/win/TestWebKitAPIPreBuild.cmd @@ -0,0 +1,6 @@ +%SystemDrive%\cygwin\bin\which.exe bash +if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH% +cmd /c +if exist "%WEBKITOUTPUTDIR%\buildfailed" grep XX%PROJECTNAME%XX "%WEBKITOUTPUTDIR%\buildfailed" +if errorlevel 1 exit 1 +echo XX%PROJECTNAME%XX > "%WEBKITOUTPUTDIR%\buildfailed" -- cgit v1.1