diff options
Diffstat (limited to 'Tools/DumpRenderTree')
79 files changed, 1464 insertions, 181 deletions
diff --git a/Tools/DumpRenderTree/DumpRenderTree.sln b/Tools/DumpRenderTree/DumpRenderTree.sln index 1f7d803..df85a7c 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.sln +++ b/Tools/DumpRenderTree/DumpRenderTree.sln @@ -24,7 +24,7 @@ Global 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 + Production|Win32 = Production|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution @@ -36,8 +36,8 @@ Global {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug|Win32.Build.0 = Debug|Win32 {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release_Cairo_CFLite|Win32.ActiveCfg = Release_Cairo_CFLite|Win32 {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release_Cairo_CFLite|Win32.Build.0 = Release_Cairo_CFLite|Win32 - {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32 - {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32 + {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Production|Win32.ActiveCfg = Production|Win32 + {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Production|Win32.Build.0 = Production|Win32 {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release|Win32.ActiveCfg = Release|Win32 {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release|Win32.Build.0 = Release|Win32 {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_All|Win32.ActiveCfg = Debug_All|Win32 @@ -48,8 +48,8 @@ Global {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug|Win32.Build.0 = Debug|Win32 {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release_Cairo_CFLite|Win32.ActiveCfg = Release_Cairo_CFLite|Win32 {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release_Cairo_CFLite|Win32.Build.0 = Release_Cairo_CFLite|Win32 - {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32 - {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32 + {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Production|Win32.ActiveCfg = Production|Win32 + {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Production|Win32.Build.0 = Production|Win32 {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release|Win32.ActiveCfg = Release|Win32 {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release|Win32.Build.0 = Release|Win32 {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug_All|Win32.ActiveCfg = Debug_All|Win32 @@ -60,8 +60,8 @@ Global {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug|Win32.Build.0 = Debug|Win32 {DA31DA52-6675-48D4-89E0-333A7144397C}.Release_Cairo_CFLite|Win32.ActiveCfg = Release_Cairo_CFLite|Win32 {DA31DA52-6675-48D4-89E0-333A7144397C}.Release_Cairo_CFLite|Win32.Build.0 = Release_Cairo_CFLite|Win32 - {DA31DA52-6675-48D4-89E0-333A7144397C}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32 - {DA31DA52-6675-48D4-89E0-333A7144397C}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32 + {DA31DA52-6675-48D4-89E0-333A7144397C}.Production|Win32.ActiveCfg = Production|Win32 + {DA31DA52-6675-48D4-89E0-333A7144397C}.Production|Win32.Build.0 = Production|Win32 {DA31DA52-6675-48D4-89E0-333A7144397C}.Release|Win32.ActiveCfg = Release|Win32 {DA31DA52-6675-48D4-89E0-333A7144397C}.Release|Win32.Build.0 = Release|Win32 {59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug_All|Win32.ActiveCfg = Debug_All|Win32 @@ -72,8 +72,8 @@ Global {59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug|Win32.Build.0 = Debug|Win32 {59CC0547-70AC-499C-9B19-EC01C6F61137}.Release_Cairo_CFLite|Win32.ActiveCfg = Release_Cairo_CFLite|Win32 {59CC0547-70AC-499C-9B19-EC01C6F61137}.Release_Cairo_CFLite|Win32.Build.0 = Release_Cairo_CFLite|Win32 - {59CC0547-70AC-499C-9B19-EC01C6F61137}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32 - {59CC0547-70AC-499C-9B19-EC01C6F61137}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32 + {59CC0547-70AC-499C-9B19-EC01C6F61137}.Production|Win32.ActiveCfg = Production|Win32 + {59CC0547-70AC-499C-9B19-EC01C6F61137}.Production|Win32.Build.0 = Production|Win32 {59CC0547-70AC-499C-9B19-EC01C6F61137}.Release|Win32.ActiveCfg = Release|Win32 {59CC0547-70AC-499C-9B19-EC01C6F61137}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection diff --git a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj index 000d83a..67a7556 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj +++ b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj @@ -42,6 +42,7 @@ 1AC6C84A0D07638600CD3161 /* PluginObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */; }; 1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7810D07589B00CD3161 /* TestObject.cpp */; }; 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */; }; + 1ACF898D132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ACF898B132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp */; }; 1AD4CB2212A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD4CB2012A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp */; }; 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */; }; 23BCB8900EA57623003C6289 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BCB88F0EA57623003C6289 /* OpenGL.framework */; }; @@ -50,6 +51,8 @@ 29CFBA2E12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CFBA2D12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm */; }; 3713EDE2115BE19300705720 /* ColorBits-A.png in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDDF115BE16F00705720 /* ColorBits-A.png */; }; 3713EDE3115BE19300705720 /* ColorBits.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDE0115BE16F00705720 /* ColorBits.ttf */; }; + 3A5626CB131CA02A002BE6D9 /* StorageTrackerDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3A5626C1131C8B17002BE6D9 /* StorageTrackerDelegate.mm */; }; + 3A5626CC131CA036002BE6D9 /* StorageTrackerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3A5626C0131C8B17002BE6D9 /* StorageTrackerDelegate.h */; }; 440590711268453800CFD48D /* WebArchiveDumpSupportMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 440590701268453800CFD48D /* WebArchiveDumpSupportMac.mm */; }; 4437730E125CBC3600AAE02C /* WebArchiveDumpSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.cpp */; }; 4437730F125CBC4D00AAE02C /* WebArchiveDumpSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */; }; @@ -212,6 +215,7 @@ 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginObject.cpp; sourceTree = "<group>"; }; 1AC6C7810D07589B00CD3161 /* TestObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestObject.cpp; sourceTree = "<group>"; }; 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeRemoveProperty.cpp; sourceTree = "<group>"; }; + 1ACF898B132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPDeallocateCalledBeforeNPShutdown.cpp; sourceTree = "<group>"; }; 1AD4CB2012A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetUserAgentWithNullNPPFromNPPNew.cpp; sourceTree = "<group>"; }; 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginScriptableNPObjectInvokeDefault.cpp; sourceTree = "<group>"; }; 23BCB88F0EA57623003C6289 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; @@ -230,6 +234,8 @@ 375F09770DAC3CB600C8B4E5 /* WebKitWeightWatcher700.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher700.ttf; path = fonts/WebKitWeightWatcher700.ttf; sourceTree = "<group>"; }; 375F09780DAC3CB600C8B4E5 /* WebKitWeightWatcher800.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher800.ttf; path = fonts/WebKitWeightWatcher800.ttf; sourceTree = "<group>"; }; 375F09790DAC3CB600C8B4E5 /* WebKitWeightWatcher900.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher900.ttf; path = fonts/WebKitWeightWatcher900.ttf; sourceTree = "<group>"; }; + 3A5626C0131C8B17002BE6D9 /* StorageTrackerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageTrackerDelegate.h; sourceTree = "<group>"; }; + 3A5626C1131C8B17002BE6D9 /* StorageTrackerDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StorageTrackerDelegate.mm; sourceTree = "<group>"; }; 440590701268453800CFD48D /* WebArchiveDumpSupportMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebArchiveDumpSupportMac.mm; path = mac/WebArchiveDumpSupportMac.mm; sourceTree = "<group>"; }; 44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebArchiveDumpSupport.h; path = cf/WebArchiveDumpSupport.h; sourceTree = "<group>"; }; 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebArchiveDumpSupport.cpp; path = cf/WebArchiveDumpSupport.cpp; sourceTree = "<group>"; }; @@ -460,6 +466,8 @@ BCA18B5E0C9B08C200114369 /* ResourceLoadDelegate.mm */, BCA18B5F0C9B08C200114369 /* UIDelegate.h */, BCA18B600C9B08C200114369 /* UIDelegate.mm */, + 3A5626C0131C8B17002BE6D9 /* StorageTrackerDelegate.h */, + 3A5626C1131C8B17002BE6D9 /* StorageTrackerDelegate.mm */, ); name = Delegates; sourceTree = "<group>"; @@ -471,6 +479,7 @@ C0E720741281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp */, 1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */, 1AD4CB2012A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp */, + 1ACF898B132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp */, 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */, 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */, C0EC3C9B12787F0500939164 /* NullNPPGetValuePointer.cpp */, @@ -620,6 +629,7 @@ 5185F6B310714E12007AA393 /* HistoryDelegate.h in Headers */, E1B7816711AF31C3007E1BC2 /* MockGeolocationProvider.h in Headers */, 29CFBA10122736E600BC30C0 /* AccessibilityTextMarker.h in Headers */, + 3A5626CC131CA036002BE6D9 /* StorageTrackerDelegate.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -763,6 +773,7 @@ C0E720751281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp in Sources */, 1AD4CB2212A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp in Sources */, 1A3E28AA1311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp in Sources */, + 1ACF898D132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -809,6 +820,7 @@ E1B7816511AF31B7007E1BC2 /* MockGeolocationProvider.mm in Sources */, 29CFBA11122736E600BC30C0 /* AccessibilityTextMarker.cpp in Sources */, 29CFBA2E12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm in Sources */, + 3A5626CB131CA02A002BE6D9 /* StorageTrackerDelegate.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Tools/DumpRenderTree/ForwardingHeaders/wtf/OwnArrayPtr.h b/Tools/DumpRenderTree/ForwardingHeaders/wtf/OwnArrayPtr.h new file mode 100644 index 0000000..595817d --- /dev/null +++ b/Tools/DumpRenderTree/ForwardingHeaders/wtf/OwnArrayPtr.h @@ -0,0 +1 @@ +#include <JavaScriptCore/OwnArrayPtr.h> diff --git a/Tools/DumpRenderTree/ForwardingHeaders/wtf/ThreadSafeRefCounted.h b/Tools/DumpRenderTree/ForwardingHeaders/wtf/ThreadSafeRefCounted.h new file mode 100644 index 0000000..48a54cc --- /dev/null +++ b/Tools/DumpRenderTree/ForwardingHeaders/wtf/ThreadSafeRefCounted.h @@ -0,0 +1 @@ +#include <JavaScriptCore/ThreadSafeRefCounted.h> diff --git a/Tools/DumpRenderTree/ForwardingHeaders/wtf/ThreadSafeShared.h b/Tools/DumpRenderTree/ForwardingHeaders/wtf/ThreadSafeShared.h deleted file mode 100644 index 4a7a77f..0000000 --- a/Tools/DumpRenderTree/ForwardingHeaders/wtf/ThreadSafeShared.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/ThreadSafeShared.h> diff --git a/Tools/DumpRenderTree/LayoutTestController.cpp b/Tools/DumpRenderTree/LayoutTestController.cpp index 9f1877c..18b3dcd 100644 --- a/Tools/DumpRenderTree/LayoutTestController.cpp +++ b/Tools/DumpRenderTree/LayoutTestController.cpp @@ -39,6 +39,7 @@ #include <stdio.h> #include <wtf/Assertions.h> #include <wtf/MathExtras.h> +#include <wtf/OwnArrayPtr.h> #include <wtf/RefPtr.h> LayoutTestController::LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash) @@ -355,15 +356,15 @@ static JSValueRef addURLToRedirectCallback(JSContextRef context, JSObjectRef fun ASSERT(!*exception); size_t maxLength = JSStringGetMaximumUTF8CStringSize(origin.get()); - char* originBuffer = new char[maxLength + 1]; - JSStringGetUTF8CString(origin.get(), originBuffer, maxLength + 1); + OwnArrayPtr<char> originBuffer = adoptArrayPtr(new char[maxLength + 1]); + JSStringGetUTF8CString(origin.get(), originBuffer.get(), maxLength + 1); maxLength = JSStringGetMaximumUTF8CStringSize(destination.get()); - char* destinationBuffer = new char[maxLength + 1]; - JSStringGetUTF8CString(destination.get(), destinationBuffer, maxLength + 1); + OwnArrayPtr<char> destinationBuffer = adoptArrayPtr(new char[maxLength + 1]); + JSStringGetUTF8CString(destination.get(), destinationBuffer.get(), maxLength + 1); LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); - controller->addURLToRedirect(originBuffer, destinationBuffer); + controller->addURLToRedirect(originBuffer.get(), destinationBuffer.get()); return JSValueMakeUndefined(context); } @@ -385,6 +386,26 @@ static JSValueRef clearAllApplicationCachesCallback(JSContextRef context, JSObje return JSValueMakeUndefined(context); } +static JSValueRef clearApplicationCacheForOriginCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + JSRetainPtr<JSStringRef> originURL(Adopt, JSValueToStringCopy(context, arguments[0], exception)); + ASSERT(!*exception); + + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + controller->clearApplicationCacheForOrigin(originURL.get()); + + return JSValueMakeUndefined(context); +} + +static JSValueRef originsWithApplicationCacheCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + return controller->originsWithApplicationCache(context); +} + static JSValueRef clearAllDatabasesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -394,6 +415,60 @@ static JSValueRef clearAllDatabasesCallback(JSContextRef context, JSObjectRef fu return JSValueMakeUndefined(context); } +static JSValueRef syncLocalStorageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + + controller->syncLocalStorage(); + + return JSValueMakeUndefined(context); +} + +static JSValueRef observeStorageTrackerNotificationsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + unsigned numNotifications = JSValueToNumber(context, arguments[0], exception); + + ASSERT(!*exception); + + controller->observeStorageTrackerNotifications(numNotifications); + + return JSValueMakeUndefined(context); +} + +static JSValueRef deleteAllLocalStorageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + controller->deleteAllLocalStorage(); + + return JSValueMakeUndefined(context); +} + +static JSValueRef deleteLocalStorageForOriginCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + JSRetainPtr<JSStringRef> url(Adopt, JSValueToStringCopy(context, arguments[0], exception)); + ASSERT(!*exception); + + controller->deleteLocalStorageForOrigin(url.get()); + + return JSValueMakeUndefined(context); +} + +static JSValueRef originsWithLocalStorageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + return controller->originsWithLocalStorage(context); +} + static JSValueRef clearBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -769,6 +844,12 @@ static JSValueRef numberOfPagesCallback(JSContextRef context, JSObjectRef functi return JSValueMakeNumber(context, controller->numberOfPages(pageWidthInPixels, pageHeightInPixels)); } +static JSValueRef numberOfPendingGeolocationPermissionRequestsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + return JSValueMakeNumber(context, controller->numberOfPendingGeolocationPermissionRequests()); +} + static JSValueRef pagePropertyCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { char* propertyName = 0; @@ -1039,6 +1120,17 @@ static JSValueRef setAuthorAndUserStylesEnabledCallback(JSContextRef context, JS return JSValueMakeUndefined(context); } +static JSValueRef setAutofilledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount != 2 || !arguments[0]) + return JSValueMakeUndefined(context); + + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + controller->setAutofilled(context, arguments[0], JSValueToBoolean(context, arguments[1])); + + return JSValueMakeUndefined(context); +} + static JSValueRef setCacheModelCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has Mac implementation. @@ -1472,11 +1564,11 @@ static JSValueRef setWillSendRequestClearHeaderCallback(JSContextRef context, JS ASSERT(!*exception); size_t maxLength = JSStringGetMaximumUTF8CStringSize(header.get()); - char* headerBuffer = new char[maxLength + 1]; - JSStringGetUTF8CString(header.get(), headerBuffer, maxLength + 1); + OwnArrayPtr<char> headerBuffer = adoptArrayPtr(new char[maxLength + 1]); + JSStringGetUTF8CString(header.get(), headerBuffer.get(), maxLength + 1); LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); - controller->setWillSendRequestClearHeader(headerBuffer); + controller->setWillSendRequestClearHeader(headerBuffer.get()); return JSValueMakeUndefined(context); } @@ -1871,6 +1963,19 @@ static JSValueRef hasSpellingMarkerCallback(JSContextRef context, JSObjectRef fu return JSValueMakeBoolean(context, ok); } +static JSValueRef hasGrammarMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount != 2) + return JSValueMakeUndefined(context); + + int from = JSValueToNumber(context, arguments[0], 0); + int length = JSValueToNumber(context, arguments[1], 0); + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + bool ok = controller->hasGrammarMarker(from, length); + + return JSValueMakeBoolean(context, ok); +} + static JSValueRef markerTextForListItemCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); @@ -2031,6 +2136,7 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "callShouldCloseOnWebView", callShouldCloseOnWebViewCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "clearAllApplicationCaches", clearAllApplicationCachesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "clearAllDatabases", clearAllDatabasesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "clearApplicationCacheForOrigin", clearApplicationCacheForOriginCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "clearBackForwardList", clearBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "clearPersistentUserStyleSheet", clearPersistentUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "closeWebInspector", closeWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2067,13 +2173,16 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "execCommand", execCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "findString", findStringCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "counterValueForElementById", counterValueForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "originsWithApplicationCache", originsWithApplicationCacheCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "hasSpellingMarker", hasSpellingMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "hasGrammarMarker", hasGrammarMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isPageBoxVisible", isPageBoxVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "layerTreeAsText", layerTreeAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "numberOfPages", numberOfPagesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "numberOfPendingGeolocationPermissionRequests", numberOfPendingGeolocationPermissionRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "markerTextForListItem", markerTextForListItemCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2107,6 +2216,7 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "setAuthenticationPassword", setAuthenticationPasswordCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAuthenticationUsername", setAuthenticationUsernameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAuthorAndUserStylesEnabled", setAuthorAndUserStylesEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "setAutofilled", setAutofilledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setCacheModel", setCacheModelCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setCallCloseOnWebViews", setCallCloseOnWebViewsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setCanOpenWindows", setCanOpenWindowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2144,7 +2254,7 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "setUseDashboardCompatibilityMode", setUseDashboardCompatibilityModeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setUserStyleSheetEnabled", setUserStyleSheetEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setUserStyleSheetLocation", setUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setValueForUser", setValueForUserCallback, kJSPropertyAttributeDontDelete }, + { "setValueForUser", setValueForUserCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setViewModeMediaFeature", setViewModeMediaFeatureCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setWebViewEditable", setWebViewEditableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setWillSendRequestClearHeader", setWillSendRequestClearHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2163,6 +2273,11 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "addOriginAccessWhitelistEntry", addOriginAccessWhitelistEntryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setScrollbarPolicy", setScrollbarPolicyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "authenticateSession", authenticateSessionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "deleteAllLocalStorage", deleteAllLocalStorageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "syncLocalStorage", syncLocalStorageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "observeStorageTrackerNotifications", observeStorageTrackerNotificationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "deleteLocalStorageForOrigin", deleteLocalStorageForOriginCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "originsWithLocalStorage", originsWithLocalStorageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setShouldPaintBrokenImage", setShouldPaintBrokenImageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { 0, 0, 0 } }; diff --git a/Tools/DumpRenderTree/LayoutTestController.h b/Tools/DumpRenderTree/LayoutTestController.h index 4b1c04e..4a6e59c 100644 --- a/Tools/DumpRenderTree/LayoutTestController.h +++ b/Tools/DumpRenderTree/LayoutTestController.h @@ -50,6 +50,7 @@ public: const std::string& redirectionDestinationForURL(std::string); void clearAllApplicationCaches(); void clearAllDatabases(); + void clearApplicationCacheForOrigin(JSStringRef name); void clearBackForwardList(); void clearPersistentUserStyleSheet(); bool callShouldCloseOnWebView(); @@ -62,12 +63,14 @@ public: void displayInvalidatedRegion(); void execCommand(JSStringRef name, JSStringRef value); bool findString(JSContextRef, JSStringRef, JSObjectRef optionsArray); + JSValueRef originsWithApplicationCache(JSContextRef); bool isCommandEnabled(JSStringRef name); void keepWebHistory(); JSValueRef computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef); JSValueRef nodesFromRect(JSContextRef, JSValueRef, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping); void notifyDone(); int numberOfPages(float pageWidthInPixels, float pageHeightInPixels); + int numberOfPendingGeolocationPermissionRequests(); void overridePreference(JSStringRef key, JSStringRef value); int pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels); JSRetainPtr<JSStringRef> pageProperty(const char* propertyName, int pageNumber) const; @@ -89,6 +92,7 @@ public: void setAppCacheMaximumSize(unsigned long long quota); void setApplicationCacheOriginQuota(unsigned long long quota); void setAuthorAndUserStylesEnabled(bool); + void setAutofilled(JSContextRef, JSValueRef nodeObject, bool autofilled); void setCacheModel(int); void setCustomPolicyDelegate(bool setDelegate, bool permissive); void setDatabaseQuota(unsigned long long quota); @@ -291,6 +295,7 @@ public: void abortModal(); bool hasSpellingMarker(int from, int length); + bool hasGrammarMarker(int from, int length); void dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight); @@ -308,6 +313,12 @@ public: JSRetainPtr<JSStringRef> markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const; + JSValueRef originsWithLocalStorage(JSContextRef); + void deleteAllLocalStorage(); + void deleteLocalStorageForOrigin(JSStringRef originIdentifier); + void observeStorageTrackerNotifications(unsigned number); + void syncLocalStorage(); + void setShouldPaintBrokenImage(bool); bool shouldPaintBrokenImage() const { return m_shouldPaintBrokenImage; } diff --git a/Tools/DumpRenderTree/StorageTrackerDelegate.h b/Tools/DumpRenderTree/StorageTrackerDelegate.h new file mode 100644 index 0000000..e025a44 --- /dev/null +++ b/Tools/DumpRenderTree/StorageTrackerDelegate.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 + * 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. + */ + +class LayoutTestController; + +@interface StorageTrackerDelegate : NSObject { + unsigned numberOfNotificationsToLog; + LayoutTestController* controllerToNotifyDone; +} + +- (void)logNotifications:(unsigned)number controller:(LayoutTestController*)controller; +- (void)originModified:(NSNotification *)notification; +- (void)setControllerToNotifyDone:(LayoutTestController*)controller; + +@end diff --git a/Tools/DumpRenderTree/StorageTrackerDelegate.mm b/Tools/DumpRenderTree/StorageTrackerDelegate.mm new file mode 100644 index 0000000..343880b --- /dev/null +++ b/Tools/DumpRenderTree/StorageTrackerDelegate.mm @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 + * 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 "StorageTrackerDelegate.h" + +#import "LayoutTestController.h" +#import <WebKit/WebSecurityOriginPrivate.h> +#import <WebKit/WebStorageManagerPrivate.h> + +@implementation StorageTrackerDelegate + +- (id)init +{ + self = [super init]; + if (!self) + return nil; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(originModified:) name:WebStorageDidModifyOriginNotification object:nil]; + + return self; +} + +- (void)logNotifications:(unsigned)number controller:(LayoutTestController*)controller +{ + controllerToNotifyDone = controller; + + numberOfNotificationsToLog = number; +} + +- (void)originModified:(NSNotification *)notification +{ + if (!numberOfNotificationsToLog) + return; + + numberOfNotificationsToLog--; + + if (numberOfNotificationsToLog == 0 && controllerToNotifyDone) { + NSArray *origins = [[WebStorageManager sharedWebStorageManager] origins]; + for (WebSecurityOrigin *origin in origins) + printf("Origin identifier: '%s'\n", [[origin databaseIdentifier] UTF8String]); + + controllerToNotifyDone->notifyDone(); + } +} + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self name:WebStorageDidModifyOriginNotification object:nil]; + + [super dealloc]; +} + +- (void)setControllerToNotifyDone:(LayoutTestController*)controller +{ + controllerToNotifyDone = controller; +} + + +@end diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp index 23120c4..98ef799 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp @@ -31,6 +31,8 @@ using namespace std; extern NPNetscapeFuncs *browser; +static void (*shutdownFunction)(); + PluginTest* PluginTest::create(NPP npp, const string& identifier) { if (identifier.empty()) @@ -47,12 +49,26 @@ PluginTest::PluginTest(NPP npp, const string& identifier) : m_npp(npp) , m_identifier(identifier) { + // Reset the shutdown function. + shutdownFunction = 0; } PluginTest::~PluginTest() { } +void PluginTest::NP_Shutdown() +{ + if (shutdownFunction) + shutdownFunction(); +} + +void PluginTest::registerNPShutdownFunction(void (*func)()) +{ + assert(!shutdownFunction); + shutdownFunction = func; +} + NPError PluginTest::NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) { return NPERR_NO_ERROR; diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h index 7c3a53e..cf94165 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h @@ -54,6 +54,8 @@ public: static PluginTest* create(NPP, const std::string& identifier); virtual ~PluginTest(); + static void NP_Shutdown(); + // NPP functions. virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved); virtual NPError NPP_Destroy(NPSavedData**); @@ -74,6 +76,8 @@ public: void executeScript(const char*); + void registerNPShutdownFunction(void (*)()); + template<typename TestClassTy> class Register { public: Register(const std::string& identifier) diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPDeallocateCalledBeforeNPShutdown.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPDeallocateCalledBeforeNPShutdown.cpp new file mode 100644 index 0000000..c53ec97 --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPDeallocateCalledBeforeNPShutdown.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PluginTest.h" + +using namespace std; + +static bool wasShutdownCalled = false; + +class NPDeallocateCalledBeforeNPShutdown : public PluginTest { +public: + NPDeallocateCalledBeforeNPShutdown(NPP npp, const string& identifier) + : PluginTest(npp, identifier) + { + } + +private: + // This is the test object. + class TestObject : public Object<TestObject> { + public: + ~TestObject() + { + // This should really be an assert, but there's no way for the test framework + // to know that the plug-in process crashed, so we'll just sleep for a while + // to ensure that the test times out. + if (wasShutdownCalled) { +#if defined(XP_WIN) + ::Sleep(100000); +#else + sleep(1000); +#endif + } + } + }; + + // This is the scriptable object. It has a single "testObject" property. + class ScriptableObject : public Object<ScriptableObject> { + public: + bool hasProperty(NPIdentifier propertyName) + { + return propertyName == pluginTest()->NPN_GetStringIdentifier("testObject"); + } + + bool getProperty(NPIdentifier propertyName, NPVariant* result) + { + if (propertyName != pluginTest()->NPN_GetStringIdentifier("testObject")) + return false; + + NPObject* testObject = TestObject::create(pluginTest()); + OBJECT_TO_NPVARIANT(testObject, *result); + return true; + } + }; + + virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) + { + registerNPShutdownFunction(shutdown); + + return NPERR_NO_ERROR; + } + + virtual NPError NPP_GetValue(NPPVariable variable, void *value) + { + if (variable != NPPVpluginScriptableNPObject) + return NPERR_GENERIC_ERROR; + + *(NPObject**)value = ScriptableObject::create(this); + + return NPERR_NO_ERROR; + } + + static void shutdown() + { + wasShutdownCalled = true; + } + +}; + +static PluginTest::Register<NPDeallocateCalledBeforeNPShutdown> npRuntimeObjectFromDestroyedPlugin("np-deallocate-called-before-np-shutdown"); + diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist b/Tools/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist index 7444b84..ef45e66 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> @@ -44,6 +44,15 @@ <string>Simple Netscape plug-in that handles test content for WebKit</string> <key>WebPluginMIMETypes</key> <dict> + <key>image/png</key> + <dict> + <key>WebPluginExtensions</key> + <array> + <string>png</string> + </array> + <key>WebPluginTypeDescription</key> + <string>PNG image</string> + </dict> <key>application/x-webkit-test-netscape</key> <dict> <key>WebPluginExtensions</key> diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp index b523fcb..a090fef 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp @@ -123,6 +123,7 @@ NPError STDCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs) extern "C" void STDCALL NP_Shutdown(void) { + PluginTest::NP_Shutdown(); } static void executeScript(const PluginObject* obj, const char* script); @@ -786,7 +787,7 @@ NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) extern "C" const char* NP_GetMIMEDescription(void) { - return "application/x-webkit-test-netscape:testnetscape:test netscape content"; + return "application/x-webkit-test-netscape:testnetscape:test netscape content;image/png:png:PNG image"; } extern "C" diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc index 5a02f9d..c0b38ee 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc @@ -71,10 +71,10 @@ BEGIN BEGIN
VALUE "CompanyName", "Apple Inc."
VALUE "FileDescription", "Simple Netscape plug-in that handles test content for WebKit"
- VALUE "FileExtents", "testnetscape"
- VALUE "FileOpenName", "test netscape content"
+ VALUE "FileExtents", "testnetscape|png"
+ VALUE "FileOpenName", "test netscape content|PNG image"
VALUE "LegalCopyright", "Copyright Apple Inc. 2007-2009"
- VALUE "MIMEType", "application/x-webkit-test-netscape"
+ VALUE "MIMEType", "application/x-webkit-test-netscape|image/png"
VALUE "OriginalFilename", "npTestNetscapePlugin.dll"
VALUE "ProductName", "WebKit Test PlugIn"
END
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj index 58a0a1f..5856985 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj @@ -18,7 +18,7 @@ <Configuration Name="Debug|Win32" ConfigurationType="2" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\TestNetscapePluginCommon.vsprops" + InheritedPropertySheets=".\TestNetscapePluginDebug.vsprops" CharacterSet="1" > <Tool @@ -79,7 +79,7 @@ <Configuration Name="Release|Win32" ConfigurationType="2" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\TestNetscapePluginCommon.vsprops" + InheritedPropertySheets=".\TestNetscapePluginRelease.vsprops" CharacterSet="1" > <Tool @@ -140,7 +140,7 @@ <Configuration Name="Debug_Cairo_CFLite|Win32" ConfigurationType="2" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\TestNetscapePluginCommon.vsprops" + InheritedPropertySheets=".\TestNetscapePluginDebugCairoCFLite.vsprops" CharacterSet="1" > <Tool @@ -201,7 +201,7 @@ <Configuration Name="Debug_All|Win32" ConfigurationType="2" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\TestNetscapePluginCommon.vsprops" + InheritedPropertySheets=".\TestNetscapePluginDebugAll.vsprops" CharacterSet="1" > <Tool @@ -260,9 +260,9 @@ /> </Configuration> <Configuration - Name="Release_LTCG|Win32" + Name="Production|Win32" ConfigurationType="2" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\TestNetscapePluginCommon.vsprops" + InheritedPropertySheets=".\TestNetscapePluginProduction.vsprops" CharacterSet="1" WholeProgramOptimization="1" > @@ -324,7 +324,7 @@ <Configuration Name="Release_Cairo_CFLite|Win32" ConfigurationType="2" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\TestNetscapePluginCommon.vsprops" + InheritedPropertySheets=".\TestNetscapePluginReleaseCairoCFLite.vsprops" CharacterSet="1" > <Tool @@ -406,6 +406,10 @@ > </File> <File + RelativePath="..\Tests\NPDeallocateCalledBeforeNPShutdown.cpp" + > + </File> + <File RelativePath="..\Tests\NPRuntimeObjectFromDestroyedPlugin.cpp" > </File> diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebug.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebug.vsprops new file mode 100644 index 0000000..a12fcb5 --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebug.vsprops @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="TestNetscapePluginDebug" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops; + .\TestNetscapePluginCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebugAll.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebugAll.vsprops new file mode 100644 index 0000000..b29989a --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebugAll.vsprops @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="TestNetscapePluginDebugAll" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops; + .\TestNetscapePluginCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebugCairoCFLite.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebugCairoCFLite.vsprops new file mode 100644 index 0000000..dd258f0 --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebugCairoCFLite.vsprops @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="TestNetscapePluginDebugCairoCFLite" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops; + .\TestNetscapePluginCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginProduction.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginProduction.vsprops new file mode 100644 index 0000000..4a65c62 --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginProduction.vsprops @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="TestNetscapePluginProduction" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; + .\TestNetscapePluginCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginRelease.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginRelease.vsprops new file mode 100644 index 0000000..c410e11 --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginRelease.vsprops @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="TestNetscapePluginRelease" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + .\TestNetscapePluginCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginReleaseCairoCFLite.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginReleaseCairoCFLite.vsprops new file mode 100644 index 0000000..eb51008 --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginReleaseCairoCFLite.vsprops @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="TestNetscapePluginReleaseCairoCFLite" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops; + .\TestNetscapePluginCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp b/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp index 4d77454..81d3e39 100644 --- a/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp +++ b/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp @@ -23,11 +23,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#import "WebArchiveDumpSupport.h" +#include "config.h" +#include "WebArchiveDumpSupport.h" -#import <CoreFoundation/CoreFoundation.h> -#import <CFNetwork/CFNetwork.h> -#import <wtf/RetainPtr.h> +#include <CoreFoundation/CoreFoundation.h> +#include <CFNetwork/CFNetwork.h> +#include <wtf/RetainPtr.h> extern "C" { diff --git a/Tools/DumpRenderTree/cg/ImageDiffCG.cpp b/Tools/DumpRenderTree/cg/ImageDiffCG.cpp index 593ba64..b4f432f 100644 --- a/Tools/DumpRenderTree/cg/ImageDiffCG.cpp +++ b/Tools/DumpRenderTree/cg/ImageDiffCG.cpp @@ -26,6 +26,10 @@ #define min min +// FIXME: We need to be able to include these defines from a config.h somewhere. +#define JS_EXPORT_PRIVATE +#define WTF_EXPORT_PRIVATE + #include <stdio.h> #include <wtf/Platform.h> #include <wtf/RetainPtr.h> diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp index 76aa781..61e726a 100644 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp +++ b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp @@ -72,11 +72,6 @@ void DRTDevToolsAgent::runtimePropertyChanged(const WebString& name, const WebSt // FIXME: Implement. } -WebCString DRTDevToolsAgent::debuggerScriptSource() -{ - return webkit_support::GetDevToolsDebuggerScriptSource(); -} - WebDevToolsAgentClient::WebKitClientMessageLoop* DRTDevToolsAgent::createClientMessageLoop() { return webkit_support::CreateDevToolsMessageLoop(); diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h index 4cbc8bc..0ecf61b 100644 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h +++ b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h @@ -61,7 +61,6 @@ public: virtual void sendMessageToInspectorFrontend(const WebKit::WebString&); virtual int hostIdentifier() { return m_routingID; } virtual void runtimePropertyChanged(const WebKit::WebString& name, const WebKit::WebString& value); - virtual WebKit::WebCString debuggerScriptSource(); virtual WebKitClientMessageLoop* createClientMessageLoop(); void asyncCall(const WebKit::WebString& args); diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp index e008432..95fcd58 100644 --- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp @@ -43,7 +43,8 @@ static const char optionDumpAllPixels[] = "--dump-all-pixels"; static const char optionNotree[] = "--notree"; static const char optionPixelTests[] = "--pixel-tests"; static const char optionThreaded[] = "--threaded"; -static const char optionTree[] = "--tree"; +static const char optionDebugRenderTree[] = "--debug-render-tree"; +static const char optionDebugLayerTree[] = "--debug-layer-tree"; static const char optionPixelTestsWithName[] = "--pixel-tests="; static const char optionTestShell[] = "--test-shell"; @@ -53,6 +54,7 @@ static const char optionCheckLayoutTestSystemDeps[] = "--check-layout-test-sys-d static const char optionHardwareAcceleratedGL[] = "--enable-hardware-gpu"; static const char optionEnableAcceleratedCompositing[] = "--enable-accelerated-compositing"; +static const char optionForceCompositingMode[] = "--force-compositing-mode"; static const char optionEnableAccelerated2DCanvas[] = "--enable-accelerated-2d-canvas"; static const char optionStressOpt[] = "--stress-opt"; @@ -131,6 +133,7 @@ int main(int argc, char* argv[]) bool allowExternalPages = false; bool startupDialog = false; bool acceleratedCompositingEnabled = false; + bool forceCompositingMode = false; bool accelerated2DCanvasEnabled = false; bool stressOpt = false; bool stressDeopt = false; @@ -148,7 +151,11 @@ int main(int argc, char* argv[]) else if (!argument.find(optionPixelTestsWithName)) { params.dumpPixels = true; params.pixelFileName = argument.substr(strlen(optionPixelTestsWithName)); - } else if (argument == optionTestShell) { + } else if (argument == optionDebugRenderTree) + params.debugRenderTree = true; + else if (argument == optionDebugLayerTree) + params.debugLayerTree = true; + else if (argument == optionTestShell) { testShellMode = true; serverMode = true; } else if (argument == optionAllowExternalPages) @@ -161,6 +168,8 @@ int main(int argc, char* argv[]) hardwareAcceleratedGL = true; else if (argument == optionEnableAcceleratedCompositing) acceleratedCompositingEnabled = true; + else if (argument == optionForceCompositingMode) + forceCompositingMode = true; else if (argument == optionEnableAccelerated2DCanvas) accelerated2DCanvasEnabled = true; else if (argument == optionStressOpt) @@ -194,6 +203,7 @@ int main(int argc, char* argv[]) TestShell shell(testShellMode); shell.setAllowExternalPages(allowExternalPages); shell.setAcceleratedCompositingEnabled(acceleratedCompositingEnabled); + shell.setForceCompositingMode(forceCompositingMode); shell.setAccelerated2dCanvasEnabled(accelerated2DCanvasEnabled); shell.setJavaScriptFlags(javaScriptFlags); shell.setStressOpt(stressOpt); diff --git a/Tools/DumpRenderTree/chromium/EventSender.cpp b/Tools/DumpRenderTree/chromium/EventSender.cpp index c5b7aa9..c800c43 100644 --- a/Tools/DumpRenderTree/chromium/EventSender.cpp +++ b/Tools/DumpRenderTree/chromium/EventSender.cpp @@ -338,7 +338,7 @@ void EventSender::doDragDrop(const WebDragData& dragData, WebDragOperationsMask WebPoint screenPoint(event.globalX, event.globalY); currentDragData = dragData; currentDragEffectsAllowed = mask; - currentDragEffect = webview()->dragTargetDragEnter(dragData, 0, clientPoint, screenPoint, currentDragEffectsAllowed); + currentDragEffect = webview()->dragTargetDragEnter(dragData, clientPoint, screenPoint, currentDragEffectsAllowed); // Finish processing events. replaySavedEvents(); @@ -826,7 +826,7 @@ void EventSender::beginDragWithFiles(const CppArgumentList& arguments, CppVarian currentDragEffectsAllowed = WebKit::WebDragOperationCopy; // Provide a drag source. - webview()->dragTargetDragEnter(currentDragData, 0, lastMousePos, lastMousePos, currentDragEffectsAllowed); + webview()->dragTargetDragEnter(currentDragData, lastMousePos, lastMousePos, currentDragEffectsAllowed); // dragMode saves events and then replays them later. We don't need/want that. dragMode.set(false); diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp index b891d1e..d91cd6e 100644 --- a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp +++ b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp @@ -73,6 +73,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) : m_shell(shell) , m_closeRemainingWindows(false) , m_deferMainResourceDataLoad(false) + , m_showDebugLayerTree(false) , m_workQueue(this) { @@ -108,13 +109,14 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("evaluateScriptInIsolatedWorld", &LayoutTestController::evaluateScriptInIsolatedWorld); bindMethod("execCommand", &LayoutTestController::execCommand); bindMethod("grantDesktopNotificationPermission", &LayoutTestController::grantDesktopNotificationPermission); + bindMethod("hasSpellingMarker", &LayoutTestController::hasSpellingMarker); bindMethod("isCommandEnabled", &LayoutTestController::isCommandEnabled); bindMethod("layerTreeAsText", &LayoutTestController::layerTreeAsText); bindMethod("markerTextForListItem", &LayoutTestController::markerTextForListItem); - bindMethod("hasSpellingMarker", &LayoutTestController::hasSpellingMarker); bindMethod("notifyDone", &LayoutTestController::notifyDone); bindMethod("numberOfActiveAnimations", &LayoutTestController::numberOfActiveAnimations); bindMethod("numberOfPages", &LayoutTestController::numberOfPages); + bindMethod("numberOfPendingGeolocationPermissionRequests", &LayoutTestController:: numberOfPendingGeolocationPermissionRequests); bindMethod("objCIdentityIsEqual", &LayoutTestController::objCIdentityIsEqual); bindMethod("overridePreference", &LayoutTestController::overridePreference); bindMethod("pageNumberForElementById", &LayoutTestController::pageNumberForElementById); @@ -137,6 +139,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("setAllowUniversalAccessFromFileURLs", &LayoutTestController::setAllowUniversalAccessFromFileURLs); bindMethod("setAlwaysAcceptCookies", &LayoutTestController::setAlwaysAcceptCookies); bindMethod("setAuthorAndUserStylesEnabled", &LayoutTestController::setAuthorAndUserStylesEnabled); + bindMethod("setAutofilled", &LayoutTestController::setAutofilled); bindMethod("setCanOpenWindows", &LayoutTestController::setCanOpenWindows); bindMethod("setCloseRemainingWindowsWhenComplete", &LayoutTestController::setCloseRemainingWindowsWhenComplete); bindMethod("setCustomPolicyDelegate", &LayoutTestController::setCustomPolicyDelegate); @@ -152,6 +155,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError); bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition); bindMethod("addMockSpeechInputResult", &LayoutTestController::addMockSpeechInputResult); + bindMethod("setPluginsEnabled", &LayoutTestController::setPluginsEnabled); bindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingEnabled); bindMethod("setPOSIXLocale", &LayoutTestController::setPOSIXLocale); bindMethod("setScrollbarPolicy", &LayoutTestController::setScrollbarPolicy); @@ -162,12 +166,14 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("setTimelineProfilingEnabled", &LayoutTestController::setTimelineProfilingEnabled); bindMethod("setUserStyleSheetEnabled", &LayoutTestController::setUserStyleSheetEnabled); bindMethod("setUserStyleSheetLocation", &LayoutTestController::setUserStyleSheetLocation); + bindMethod("setValueForUser", &LayoutTestController::setValueForUser); bindMethod("setWillSendRequestClearHeader", &LayoutTestController::setWillSendRequestClearHeader); bindMethod("setWillSendRequestReturnsNull", &LayoutTestController::setWillSendRequestReturnsNull); bindMethod("setWillSendRequestReturnsNullOnRedirect", &LayoutTestController::setWillSendRequestReturnsNullOnRedirect); bindMethod("setWindowIsKey", &LayoutTestController::setWindowIsKey); bindMethod("setXSSAuditorEnabled", &LayoutTestController::setXSSAuditorEnabled); bindMethod("setAsynchronousSpellCheckingEnabled", &LayoutTestController::setAsynchronousSpellCheckingEnabled); + bindMethod("shadowRoot", &LayoutTestController::shadowRoot); bindMethod("showWebInspector", &LayoutTestController::showWebInspector); bindMethod("simulateDesktopNotificationClick", &LayoutTestController::simulateDesktopNotificationClick); bindMethod("suspendAnimations", &LayoutTestController::suspendAnimations); @@ -182,6 +188,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("addDisallowedURL", &LayoutTestController::addDisallowedURL); bindMethod("callShouldCloseOnWebView", &LayoutTestController::callShouldCloseOnWebView); bindMethod("clearAllApplicationCaches", &LayoutTestController::clearAllApplicationCaches); + bindMethod("clearApplicationCacheForOrigin", &LayoutTestController::clearApplicationCacheForOrigin); bindMethod("clearBackForwardList", &LayoutTestController::clearBackForwardList); bindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); bindMethod("keepWebHistory", &LayoutTestController::keepWebHistory); @@ -192,7 +199,12 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("setPrivateBrowsingEnabled", &LayoutTestController::setPrivateBrowsingEnabled); bindMethod("setUseDashboardCompatibilityMode", &LayoutTestController::setUseDashboardCompatibilityMode); bindMethod("storeWebScriptObject", &LayoutTestController::storeWebScriptObject); - + bindMethod("deleteAllLocalStorage", &LayoutTestController::deleteAllLocalStorage); + bindMethod("originsWithLocalStorage", &LayoutTestController::originsWithLocalStorage); + bindMethod("deleteLocalStorageForOrigin", &LayoutTestController::deleteLocalStorageForOrigin); + bindMethod("observeStorageTrackerNotifications", &LayoutTestController::observeStorageTrackerNotifications); + bindMethod("syncLocalStorage", &LayoutTestController::syncLocalStorage); + // The fallback method is called when an unknown method is invoked. bindFallbackMethod(&LayoutTestController::fallbackMethod); @@ -636,6 +648,28 @@ void LayoutTestController::setAsynchronousSpellCheckingEnabled(const CppArgument result->setNull(); } +void LayoutTestController::shadowRoot(const CppArgumentList& arguments, CppVariant* result) +{ + if (arguments.size() != 1 || !arguments[0].isObject()) { + result->setNull(); + return; + } + + WebElement element; + if (!WebBindings::getElement(arguments[0].value.objectValue, &element)) { + result->setNull(); + return; + } + + WebNode shadowRoot = element.shadowRoot(); + if (shadowRoot.isNull()) { + result->setNull(); + return; + } + + result->set(WebBindings::makeNode(shadowRoot)); +} + void LayoutTestController::showWebInspector(const CppArgumentList&, CppVariant* result) { m_shell->showDevTools(); @@ -731,13 +765,25 @@ void LayoutTestController::setUseDashboardCompatibilityMode(const CppArgumentLis void LayoutTestController::clearAllApplicationCaches(const CppArgumentList&, CppVariant* result) { - // FIXME: implement to support Application Cache Quotas. + // FIXME: Implement to support application cache quotas. + result->setNull(); +} + +void LayoutTestController::clearApplicationCacheForOrigin(const CppArgumentList&, CppVariant* result) +{ + // FIXME: Implement to support deleting all application cache for an origin. result->setNull(); } void LayoutTestController::setApplicationCacheOriginQuota(const CppArgumentList&, CppVariant* result) { - // FIXME: implement to support Application Cache Quotas. + // FIXME: Implement to support application cache quotas. + result->setNull(); +} + +void LayoutTestController::originsWithApplicationCache(const CppArgumentList&, CppVariant* result) +{ + // FIXME: Implement to support getting origins that have application caches. result->setNull(); } @@ -1452,6 +1498,16 @@ void LayoutTestController::numberOfPages(const CppArgumentList& arguments, CppVa result->set(numberOfPages); } +void LayoutTestController::numberOfPendingGeolocationPermissionRequests(const CppArgumentList& arguments, CppVariant* result) +{ + result->setNull(); + Vector<WebViewHost*> windowList = m_shell->windowList(); + int numberOfRequests = 0; + for (size_t i = 0; i < windowList.size(); i++) + numberOfRequests += windowList[i]->geolocationClientMock()->numberOfPendingPermissionRequests(); + result->set(numberOfRequests); +} + void LayoutTestController::logErrorToConsole(const std::string& text) { m_shell->webViewHost()->didAddMessageToConsole( @@ -1576,7 +1632,7 @@ void LayoutTestController::addMockSpeechInputResult(const CppArgumentList& argum void LayoutTestController::layerTreeAsText(const CppArgumentList& args, CppVariant* result) { - result->set(m_shell->webView()->mainFrame()->layerTreeAsText().utf8()); + result->set(m_shell->webView()->mainFrame()->layerTreeAsText(m_showDebugLayerTree).utf8()); } void LayoutTestController::markerTextForListItem(const CppArgumentList& args, CppVariant* result) @@ -1602,3 +1658,71 @@ void LayoutTestController::setMinimumTimerInterval(const CppArgumentList& argume return; m_shell->webView()->settings()->setMinimumTimerInterval(arguments[0].toDouble()); } + +void LayoutTestController::setAutofilled(const CppArgumentList& arguments, CppVariant* result) +{ + result->setNull(); + if (arguments.size() != 2 || !arguments[1].isBool()) + return; + + WebElement element; + if (!WebBindings::getElement(arguments[0].value.objectValue, &element)) + return; + + WebInputElement* input = toWebInputElement(&element); + if (!input) + return; + + input->setAutofilled(arguments[1].value.boolValue); +} + +void LayoutTestController::setValueForUser(const CppArgumentList& arguments, CppVariant* result) +{ + result->setNull(); + if (arguments.size() != 2) + return; + + WebElement element; + if (!WebBindings::getElement(arguments[0].value.objectValue, &element)) + return; + + WebInputElement* input = toWebInputElement(&element); + if (!input) + return; + + input->setValue(cppVariantToWebString(arguments[1]), true); +} + +void LayoutTestController::deleteAllLocalStorage(const CppArgumentList& arguments, CppVariant*) +{ + // Not Implemented +} + +void LayoutTestController::originsWithLocalStorage(const CppArgumentList& arguments, CppVariant*) +{ + // Not Implemented +} + +void LayoutTestController::deleteLocalStorageForOrigin(const CppArgumentList& arguments, CppVariant*) +{ + // Not Implemented +} + +void LayoutTestController::observeStorageTrackerNotifications(const CppArgumentList&, CppVariant*) +{ + // Not Implemented +} + +void LayoutTestController::syncLocalStorage(const CppArgumentList&, CppVariant*) +{ + // Not Implemented +} + +void LayoutTestController::setPluginsEnabled(const CppArgumentList& arguments, CppVariant* result) +{ + if (arguments.size() > 0 && arguments[0].isBool()) { + m_shell->preferences()->pluginsEnabled = arguments[0].toBoolean(); + m_shell->applyPreferences(); + } + result->setNull(); +} diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.h b/Tools/DumpRenderTree/chromium/LayoutTestController.h index 6150133..a9c6ce4 100644 --- a/Tools/DumpRenderTree/chromium/LayoutTestController.h +++ b/Tools/DumpRenderTree/chromium/LayoutTestController.h @@ -270,6 +270,7 @@ public: void setAllowUniversalAccessFromFileURLs(const CppArgumentList&, CppVariant*); void setAllowFileAccessFromFileURLs(const CppArgumentList&, CppVariant*); + void shadowRoot(const CppArgumentList&, CppVariant*); // The fallback method is called when a nonexistent method is called on // the layout test controller object. @@ -282,9 +283,13 @@ public: void addOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*); void removeOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*); - // Clears all Application Caches. + // Clears all application caches. void clearAllApplicationCaches(const CppArgumentList&, CppVariant*); - // Sets the Application Quota for the localhost origin. + // Clears an application cache for an origin. + void clearApplicationCacheForOrigin(const CppArgumentList&, CppVariant*); + // Returns origins that have application caches. + void originsWithApplicationCache(const CppArgumentList&, CppVariant*); + // Sets the application cache quota for the localhost origin. void setApplicationCacheOriginQuota(const CppArgumentList&, CppVariant*); // Clears all databases. @@ -305,6 +310,8 @@ public: // Gets the number of pages to be printed. void numberOfPages(const CppArgumentList&, CppVariant*); + // Gets the number of geolocation permissions requests pending. + void numberOfPendingGeolocationPermissionRequests(const CppArgumentList&, CppVariant*); // Allows layout tests to start Timeline profiling. void setTimelineProfilingEnabled(const CppArgumentList&, CppVariant*); @@ -337,6 +344,24 @@ public: void setMinimumTimerInterval(const CppArgumentList&, CppVariant*); + // Expects the first argument to be an input element and the second argument to be a boolean. + // Forwards the setAutofilled() call to the element. + void setAutofilled(const CppArgumentList&, CppVariant*); + + // Expects the first argument to be an input element and the second argument to be a string value. + // Forwards the setValueForUser() call to the element. + void setValueForUser(const CppArgumentList&, CppVariant*); + + // LocalStorage origin-related + void deleteAllLocalStorage(const CppArgumentList&, CppVariant*); + void originsWithLocalStorage(const CppArgumentList&, CppVariant*); + void deleteLocalStorageForOrigin(const CppArgumentList&, CppVariant*); + void observeStorageTrackerNotifications(const CppArgumentList&, CppVariant*); + void syncLocalStorage(const CppArgumentList&, CppVariant*); + + // Enable or disable plugins. + void setPluginsEnabled(const CppArgumentList&, CppVariant*); + public: // The following methods are not exposed to JavaScript. void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); } @@ -365,6 +390,7 @@ public: bool shouldAddFileToPasteboard() { return m_shouldAddFileToPasteboard; } bool stopProvisionalFrameLoads() { return m_stopProvisionalFrameLoads; } bool deferMainResourceDataLoad() { return m_deferMainResourceDataLoad; } + void setShowDebugLayerTree(bool value) { m_showDebugLayerTree = value; } bool testRepaint() const { return m_testRepaint; } bool sweepHorizontally() const { return m_sweepHorizontally; } @@ -538,6 +564,9 @@ private: // If false, all new requests will not defer the main resource data load. bool m_deferMainResourceDataLoad; + // If true, we will show extended information in the graphics layer tree. + bool m_showDebugLayerTree; + WorkQueue m_workQueue; CppVariant m_globalFlag; diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp index 2574abc..4790509 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.cpp +++ b/Tools/DumpRenderTree/chromium/TestShell.cpp @@ -85,11 +85,13 @@ TestShell::TestShell(bool testShellMode) , m_devTools(0) , m_allowExternalPages(false) , m_acceleratedCompositingEnabled(false) + , m_forceCompositingMode(false) , m_accelerated2dCanvasEnabled(false) , m_stressOpt(false) , m_stressDeopt(false) , m_dumpWhenFinished(true) { + WebRuntimeFeatures::enableDataTransferItems(true); WebRuntimeFeatures::enableGeolocation(true); WebRuntimeFeatures::enableIndexedDatabase(true); WebRuntimeFeatures::enableFileSystem(true); @@ -162,6 +164,7 @@ void TestShell::resetWebSettings(WebView& webView) { m_prefs.reset(); m_prefs.acceleratedCompositingEnabled = m_acceleratedCompositingEnabled; + m_prefs.forceCompositingMode = m_forceCompositingMode; m_prefs.accelerated2dCanvasEnabled = m_accelerated2dCanvasEnabled; m_prefs.applyTo(&webView); } @@ -187,6 +190,9 @@ void TestShell::runFileTest(const TestParams& params) || testUrl.find("\\inspector\\") != string::npos) showDevTools(); + if (m_params.debugLayerTree) + m_layoutTestController->setShowDebugLayerTree(true); + if (m_dumpWhenFinished) m_printer->handleTestHeader(testUrl.c_str()); loadURL(m_params.testUrl); @@ -453,7 +459,7 @@ void TestShell::dump() if (fwrite(dataUtf8.c_str(), 1, dataUtf8.size(), stdout) != dataUtf8.size()) FATAL("Short write to stdout, disk full?\n"); } else { - printf("%s", frame->renderTreeAsText().utf8().data()); + printf("%s", frame->renderTreeAsText(m_params.debugRenderTree).utf8().data()); bool recursive = m_layoutTestController->shouldDumpChildFrameScrollPositions(); dumpFrameScrollPosition(frame, recursive); } @@ -544,14 +550,12 @@ void TestShell::dumpImage(skia::PlatformCanvas* canvas) const md5hash.append(hex); } - // Only encode and dump the png if the hashes don't match. Encoding the image - // is really expensive. + // Only encode and dump the png if the hashes don't match. Encoding the + // image is really expensive. if (md5hash.compare(m_params.pixelHash)) { std::vector<unsigned char> png; - webkit_support::EncodeBGRAPNG( - reinterpret_cast<const unsigned char*>(sourceBitmap.getPixels()), - sourceBitmap.width(), sourceBitmap.height(), - static_cast<int>(sourceBitmap.rowBytes()), discardTransparency, &png); + webkit_support::EncodeBGRAPNGWithChecksum(reinterpret_cast<const unsigned char*>(sourceBitmap.getPixels()), sourceBitmap.width(), + sourceBitmap.height(), static_cast<int>(sourceBitmap.rowBytes()), discardTransparency, md5hash, &png); m_printer->handleImage(md5hash.c_str(), m_params.pixelHash.c_str(), &png[0], png.size(), m_params.pixelFileName.c_str()); } else @@ -575,7 +579,8 @@ WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url) WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url, DRTDevToolsAgent* devToolsAgent) { WebViewHost* host = new WebViewHost(this); - WebView* view = WebView::create(host, devToolsAgent, 0); + WebView* view = WebView::create(host); + view->setDevToolsAgentClient(devToolsAgent); host->setWebWidget(view); m_prefs.applyTo(view); view->initializeMainFrame(host); diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h index ef9be7f..d84d642 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.h +++ b/Tools/DumpRenderTree/chromium/TestShell.h @@ -65,6 +65,8 @@ class DRTDevToolsClient; struct TestParams { bool dumpTree; bool dumpPixels; + bool debugRenderTree; + bool debugLayerTree; bool printSeparators; WebKit::WebURL testUrl; // Resultant image file name. Required only if the test_shell mode. @@ -74,6 +76,8 @@ struct TestParams { TestParams() : dumpTree(true) , dumpPixels(false) + , debugRenderTree(false) + , debugLayerTree(false) , printSeparators(false) {} }; @@ -125,6 +129,7 @@ public: void setAllowExternalPages(bool allowExternalPages) { m_allowExternalPages = allowExternalPages; } void setAcceleratedCompositingEnabled(bool enabled) { m_acceleratedCompositingEnabled = enabled; } + void setForceCompositingMode(bool enabled) { m_forceCompositingMode = enabled; } void setAccelerated2dCanvasEnabled(bool enabled) { m_accelerated2dCanvasEnabled = enabled; } #if defined(OS_WIN) @@ -200,6 +205,7 @@ private: int m_timeout; // timeout value in millisecond bool m_allowExternalPages; bool m_acceleratedCompositingEnabled; + bool m_forceCompositingMode; bool m_accelerated2dCanvasEnabled; WebPreferences m_prefs; bool m_stressOpt; diff --git a/Tools/DumpRenderTree/chromium/TestShellWin.cpp b/Tools/DumpRenderTree/chromium/TestShellWin.cpp index 3b3ddd9..f82771f 100644 --- a/Tools/DumpRenderTree/chromium/TestShellWin.cpp +++ b/Tools/DumpRenderTree/chromium/TestShellWin.cpp @@ -166,39 +166,11 @@ void openStartupDialog() bool checkLayoutTestSystemDependencies() { - std::list<std::string> errors; - - OSVERSIONINFOEX versionInfo; - ::ZeroMemory(&versionInfo, sizeof(OSVERSIONINFOEX)); - versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - ::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&versionInfo)); - - // Default to XP metrics, override if on Vista or win 7. - int requiredVScrollSize = 17; - int requiredFontSize = -11; // 8 pt - const wchar_t* requiredFont = L"Tahoma"; - bool isVista = false; - bool isWin7 = false; - const DWORD major = versionInfo.dwMajorVersion; - const DWORD minor = versionInfo.dwMinorVersion; - const WORD type = versionInfo.wProductType; - if (major == 6 && minor == 1 && type == VER_NT_WORKSTATION) { - requiredFont = L"Segoe UI"; - requiredFontSize = -12; - isWin7 = true; - } else if (major == 6 && !minor && type == VER_NT_WORKSTATION) { - requiredFont = L"Segoe UI"; - requiredFontSize = -12; // 9 pt - isVista = true; - } else if (!(major == 5 && minor == 1 && type == VER_NT_WORKSTATION)) { - // The above check is for XP, so that means ... - errors.push_back("Unsupported Operating System version " - "(must use XP, Vista, or Windows 7)."); - } - // This metric will be 17 when font size is "Normal". // The size of drop-down menus depends on it. int verticalScrollSize = ::GetSystemMetrics(SM_CXVSCROLL); + int requiredVScrollSize = 17; + std::list<std::string> errors; if (verticalScrollSize != requiredVScrollSize) errors.push_back("Must use normal size fonts (96 dpi)."); @@ -210,21 +182,22 @@ bool checkLayoutTestSystemDependencies() if (fontSmoothingEnabled && (fontSmoothingType == FE_FONTSMOOTHINGCLEARTYPE)) errors.push_back("ClearType must be disabled."); - // Check that we're using the default system fonts - NONCLIENTMETRICS metrics; - // Checks Vista or later. - metrics.cbSize = major >= 6 ? sizeof(NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA; + // Check that we're using the default system fonts. + OSVERSIONINFO versionInfo = {0}; + versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); + ::GetVersionEx(&versionInfo); + const bool isVistaOrLater = (versionInfo.dwMajorVersion >= 6); + NONCLIENTMETRICS metrics = {0}; + metrics.cbSize = isVistaOrLater ? (sizeof NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA; const bool success = !!::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0); ASSERT(success); LOGFONTW* systemFonts[] = {&metrics.lfStatusFont, &metrics.lfMenuFont, &metrics.lfSmCaptionFont}; - + const wchar_t* const requiredFont = isVistaOrLater ? L"Segoe UI" : L"Tahoma"; + const int requiredFontSize = isVistaOrLater ? -12 : -11; for (size_t i = 0; i < arraysize(systemFonts); ++i) { if (systemFonts[i]->lfHeight != requiredFontSize || wcscmp(requiredFont, systemFonts[i]->lfFaceName)) { - if (isVista || isWin7) - errors.push_back("Must use either the Aero or Basic theme."); - else - errors.push_back("Must use the default XP theme (Luna)."); + errors.push_back(isVistaOrLater ? "Must use either the Aero or Basic theme." : "Must use the default XP theme (Luna)."); break; } } diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.cpp b/Tools/DumpRenderTree/chromium/WebPreferences.cpp index 71f5ec7..84f84b6 100644 --- a/Tools/DumpRenderTree/chromium/WebPreferences.cpp +++ b/Tools/DumpRenderTree/chromium/WebPreferences.cpp @@ -104,6 +104,7 @@ void WebPreferences::reset() hyperlinkAuditingEnabled = false; acceleratedCompositingEnabled = false; accelerated2dCanvasEnabled = false; + forceCompositingMode = false; } void WebPreferences::applyTo(WebView* webView) @@ -149,6 +150,7 @@ void WebPreferences::applyTo(WebView* webView) webView->setTabsToLinks(tabsToLinks); settings->setCaretBrowsingEnabled(caretBrowsingEnabled); settings->setAcceleratedCompositingEnabled(acceleratedCompositingEnabled); + settings->setForceCompositingMode(forceCompositingMode); settings->setAccelerated2dCanvasEnabled(accelerated2dCanvasEnabled); // Fixed values. diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.h b/Tools/DumpRenderTree/chromium/WebPreferences.h index 50bb8cc..ad27fb8 100644 --- a/Tools/DumpRenderTree/chromium/WebPreferences.h +++ b/Tools/DumpRenderTree/chromium/WebPreferences.h @@ -78,6 +78,7 @@ struct WebPreferences { bool hyperlinkAuditingEnabled; bool caretBrowsingEnabled; bool acceleratedCompositingEnabled; + bool forceCompositingMode; bool accelerated2dCanvasEnabled; WebPreferences() { reset(); } diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp index a0ed6da..97c00e2 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp +++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp @@ -1156,6 +1156,12 @@ WebViewHost::~WebViewHost() webkit_support::QuitMessageLoop(); } +void WebViewHost::setWebWidget(WebKit::WebWidget* widget) +{ + m_webWidget = widget; + webView()->setSpellCheckClient(this); +} + WebView* WebViewHost::webView() const { ASSERT(m_webWidget); diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h index 4fc3400..014be2e 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.h +++ b/Tools/DumpRenderTree/chromium/WebViewHost.h @@ -37,6 +37,7 @@ #include "WebAccessibilityNotification.h" #include "WebCursorInfo.h" #include "WebFrameClient.h" +#include "WebSpellCheckClient.h" #include "WebViewClient.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> @@ -64,11 +65,11 @@ namespace skia { class PlatformCanvas; } -class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, public NavigationHost { +class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewClient, public WebKit::WebFrameClient, public NavigationHost { public: WebViewHost(TestShell* shell); ~WebViewHost(); - void setWebWidget(WebKit::WebWidget* widget) { m_webWidget = widget; } + void setWebWidget(WebKit::WebWidget*); WebKit::WebView* webView() const; WebKit::WebWidget* webWidget() const; void reset(); @@ -104,6 +105,11 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, // NavigationHost virtual bool navigate(const TestNavigationEntry&, bool reload); + // WebKit::WebSpellCheckClient + virtual void spellCheck(const WebKit::WebString&, int& offset, int& length); + virtual void requestCheckingOfText(const WebKit::WebString&, WebKit::WebTextCheckingCompletion*); + virtual WebKit::WebString autoCorrectWord(const WebKit::WebString&); + // WebKit::WebViewClient virtual WebKit::WebView* createView(WebKit::WebFrame*, const WebKit::WebURLRequest&, const WebKit::WebWindowFeatures&, const WebKit::WebString&); virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType); @@ -126,9 +132,6 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, virtual void didChangeContents(); virtual void didEndEditing(); virtual bool handleCurrentKeyboardEvent(); - virtual void spellCheck(const WebKit::WebString&, int& offset, int& length); - virtual void requestCheckingOfText(const WebKit::WebString&, WebKit::WebTextCheckingCompletion*); - virtual WebKit::WebString autoCorrectWord(const WebKit::WebString&); virtual void runModalAlertDialog(WebKit::WebFrame*, const WebKit::WebString&); virtual bool runModalConfirmDialog(WebKit::WebFrame*, const WebKit::WebString&); virtual bool runModalPromptDialog(WebKit::WebFrame*, const WebKit::WebString& message, const WebKit::WebString& defaultValue, WebKit::WebString* actualValue); diff --git a/Tools/DumpRenderTree/chromium/config.h b/Tools/DumpRenderTree/chromium/config.h index 7dfda18..ed3aad9 100644 --- a/Tools/DumpRenderTree/chromium/config.h +++ b/Tools/DumpRenderTree/chromium/config.h @@ -53,4 +53,7 @@ #define JS_EXPORTDATA #endif +#define WTF_EXPORT_PRIVATE JS_EXPORTDATA +#define JS_EXPORT_PRIVATE JS_EXPORTDATA + #endif // config_h diff --git a/Tools/DumpRenderTree/config.h b/Tools/DumpRenderTree/config.h index 351a2b1..90cfcf6 100644 --- a/Tools/DumpRenderTree/config.h +++ b/Tools/DumpRenderTree/config.h @@ -26,13 +26,21 @@ #include <wtf/Platform.h> -#ifdef __cplusplus -#undef new -#undef delete -#include <wtf/FastMalloc.h> -#endif +/* See note in wtf/Platform.h for more info on EXPORT_MACROS. */ +#if USE(EXPORT_MACROS) + +#include <wtf/ExportMacros.h> + +#define WTF_EXPORT_PRIVATE WTF_IMPORT +#define JS_EXPORT_PRIVATE WTF_IMPORT +#define WEBKIT_EXPORTDATA WTF_IMPORT + +#define JS_EXPORTDATA JS_EXPORT_PRIVATE +#define JS_EXPORTCLASS JS_EXPORT_PRIVATE + +#else /* !USE(EXPORT_MACROS) */ -#if OS(WINDOWS) && !COMPILER(GCC) +#if OS(WINDOWS) && !COMPILER(GCC) && !defined(BUILDING_WX__) #define JS_EXPORTDATA __declspec(dllimport) #define WEBKIT_EXPORTDATA __declspec(dllimport) #else @@ -40,6 +48,17 @@ #define WEBKIT_EXPORTDATA #endif +#define WTF_EXPORT_PRIVATE JS_EXPORTDATA +#define JS_EXPORT_PRIVATE JS_EXPORTDATA + +#endif /* USE(EXPORT_MACROS) */ + +#ifdef __cplusplus +#undef new +#undef delete +#include <wtf/FastMalloc.h> +#endif + #if PLATFORM(MAC) #define WTF_USE_CF 1 diff --git a/Tools/DumpRenderTree/gtk/AccessibilityCallbacks.cpp b/Tools/DumpRenderTree/gtk/AccessibilityCallbacks.cpp index be66513..8d73d45 100644 --- a/Tools/DumpRenderTree/gtk/AccessibilityCallbacks.cpp +++ b/Tools/DumpRenderTree/gtk/AccessibilityCallbacks.cpp @@ -92,6 +92,9 @@ static gboolean axObjectEventListener(GSignalInvocationHint *signalHint, } else if (!g_strcmp0(signal_query.signal_name, "children-changed")) { signalName.set(g_strdup_printf("children-changed = %d", g_value_get_uint(¶mValues[1]))); + } else if (!g_strcmp0(signal_query.signal_name, "property-change")) { + signalName.set(g_strdup_printf("property-change:%s", + g_quark_to_string(signalHint->detail))); } else signalName.set(g_strdup(signal_query.signal_name)); diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp index 3f70b49..f768b43 100644 --- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -2,7 +2,7 @@ * Copyright (C) 2007 Eric Seidel <eric@webkit.org> * Copyright (C) 2008 Alp Toker <alp@nuanti.com> * Copyright (C) 2009 Jan Alonzo <jmalonzo@gmail.com> - * Copyright (C) 2010 Igalia S.L. + * Copyright (C) 2010, 2011 Igalia S.L. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -137,9 +137,13 @@ static void initializeGtkFontSettings(const char* testURL) GtkSettings* settings = gtk_settings_get_default(); if (!settings) return; - g_object_set(settings, "gtk-xft-antialias", 1, + g_object_set(settings, + "gtk-xft-dpi", 98304, // This is 96 * 1024 or 96 DPI according to the GTK+ docs. + "gtk-xft-antialias", 1, "gtk-xft-hinting", 0, - "gtk-font-name", "Liberation Sans 16", NULL); + "gtk-font-name", "Liberation Sans 12", + NULL); + gdk_screen_set_resolution(gdk_screen_get_default(), 96.0); // One test needs subpixel anti-aliasing turned on, but generally we // want all text in other tests to use to grayscale anti-aliasing. @@ -419,8 +423,8 @@ static void resetDefaultsToConsistentValues() "sans-serif-font-family", "Helvetica", "cursive-font-family", "cursive", "fantasy-font-family", "fantasy", - "default-font-size", 16, - "default-monospace-font-size", 13, + "default-font-size", 12, + "default-monospace-font-size", 10, "minimum-font-size", 0, "enable-caret-browsing", FALSE, "enable-page-cache", FALSE, @@ -458,7 +462,7 @@ static void resetDefaultsToConsistentValues() setlocale(LC_ALL, ""); DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(true); - DumpRenderTreeSupportGtk::setIconDatabaseEnabled(false); + webkit_icon_database_set_path(webkit_get_icon_database(), 0); DumpRenderTreeSupportGtk::setSelectTrailingWhitespaceEnabled(false); if (axController) @@ -583,8 +587,6 @@ void dump() static void setDefaultsToConsistentStateValuesForTesting() { - gdk_screen_set_resolution(gdk_screen_get_default(), 72.0); - resetDefaultsToConsistentValues(); /* Disable the default auth dialog for testing */ @@ -598,6 +600,26 @@ static void setDefaultsToConsistentStateValuesForTesting() gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "gtkwebkitdrt", "databases", NULL); webkit_set_web_database_directory_path(databaseDirectory); g_free(databaseDirectory); + +#if defined(GTK_API_VERSION_2) + gtk_rc_parse_string("style \"nix_scrollbar_spacing\" " + "{ " + " GtkScrolledWindow::scrollbar-spacing = 0 " + "} " + "class \"GtkWidget\" style \"nix_scrollbar_spacing\""); + +#else + GtkCssProvider* cssProvider = gtk_css_provider_new(); + gtk_css_provider_load_from_data(cssProvider, + " * { " + " -GtkScrolledWindow-scrollbar-spacing: 0;" + "} ", + -1, 0); + gtk_style_context_add_provider_for_screen(gdk_display_get_default_screen(gdk_display_get_default()), + GTK_STYLE_PROVIDER(cssProvider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + g_object_unref(cssProvider); +#endif } static void sendPixelResultsEOF() @@ -1027,6 +1049,17 @@ static void frameCreatedCallback(WebKitWebView* webView, WebKitWebFrame* webFram static void willSendRequestCallback(WebKitWebView* webView, WebKitWebFrame*, WebKitWebResource*, WebKitNetworkRequest* request, WebKitNetworkResponse*) { SoupMessage* soupMessage = webkit_network_request_get_message(request); + SoupURI* uri = soup_uri_new(webkit_network_request_get_uri(request)); + + if (SOUP_URI_VALID_FOR_HTTP(uri) && g_strcmp0(uri->host, "127.0.0.1") + && g_strcmp0(uri->host, "255.255.255.255") + && g_ascii_strncasecmp(uri->host, "localhost", 9)) { + printf("Blocked access to external URL %s\n", soup_uri_to_string(uri, FALSE)); + soup_uri_free(uri); + return; + } + soup_uri_free(uri); + if (soupMessage) { const set<string>& clearHeaders = gLayoutTestController->willSendRequestClearHeaders(); diff --git a/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index 77d6ae1..c26e2db 100644 --- a/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -332,9 +332,9 @@ void LayoutTestController::setUserStyleSheetLocation(JSStringRef path) setUserStyleSheetEnabled(true); } -void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef element, JSStringRef value) +void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value) { - // FIXME: implement + DumpRenderTreeSupportGtk::setValueForUser(context, nodeObject, value); } void LayoutTestController::setViewModeMediaFeature(JSStringRef mode) @@ -458,6 +458,11 @@ void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag) // FIXME: implement } +void LayoutTestController::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool isAutofilled) +{ + DumpRenderTreeSupportGtk::setAutofilled(context, nodeObject, isAutofilled); +} + void LayoutTestController::disableImageLoading() { // FIXME: Implement for testing fix for https://bugs.webkit.org/show_bug.cgi?id=27896 @@ -488,6 +493,12 @@ void LayoutTestController::setGeolocationPermission(bool allow) setGeolocationPermissionCommon(allow); } +int LayoutTestController::numberOfPendingGeolocationPermissionRequests() +{ + // FIXME: Implement for Geolocation layout tests. + return -1; +} + void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language) { // FIXME: Implement for speech input layout tests. @@ -496,7 +507,12 @@ void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double c void LayoutTestController::setIconDatabaseEnabled(bool enabled) { - DumpRenderTreeSupportGtk::setIconDatabaseEnabled(enabled); + WebKitIconDatabase* database = webkit_get_icon_database(); + if (enabled) { + GOwnPtr<gchar> iconDatabasePath(g_build_filename(g_get_tmp_dir(), "DumpRenderTree", "icondatabase", NULL)); + webkit_icon_database_set_path(database, iconDatabasePath.get()); + } else + webkit_icon_database_set_path(database, 0); } void LayoutTestController::setJavaScriptProfilingEnabled(bool flag) @@ -627,12 +643,23 @@ void LayoutTestController::clearPersistentUserStyleSheet() void LayoutTestController::clearAllApplicationCaches() { - // FIXME: implement to support Application Cache quotas. + // FIXME: Implement to support application cache quotas. } void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quota) { - // FIXME: implement to support Application Cache quotas. + // FIXME: Implement to support application cache quotas. +} + +void LayoutTestController::clearApplicationCacheForOrigin(OpaqueJSString*) +{ + // FIXME: Implement to support deleting all application caches for an origin. +} + +JSValueRef LayoutTestController::originsWithApplicationCache(JSContextRef context) +{ + // FIXME: Implement to get origins that contain application caches. + return JSValueMakeUndefined(context); } void LayoutTestController::clearAllDatabases() @@ -646,6 +673,32 @@ void LayoutTestController::setDatabaseQuota(unsigned long long quota) webkit_security_origin_set_web_database_quota(origin, quota); } +JSValueRef LayoutTestController::originsWithLocalStorage(JSContextRef context) +{ + // FIXME: implement + return JSValueMakeUndefined(context); +} + +void LayoutTestController::deleteAllLocalStorage() +{ + // FIXME: implement +} + +void LayoutTestController::deleteLocalStorageForOrigin(JSStringRef originIdentifier) +{ + // FIXME: implement +} + +void LayoutTestController::observeStorageTrackerNotifications(unsigned number) +{ + // FIXME: implement +} + +void LayoutTestController::syncLocalStorage() +{ + // FIXME: implement +} + void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool, JSStringRef) { // FIXME: implement @@ -873,6 +926,11 @@ bool LayoutTestController::hasSpellingMarker(int from, int length) return DumpRenderTreeSupportGtk::webkitWebFrameSelectionHasSpellingMarker(mainFrame, from, length); } +bool LayoutTestController::hasGrammarMarker(int from, int length) +{ + return false; +} + void LayoutTestController::dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight) { WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); diff --git a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig index 28a0518..8463985 100644 --- a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig +++ b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig @@ -52,12 +52,16 @@ TARGET_GCC_VERSION_1050_ = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_ACTUAL)); TARGET_GCC_VERSION_1050_0310 = GCC_42; TARGET_GCC_VERSION_1050_0320 = GCC_42; TARGET_GCC_VERSION_1060 = GCC_42; -TARGET_GCC_VERSION_1070 = LLVM_GCC_42; +TARGET_GCC_VERSION_1070 = $(TARGET_GCC_VERSION_1070_$(CONFIGURATION)); +TARGET_GCC_VERSION_1070_Debug = LLVM_COMPILER; +TARGET_GCC_VERSION_1070_Release = LLVM_GCC_42; +TARGET_GCC_VERSION_1070_Production = LLVM_GCC_42; GCC_VERSION = $(GCC_VERSION_$(TARGET_GCC_VERSION)); GCC_VERSION_GCC_40 = 4.0; GCC_VERSION_GCC_42 = 4.2; GCC_VERSION_LLVM_GCC_42 = com.apple.compilers.llvmgcc42; +GCC_VERSION_LLVM_COMPILER = com.apple.compilers.llvm.clang.1_0; // If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm index dca0d38..207e8fb 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm @@ -48,6 +48,7 @@ #import "PixelDumpSupport.h" #import "PolicyDelegate.h" #import "ResourceLoadDelegate.h" +#import "StorageTrackerDelegate.h" #import "UIDelegate.h" #import "WebArchiveDumpSupport.h" #import "WorkQueue.h" @@ -77,6 +78,7 @@ #import <WebKit/WebPreferencesPrivate.h> #import <WebKit/WebPreferenceKeysPrivate.h> #import <WebKit/WebResourceLoadDelegate.h> +#import <WebKit/WebStorageManagerPrivate.h> #import <WebKit/WebTypesInternal.h> #import <WebKit/WebViewPrivate.h> #import <getopt.h> @@ -134,6 +136,7 @@ static EditingDelegate *editingDelegate; static ResourceLoadDelegate *resourceLoadDelegate; static HistoryDelegate *historyDelegate; PolicyDelegate *policyDelegate; +StorageTrackerDelegate *storageDelegate; static int dumpPixels; static int threaded; @@ -303,6 +306,9 @@ WebView *createWebViewAndOffscreenWindow() [WebView registerURLSchemeAsLocal:@"feedsearch"]; [webView setContinuousSpellCheckingEnabled:YES]; + [webView setGrammarCheckingEnabled:YES]; + [webView setInteractiveFormValidationEnabled:YES]; + [webView setValidationMessageTimerMagnification:-1]; // To make things like certain NSViews, dragging, and plug-ins work, put the WebView a window, but put it off-screen so you don't see it. // Put it at -10000, -10000 in "flipped coordinates", since WebCore and the DOM use flipped coordinates. @@ -414,6 +420,7 @@ static void resetDefaultsToConsistentValues() NSString *path = libraryPathForDumpRenderTree(); [defaults setObject:[path stringByAppendingPathComponent:@"Databases"] forKey:WebDatabaseDirectoryDefaultsKey]; + [defaults setObject:[path stringByAppendingPathComponent:@"LocalStorage"] forKey:WebStorageDirectoryDefaultsKey]; [defaults setObject:[path stringByAppendingPathComponent:@"LocalCache"] forKey:WebKitLocalCacheDefaultsKey]; WebPreferences *preferences = [WebPreferences standardPreferences]; @@ -545,6 +552,7 @@ static void allocateGlobalControllers() resourceLoadDelegate = [[ResourceLoadDelegate alloc] init]; policyDelegate = [[PolicyDelegate alloc] init]; historyDelegate = [[HistoryDelegate alloc] init]; + storageDelegate = [[StorageTrackerDelegate alloc] init]; } // ObjC++ doens't seem to let me pass NSObject*& sadly. @@ -562,6 +570,7 @@ static void releaseGlobalControllers() releaseAndZero(&resourceLoadDelegate); releaseAndZero(&uiDelegate); releaseAndZero(&policyDelegate); + releaseAndZero(&storageDelegate); } static void initializeGlobalsFromCommandLineOptions(int argc, const char *argv[]) diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h b/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h index 36c5eac..901008c 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h +++ b/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h @@ -35,6 +35,7 @@ @class DumpRenderTreeDraggingInfo; @class NavigationController; @class PolicyDelegate; +@class StorageTrackerDelegate; @class WebFrame; @class WebScriptWorld; @class WebView; @@ -42,6 +43,7 @@ class DumpRenderTreeDraggingInfo; class NavigationController; class PolicyDelegate; +class StorageTrackerDelegate; class WebFrame; class WebScriptWorld; class WebView; @@ -54,6 +56,7 @@ extern WebFrame* topLoadingFrame; extern DumpRenderTreeDraggingInfo *draggingInfo; extern NavigationController* gNavigationController; extern PolicyDelegate* policyDelegate; +extern StorageTrackerDelegate* storageDelegate; extern const unsigned maxViewHeight; extern const unsigned maxViewWidth; diff --git a/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm index 72ec759..66c0cce 100644 --- a/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -33,6 +33,7 @@ #import "EditingDelegate.h" #import "MockGeolocationProvider.h" #import "PolicyDelegate.h" +#import "StorageTrackerDelegate.h" #import "UIDelegate.h" #import "WorkQueue.h" #import "WorkQueueItem.h" @@ -66,6 +67,7 @@ #import <WebKit/WebQuotaManager.h> #import <WebKit/WebScriptWorld.h> #import <WebKit/WebSecurityOriginPrivate.h> +#import <WebKit/WebStorageManagerPrivate.h> #import <WebKit/WebTypesInternal.h> #import <WebKit/WebView.h> #import <WebKit/WebViewPrivate.h> @@ -133,11 +135,68 @@ void LayoutTestController::clearAllApplicationCaches() [WebApplicationCache deleteAllApplicationCaches]; } +void LayoutTestController::syncLocalStorage() +{ + [[WebStorageManager sharedWebStorageManager] syncLocalStorage]; +} + +void LayoutTestController::observeStorageTrackerNotifications(unsigned number) +{ + [storageDelegate logNotifications:number controller:this]; +} + +void LayoutTestController::clearApplicationCacheForOrigin(JSStringRef url) +{ + RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url)); + + WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]]; + [WebApplicationCache deleteCacheForOrigin:origin]; + [origin release]; +} + +JSValueRef originsArrayToJS(JSContextRef context, NSArray* origins) +{ + NSUInteger count = [origins count]; + + JSValueRef jsOriginsArray[count]; + for (NSUInteger i = 0; i < count; i++) { + NSString *origin = [[origins objectAtIndex:i] databaseIdentifier]; + JSRetainPtr<JSStringRef> originJS(Adopt, JSStringCreateWithCFString((CFStringRef)origin)); + jsOriginsArray[i] = JSValueMakeString(context, originJS.get()); + } + + return JSObjectMakeArray(context, count, jsOriginsArray, NULL); +} + +JSValueRef LayoutTestController::originsWithApplicationCache(JSContextRef context) +{ + return originsArrayToJS(context, [WebApplicationCache originsWithCache]); +} + void LayoutTestController::clearAllDatabases() { [[WebDatabaseManager sharedWebDatabaseManager] deleteAllDatabases]; } +void LayoutTestController::deleteAllLocalStorage() +{ + [[WebStorageManager sharedWebStorageManager] deleteAllOrigins]; +} + +JSValueRef LayoutTestController::originsWithLocalStorage(JSContextRef context) +{ + return originsArrayToJS(context, [[WebStorageManager sharedWebStorageManager] origins]); +} + +void LayoutTestController::deleteLocalStorageForOrigin(JSStringRef URL) +{ + RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, URL)); + + WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]]; + [[WebStorageManager sharedWebStorageManager] deleteOrigin:origin]; + [origin release]; +} + void LayoutTestController::clearBackForwardList() { WebBackForwardList *backForwardList = [[mainFrame webView] backForwardList]; @@ -254,6 +313,11 @@ int LayoutTestController::numberOfPages(float pageWidthInPixels, float pageHeigh return [mainFrame numberOfPages:pageWidthInPixels:pageHeightInPixels]; } +int LayoutTestController::numberOfPendingGeolocationPermissionRequests() +{ + return [[[mainFrame webView] UIDelegate] numberOfPendingGeolocationPermissionRequests]; +} + size_t LayoutTestController::webHistoryItemCount() { return [[[WebHistory optionalSharedHistory] allItems] count]; @@ -320,6 +384,15 @@ void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag) [[[mainFrame webView] preferences] setAuthorAndUserStylesEnabled:flag]; } +void LayoutTestController::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled) +{ + DOMElement *element = [DOMElement _DOMElementFromJSContext:context value:nodeObject]; + if (!element || ![element isKindOfClass:[DOMHTMLInputElement class]]) + return; + + [(DOMHTMLInputElement *)element _setAutofilled:autofilled]; +} + void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permissive) { if (setDelegate) { @@ -484,7 +557,7 @@ void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef node DOMElement *element = [DOMElement _DOMElementFromJSContext:context value:nodeObject]; if (!element || ![element isKindOfClass:[DOMHTMLInputElement class]]) return; - + RetainPtr<CFStringRef> valueCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, value)); [(DOMHTMLInputElement *)element _setValueForUser:(NSString *)valueCF.get()]; } @@ -926,8 +999,8 @@ static NSString *SynchronousLoaderRunLoopMode = @"DumpRenderTreeSynchronousLoade - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { if ([challenge previousFailureCount] == 0) { - NSURLCredential *credential = [[NSURLCredential alloc] initWithUser:m_username password:m_password persistence:NSURLCredentialPersistenceForSession]; - [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; + RetainPtr<NSURLCredential> credential(AdoptNS, [[NSURLCredential alloc] initWithUser:m_username password:m_password persistence:NSURLCredentialPersistenceForSession]); + [[challenge sender] useCredential:credential.get() forAuthenticationChallenge:challenge]; return; } [[challenge sender] cancelAuthenticationChallenge:challenge]; @@ -977,9 +1050,9 @@ void LayoutTestController::authenticateSession(JSStringRef url, JSStringRef user RetainPtr<CFStringRef> usernameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, username)); RetainPtr<CFStringRef> passwordCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, password)); - NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:(NSString *)urlStringCF.get()]]; + RetainPtr<NSURLRequest> request(AdoptNS, [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:(NSString *)urlStringCF.get()]]); - [SynchronousLoader makeRequest:request withUsername:(NSString *)usernameCF.get() password:(NSString *)passwordCF.get()]; + [SynchronousLoader makeRequest:request.get() withUsername:(NSString *)usernameCF.get() password:(NSString *)passwordCF.get()]; #endif } @@ -1004,6 +1077,12 @@ bool LayoutTestController::hasSpellingMarker(int from, int length) { return [mainFrame hasSpellingMarker:from length:length]; } + +bool LayoutTestController::hasGrammarMarker(int from, int length) +{ + return [mainFrame hasGrammarMarker:from length:length]; +} + void LayoutTestController::dumpConfigurationForViewport(int /*deviceDPI*/, int /*deviceWidth*/, int /*deviceHeight*/, int /*availableWidth*/, int /*availableHeight*/) { diff --git a/Tools/DumpRenderTree/mac/PerlSupport/Makefile b/Tools/DumpRenderTree/mac/PerlSupport/Makefile index 16a9e51..96ddc93 100644 --- a/Tools/DumpRenderTree/mac/PerlSupport/Makefile +++ b/Tools/DumpRenderTree/mac/PerlSupport/Makefile @@ -66,7 +66,7 @@ $(PERL_MODULE): DumpRenderTreeSupportPregenerated.pm $(DUMPRENDERTREE) endif $(DYLIB): DumpRenderTreeSupport.c $(WRAPPER) - gcc -g -dynamiclib -o $(DYLIB) `$(PERL) -MExtUtils::Embed -eperl_inc` `$(PERL) -MExtUtils::Embed -eldopts` $^ + gcc -g -dynamiclib -o $(DYLIB) `$(PERL) -MExtUtils::Embed -eperl_inc` `$(PERL) -MExtUtils::Embed -e'my $$opts = ldopts(0); $$opts =~ s/-arch [^ ]*( |$$)//g; print $$opts, " -arch ", join(" -arch ", split(" ",$$ENV{ARCHS}))'` $^ clean: rm -f $(WRAPPER) $(PERL_MODULE) $(DYLIB) diff --git a/Tools/DumpRenderTree/mac/UIDelegate.h b/Tools/DumpRenderTree/mac/UIDelegate.h index a8017ad..982b480 100644 --- a/Tools/DumpRenderTree/mac/UIDelegate.h +++ b/Tools/DumpRenderTree/mac/UIDelegate.h @@ -37,5 +37,6 @@ } - (void)didSetMockGeolocationPermission; +- (int)numberOfPendingGeolocationPermissionRequests; @end diff --git a/Tools/DumpRenderTree/mac/UIDelegate.mm b/Tools/DumpRenderTree/mac/UIDelegate.mm index 06a71f8..6b84738 100644 --- a/Tools/DumpRenderTree/mac/UIDelegate.mm +++ b/Tools/DumpRenderTree/mac/UIDelegate.mm @@ -205,6 +205,14 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil; m_timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(timerFired) userInfo:0 repeats:NO]; } +- (int)numberOfPendingGeolocationPermissionRequests +{ + if (!m_pendingGeolocationPermissionListeners) + return 0; + return [m_pendingGeolocationPermissionListeners count]; +} + + - (void)timerFired { ASSERT(gLayoutTestController->isGeolocationPermissionSet()); @@ -227,7 +235,7 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil; return NO; } -- (BOOL)webView:(WebView *)webView supportsFullScreenForElement:(DOMElement*)element +- (BOOL)webView:(WebView *)webView supportsFullScreenForElement:(DOMElement*)element withKeyboard:(BOOL)withKeyboard { return YES; } diff --git a/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm b/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm index c273087..9f94ecb 100644 --- a/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm +++ b/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm @@ -23,6 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "WebArchiveDumpSupport.h" #import <CFNetwork/CFHTTPMessage.h> diff --git a/Tools/DumpRenderTree/qt/DumpRenderTree.pro b/Tools/DumpRenderTree/qt/DumpRenderTree.pro index d84af96..a76b886 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTree.pro +++ b/Tools/DumpRenderTree/qt/DumpRenderTree.pro @@ -9,6 +9,7 @@ include(../../../Source/WebKit.pri) INCLUDEPATH += ../../../Source INCLUDEPATH += ../../../Source/JavaScriptCore INCLUDEPATH += ../../../Source/JavaScriptCore/ForwardingHeaders +INCLUDEPATH += ../../../Source/WebKit/qt/WebCoreSupport INCLUDEPATH += $$BASEDIR DESTDIR = ../../bin @@ -51,3 +52,4 @@ wince*: { } DEFINES += USE_SYSTEM_MALLOC=1 +DEFINES -= QT_ASCII_CAST_WARNINGS diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index 6af6fc2..97d9f20 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -32,7 +32,7 @@ #include "config.h" #include "DumpRenderTreeQt.h" -#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "DumpRenderTreeSupportQt.h" #include "EventSenderQt.h" #include "GCControllerQt.h" #include "LayoutTestControllerQt.h" @@ -499,6 +499,10 @@ DumpRenderTree::DumpRenderTree() DumpRenderTree::~DumpRenderTree() { + if (!m_redirectOutputFileName.isEmpty()) + fclose(stdout); + if (!m_redirectErrorFileName.isEmpty()) + fclose(stderr); delete m_mainView; delete m_stdin; DumpRenderTreeSupportQt::removeMockDeviceOrientation(); @@ -676,9 +680,7 @@ void DumpRenderTree::processArgsLine(const QStringList &args) { setStandAloneMode(true); - for (int i = 1; i < args.size(); ++i) - if (!args.at(i).startsWith('-')) - m_standAloneModeTestList.append(args[i]); + m_standAloneModeTestList = args; QFileInfo firstEntry(m_standAloneModeTestList.first()); if (firstEntry.isDir()) { @@ -690,11 +692,12 @@ void DumpRenderTree::processArgsLine(const QStringList &args) for (int i = 0; i < m_standAloneModeTestList.size(); ++i) m_standAloneModeTestList[i] = folderEntry.absoluteFilePath(m_standAloneModeTestList[i]); } - - processLine(m_standAloneModeTestList.first()); - m_standAloneModeTestList.removeFirst(); - connect(this, SIGNAL(ready()), this, SLOT(loadNextTestInStandAloneMode())); + + if (!m_standAloneModeTestList.isEmpty()) { + QString first = m_standAloneModeTestList.takeFirst(); + processLine(first); + } } void DumpRenderTree::loadNextTestInStandAloneMode() @@ -703,9 +706,8 @@ void DumpRenderTree::loadNextTestInStandAloneMode() emit quit(); return; } - - processLine(m_standAloneModeTestList.first()); - m_standAloneModeTestList.removeFirst(); + QString first = m_standAloneModeTestList.takeFirst(); + processLine(first); } void DumpRenderTree::processLine(const QString &input) diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h index 5b53cd9..858856f 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -40,7 +40,7 @@ #include <QSslError> #endif -#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "DumpRenderTreeSupportQt.h" #include <qgraphicsview.h> #include <qgraphicswebview.h> #include <qwebframe.h> @@ -105,6 +105,8 @@ public: static void initializeFonts(); #endif void processArgsLine(const QStringList&); + void setRedirectOutputFileName(const QString& fileName) { m_redirectOutputFileName = fileName; } + void setRedirectErrorFileName(const QString& fileName) { m_redirectErrorFileName = fileName; } public Q_SLOTS: void initJSObjects(); @@ -160,6 +162,8 @@ private: bool m_standAloneMode; bool m_graphicsBased; QString m_persistentStoragePath; + QString m_redirectOutputFileName; + QString m_redirectErrorFileName; }; class NetworkAccessManager : public QNetworkAccessManager { diff --git a/Tools/DumpRenderTree/qt/GCControllerQt.cpp b/Tools/DumpRenderTree/qt/GCControllerQt.cpp index 2a30ba8..a2e5e0c 100644 --- a/Tools/DumpRenderTree/qt/GCControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/GCControllerQt.cpp @@ -29,7 +29,7 @@ #include "config.h" #include "GCControllerQt.h" -#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "DumpRenderTreeSupportQt.h" #include <qwebpage.h> diff --git a/Tools/DumpRenderTree/qt/ImageDiff.pro b/Tools/DumpRenderTree/qt/ImageDiff.pro index cdb067e..b3d5181 100644 --- a/Tools/DumpRenderTree/qt/ImageDiff.pro +++ b/Tools/DumpRenderTree/qt/ImageDiff.pro @@ -14,3 +14,4 @@ unix:!mac { QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR } +DEFINES -= QT_ASCII_CAST_WARNINGS diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index 74055e2..4e3087e 100644 --- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -28,7 +28,7 @@ */ #include "config.h" #include "LayoutTestControllerQt.h" -#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "DumpRenderTreeSupportQt.h" #include "DumpRenderTreeQt.h" #include "WorkQueue.h" @@ -315,9 +315,12 @@ void LayoutTestController::queueLoad(const QString& url, const QString& target) WorkQueue::shared()->queue(new LoadItem(absoluteUrl, target, m_drt->webPage())); } -void LayoutTestController::queueLoadHTMLString(const QString& content, const QString& baseURL) +void LayoutTestController::queueLoadHTMLString(const QString& content, const QString& baseURL, const QString& failingURL) { - WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL, m_drt->webPage())); + if (failingURL.isEmpty()) + WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL, m_drt->webPage())); + else + WorkQueue::shared()->queue(new LoadAlternateHTMLStringItem(content, baseURL, failingURL, m_drt->webPage())); } void LayoutTestController::queueReload() @@ -552,6 +555,11 @@ void LayoutTestController::clearAllApplicationCaches() DumpRenderTreeSupportQt::clearAllApplicationCaches(); } +void LayoutTestController::clearApplicationCacheForOrigin(const QString& url) +{ + // FIXME: Implement to support deleting all application caches for an origin. +} + void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quota) { if (!m_topLoadingFrame) @@ -559,6 +567,12 @@ void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quo m_topLoadingFrame->securityOrigin().setApplicationCacheQuota(quota); } +QStringList LayoutTestController::originsWithApplicationCache() +{ + // FIXME: Implement to get origins that have application caches. + return QStringList(); +} + void LayoutTestController::setDatabaseQuota(int size) { if (!m_topLoadingFrame) @@ -766,6 +780,12 @@ void LayoutTestController::setGeolocationPermission(bool allow) DumpRenderTreeSupportQt::setMockGeolocationPermission(m_drt->webPage(), allow); } +int LayoutTestController::numberOfPendingGeolocationPermissionRequests() +{ + // FIXME: Implement for Geolocation layout tests. + return -1; +} + void LayoutTestController::setGeolocationPermissionCommon(bool allow) { m_isGeolocationPermissionSet = true; @@ -842,5 +862,30 @@ void LayoutTestController::setMinimumTimerInterval(double minimumTimerInterval) DumpRenderTreeSupportQt::setMinimumTimerInterval(m_drt->webPage(), minimumTimerInterval); } +void LayoutTestController::originsWithLocalStorage() +{ + // FIXME: Implement. +} + +void LayoutTestController::deleteAllLocalStorage() +{ + // FIXME: Implement. +} + +void LayoutTestController::deleteLocalStorageForOrigin(const QString& originIdentifier) +{ + // FIXME: Implement. +} + +void LayoutTestController::observeStorageTrackerNotifications(unsigned number) +{ + // FIXME: Implement. +} + +void LayoutTestController::syncLocalStorage() +{ + // FIXME: Implement. +} + const unsigned LayoutTestController::maxViewWidth = 800; const unsigned LayoutTestController::maxViewHeight = 600; diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h index 0b5bbba..f29233a 100644 --- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h +++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -121,7 +121,7 @@ public slots: void queueBackNavigation(int howFarBackward); void queueForwardNavigation(int howFarForward); void queueLoad(const QString& url, const QString& target = QString()); - void queueLoadHTMLString(const QString& content, const QString& baseURL = QString()); + void queueLoadHTMLString(const QString& content, const QString& baseURL = QString(), const QString& failingURL = QString()); void queueReload(); void queueLoadingScript(const QString& script); void queueNonLoadingScript(const QString& script); @@ -189,7 +189,9 @@ public slots: void disableImageLoading(); void clearAllApplicationCaches(); + void clearApplicationCacheForOrigin(const QString& url); void setApplicationCacheOriginQuota(unsigned long long quota); + QStringList originsWithApplicationCache(); void setDatabaseQuota(int size); void clearAllDatabases(); @@ -219,6 +221,7 @@ public slots: void setMockGeolocationError(int code, const QString& message); void setMockGeolocationPosition(double latitude, double longitude, double accuracy); void setGeolocationPermission(bool allow); + int numberOfPendingGeolocationPermissionRequests(); bool isGeolocationPermissionSet() const { return m_isGeolocationPermissionSet; } bool geolocationPermission() const { return m_geolocationPermission; } @@ -253,6 +256,12 @@ public slots: void addUserStyleSheet(const QString& sourceCode); void setMinimumTimerInterval(double); + + void originsWithLocalStorage(); + void deleteAllLocalStorage(); + void deleteLocalStorageForOrigin(const QString& originIdentifier); + void observeStorageTrackerNotifications(unsigned number); + void syncLocalStorage(); private slots: void processWork(); diff --git a/Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp b/Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp index 729ccd0..dd63fea 100644 --- a/Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp @@ -28,7 +28,7 @@ #include "config.h" #include "PlainTextControllerQt.h" -#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "DumpRenderTreeSupportQt.h" #include <QApplication> #include <QInputMethodEvent> #include <QKeyEvent> diff --git a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro index 96f0fc5..6741668 100644 --- a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro +++ b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro @@ -32,6 +32,7 @@ SOURCES = PluginObject.cpp \ Tests/EvaluateJSAfterRemovingPluginElement.cpp \ Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp \ Tests/GetUserAgentWithNullNPPFromNPPNew.cpp \ + Tests/NPDeallocateCalledBeforeNPShutdown.cpp \ Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \ Tests/NPRuntimeRemoveProperty.cpp \ Tests/NullNPPGetValuePointer.cpp \ @@ -46,6 +47,8 @@ mac { SOURCES += ../../unix/TestNetscapePlugin/TestNetscapePlugin.cpp } +DEFINES -= QT_ASCII_CAST_WARNINGS + !win32:!embedded:!mac:!symbian { LIBS += -lX11 } diff --git a/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp b/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp index 9112674..8cf2e4e 100644 --- a/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp @@ -28,7 +28,7 @@ */ #include "config.h" #include "TextInputControllerQt.h" -#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "DumpRenderTreeSupportQt.h" #include <QApplication> #include <QInputMethodEvent> diff --git a/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp b/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp index d1baf08..b093366 100644 --- a/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp +++ b/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp @@ -28,6 +28,7 @@ */ #include "config.h" #include "WorkQueueItemQt.h" +#include "DumpRenderTreeSupportQt.h" QWebFrame* findFrameNamed(const QString& frameName, QWebFrame* frame) { @@ -72,6 +73,18 @@ bool LoadHTMLStringItem::invoke() const return true; } +bool LoadAlternateHTMLStringItem::invoke() const +{ + Q_ASSERT(m_webPage); + + QWebFrame* frame = m_webPage->mainFrame(); + if (!frame) + return false; + + DumpRenderTreeSupportQt::setAlternateHtml(frame, m_content, QUrl(m_baseURL), QUrl(m_failingURL)); + return true; +} + bool ReloadItem::invoke() const { //qDebug() << ">>>ReloadItem::invoke"; diff --git a/Tools/DumpRenderTree/qt/WorkQueueItemQt.h b/Tools/DumpRenderTree/qt/WorkQueueItemQt.h index 97c9b04..ac7d1b3 100644 --- a/Tools/DumpRenderTree/qt/WorkQueueItemQt.h +++ b/Tools/DumpRenderTree/qt/WorkQueueItemQt.h @@ -80,6 +80,24 @@ private: QString m_baseURL; }; +class LoadAlternateHTMLStringItem : public WorkQueueItem { +public: + LoadAlternateHTMLStringItem(const QString& content, const QString& baseURL, const QString &failingURL, QWebPage *page) + : WorkQueueItem(page) + , m_content(content) + , m_baseURL(baseURL) + , m_failingURL(failingURL) + { + } + +private: + virtual bool invoke() const; + + QString m_content; + QString m_baseURL; + QString m_failingURL; +}; + class ReloadItem : public WorkQueueItem { public: ReloadItem(QWebPage *page) diff --git a/Tools/DumpRenderTree/qt/main.cpp b/Tools/DumpRenderTree/qt/main.cpp index 8349d73..bc762e5 100644 --- a/Tools/DumpRenderTree/qt/main.cpp +++ b/Tools/DumpRenderTree/qt/main.cpp @@ -67,6 +67,33 @@ void messageHandler(QtMsgType type, const char *message) // do nothing } +// We only support -v or --pixel-tests or --stdout or --stderr or -, all the others will be +// pass as test case name (even -abc.html is a valid test case name) +bool isOption(const QString& str) +{ + return str == QString("-v") || str == QString("--pixel-tests") + || str == QString("--stdout") || str == QString("--stderr") + || str == QString("-"); +} + +QString takeOptionValue(QStringList& arguments, int index) +{ + QString result; + + if (index + 1 < arguments.count() && !isOption(arguments.at(index + 1))) + result = arguments.takeAt(index + 1); + arguments.removeAt(index); + + return result; +} + +void printUsage() +{ + fprintf(stderr, "Usage: DumpRenderTree [-v|--pixel-tests] [--stdout output_filename] [-stderr error_filename] filename [filename2..n]\n"); + fprintf(stderr, "Or folder containing test files: DumpRenderTree [-v|--pixel-tests] dirpath\n"); + fflush(stderr); +} + QString get_backtrace() { QString s; @@ -143,28 +170,70 @@ int main(int argc, char* argv[]) QStringList args = app.arguments(); if (args.count() < 2) { - qDebug() << "Usage: DumpRenderTree [-v|--pixel-tests] filename [filename2..n]"; - qDebug() << "Or folder containing test files: DumpRenderTree [-v|--pixel-tests] dirpath"; - exit(0); + printUsage(); + exit(1); } + // Remove the first arguments, it is application name itself + args.removeAt(0); + // Suppress debug output from Qt if not started with -v - if (!args.contains(QLatin1String("-v"))) + int index = args.indexOf(QLatin1String("-v")); + if (index == -1) qInstallMsgHandler(messageHandler); + else + args.removeAt(index); WebCore::DumpRenderTree dumper; - if (args.contains(QLatin1String("--pixel-tests"))) + index = args.indexOf(QLatin1String("--pixel-tests")); + if (index != -1) { dumper.setDumpPixels(true); + args.removeAt(index); + } + index = args.indexOf(QLatin1String("--stdout")); + if (index != -1) { + QString fileName = takeOptionValue(args, index); + dumper.setRedirectOutputFileName(fileName); + if (fileName.isEmpty() || !freopen(qPrintable(fileName), "w", stdout)) { + fprintf(stderr, "STDOUT redirection failed."); + exit(1); + } + } + index = args.indexOf(QLatin1String("--stderr")); + if (index != -1) { + QString fileName = takeOptionValue(args, index); + dumper.setRedirectErrorFileName(fileName); + if (!freopen(qPrintable(fileName), "w", stderr)) { + fprintf(stderr, "STDERR redirection failed."); + exit(1); + } + } QWebDatabase::removeAllDatabases(); - if (args.contains(QLatin1String("-"))) { - QObject::connect(&dumper, SIGNAL(ready()), &dumper, SLOT(readLine()), Qt::QueuedConnection); - QTimer::singleShot(0, &dumper, SLOT(readLine())); - } else + index = args.indexOf(QLatin1String("-")); + if (index != -1) { + args.removeAt(index); + + // Continue waiting in STDIN for more test case after process one test case + QObject::connect(&dumper, SIGNAL(ready()), &dumper, SLOT(readLine()), Qt::QueuedConnection); + + // Read and only read the first test case, ignore the others + if (args.size() > 0) { + // Process the argument first + dumper.processLine(args[0]); + } else + QTimer::singleShot(0, &dumper, SLOT(readLine())); + } else { + // Go into standalone mode + // Standalone mode need at least one test case + if (args.count() < 1) { + printUsage(); + exit(1); + } dumper.processArgsLine(args); - + } return app.exec(); #ifdef Q_WS_X11 diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj index ca26cb8..39d2df2 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj +++ b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj @@ -18,7 +18,7 @@ <Configuration Name="Debug|Win32" ConfigurationType="1" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeApple.vsprops" + InheritedPropertySheets=".\DumpRenderTreeDebug.vsprops" CharacterSet="1" > <Tool @@ -79,7 +79,7 @@ <Configuration Name="Release|Win32" ConfigurationType="1" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeApple.vsprops" + InheritedPropertySheets=".\DumpRenderTreeRelease.vsprops" CharacterSet="1" > <Tool @@ -140,7 +140,7 @@ <Configuration Name="Debug_Cairo_CFLite|Win32" ConfigurationType="1" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\cURL.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeCairo.vsprops;.\DumpRenderTreeCFLite.vsprops" + InheritedPropertySheets=".\DumpRenderTreeDebugCairoCFLite.vsprops" CharacterSet="1" > <Tool @@ -201,7 +201,7 @@ <Configuration Name="Release_Cairo_CFLite|Win32" ConfigurationType="1" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\cURL.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeCairo.vsprops;.\DumpRenderTreeCFLite.vsprops" + InheritedPropertySheets=".\DumpRenderTreeReleaseCairoCFLite.vsprops" CharacterSet="1" > <Tool @@ -262,7 +262,7 @@ <Configuration Name="Debug_All|Win32" ConfigurationType="1" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeApple.vsprops" + InheritedPropertySheets=".\DumpRenderTreeDebugAll.vsprops" CharacterSet="1" > <Tool @@ -321,9 +321,9 @@ /> </Configuration> <Configuration - Name="Release_LTCG|Win32" + Name="Production|Win32" ConfigurationType="1" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeApple.vsprops" + InheritedPropertySheets=".\DumpRenderTreeProduction.vsprops" CharacterSet="1" WholeProgramOptimization="1" > @@ -610,7 +610,7 @@ /> </FileConfiguration> <FileConfiguration - Name="Release_LTCG|Win32" + Name="Production|Win32" ExcludedFromBuild="true" > <Tool @@ -646,7 +646,7 @@ /> </FileConfiguration> <FileConfiguration - Name="Release_LTCG|Win32" + Name="Production|Win32" ExcludedFromBuild="true" > <Tool diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeDebug.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeDebug.vsprops new file mode 100644 index 0000000..adfa61f --- /dev/null +++ b/Tools/DumpRenderTree/win/DumpRenderTreeDebug.vsprops @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="DumpRenderTreeDebug" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops; + .\DumpRenderTreeCommon.vsprops; + .\DumpRenderTreeApple.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeDebugAll.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeDebugAll.vsprops new file mode 100644 index 0000000..aa3db54 --- /dev/null +++ b/Tools/DumpRenderTree/win/DumpRenderTreeDebugAll.vsprops @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="DumpRenderTreeDebugAll" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops; + .\DumpRenderTreeCommon.vsprops; + .\DumpRenderTreeApple.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeDebugCairoCFLite.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeDebugCairoCFLite.vsprops new file mode 100644 index 0000000..b0985b0 --- /dev/null +++ b/Tools/DumpRenderTree/win/DumpRenderTreeDebugCairoCFLite.vsprops @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="DumpRenderTreeDebugCairoCFLite" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\cURL.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeCairo.vsprops;.\DumpRenderTreeCFLite.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeProduction.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeProduction.vsprops new file mode 100644 index 0000000..818bff2 --- /dev/null +++ b/Tools/DumpRenderTree/win/DumpRenderTreeProduction.vsprops @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="DumpRenderTreeProduction" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; + .\DumpRenderTreeCommon.vsprops; + .\DumpRenderTreeApple.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeRelease.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeRelease.vsprops new file mode 100644 index 0000000..c39a9cd --- /dev/null +++ b/Tools/DumpRenderTree/win/DumpRenderTreeRelease.vsprops @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="DumpRenderTreeRelease" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + .\DumpRenderTreeCommon.vsprops; + .\DumpRenderTreeApple.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeReleaseCairoCFLite.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeReleaseCairoCFLite.vsprops new file mode 100644 index 0000000..508e8c5 --- /dev/null +++ b/Tools/DumpRenderTree/win/DumpRenderTreeReleaseCairoCFLite.vsprops @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="DumpRenderTreeReleaseCairoCFLite" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\cURL.vsprops; + .\DumpRenderTreeCommon.vsprops; + .\DumpRenderTreeCairo.vsprops; + .\DumpRenderTreeCFLite.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/ImageDiff.vcproj b/Tools/DumpRenderTree/win/ImageDiff.vcproj index f48af25..7094fec 100644 --- a/Tools/DumpRenderTree/win/ImageDiff.vcproj +++ b/Tools/DumpRenderTree/win/ImageDiff.vcproj @@ -17,7 +17,7 @@ <Configuration Name="Debug|Win32" ConfigurationType="1" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\ImageDiffCommon.vsprops" + InheritedPropertySheets=".\ImageDiffDebug.vsprops" CharacterSet="2" > <Tool @@ -78,7 +78,7 @@ <Configuration Name="Release|Win32" ConfigurationType="1" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\ImageDiffCommon.vsprops" + InheritedPropertySheets=".\ImageDiffRelease.vsprops" CharacterSet="2" > <Tool @@ -139,7 +139,7 @@ <Configuration Name="Debug_All|Win32" ConfigurationType="1" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\ImageDiffCommon.vsprops" + InheritedPropertySheets=".\ImageDiffDebugAll.vsprops" CharacterSet="2" > <Tool @@ -200,7 +200,7 @@ <Configuration Name="Debug_Cairo_CFLite|Win32" ConfigurationType="1" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\ImageDiffCommon.vsprops" + InheritedPropertySheets=".\ImageDiffDebugCairoCFLite.vsprops" CharacterSet="2" > <Tool @@ -259,9 +259,9 @@ /> </Configuration> <Configuration - Name="Release_LTCG|Win32" + Name="Production|Win32" ConfigurationType="1" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\ImageDiffCommon.vsprops" + InheritedPropertySheets=".\ImageDiffProduction.vsprops" CharacterSet="2" WholeProgramOptimization="1" > @@ -323,7 +323,7 @@ <Configuration Name="Release_Cairo_CFLite|Win32" ConfigurationType="1" - InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\ImageDiffCommon.vsprops" + InheritedPropertySheets=".\ImageDiffReleaseCairoCFLite.vsprops" CharacterSet="2" > <Tool diff --git a/Tools/DumpRenderTree/win/ImageDiffDebug.vsprops b/Tools/DumpRenderTree/win/ImageDiffDebug.vsprops new file mode 100644 index 0000000..28641a2 --- /dev/null +++ b/Tools/DumpRenderTree/win/ImageDiffDebug.vsprops @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="ImageDiffDebug" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops; + .\ImageDiffCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/ImageDiffDebugAll.vsprops b/Tools/DumpRenderTree/win/ImageDiffDebugAll.vsprops new file mode 100644 index 0000000..824a4b9 --- /dev/null +++ b/Tools/DumpRenderTree/win/ImageDiffDebugAll.vsprops @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="ImageDiffDebugAll" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops; + .\ImageDiffCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/ImageDiffDebugCairoCFLite.vsprops b/Tools/DumpRenderTree/win/ImageDiffDebugCairoCFLite.vsprops new file mode 100644 index 0000000..bd6bc8a --- /dev/null +++ b/Tools/DumpRenderTree/win/ImageDiffDebugCairoCFLite.vsprops @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="ImageDiffDebugCairoCFLite" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops; + .\ImageDiffCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/ImageDiffProduction.vsprops b/Tools/DumpRenderTree/win/ImageDiffProduction.vsprops new file mode 100644 index 0000000..37ff9de --- /dev/null +++ b/Tools/DumpRenderTree/win/ImageDiffProduction.vsprops @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="ImageDiffProduction" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; + .\ImageDiffCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/ImageDiffRelease.vsprops b/Tools/DumpRenderTree/win/ImageDiffRelease.vsprops new file mode 100644 index 0000000..79e9749 --- /dev/null +++ b/Tools/DumpRenderTree/win/ImageDiffRelease.vsprops @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="ImageDiffRelease" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + .\ImageDiffCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/ImageDiffReleaseCairoCFLite.vsprops b/Tools/DumpRenderTree/win/ImageDiffReleaseCairoCFLite.vsprops new file mode 100644 index 0000000..1cb062b --- /dev/null +++ b/Tools/DumpRenderTree/win/ImageDiffReleaseCairoCFLite.vsprops @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="ImageDiffReleaseCairoCFLite" + InheritedPropertySheets=" + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops; + .\ImageDiffCommon.vsprops" + > +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp index 12a3a55..1d2f3d8 100644 --- a/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -374,6 +374,27 @@ void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag) prefsPrivate->setAuthorAndUserStylesEnabled(flag); } +void LayoutTestController::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled) +{ + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return; + + COMPtr<IWebViewPrivate> webViewPrivate(Query, webView); + if (!webViewPrivate) + return; + + COMPtr<IDOMElement> element; + if (FAILED(webViewPrivate->elementFromJS(context, nodeObject, &element))) + return; + + COMPtr<IFormsAutoFillTransition> autofillElement(Query, element); + if (!autofillElement) + return; + + autofillElement->setAutofilled(autofilled); +} + void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permissive) { COMPtr<IWebView> webView; @@ -411,6 +432,12 @@ void LayoutTestController::setGeolocationPermission(bool allow) setGeolocationPermissionCommon(allow); } +int LayoutTestController::numberOfPendingGeolocationPermissionRequests() +{ + // FIXME: Implement for Geolocation layout tests. + return -1; +} + void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language) { // FIXME: Implement for speech input layout tests. @@ -922,12 +949,23 @@ bool LayoutTestController::isCommandEnabled(JSStringRef /*name*/) void LayoutTestController::clearAllApplicationCaches() { - // FIXME: implement to support Application Cache quotas. + // FIXME: Implement to support application cache quotas. +} + +void LayoutTestController::clearApplicationCacheForOrigin(JSStringRef origin) +{ + // FIXME: Implement to support deleting all application cache for an origin. } void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quota) { - // FIXME: implement to support Application Cache quotas. + // FIXME: Implement to support application cache quotas. +} + +JSValueRef LayoutTestController::originsWithApplicationCache(JSContextRef context) +{ + // FIXME: Implement to get origins that have application caches. + return JSValueMakeUndefined(context); } void LayoutTestController::clearAllDatabases() @@ -1418,6 +1456,12 @@ bool LayoutTestController::hasSpellingMarker(int from, int length) return ret; } +bool LayoutTestController::hasGrammarMarker(int from, int length) +{ + // FIXME: Implement this. + return false; +} + void LayoutTestController::dumpConfigurationForViewport(int /*deviceDPI*/, int /*deviceWidth*/, int /*deviceHeight*/, int /*availableWidth*/, int /*availableHeight*/) { // FIXME: Implement this. @@ -1428,6 +1472,32 @@ void LayoutTestController::setSerializeHTTPLoads(bool) // FIXME: Implement. } +void LayoutTestController::syncLocalStorage() +{ + // FIXME: Implement. +} + +void LayoutTestController::observeStorageTrackerNotifications(unsigned number) +{ + // FIXME: Implement. +} + +void LayoutTestController::deleteAllLocalStorage() +{ + // FIXME: Implement. +} + +JSValueRef LayoutTestController::originsWithLocalStorage(JSContextRef context) +{ + // FIXME: Implement. + return JSValueMakeUndefined(context); +} + +void LayoutTestController::deleteLocalStorageForOrigin(JSStringRef URL) +{ + // FIXME: Implement. +} + void LayoutTestController::setMinimumTimerInterval(double minimumTimerInterval) { COMPtr<IWebView> webView; @@ -1440,3 +1510,5 @@ void LayoutTestController::setMinimumTimerInterval(double minimumTimerInterval) viewPrivate->setMinimumTimerInterval(minimumTimerInterval); } + + diff --git a/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp index a95aa50..c45ea0e 100644 --- a/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp +++ b/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp @@ -207,6 +207,11 @@ void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag) // FIXME: implement } +void LayoutTestController::setAutofilled(JSContextRef, JSValueRef element, bool isAutofilled) +{ + // FIXME: implement +} + void LayoutTestController::setPopupBlockingEnabled(bool popupBlockingEnabled) { // FIXME: implement @@ -240,12 +245,23 @@ void LayoutTestController::clearPersistentUserStyleSheet() void LayoutTestController::clearAllApplicationCaches() { - // FIXME: implement to support Application Cache quotas. + // FIXME: Implement to support application cache quotas. +} + +void LayoutTestController::clearApplicationCacheForOrigin(JSStringRef url) +{ + // FIXME: Implement to support deleting all application cache for an origin. } void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quota) { - // FIXME: implement to support Application Cache quotas. + // FIXME: Implement to support application cache quotas. +} + +JSValueRef LayoutTestController::originsWithApplicationCache(JSContextRef context) +{ + // FIXME: Implement to get origins that have application caches. + return 0; } void LayoutTestController::clearAllDatabases() @@ -325,6 +341,12 @@ void LayoutTestController::setGeolocationPermission(bool allow) setGeolocationPermissionCommon(allow); } +int LayoutTestController::numberOfPendingGeolocationPermissionRequests() +{ + // FIXME: Implement for Geolocation layout tests. + return -1; +} + void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language) { // FIXME: Implement for speech input layout tests. @@ -516,6 +538,12 @@ bool LayoutTestController::hasSpellingMarker(int, int) return false; } +bool LayoutTestController::hasGrammarMarker(int, int) +{ + // FIXME: Implement + return false; +} + void LayoutTestController::dumpConfigurationForViewport(int /*deviceDPI*/, int /*deviceWidth*/, int /*deviceHeight*/, int /*availableWidth*/, int /*availableHeight*/) { // FIXME: Implement @@ -558,4 +586,29 @@ void LayoutTestController::setSerializeHTTPLoads(bool) void LayoutTestController::setMinimumTimerInterval(double interval) { } - + +void LayoutTestController::syncLocalStorage() +{ + // FIXME: Implement. +} + +void LayoutTestController::observeStorageTrackerNotifications(unsigned number) +{ + // FIXME: Implement. +} + +void LayoutTestController::deleteAllLocalStorage() +{ + // FIXME: Implement. +} + +JSValueRef LayoutTestController::originsWithLocalStorage(JSContextRef context) +{ + // FIXME: Implement. + return 0; +} + +void LayoutTestController::deleteLocalStorageForOrigin(JSStringRef URL) +{ + // FIXME: Implement. +} |