diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
commit | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch) | |
tree | 24d68c6f61c464ecba1e05670b80390ea3b0e50c /Tools/DumpRenderTree | |
parent | 69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff) | |
download | qtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz |
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Tools/DumpRenderTree')
62 files changed, 969 insertions, 546 deletions
diff --git a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp index a81284b0b..56aeab732 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp +++ b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp @@ -93,10 +93,12 @@ '<(DEPTH)', '../chromium/TestRunner/public', '../chromium/TestRunner/src', + '../../../Source', ], 'direct_dependent_settings': { 'include_dirs': [ '../chromium/TestRunner/public', + '../../../Source', ], }, 'sources': [ @@ -114,6 +116,12 @@ '<(source_dir)/WebKit/chromium/public/gtk', ], }], + ['inside_chromium_build==1 and component=="shared_library"', { + 'sources': [ + '<(source_dir)/WebKit/chromium/src/ChromiumCurrentTime.cpp', + '<(source_dir)/WebKit/chromium/src/ChromiumThreading.cpp', + ], + }], ], }, { @@ -346,18 +354,6 @@ ['exclude', 'Android\\.cpp$'], ], }], - ['inside_chromium_build==1 and component=="shared_library"', { - 'sources': [ - '<(source_dir)/WebKit/chromium/src/ChromiumCurrentTime.cpp', - '<(source_dir)/WebKit/chromium/src/ChromiumThreading.cpp', - ], - 'include_dirs': [ - '<(source_dir)/WebKit/chromium/public', - ], - 'dependencies': [ - '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf', - ], - }], ['inside_chromium_build==0', { 'dependencies': [ '<(chromium_src_dir)/webkit/support/setup_third_party.gyp:third_party_headers', diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi index 26722ece7..dd768d049 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gypi +++ b/Tools/DumpRenderTree/DumpRenderTree.gypi @@ -83,6 +83,8 @@ 'chromium/TestRunner/src/EventSender.h', 'chromium/TestRunner/src/GamepadController.cpp', 'chromium/TestRunner/src/GamepadController.h', + 'chromium/TestRunner/src/KeyCodeMapping.cpp', + 'chromium/TestRunner/src/KeyCodeMapping.h', 'chromium/TestRunner/src/TestInterfaces.cpp', 'chromium/TestRunner/src/TestInterfaces.h', 'chromium/TestRunner/src/TextInputController.cpp', @@ -110,6 +112,7 @@ 'TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp', 'TestNetscapePlugIn/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp', 'TestNetscapePlugIn/Tests/NPPNewFails.cpp', + 'TestNetscapePlugIn/Tests/NPRuntimeCallsWithNullNPP.cpp', 'TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp', 'TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp', 'TestNetscapePlugIn/Tests/NullNPPGetValuePointer.cpp', diff --git a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj index 0c6b8049e..f35ebccdf 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj +++ b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj @@ -50,6 +50,7 @@ 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 */; }; + 1AD8683F163B2FD000A28583 /* NPRuntimeCallsWithNullNPP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD8683D163B2FD000A28583 /* NPRuntimeCallsWithNullNPP.cpp */; }; 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */; }; 1AFF66BC137DEFD200791696 /* GetURLNotifyWithURLThatFailsToLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFF66BB137DEA8300791696 /* GetURLNotifyWithURLThatFailsToLoad.cpp */; }; 23BCB8900EA57623003C6289 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BCB88F0EA57623003C6289 /* OpenGL.framework */; }; @@ -116,7 +117,6 @@ BC0E24E00E2D9451001B6BC2 /* AccessibilityUIElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0E24DE0E2D9451001B6BC2 /* AccessibilityUIElement.h */; }; BC0E24E10E2D9451001B6BC2 /* AccessibilityUIElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0E24DF0E2D9451001B6BC2 /* AccessibilityUIElement.cpp */; }; BC0E26150E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC0E26140E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm */; }; - BC0E24E00E2D9451001B6BC3 /* AccessibilityCommonMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0E24DE0E2D9451001B6BC3 /* AccessibilityCommonMac.h */; }; BC0E26150E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC0E26140E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm */; }; BC47412A0D038A4C0072B006 /* JavaScriptThreading.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4741290D038A4C0072B006 /* JavaScriptThreading.h */; }; BC4741410D038A570072B006 /* JavaScriptThreadingPthreads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4741400D038A570072B006 /* JavaScriptThreadingPthreads.cpp */; }; @@ -262,6 +262,7 @@ 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>"; }; + 1AD8683D163B2FD000A28583 /* NPRuntimeCallsWithNullNPP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeCallsWithNullNPP.cpp; sourceTree = "<group>"; }; 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginScriptableNPObjectInvokeDefault.cpp; sourceTree = "<group>"; }; 1AFF66BB137DEA8300791696 /* GetURLNotifyWithURLThatFailsToLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetURLNotifyWithURLThatFailsToLoad.cpp; sourceTree = "<group>"; }; 23BCB88F0EA57623003C6289 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; @@ -325,13 +326,11 @@ BC0131D80C9772010087317D /* TestRunner.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TestRunner.cpp; sourceTree = "<group>"; }; BC0131D90C9772010087317D /* TestRunner.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TestRunner.h; sourceTree = "<group>"; }; BC0E24DE0E2D9451001B6BC2 /* AccessibilityUIElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityUIElement.h; sourceTree = "<group>"; }; - BC0E24DE0E2D9451001B6BC3 /* AccessibilityCommonMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mac/AccessibilityCommonMac.h; sourceTree = "<group>"; }; BC0E24DF0E2D9451001B6BC2 /* AccessibilityUIElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityUIElement.cpp; sourceTree = "<group>"; }; BC0E26140E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityUIElementMac.mm; path = mac/AccessibilityUIElementMac.mm; sourceTree = "<group>"; }; BC0E26140E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityCommonMac.mm; path = mac/AccessibilityCommonMac.mm; sourceTree = "<group>"; }; BC4741290D038A4C0072B006 /* JavaScriptThreading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptThreading.h; sourceTree = "<group>"; }; BC4741400D038A570072B006 /* JavaScriptThreadingPthreads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JavaScriptThreadingPthreads.cpp; path = pthreads/JavaScriptThreadingPthreads.cpp; sourceTree = "<group>"; }; - BC646A4B136905DE00B35DED /* CompilerVersion.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CompilerVersion.xcconfig; path = mac/Configurations/CompilerVersion.xcconfig; sourceTree = "<group>"; }; BC9D90210C97472D0099A4A3 /* WorkQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueue.cpp; sourceTree = "<group>"; }; BC9D90220C97472E0099A4A3 /* WorkQueue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WorkQueue.h; sourceTree = "<group>"; }; BC9D90230C97472E0099A4A3 /* WorkQueueItem.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WorkQueueItem.h; sourceTree = "<group>"; }; @@ -507,7 +506,7 @@ BC0E24DF0E2D9451001B6BC2 /* AccessibilityUIElement.cpp */, BC0E24DE0E2D9451001B6BC2 /* AccessibilityUIElement.h */, BC0E26140E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm */, - BC0E26140E2DA4C6001B6BC3 /* AccessibilityCommonMac.h */, + BC0E26140E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm */, BC0E26140E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm */, BCA18B360C9B021900114369 /* AppleScriptController.h */, BCA18B370C9B021900114369 /* AppleScriptController.m */, @@ -572,6 +571,7 @@ 1ACF898B132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp */, 5113DE6615F6CBE5005EC8B3 /* NPPNewFails.cpp */, C031182A134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp */, + 1AD8683D163B2FD000A28583 /* NPRuntimeCallsWithNullNPP.cpp */, 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */, 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */, C0EC3C9B12787F0500939164 /* NullNPPGetValuePointer.cpp */, @@ -681,7 +681,6 @@ isa = PBXGroup; children = ( BCB281EE0CFA713D007E533E /* Base.xcconfig */, - BC646A4B136905DE00B35DED /* CompilerVersion.xcconfig */, BCB282F40CFA7450007E533E /* DebugRelease.xcconfig */, BCB281F00CFA713D007E533E /* DumpRenderTree.xcconfig */, BCB283D80CFA7AFD007E533E /* ImageDiff.xcconfig */, @@ -935,6 +934,7 @@ 515C0CD015EE785700F5A613 /* LogNPPSetWindow.cpp in Sources */, 5113DE6715F6CBE5005EC8B3 /* NPPNewFails.cpp in Sources */, 51134C9916014FDC001AA513 /* InvokeDestroysPluginWithinNPP_New.cpp in Sources */, + 1AD8683F163B2FD000A28583 /* NPRuntimeCallsWithNullNPP.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt b/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt index 65a7427cd..384b5bfb0 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt @@ -16,6 +16,7 @@ SET(WebKitTestNetscapePlugin_SOURCES ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPDeallocateCalledBeforeNPShutdown.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPPNewFails.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPPSetWindowCalledDuringDestruction.cpp + ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPRuntimeCallsWithNullNPP.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPRuntimeRemoveProperty.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NullNPPGetValuePointer.cpp diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp index b884503af..c2195c5b1 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp @@ -223,6 +223,11 @@ bool PluginTest::NPN_RemoveProperty(NPObject* npObject, NPIdentifier propertyNam return browser->removeproperty(m_npp, npObject, propertyName); } +void PluginTest::NPN_ReleaseVariantValue(NPVariant* variant) +{ + browser->releasevariantvalue(variant); +} + #ifdef XP_MACOSX bool PluginTest::NPN_ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace) { @@ -257,6 +262,11 @@ void PluginTest::log(const char* format, ...) va_end(args); } +NPNetscapeFuncs* PluginTest::netscapeFuncs() +{ + return browser; +} + void PluginTest::waitUntilDone() { executeScript("testRunner.waitUntilDone()"); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h index ab64f2521..f8a9aaee3 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h @@ -90,6 +90,7 @@ public: NPObject* NPN_RetainObject(NPObject*); void NPN_ReleaseObject(NPObject*); bool NPN_RemoveProperty(NPObject*, NPIdentifier propertyName); + void NPN_ReleaseVariantValue(NPVariant*); #ifdef XP_MACOSX bool NPN_ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); @@ -125,6 +126,8 @@ protected: const std::string& identifier() const { return m_identifier; } + static NPNetscapeFuncs* netscapeFuncs(); + void waitUntilDone(); void notifyDone(); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeCallsWithNullNPP.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeCallsWithNullNPP.cpp new file mode 100644 index 000000000..84e9714df --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeCallsWithNullNPP.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PluginTest.h" + +class NPRuntimeCallsWithNullNPP : public PluginTest { +public: + NPRuntimeCallsWithNullNPP(NPP npp, const std::string& identifier) + : PluginTest(npp, identifier) + { + } + +private: + virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *saved) + { + NPObject* windowObject = 0; + if (NPN_GetValue(NPNVWindowNPObject, &windowObject) != NPERR_NO_ERROR || !windowObject) + return NPERR_GENERIC_ERROR; + + NPIdentifier alertIdentifier = NPN_GetStringIdentifier("alert"); + if (!PluginTest::netscapeFuncs()->hasmethod(0, windowObject, alertIdentifier)) { + NPN_ReleaseObject(windowObject); + return NPERR_GENERIC_ERROR; + } + + NPIdentifier documentIdentifier = NPN_GetStringIdentifier("document"); + NPVariant variant; + if (!PluginTest::netscapeFuncs()->getproperty(0, windowObject, documentIdentifier, &variant)) { + NPN_ReleaseObject(windowObject); + return NPERR_GENERIC_ERROR; + } + NPN_ReleaseVariantValue(&variant); + + NPN_ReleaseObject(windowObject); + + executeScript("document.getElementById('result').innerHTML = 'SUCCESS!'"); + notifyDone(); + return NPERR_NO_ERROR; + } +}; + +static PluginTest::Register<NPRuntimeCallsWithNullNPP> npRuntimeCallsWithNullNPP("npruntime-calls-with-null-npp"); + + diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj index 43229839f..86414e21f 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj @@ -434,6 +434,10 @@ >
</File>
<File
+ RelativePath="..\Tests\NPRuntimeCallsWithNullNPP.cpp"
+ >
+ </File>
+ <File
RelativePath="..\Tests\NPRuntimeObjectFromDestroyedPlugin.cpp"
>
</File>
diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp index ebc5c396b..a62083fa9 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp @@ -66,7 +66,6 @@ #include <wtf/NonCopyingSort.h> #include <wtf/OwnArrayPtr.h> #include <wtf/Vector.h> -#include <wtf/text/CString.h> #define SDCARD_PATH "/developer" @@ -154,7 +153,7 @@ DumpRenderTree::DumpRenderTree(BlackBerry::WebKit::WebPage* page) : m_gcController(0) , m_accessibilityController(0) , m_page(page) - , m_dumpPixels(false) + , m_enablePixelTests(getenv("pixelTests")) , m_waitToDumpWatchdogTimer(this, &DumpRenderTree::waitToDumpWatchdogTimerFired) , m_workTimer(this, &DumpRenderTree::processWork) , m_acceptsEditing(true) @@ -175,10 +174,10 @@ DumpRenderTree::~DumpRenderTree() delete m_accessibilityController; } -void DumpRenderTree::runTest(const String& url) +void DumpRenderTree::runTest(const String& url, const String& imageHash) { mainFrame->loader()->stopForUserCancel(); - resetToConsistentStateBeforeTesting(); + resetToConsistentStateBeforeTesting(url, imageHash); if (shouldLogFrameLoadDelegates(url)) gTestRunner->setDumpFrameLoadCallbacks(true); if (!runFromCommandLine) { @@ -211,12 +210,18 @@ void DumpRenderTree::doneDrt() void DumpRenderTree::runCurrentTest() { + String imageHash = ""; + int posSplitter = m_currentTest->find('?'); + if (posSplitter > 1 && (unsigned)posSplitter < m_currentTest->length() - 1) { + imageHash = m_currentTest->substring(posSplitter + 1); + m_currentTest->truncate(posSplitter); + } if (isHTTPTest(m_currentTest->utf8().data())) { m_currentHttpTest = m_currentTest->utf8().data(); m_currentHttpTest.remove(0, strlen(httpTestSyntax)); - runTest(httpPrefixURL + m_currentHttpTest); + runTest(httpPrefixURL + m_currentHttpTest, imageHash); } else - runTest(kSDCLayoutTestsURI + *m_currentTest); + runTest(kSDCLayoutTestsURI + *m_currentTest, imageHash); } void DumpRenderTree::runRemainingTests() @@ -245,12 +250,9 @@ void DumpRenderTree::runRemainingTests() runCurrentTest(); } -void DumpRenderTree::resetToConsistentStateBeforeTesting() +void DumpRenderTree::resetToConsistentStateBeforeTesting(const String& url, const String& imageHash) { - if (isHTTPTest(m_currentTest->utf8().data())) - gTestRunner = TestRunner::create(String(httpPrefixURL + *m_currentTest).utf8().data(), ""); - else - gTestRunner = TestRunner::create(String(kSDCLayoutTestsURI + *m_currentTest).utf8().data(), ""); + gTestRunner = TestRunner::create(url.utf8().data(), imageHash.utf8().data()); gTestRunner->setIconDatabaseEnabled(false); @@ -335,7 +337,7 @@ void DumpRenderTree::runTests() mainFrame = DumpRenderTreeSupport::corePage(m_page)->mainFrame(); - if (getenv("drtTestFile")) { + if (const char* testFile = getenv("drtTestFile")) { runFromCommandLine = true; addTest(testFile); } else { @@ -371,12 +373,12 @@ String DumpRenderTree::dumpFramesAsText(WebCore::Frame* frame) if (frame->tree()->parent()) s = String::format("\n--------\nFrame: '%s'\n--------\n", frame->tree()->uniqueName().string().utf8().data()); - s += documentElement->innerText() + "\n"; + s = s + documentElement->innerText() + "\n"; if (gTestRunner->dumpChildFramesAsText()) { WebCore::FrameTree* tree = frame->tree(); for (WebCore::Frame* child = tree->firstChild(); child; child = child->tree()->nextSibling()) - s += dumpFramesAsText(child); + s = s + dumpFramesAsText(child); } return s; } @@ -424,11 +426,11 @@ static String dumpHistoryItem(PassRefPtr<WebCore::HistoryItem> item, int indent, int start = 0; if (current) { - result += "curr->"; + result = result + "curr->"; start = 6; } for (int i = start; i < indent; i++) - result += " "; + result = result + " "; String url = item->urlString(); if (url.contains("file://")) { @@ -439,25 +441,25 @@ static String dumpHistoryItem(PassRefPtr<WebCore::HistoryItem> item, int indent, if (res.isEmpty()) return result; - result += fileTestString; - result += res; + result = result + fileTestString; + result = result + res; } else - result += url; + result = result + url; String target = item->target(); if (!target.isEmpty()) - result += " (in frame \"" + target + "\")"; + result = result + " (in frame \"" + target + "\")"; if (item->isTargetItem()) - result += " **nav target**"; - result += "\n"; + result = result + " **nav target**"; + result = result + "\n"; WebCore::HistoryItemVector children = item->children(); // Must sort to eliminate arbitrary result ordering which defeats reproducible testing. nonCopyingSort(children.begin(), children.end(), historyItemCompare); unsigned resultSize = children.size(); for (unsigned i = 0; i < resultSize; ++i) - result += dumpHistoryItem(children[i], indent + 4, false); + result = result + dumpHistoryItem(children[i], indent + 4, false); return result; } @@ -474,16 +476,16 @@ static String dumpBackForwardListForWebView() bfList->backListWithLimit(maxItems, entries); unsigned resultSize = entries.size(); for (unsigned i = 0; i < resultSize; ++i) - result += dumpHistoryItem(entries[i], 8, false); + result = result + dumpHistoryItem(entries[i], 8, false); - result += dumpHistoryItem(bfList->currentItem(), 8, true); + result = result + dumpHistoryItem(bfList->currentItem(), 8, true); bfList->forwardListWithLimit(maxItems, entries); resultSize = entries.size(); for (unsigned i = 0; i < resultSize; ++i) - result += dumpHistoryItem(entries[i], 8, false); + result = result + dumpHistoryItem(entries[i], 8, false); - result += "===============================================\n"; + result = result + "===============================================\n"; return result; } @@ -504,15 +506,27 @@ void DumpRenderTree::dump() String data = dumpAsText ? dumpFramesAsText(mainFrame) : renderTreeDump(); if (gTestRunner->dumpBackForwardList()) - data += dumpBackForwardListForWebView(); + data = data + dumpBackForwardListForWebView(); String result = "Content-Type: " + resultMimeType + "\n" + data; dumpToFile(result); - if (m_dumpPixels && !dumpAsText && gTestRunner->generatePixelResults()) - dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash()); if (!runFromCommandLine) { + // signal end of text block + fputs("#EOF\n", stdout); + + // There are two scenarios for dumping pixels: + // 1. When the test case explicitly asks for it by calling dumpAsText(true) with that extra true passed as a parameter value, from JavaScript + bool explicitPixelResults = gTestRunner->dumpAsText() && gTestRunner->generatePixelResults(); + // 2. When the test case implicitly allows it by not calling dumpAsText() at all (with no parameters). + bool implicitPixelResults = !gTestRunner->dumpAsText(); + + // But only if m_enablePixelTests is set, to say that the user wants to run pixel tests at all. + bool generatePixelResults = m_enablePixelTests && (explicitPixelResults || implicitPixelResults); + if (generatePixelResults) + dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash()); + String crashFile = dumpFile + ".crash"; unlink(crashFile.utf8().data()); @@ -617,7 +631,7 @@ void DumpRenderTree::didFinishDocumentLoadForFrame(WebCore::Frame* frame) if (gTestRunner->dumpFrameLoadCallbacks()) printf("%s - didFinishDocumentLoadForFrame\n", drtFrameDescription(frame).utf8().data()); else { - unsigned pendingFrameUnloadEvents = frame->domWindow()->pendingUnloadEventListeners(); + unsigned pendingFrameUnloadEvents = frame->document()->domWindow()->pendingUnloadEventListeners(); if (pendingFrameUnloadEvents) printf("%s - has %u onunload handler(s)\n", drtFrameDescription(frame).utf8().data(), pendingFrameUnloadEvents); } @@ -650,7 +664,7 @@ void DumpRenderTree::didReceiveTitleForFrame(const String& title, WebCore::Frame printf("%s - didReceiveTitle: %s\n", drtFrameDescription(frame).utf8().data(), title.utf8().data()); if (gTestRunner->dumpTitleChanges()) - printf("TITLE CHANGED: '%s'\n", title.utf8().data()); + printf("TITLE CHANGED: %s\n", title.utf8().data()); } // ChromeClient delegates. @@ -677,10 +691,8 @@ void DumpRenderTree::addMessageToConsole(const String& message, unsigned lineNum void DumpRenderTree::runJavaScriptAlert(const String& message) { - if (!testDone) { + if (!testDone) printf("ALERT: %s\n", message.utf8().data()); - fflush(stdout); - } } bool DumpRenderTree::runJavaScriptConfirm(const String& message) @@ -753,12 +765,6 @@ void DumpRenderTree::didChangeSelection() printf("EDITING DELEGATE: webViewDidChangeSelection:%s\n", "WebViewDidChangeSelectionNotification"); } -bool DumpRenderTree::findString(const String& string, WebCore::FindOptions options) -{ - WebCore::Page* page = mainFrame ? mainFrame->page() : 0; - return page && page->findString(string, options); -} - bool DumpRenderTree::shouldBeginEditingInDOMRange(WebCore::Range* range) { if (!testDone && gTestRunner->dumpEditingCallbacks()) diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h index dfcf7c86c..daca112c9 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h @@ -23,11 +23,11 @@ #include "DumpRenderTreeClient.h" -#include "PlatformString.h" #include "Timer.h" #include <BlackBerryPlatformLayoutTest.h> #include <FindOptions.h> #include <wtf/Vector.h> +#include <wtf/text/WTFString.h> namespace WebCore { class Credential; @@ -94,7 +94,6 @@ public: void didEndEditing(); void didChange(); void didChangeSelection(); - bool findString(const String&, WebCore::FindOptions); bool shouldBeginEditingInDOMRange(WebCore::Range*); bool shouldEndEditingInDOMRange(WebCore::Range*); bool shouldDeleteDOMRange(WebCore::Range*); @@ -109,7 +108,7 @@ public: // BlackBerry::Platform::BlackBerryPlatformLayoutTestClient method virtual void addTest(const char* testFile); private: - void runTest(const String& url); + void runTest(const String& url, const String& imageHash); void runTests(); void runCurrentTest(); @@ -124,7 +123,7 @@ private: void doneDrt(); bool isHTTPTest(const String& test); String renderTreeDump() const; - void resetToConsistentStateBeforeTesting(); + void resetToConsistentStateBeforeTesting(const String& url, const String& imageHash); void runRemainingTests(); void invalidateAnyPreviousWaitToDumpWatchdog(); void waitToDumpWatchdogTimerFired(WebCore::Timer<DumpRenderTree>*); @@ -141,7 +140,7 @@ private: GCController* m_gcController; AccessibilityController* m_accessibilityController; WebPage* m_page; - bool m_dumpPixels; + bool m_enablePixelTests; WebCore::Timer<DumpRenderTree> m_waitToDumpWatchdogTimer; WebCore::Timer<DumpRenderTree> m_workTimer; diff --git a/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp b/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp index 22f202c90..bc4e7ab85 100644 --- a/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp +++ b/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Research In Motion Limited. All rights reserved. + * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,8 +21,6 @@ #include "config.h" #include "PNGImageEncoder.h" -#include "SkBitmap.h" -#include "SkUnPreMultiply.h" extern "C" { #include "png.h" @@ -33,20 +31,16 @@ extern "C" { // This code is almost a mirror of the code in WebCore/platform/image-encoders/skia/PNGImageEncoder.cpp // since we can't include this private WebCore file in a WebKit-client application. -// Converts BGRA->RGBA and RGBA->BGRA and undoes alpha premultiplication. -static void preMultipliedBGRAtoRGBA(const unsigned char* input, int numberOfPixels, unsigned char* output) +// Keep the premultipied for as it is the most faithful information +static void BGRAtoRGBA(const unsigned char* input, int numberOfPixels, unsigned char* output) { - SkBitmap inputBitmap; - inputBitmap.setConfig(SkBitmap::kARGB_8888_Config, numberOfPixels, 1); - inputBitmap.setPixels(const_cast<unsigned char*>(input)); for (int x = 0; x < numberOfPixels; x++) { - uint32_t srcPixel = *inputBitmap.getAddr32(x, 0); - SkColor unmultiplied = SkUnPreMultiply::PMColorToColor(srcPixel); - unsigned char* pixelOut = &output[x * 4]; - pixelOut[0] = SkColorGetR(unmultiplied); - pixelOut[1] = SkColorGetG(unmultiplied); - pixelOut[2] = SkColorGetB(unmultiplied); - pixelOut[3] = SkColorGetA(unmultiplied); + output[0] = input[2]; + output[1] = input[1]; + output[2] = input[0]; + output[3] = input[3]; + input += 4; + output += 4; } } @@ -130,8 +124,8 @@ static bool encodeImpl(const unsigned char* input, int imageWidth, int imageHeig png_set_write_fn(pngPtr, &state, encoderWriteCallback, 0); png_set_IHDR(pngPtr, infoPtr, imageWidth, imageHeight, 8, pngOutputColorType, - PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, - PNG_FILTER_TYPE_DEFAULT); + PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); png_write_info(pngPtr, infoPtr); OwnArrayPtr<unsigned char> rowPixels = adoptArrayPtr(new unsigned char[imageWidth * outputColorComponents]); @@ -144,13 +138,8 @@ static bool encodeImpl(const unsigned char* input, int imageWidth, int imageHeig return true; } -bool encodeSkBitmapToPNG(const SkBitmap& image, Vector<unsigned char>* output) +bool encodeBitmapToPNG(unsigned char* data, int width, int height, Vector<unsigned char>* output) { - if (image.config() != SkBitmap::kARGB_8888_Config) - return false; // Only support ARGB at 8 bpp now. - - image.lockPixels(); - bool result = encodeImpl(static_cast<unsigned char*>(image.getPixels()), image.width(), image.height(), image.rowBytes(), output, preMultipliedBGRAtoRGBA); - image.unlockPixels(); + bool result = encodeImpl(data, width, height, width * 4, output, BGRAtoRGBA); return result; } diff --git a/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h b/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h index 779f7a0f9..7a320a757 100644 --- a/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h +++ b/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Research In Motion Limited. All rights reserved. + * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,8 +21,6 @@ #include <wtf/Vector.h> -class SkBitmap; - -bool encodeSkBitmapToPNG(const SkBitmap&, WTF::Vector<unsigned char>* output); +bool encodeBitmapToPNG(unsigned char* data, int width, int height, WTF::Vector<unsigned char>* output); #endif // PNGImageEncoder_h diff --git a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp index 0bb4a0c27..420cdfbb8 100644 --- a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp +++ b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Research In Motion Limited. All rights reserved. + * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,6 +19,7 @@ #include "config.h" #include "PixelDumpSupportBlackBerry.h" +#include "BackingStore.h" #include "DumpRenderTreeBlackBerry.h" #include "PNGImageEncoder.h" #include "PixelDumpSupport.h" @@ -26,7 +27,9 @@ #include "WebPageClient.h" #include <BlackBerryPlatformWindow.h> -#include <skia/SkDevice.h> +#if USE(SKIA) +#include <SkDevice.h> +#endif #include <wtf/MD5.h> #include <wtf/Vector.h> @@ -39,34 +42,52 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool /*onscreen*/, bool Platform::Graphics::Window* window = DumpRenderTree::currentInstance()->page()->client()->window(); ASSERT(window); - const Platform::IntRect& windowRect = window->viewportRect(); - - SkBitmap* bitmap = new SkBitmap; - bitmap->setConfig(SkBitmap::kARGB_8888_Config, windowRect.width(), windowRect.height()); // We use 32-bit RGBA since that is the pixel format that ImageDiff expects. - bitmap->allocPixels(); + // The BackingStore has a queue of pending jobs, which are run on idle + // and which may not have been run yet. + BackingStore* backingStore = DumpRenderTree::currentInstance()->page()->backingStore(); + while (backingStore->hasBlitJobs()) + backingStore->blitOnIdle(); - SkCanvas* canvas = new SkCanvas; - canvas->setBitmapDevice(*bitmap); + const Platform::IntRect& windowRect = window->viewportRect(); + const Platform::IntSize& windowSize = window->viewportSize(); + unsigned char* data = new unsigned char[windowSize.width() * windowSize.height() * 4]; // We need to force a synchronous update to the window or we may get an empty bitmap. // For example, running DRT with one test case that finishes before the screen is updated. window->post(windowRect); - const SkBitmap* windowBitmap = static_cast<const SkBitmap*>(lockBufferBackingImage(window->buffer(), Platform::Graphics::ReadAccess)); - canvas->drawBitmap(*windowBitmap, 0, 0); // Draw the bitmap at (0, 0). +#if USE(SKIA) + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, windowSize.width(), windowSize.height()); + bitmap.allocPixels(); + bitmap.eraseARGB(0, 0, 0, 0); + + SkCanvas canvas(bitmap); + backingStore->drawContents(&canvas, windowRect, windowSize); + + // Read that SkBitmap rather than change it. So use false on accessBitmap. + const SkBitmap& contentsBitmap = canvas.getDevice()->accessBitmap(false/*changePixels*/); + contentsBitmap.lockPixels(); + + const unsigned char* windowPixels = 0; + if (!contentsBitmap.empty()) { + SkAutoLockPixels lock(contentsBitmap); + windowPixels = static_cast<const unsigned char*>(contentsBitmap.getPixels()); + } +#else + const unsigned char* windowPixels = lockBufferBackingImage(window->buffer(), Platform::Graphics::ReadAccess); +#endif + memcpy(data, windowPixels, windowSize.width() * windowSize.height() * 4); Platform::Graphics::releaseBufferBackingImage(window->buffer()); - return BitmapContext::createByAdoptingBitmapAndContext(bitmap, canvas); + return BitmapContext::createByAdoptingData(data, windowSize.width(), windowSize.height()); } void computeMD5HashStringForBitmapContext(BitmapContext* context, char hashString[33]) { - const SkBitmap& bitmap = context->canvas()->getDevice()->accessBitmap(false); - ASSERT(bitmap.bytesPerPixel() == 4); // 32-bit RGBA - - int pixelsWide = bitmap.width(); - int pixelsHigh = bitmap.height(); - int bytesPerRow = bitmap.rowBytes(); - unsigned char* pixelData = (unsigned char*)bitmap.getPixels(); + int pixelsWide = context->m_width; + int pixelsHigh = context->m_height; + int bytesPerRow = context->m_width * 4; + unsigned char* pixelData = context->m_data; MD5 md5; for (int i = 0; i < pixelsHigh; ++i) { @@ -82,14 +103,14 @@ void computeMD5HashStringForBitmapContext(BitmapContext* context, char hashStrin snprintf(hashString, 33, "%s%02x", hashString, hash[i]); } -static void printPNG(SkCanvas* canvas, const char* checksum) +static void printPNG(BitmapContext* context, const char* checksum) { Vector<unsigned char> pngData; - encodeSkBitmapToPNG(canvas->getDevice()->accessBitmap(false), &pngData); + encodeBitmapToPNG(context->m_data, context->m_width, context->m_height, &pngData); printPNG(pngData.data(), pngData.size(), checksum); } void dumpBitmap(BitmapContext* context, const char* checksum) { - printPNG(context->canvas(), checksum); + printPNG(context, checksum); } diff --git a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h index e8ae786c7..87c6bf08a 100644 --- a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h +++ b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Research In Motion Limited. All rights reserved. + * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,38 +19,34 @@ #ifndef PixelDumpSupportBlackBerry_h #define PixelDumpSupportBlackBerry_h -#include <skia/SkBitmap.h> -#include <skia/SkCanvas.h> +#include <stdio.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> class BitmapContext : public RefCounted<BitmapContext> { public: - static PassRefPtr<BitmapContext> createByAdoptingBitmapAndContext(SkBitmap* bitmap, SkCanvas* canvas) + static PassRefPtr<BitmapContext> createByAdoptingData(unsigned char* data, int width, int height) { - return adoptRef(new BitmapContext(bitmap, canvas)); + return adoptRef(new BitmapContext(data, width, height)); } ~BitmapContext() { - delete m_bitmap; - delete m_canvas; + delete m_data; } - SkCanvas* canvas() { return m_canvas; } + unsigned char* m_data; + int m_width, m_height; private: - BitmapContext(SkBitmap* bitmap, SkCanvas* canvas) - : m_bitmap(bitmap) - , m_canvas(canvas) + BitmapContext(unsigned char* data, int width, int height) + : m_data(data) + , m_width(width) + , m_height(height) { } - - SkBitmap* m_bitmap; - SkCanvas* m_canvas; - }; #endif // PixelDumpSupportBlackBerry_h diff --git a/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp index c9d013775..c80a96ddb 100644 --- a/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp +++ b/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2009, 2010, 2012 Research In Motion Limited. All rights reserved. - * Copyright (C) 2012 Apple Inc. All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +19,6 @@ #include "config.h" #include "TestRunner.h" -#include "CString.h" #include "DatabaseTracker.h" #include "Document.h" #include "DocumentLoader.h" @@ -36,14 +34,12 @@ #include "JSElement.h" #include "KURL.h" #include "NotImplemented.h" -#include "OwnArrayPtr.h" #include "Page.h" #include "RenderTreeAsText.h" #include "SchemeRegistry.h" #include "SecurityOrigin.h" #include "SecurityPolicy.h" #include "Settings.h" -#include "UnusedParam.h" #include "WorkQueue.h" #include "WorkQueueItem.h" #include "WorkerThread.h" @@ -53,6 +49,10 @@ #include <WebPage.h> #include <WebSettings.h> +#include <wtf/OwnArrayPtr.h> +#include <wtf/UnusedParam.h> +#include <wtf/text/CString.h> + using WebCore::toElement; using WebCore::toJS; @@ -452,10 +452,10 @@ void TestRunner::setMockGeolocationPosition(double latitude, double longitude, d DumpRenderTreeSupport::setMockGeolocationPosition(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), latitude, longitude, accuracy); } -void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message) +void TestRunner::setMockGeolocationError(int code, JSStringRef message) { String messageStr = jsStringRefToWebCoreString(message); - DumpRenderTreeSupport::setMockGeolocationPositionUnavailableError(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), messageStr); + DumpRenderTreeSupport::setMockGeolocationError(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), code, messageStr); } void TestRunner::showWebInspector() @@ -587,6 +587,12 @@ JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, J return DumpRenderTreeSupport::computedStyleIncludingVisitedInfo(context, value); } +JSRetainPtr<JSStringRef> TestRunner::layerTreeAsText() const +{ + notImplemented(); + return 0; +} + JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const { WebCore::Element* element = toElement(toJS(toJS(context), nodeObject)); @@ -746,9 +752,7 @@ bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRe options |= WebCore::StartInSelection; } - // Our layout tests assume find will wrap and highlight all matches. - return BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->findNextString(nameStr.utf8().data(), - !(options & WebCore::Backwards), !(options & WebCore::CaseInsensitive), true /* wrap */, true /* highlightAllMatches */); + return mainFrame->page()->findString(nameStr, options); } void TestRunner::deleteLocalStorageForOrigin(JSStringRef URL) @@ -839,3 +843,9 @@ void TestRunner::deliverWebIntent(JSStringRef, JSStringRef, JSStringRef) { notImplemented(); } + +void TestRunner::setStorageDatabaseIdleInterval(double) +{ + // FIXME: Implement this. + notImplemented(); +} diff --git a/Tools/DumpRenderTree/blackberry/build b/Tools/DumpRenderTree/blackberry/build new file mode 100755 index 000000000..fb8dce473 --- /dev/null +++ b/Tools/DumpRenderTree/blackberry/build @@ -0,0 +1,12 @@ +#!/bin/sh + +# This file builds the ImageDiff executable, to run +# on the host machine. + +which qmake-qt4 > /dev/null +if [ $? -eq 0 ] ; then + qmake-qt4 +else + qmake +fi +make diff --git a/Tools/DumpRenderTree/blackberry/src.pro b/Tools/DumpRenderTree/blackberry/src.pro new file mode 100644 index 000000000..10967958e --- /dev/null +++ b/Tools/DumpRenderTree/blackberry/src.pro @@ -0,0 +1,16 @@ +lessThan(QT_VERSION, 4.5) { + error("Qt 4.5 or greater is required.") +} + +TEMPLATE = app +TARGET = ImageDiff + +SOURCES += ../qt/ImageDiff.cpp +DESTDIR = . + +unix:CONFIG += debug_and_release +mac:CONFIG -= app_bundle +win32: CONFIG += console + +QT = core gui + diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp b/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp index b31d7da70..dafafa181 100644 --- a/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp +++ b/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp @@ -157,6 +157,7 @@ DRTTestRunner::DRTTestRunner(TestShell* shell) bindMethod("evaluateScriptInIsolatedWorld", &DRTTestRunner::evaluateScriptInIsolatedWorld); bindMethod("evaluateScriptInIsolatedWorldAndReturnValue", &DRTTestRunner::evaluateScriptInIsolatedWorldAndReturnValue); bindMethod("setIsolatedWorldSecurityOrigin", &DRTTestRunner::setIsolatedWorldSecurityOrigin); + bindMethod("setIsolatedWorldContentSecurityPolicy", &DRTTestRunner::setIsolatedWorldContentSecurityPolicy); bindMethod("execCommand", &DRTTestRunner::execCommand); bindMethod("forceRedSelectionColors", &DRTTestRunner::forceRedSelectionColors); #if ENABLE(NOTIFICATIONS) @@ -1403,6 +1404,16 @@ void DRTTestRunner::setIsolatedWorldSecurityOrigin(const CppArgumentList& argume m_shell->webView()->focusedFrame()->setIsolatedWorldSecurityOrigin(arguments[0].toInt32(), origin); } +void DRTTestRunner::setIsolatedWorldContentSecurityPolicy(const CppArgumentList& arguments, CppVariant* result) +{ + result->setNull(); + + if (arguments.size() != 2 || !arguments[0].isNumber() || !arguments[1].isString()) + return; + + m_shell->webView()->focusedFrame()->setIsolatedWorldContentSecurityPolicy(arguments[0].toInt32(), cppVariantToWebString(arguments[1])); +} + void DRTTestRunner::setAllowUniversalAccessFromFileURLs(const CppArgumentList& arguments, CppVariant* result) { if (arguments.size() > 0 && arguments[0].isBool()) { @@ -1560,6 +1571,8 @@ void DRTTestRunner::overridePreference(const CppArgumentList& arguments, CppVari prefs->webSecurityEnabled = cppVariantToBool(value); else if (key == "WebKitJavaScriptCanOpenWindowsAutomatically") prefs->javaScriptCanOpenWindowsAutomatically = cppVariantToBool(value); + else if (key == "WebKitSupportsMultipleWindows") + prefs->supportsMultipleWindows = cppVariantToBool(value); else if (key == "WebKitDisplayImagesKey") prefs->loadsImagesAutomatically = cppVariantToBool(value); else if (key == "WebKitPluginsEnabled") @@ -1604,6 +1617,8 @@ void DRTTestRunner::overridePreference(const CppArgumentList& arguments, CppVari prefs->allowRunningOfInsecureContent = cppVariantToBool(value); else if (key == "WebKitCSSCustomFilterEnabled") prefs->cssCustomFilterEnabled = cppVariantToBool(value); + else if (key == "WebKitShouldRespectImageOrientation") + prefs->shouldRespectImageOrientation = cppVariantToBool(value); else if (key == "WebKitWebAudioEnabled") { ASSERT(cppVariantToBool(value)); } else { diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.h b/Tools/DumpRenderTree/chromium/DRTTestRunner.h index ec4778fd5..c4cb7ace8 100644 --- a/Tools/DumpRenderTree/chromium/DRTTestRunner.h +++ b/Tools/DumpRenderTree/chromium/DRTTestRunner.h @@ -43,7 +43,23 @@ #define DRTTestRunner_h #include "TestRunner/src/TestRunner.h" +#include "WebDeliveredIntentClient.h" #include "WebTask.h" +#include "WebTextDirection.h" +#include "platform/WebArrayBufferView.h" +#include "platform/WebString.h" +#include "platform/WebURL.h" +#include <wtf/Deque.h> +#include <wtf/OwnPtr.h> + +namespace WebKit { +class WebGeolocationClientMock; +} + +namespace webkit_support { +class ScopedTempDirectory; +} + class TestShell; @@ -281,6 +297,7 @@ public: void evaluateScriptInIsolatedWorldAndReturnValue(const CppArgumentList&, CppVariant*); void evaluateScriptInIsolatedWorld(const CppArgumentList&, CppVariant*); void setIsolatedWorldSecurityOrigin(const CppArgumentList&, CppVariant*); + void setIsolatedWorldContentSecurityPolicy(const CppArgumentList&, CppVariant*); // The fallback method is called when a nonexistent method is called on // the layout test controller object. diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp index 5a3210449..bbd16af32 100644 --- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp @@ -62,6 +62,7 @@ static const char optionEnableAccelerated2DCanvas[] = "--enable-accelerated-2d-c static const char optionEnableDeferred2DCanvas[] = "--enable-deferred-2d-canvas"; static const char optionEnableAcceleratedPainting[] = "--enable-accelerated-painting"; static const char optionEnableAcceleratedCompositingForVideo[] = "--enable-accelerated-video"; +static const char optionEnableAcceleratedFixedPosition[] = "--enable-accelerated-fixed-position"; static const char optionUseGraphicsContext3DImplementation[] = "--use-graphics-context-3d-implementation="; static const char optionEnablePerTilePainting[] = "--enable-per-tile-painting"; static const char optionEnableDeferredImageDecoding[] = "--enable-deferred-image-decoding"; @@ -127,6 +128,7 @@ int main(int argc, char* argv[]) bool allowExternalPages = false; bool startupDialog = false; bool acceleratedCompositingForVideoEnabled = false; + bool acceleratedCompositingForFixedPositionEnabled = false; bool softwareCompositingEnabled = false; bool threadedCompositingEnabled = false; bool forceCompositingMode = false; @@ -141,6 +143,7 @@ int main(int argc, char* argv[]) string javaScriptFlags; bool encodeBinary = false; bool noTimeout = false; + bool acceleratedAnimationEnabled = false; for (int i = 1; i < argc; ++i) { string argument(argv[i]); if (argument == "-") @@ -163,6 +166,8 @@ int main(int argc, char* argv[]) hardwareAcceleratedGL = true; else if (argument == optionEnableAcceleratedCompositingForVideo) acceleratedCompositingForVideoEnabled = true; + else if (argument == optionEnableAcceleratedFixedPosition) + acceleratedCompositingForFixedPositionEnabled = true; else if (argument == optionEnableSoftwareCompositing) softwareCompositingEnabled = true; else if (argument == optionEnableThreadedCompositing) @@ -219,12 +224,14 @@ int main(int argc, char* argv[]) TestShell shell; shell.setAllowExternalPages(allowExternalPages); shell.setAcceleratedCompositingForVideoEnabled(acceleratedCompositingForVideoEnabled); + shell.setAcceleratedCompositingForFixedPositionEnabled(acceleratedCompositingForFixedPositionEnabled); shell.setSoftwareCompositingEnabled(softwareCompositingEnabled); shell.setThreadedCompositingEnabled(threadedCompositingEnabled); shell.setForceCompositingMode(forceCompositingMode); shell.setAccelerated2dCanvasEnabled(accelerated2DCanvasEnabled); shell.setDeferred2dCanvasEnabled(deferred2DCanvasEnabled); shell.setAcceleratedPaintingEnabled(acceleratedPaintingEnabled); + shell.setAcceleratedAnimationEnabled(acceleratedAnimationEnabled); shell.setPerTilePaintingEnabled(perTilePaintingEnabled); shell.setDeferredImageDecodingEnabled(deferredImageDecodingEnabled); shell.setJavaScriptFlags(javaScriptFlags); diff --git a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp index 6eaf9d603..ca1e6043f 100644 --- a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp +++ b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp @@ -161,7 +161,7 @@ public: virtual void runIfValid() OVERRIDE { m_dataChannel.dataArrived(m_data, m_length); - delete m_data; + delete [] m_data; } private: diff --git a/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp b/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp index b8aecf100..aa2bf830f 100644 --- a/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp +++ b/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp @@ -65,7 +65,6 @@ void TestEventPrinter::handleTextHeader() const void TestEventPrinter::handleTextFooter() const { printf("#EOF\n"); - fprintf(stderr, "#EOF\n"); } void TestEventPrinter::handleAudio(const void* audioData, size_t audioSize) const @@ -95,6 +94,7 @@ void TestEventPrinter::handleImage(const char* actualHash, const char* expectedH void TestEventPrinter::handleTestFooter(bool) const { printf("#EOF\n"); + fprintf(stderr, "#EOF\n"); } void TestEventPrinter::handleBinary(const void* data, size_t size) const diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebEventSender.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebEventSender.h index 0df88a77d..47c59efe6 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/public/WebEventSender.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/public/WebEventSender.h @@ -31,7 +31,7 @@ #ifndef WebEventSender_h #define WebEventSender_h -#include "WebDragOperation.h" +#include "WebKit/chromium/public/WebDragOperation.h" namespace WebKit { class WebDragData; diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h index dd3303352..ab47d4f9d 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h @@ -31,8 +31,8 @@ #ifndef WebTestDelegate_h #define WebTestDelegate_h -#include "platform/WebString.h" -#include "platform/WebVector.h" +#include "Platform/chromium/public/WebString.h" +#include "Platform/chromium/public/WebVector.h" namespace WebKit { struct WebContextMenuData; @@ -51,7 +51,7 @@ public: virtual void setEditCommand(const std::string& name, const std::string& value) = 0; virtual WebKit::WebContextMenuData* lastContextMenuData() const = 0; virtual void setGamepadData(const WebKit::WebGamepads&) = 0; - virtual void printMessage(const std::string& message) const = 0; + virtual void printMessage(const std::string& message) = 0; // The delegate takes ownership of the WebTask objects and is responsible // for deleting them. @@ -59,6 +59,8 @@ public: virtual void postDelayedTask(WebTask*, long long ms) = 0; virtual WebKit::WebString registerIsolatedFileSystem(const WebKit::WebVector<WebKit::WebString>& absoluteFilenames) = 0; + virtual long long getCurrentTimeInMillisecond() = 0; + virtual WebKit::WebString getAbsoluteWebStringFromUTF8Path(const std::string& path) = 0; }; } diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h b/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h index 60cc6271e..47fd466af 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h @@ -43,7 +43,6 @@ #define CppVariant_h #include "WebBindings.h" -#include "webkit/support/webkit_support.h" #include <string> #include <wtf/Vector.h> diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp index 2f4a0554c..77fcb76e8 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp @@ -43,16 +43,17 @@ #include "config.h" #include "EventSender.h" +#include "KeyCodeMapping.h" #include "TestDelegate.h" #include "WebContextMenuData.h" #include "WebDragOperation.h" +#include "WebEventSender.h" #include "WebTouchPoint.h" #include "WebView.h" #include "platform/WebDragData.h" #include "platform/WebPoint.h" #include "platform/WebString.h" #include "platform/WebVector.h" -#include "webkit/support/webkit_support.h" #include <wtf/Deque.h> #include <wtf/StringExtras.h> @@ -125,9 +126,9 @@ inline bool outsideMultiClickRadius(const WebPoint& a, const WebPoint& b) // dependent (e.g., dragging has a timeout vs selection). uint32 timeOffsetMs = 0; -double getCurrentEventTimeSec() +double getCurrentEventTimeSec(TestDelegate* delegate) { - return (webkit_support::GetCurrentTimeInMillisecond() + timeOffsetMs) / 1000.0; + return (delegate->getCurrentTimeInMillisecond() + timeOffsetMs) / 1000.0; } void advanceEventTime(int32_t deltaMs) @@ -135,7 +136,7 @@ void advanceEventTime(int32_t deltaMs) timeOffsetMs += deltaMs; } -void initMouseEvent(WebInputEvent::Type t, WebMouseEvent::Button b, const WebPoint& pos, WebMouseEvent* e) +void initMouseEvent(WebInputEvent::Type t, WebMouseEvent::Button b, const WebPoint& pos, WebMouseEvent* e, double ts) { e->type = t; e->button = b; @@ -144,7 +145,7 @@ void initMouseEvent(WebInputEvent::Type t, WebMouseEvent::Button b, const WebPoi e->y = pos.y; e->globalX = pos.x; e->globalY = pos.y; - e->timeStampSeconds = getCurrentEventTimeSec(); + e->timeStampSeconds = ts; e->clickCount = clickCount; } @@ -214,16 +215,16 @@ bool getEditCommand(const WebKeyboardEvent& event, string* name) return false; switch (event.windowsKeyCode) { - case webkit_support::VKEY_LEFT: + case VKEY_LEFT: *name = "MoveToBeginningOfLine"; break; - case webkit_support::VKEY_RIGHT: + case VKEY_RIGHT: *name = "MoveToEndOfLine"; break; - case webkit_support::VKEY_UP: + case VKEY_UP: *name = "MoveToBeginningOfDocument"; break; - case webkit_support::VKEY_DOWN: + case VKEY_DOWN: *name = "MoveToEndOfDocument"; break; default: @@ -349,7 +350,7 @@ void EventSender::reset() void EventSender::doDragDrop(const WebDragData& dragData, WebDragOperationsMask mask) { WebMouseEvent event; - initMouseEvent(WebInputEvent::MouseDown, pressedButton, lastMousePos, &event); + initMouseEvent(WebInputEvent::MouseDown, pressedButton, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); WebPoint clientPoint(event.x, event.y); WebPoint screenPoint(event.globalX, event.globalY); currentDragData = dragData; @@ -392,7 +393,7 @@ int EventSender::getButtonNumberFromSingleArg(const CppArgumentList& arguments) void EventSender::updateClickCountForButton(WebMouseEvent::Button buttonType) { - if ((getCurrentEventTimeSec() - lastClickTimeSec < multipleClickTimeSec) + if ((getCurrentEventTimeSec(m_delegate) - lastClickTimeSec < multipleClickTimeSec) && (!outsideMultiClickRadius(lastMousePos, lastClickPos)) && (buttonType == lastButtonType)) ++clickCount; @@ -422,7 +423,7 @@ void EventSender::mouseDown(const CppArgumentList& arguments, CppVariant* result WebMouseEvent event; pressedButton = buttonType; - initMouseEvent(WebInputEvent::MouseDown, buttonType, lastMousePos, &event); + initMouseEvent(WebInputEvent::MouseDown, buttonType, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); if (arguments.size() >= 2 && (arguments[1].isObject() || arguments[1].isString())) applyKeyModifiers(&(arguments[1]), &event); webview()->handleInputEvent(event); @@ -448,7 +449,7 @@ void EventSender::mouseUp(const CppArgumentList& arguments, CppVariant* result) replaySavedEvents(); } else { WebMouseEvent event; - initMouseEvent(WebInputEvent::MouseUp, buttonType, lastMousePos, &event); + initMouseEvent(WebInputEvent::MouseUp, buttonType, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); if (arguments.size() >= 2 && (arguments[1].isObject() || arguments[1].isString())) applyKeyModifiers(&(arguments[1]), &event); doMouseUp(event); @@ -497,7 +498,7 @@ void EventSender::mouseMoveTo(const CppArgumentList& arguments, CppVariant* resu mouseEventQueue.append(savedEvent); } else { WebMouseEvent event; - initMouseEvent(WebInputEvent::MouseMove, pressedButton, mousePos, &event); + initMouseEvent(WebInputEvent::MouseMove, pressedButton, mousePos, &event, getCurrentEventTimeSec(m_delegate)); doMouseMove(event); } } @@ -535,50 +536,43 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result) bool needsShiftKeyModifier = false; if ("\n" == codeStr) { generateChar = true; - text = code = webkit_support::VKEY_RETURN; + text = code = VKEY_RETURN; } else if ("rightArrow" == codeStr) - code = webkit_support::VKEY_RIGHT; + code = VKEY_RIGHT; else if ("downArrow" == codeStr) - code = webkit_support::VKEY_DOWN; + code = VKEY_DOWN; else if ("leftArrow" == codeStr) - code = webkit_support::VKEY_LEFT; + code = VKEY_LEFT; else if ("upArrow" == codeStr) - code = webkit_support::VKEY_UP; + code = VKEY_UP; else if ("insert" == codeStr) - code = webkit_support::VKEY_INSERT; + code = VKEY_INSERT; else if ("delete" == codeStr) - code = webkit_support::VKEY_DELETE; + code = VKEY_DELETE; else if ("pageUp" == codeStr) - code = webkit_support::VKEY_PRIOR; + code = VKEY_PRIOR; else if ("pageDown" == codeStr) - code = webkit_support::VKEY_NEXT; + code = VKEY_NEXT; else if ("home" == codeStr) - code = webkit_support::VKEY_HOME; + code = VKEY_HOME; else if ("end" == codeStr) - code = webkit_support::VKEY_END; + code = VKEY_END; else if ("printScreen" == codeStr) - code = webkit_support::VKEY_SNAPSHOT; + code = VKEY_SNAPSHOT; else if ("menu" == codeStr) - // FIXME: Change this to webkit_support::VKEY_APPS. - code = 0x5D; + code = VKEY_APPS; else if ("leftControl" == codeStr) - // FIXME: Change this to webkit_support::VKEY_LCONTROL. - code = 0xA2; + code = VKEY_LCONTROL; else if ("rightControl" == codeStr) - // FIXME: Change this to webkit_support::VKEY_RCONTROL. - code = 0xA3; + code = VKEY_RCONTROL; else if ("leftShift" == codeStr) - // FIXME: Change this to webkit_support::VKEY_LSHIFT. - code = 0xA0; + code = VKEY_LSHIFT; else if ("rightShift" == codeStr) - // FIXME: Change this to webkit_support::VKEY_RSHIFT. - code = 0xA1; + code = VKEY_RSHIFT; else if ("leftAlt" == codeStr) - // FIXME: Change this to webkit_support::VKEY_LMENU. - code = 0xA4; + code = VKEY_LMENU; else if ("rightAlt" == codeStr) - // FIXME: Change this to webkit_support::VKEY_RMENU. - code = 0xA5; + code = VKEY_RMENU; else { // Compare the input string with the function-key names defined by the // DOM spec (i.e. "F1",...,"F24"). If the input string is a function-key @@ -588,7 +582,7 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result) snprintf(functionChars, 10, "F%d", i); string functionKeyName(functionChars); if (functionKeyName == codeStr) { - code = webkit_support::VKEY_F1 + (i - 1); + code = VKEY_F1 + (i - 1); break; } } @@ -613,7 +607,7 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result) eventDown.modifiers = 0; eventDown.windowsKeyCode = code; #if OS(LINUX) && USE(GTK) - eventDown.nativeKeyCode = webkit_support::NativeKeyCodeForWindowsKeyCode(code, needsShiftKeyModifier); + eventDown.nativeKeyCode = NativeKeyCodeForWindowsKeyCode(code); #endif if (generateChar) { @@ -775,7 +769,7 @@ void EventSender::replaySavedEvents() switch (e.type) { case SavedEvent::MouseMove: { WebMouseEvent event; - initMouseEvent(WebInputEvent::MouseMove, pressedButton, e.pos, &event); + initMouseEvent(WebInputEvent::MouseMove, pressedButton, e.pos, &event, getCurrentEventTimeSec(m_delegate)); doMouseMove(event); break; } @@ -784,7 +778,7 @@ void EventSender::replaySavedEvents() break; case SavedEvent::MouseUp: { WebMouseEvent event; - initMouseEvent(WebInputEvent::MouseUp, e.buttonType, lastMousePos, &event); + initMouseEvent(WebInputEvent::MouseUp, e.buttonType, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); doMouseUp(event); break; } @@ -843,10 +837,10 @@ void EventSender::contextClick(const CppArgumentList& arguments, CppVariant* res // Generate right mouse down and up. WebMouseEvent event; pressedButton = WebMouseEvent::ButtonRight; - initMouseEvent(WebInputEvent::MouseDown, WebMouseEvent::ButtonRight, lastMousePos, &event); + initMouseEvent(WebInputEvent::MouseDown, WebMouseEvent::ButtonRight, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); webview()->handleInputEvent(event); - initMouseEvent(WebInputEvent::MouseUp, WebMouseEvent::ButtonRight, lastMousePos, &event); + initMouseEvent(WebInputEvent::MouseUp, WebMouseEvent::ButtonRight, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); webview()->handleInputEvent(event); pressedButton = WebMouseEvent::ButtonNone; @@ -906,7 +900,7 @@ void EventSender::beginDragWithFiles(const CppArgumentList& arguments, CppVarian for (size_t i = 0; i < files.size(); ++i) { WebDragData::Item item; item.storageType = WebDragData::Item::StorageTypeFilename; - item.filenameData = webkit_support::GetAbsoluteWebStringFromUTF8Path(files[i]); + item.filenameData = m_delegate->getAbsoluteWebStringFromUTF8Path(files[i]); currentDragData.addItem(item); absoluteFilenames[i] = item.filenameData; } @@ -1014,7 +1008,7 @@ void EventSender::sendCurrentTouchEvent(const WebInputEvent::Type type) WebTouchEvent touchEvent; touchEvent.type = type; touchEvent.modifiers = touchModifiers; - touchEvent.timeStampSeconds = getCurrentEventTimeSec(); + touchEvent.timeStampSeconds = getCurrentEventTimeSec(m_delegate); touchEvent.touchesLength = touchPoints.size(); for (unsigned i = 0; i < touchPoints.size(); ++i) touchEvent.touches[i] = touchPoints[i]; @@ -1054,7 +1048,7 @@ void EventSender::handleMouseWheel(const CppArgumentList& arguments, CppVariant* hasPreciseScrollingDeltas = arguments[3].toBoolean(); WebMouseWheelEvent event; - initMouseEvent(WebInputEvent::MouseWheel, pressedButton, lastMousePos, &event); + initMouseEvent(WebInputEvent::MouseWheel, pressedButton, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); event.wheelTicksX = static_cast<float>(horizontal); event.wheelTicksY = static_cast<float>(vertical); event.deltaX = event.wheelTicksX; @@ -1206,10 +1200,18 @@ void EventSender::gestureEvent(WebInputEvent::Type type, const CppArgumentList& case WebInputEvent::GestureLongPress: event.x = point.x; event.y = point.y; + if (arguments.size() >= 4) { + event.data.tapDown.width = static_cast<float>(arguments[2].toDouble()); + event.data.tapDown.height = static_cast<float>(arguments[3].toDouble()); + } break; case WebInputEvent::GestureTwoFingerTap: event.x = point.x; event.y = point.y; + if (arguments.size() >= 4) { + event.data.twoFingerTap.firstFingerWidth = static_cast<float>(arguments[2].toDouble()); + event.data.twoFingerTap.firstFingerHeight = static_cast<float>(arguments[3].toDouble()); + } break; default: ASSERT_NOT_REACHED(); @@ -1217,7 +1219,7 @@ void EventSender::gestureEvent(WebInputEvent::Type type, const CppArgumentList& event.globalX = event.x; event.globalY = event.y; - event.timeStampSeconds = getCurrentEventTimeSec(); + event.timeStampSeconds = getCurrentEventTimeSec(m_delegate); webview()->handleInputEvent(event); } @@ -1229,7 +1231,7 @@ void EventSender::gestureFlingCancel(const CppArgumentList& arguments, CppVarian WebGestureEvent event; event.type = WebInputEvent::GestureFlingCancel; - event.timeStampSeconds = getCurrentEventTimeSec(); + event.timeStampSeconds = getCurrentEventTimeSec(m_delegate); webview()->handleInputEvent(event); } @@ -1253,7 +1255,7 @@ void EventSender::gestureFlingStart(const CppArgumentList& arguments, CppVariant event.data.flingStart.velocityX = static_cast<float>(arguments[2].toDouble()); event.data.flingStart.velocityY = static_cast<float>(arguments[3].toDouble()); - event.timeStampSeconds = getCurrentEventTimeSec(); + event.timeStampSeconds = getCurrentEventTimeSec(m_delegate); webview()->handleInputEvent(event); } diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.cpp new file mode 100644 index 000000000..c339f2f2b --- /dev/null +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.cpp @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2012 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER 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. + */ + +#include "config.h" +#include "KeyCodeMapping.h" + +#include <wtf/UnusedParam.h> + +namespace WebTestRunner { + +int NativeKeyCodeForWindowsKeyCode(int keysym) +{ +#if OS(LINUX) && USE(GTK) + // See /usr/share/X11/xkb/keycodes/* + static const int asciiToKeyCode[] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 22, + 23, + 0, + 0, + 0, + 36, + 0, + 0, + 50, + 37, + 64, + 127, + 66, + 0, + 0, + 0, + 0, + 131, + 0, + 9, + 100, + 102, + 0, + 0, + 65, // ' ' + 112, // '!' + 117, // '"' + 115, // '#' + 110, // '$' + 113, // '%' + 111, // '&' + 114, // ''' + 116, // '(' + 0, // ')' + 107, // '*' + 0, // '+' + 0, // ',' + 118, // '-' + 119, // '.' + 146, // '/' + 19, // '0' + 10, // '1' + 11, // '2' + 12, // '3' + 13, // '4' + 14, // '5' + 15, // '6' + 16, // '7' + 17, // '8' + 18, // '9' + 0, // ':' + 0, // ';' + 0, // '<' + 0, // '=' + 0, // '>' + 0, // '?' + 0, // '@' + 38, // 'A' + 56, // 'B' + 54, // 'C' + 40, // 'D' + 26, // 'E' + 41, // 'F' + 42, // 'G' + 43, // 'H' + 31, // 'I' + 44, // 'J' + 45, // 'K' + 46, // 'L' + 58, // 'M' + 57, // 'N' + 32, // 'O' + 33, // 'P' + 24, // 'Q' + 27, // 'R' + 39, // 'S' + 28, // 'T' + 30, // 'U' + 55, // 'V' + 25, // 'W' + 53, // 'X' + 29, // 'Y' + 52, // 'Z' + 133, // '[' + 134, // '\' + 135, // ']' + 0, // '^' + 0, // '_' + 90, // '`' + 38, // 'a' + 56, // 'b' + 54, // 'c' + 40, // 'd' + 26, // 'e' + 41, // 'f' + 42, // 'g' + 43, // 'h' + 31, // 'i' + 44, // 'j' + 45, // 'k' + 46, // 'l' + 58, // 'm' + 57, // 'n' + 32, // 'o' + 33, // 'p' + 24, // 'q' + 27, // 'r' + 39, // 's' + 28, // 't' + 30, // 'u' + 55, // 'v' + 25, // 'w' + 53, // 'x' + 29, // 'y' + 52, // 'z' + 96, // '{' + 0, // '|' + 0, // '}' + 0, // '~' + 0, // DEL + }; + + if (keysym <= 127) + return asciiToKeyCode[keysym]; + + switch (keysym) { + case VKEY_PRIOR: + return 112; + case VKEY_NEXT: + return 117; + case VKEY_END: + return 115; + case VKEY_HOME: + return 110; + case VKEY_LEFT: + return 113; + case VKEY_UP: + return 111; + case VKEY_RIGHT: + return 114; + case VKEY_DOWN: + return 116; + case VKEY_SNAPSHOT: + return 107; + case VKEY_INSERT: + return 118; + case VKEY_DELETE: + return 119; + case VKEY_APPS: + return 135; + case VKEY_F1: + case VKEY_F1 + 1: + case VKEY_F1 + 2: + case VKEY_F1 + 3: + case VKEY_F1 + 4: + case VKEY_F1 + 5: + case VKEY_F1 + 6: + case VKEY_F1 + 7: + case VKEY_F1 + 8: + case VKEY_F1 + 9: + case VKEY_F1 + 10: + case VKEY_F1 + 11: + case VKEY_F1 + 12: + case VKEY_F1 + 13: + case VKEY_F1 + 14: + case VKEY_F1 + 15: + case VKEY_F1 + 16: + case VKEY_F1 + 17: + case VKEY_F1 + 18: + case VKEY_F1 + 19: + case VKEY_F1 + 20: + case VKEY_F1 + 21: + case VKEY_F1 + 22: + case VKEY_F1 + 23: + return 67 + (keysym - VKEY_F1); + case VKEY_LSHIFT: + return 50; + case VKEY_RSHIFT: + return 62; + case VKEY_LCONTROL: + return 37; + case VKEY_RCONTROL: + return 105; + case VKEY_LMENU: + return 64; + case VKEY_RMENU: + return 108; + + default: + return 0; + } +#else + UNUSED_PARAM(keysym); + return 0; +#endif +} + +} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.h b/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.h new file mode 100644 index 000000000..87469fac4 --- /dev/null +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2012 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER 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. + */ + +#ifndef KeyCodeMapping_h +#define KeyCodeMapping_h + +namespace WebTestRunner { + +// The keycodes match the values of the virtual keycodes found here http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx +enum { + VKEY_RETURN = 0x0D, + VKEY_PRIOR = 0x21, + VKEY_NEXT = 0x22, + VKEY_END = 0x23, + VKEY_HOME = 0x24, + VKEY_LEFT = 0x25, + VKEY_UP = 0x26, + VKEY_RIGHT = 0x27, + VKEY_DOWN = 0x28, + VKEY_SNAPSHOT = 0x2C, + VKEY_INSERT = 0x2D, + VKEY_DELETE = 0x2E, + VKEY_APPS = 0x5D, + VKEY_F1 = 0x70, + VKEY_LSHIFT = 0xA0, + VKEY_RSHIFT = 0xA1, + VKEY_LCONTROL = 0xA2, + VKEY_RCONTROL = 0xA3, + VKEY_LMENU = 0xA4, + VKEY_RMENU = 0xA5, +}; + +// Map a windows keycode to a native keycode on OS(LINUX) && USE(GTK). +int NativeKeyCodeForWindowsKeyCode(int keysym); + +} + +#endif // KeyCodeMapping_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h index 218bbdf42..0498fcb3f 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h @@ -51,10 +51,12 @@ public: virtual void setEditCommand(const std::string& name, const std::string& value) = 0; virtual WebKit::WebContextMenuData* lastContextMenuData() const = 0; virtual void setGamepadData(const WebKit::WebGamepads&) = 0; - virtual void printMessage(const std::string& message) const = 0; + virtual void printMessage(const std::string& message) = 0; virtual void postTask(WebTestRunner::WebTask*) = 0; virtual void postDelayedTask(WebTestRunner::WebTask*, long long ms) = 0; virtual WebKit::WebString registerIsolatedFileSystem(const WebKit::WebVector<WebKit::WebString>& absoluteFilenames) = 0; + virtual long long getCurrentTimeInMillisecond() = 0; + virtual WebKit::WebString getAbsoluteWebStringFromUTF8Path(const std::string& path) = 0; }; #endif // TestDelegate_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp index e6ead1551..f0da79831 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp @@ -32,51 +32,6 @@ #include "config.h" #include "TestRunner.h" -#include "WebAnimationController.h" -#include "WebBindings.h" -#include "WebConsoleMessage.h" -#include "WebDeviceOrientation.h" -#include "WebDeviceOrientationClientMock.h" -#include "WebDocument.h" -#include "WebElement.h" -#include "WebFindOptions.h" -#include "WebFrame.h" -#include "WebGeolocationClientMock.h" -#include "WebIDBFactory.h" -#include "WebInputElement.h" -#include "WebIntent.h" -#include "WebIntentRequest.h" -#include "WebKit.h" -#include "WebNotificationPresenter.h" -#include "WebPrintParams.h" -#include "WebScriptSource.h" -#include "WebSecurityPolicy.h" -#include "WebSettings.h" -#include "WebSurroundingText.h" -#include "WebView.h" -#include "WebWorkerInfo.h" -#include "platform/WebData.h" -#include "platform/WebSerializedScriptValue.h" -#include "platform/WebSize.h" -#include "platform/WebURL.h" -#include "v8/include/v8.h" -#include "webkit/support/webkit_support.h" -#include <algorithm> -#include <clocale> -#include <cstdlib> -#include <limits> -#include <sstream> -#include <wtf/OwnArrayPtr.h> -#include <wtf/text/WTFString.h> - -#if OS(LINUX) || OS(ANDROID) -#include "linux/WebFontRendering.h" -#endif - -using namespace WebCore; -using namespace WebKit; -using namespace std; - TestRunner::TestRunner() { } diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h index 39e19d573..503271b5d 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h @@ -33,21 +33,6 @@ #define TestRunner_h #include "CppBoundClass.h" -#include "WebDeliveredIntentClient.h" -#include "WebTextDirection.h" -#include "platform/WebArrayBufferView.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" -#include <wtf/Deque.h> -#include <wtf/OwnPtr.h> - -namespace WebKit { -class WebGeolocationClientMock; -} - -namespace webkit_support { -class ScopedTempDirectory; -} class TestRunner : public CppBoundClass { public: diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp index 632d9664b..9a86953c3 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp @@ -63,10 +63,12 @@ public: virtual void setEditCommand(const std::string& name, const std::string& value); virtual WebContextMenuData* lastContextMenuData() const; virtual void setGamepadData(const WebGamepads&); - virtual void printMessage(const std::string& message) const; + virtual void printMessage(const std::string& message); virtual void postTask(WebTask*); virtual void postDelayedTask(WebTask*, long long ms); virtual WebString registerIsolatedFileSystem(const WebVector<WebString>& absoluteFilenames); + virtual long long getCurrentTimeInMillisecond(); + virtual WebKit::WebString getAbsoluteWebStringFromUTF8Path(const std::string& path); private: TestInterfaces m_interfaces; @@ -127,7 +129,7 @@ void WebTestInterfaces::Internal::setGamepadData(const WebGamepads& pads) m_delegate->setGamepadData(pads); } -void WebTestInterfaces::Internal::printMessage(const std::string& message) const +void WebTestInterfaces::Internal::printMessage(const std::string& message) { m_delegate->printMessage(message); } @@ -147,6 +149,16 @@ WebString WebTestInterfaces::Internal::registerIsolatedFileSystem(const WebVecto return m_delegate->registerIsolatedFileSystem(absoluteFilenames); } +long long WebTestInterfaces::Internal::getCurrentTimeInMillisecond() +{ + return m_delegate->getCurrentTimeInMillisecond(); +} + +WebKit::WebString WebTestInterfaces::Internal::getAbsoluteWebStringFromUTF8Path(const std::string& path) +{ + return m_delegate->getAbsoluteWebStringFromUTF8Path(path); +} + WebTestInterfaces::WebTestInterfaces() { m_internal = new Internal; diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp index 2692e7458..4c42dc0dd 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.cpp +++ b/Tools/DumpRenderTree/chromium/TestShell.cpp @@ -35,6 +35,7 @@ #include "DRTDevToolsClient.h" #include "DRTTestRunner.h" #include "MockWebPrerenderingSupport.h" +#include "WebCache.h" #include "WebDataSource.h" #include "WebDocument.h" #include "WebElement.h" @@ -109,6 +110,7 @@ TestShell::TestShell() , m_dumpPixelsForCurrentTest(false) , m_allowExternalPages(false) , m_acceleratedCompositingForVideoEnabled(false) + , m_acceleratedCompositingForFixedPositionEnabled(false) , m_softwareCompositingEnabled(false) , m_threadedCompositingEnabled(false) , m_forceCompositingMode(false) @@ -144,6 +146,7 @@ TestShell::TestShell() WebRuntimeFeatures::enableShadowDOM(true); WebRuntimeFeatures::enableStyleScoped(true); WebRuntimeFeatures::enableScriptedSpeech(true); + WebRuntimeFeatures::enableRequestAutocomplete(true); // 30 second is the same as the value in Mac DRT. // If we use a value smaller than the timeout value of @@ -228,6 +231,7 @@ void TestShell::resetWebSettings(WebView& webView) m_prefs.reset(); m_prefs.acceleratedCompositingEnabled = true; m_prefs.acceleratedCompositingForVideoEnabled = m_acceleratedCompositingForVideoEnabled; + m_prefs.acceleratedCompositingForFixedPositionEnabled = m_acceleratedCompositingForFixedPositionEnabled; m_prefs.forceCompositingMode = m_forceCompositingMode; m_prefs.accelerated2dCanvasEnabled = m_accelerated2dCanvasEnabled; m_prefs.deferred2dCanvasEnabled = m_deferred2dCanvasEnabled; @@ -318,6 +322,7 @@ void TestShell::resetTestController() webView()->setFixedLayoutSize(WebSize(0, 0)); webView()->mainFrame()->clearOpener(); WebTestingSupport::resetInternalsObject(webView()->mainFrame()); + WebCache::clear(); } void TestShell::loadURL(const WebURL& url) @@ -387,6 +392,11 @@ void TestShell::setPerTilePaintingEnabled(bool enabled) Platform::current()->compositorSupport()->setPerTilePaintingEnabled(enabled); } +void TestShell::setAcceleratedAnimationEnabled(bool enabled) +{ + Platform::current()->compositorSupport()->setAcceleratedAnimationEnabled(enabled); +} + static string dumpDocumentText(WebFrame* frame) { // We use the document element's text instead of the body text here because diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h index 03315690e..12e1dbbef 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.h +++ b/Tools/DumpRenderTree/chromium/TestShell.h @@ -128,6 +128,7 @@ public: void setAllowExternalPages(bool allowExternalPages) { m_allowExternalPages = allowExternalPages; } void setAcceleratedCompositingForVideoEnabled(bool enabled) { m_acceleratedCompositingForVideoEnabled = enabled; } + void setAcceleratedCompositingForFixedPositionEnabled(bool enabled) { m_acceleratedCompositingForFixedPositionEnabled = enabled; } bool softwareCompositingEnabled() { return m_softwareCompositingEnabled; } void setSoftwareCompositingEnabled(bool enabled) { m_softwareCompositingEnabled = enabled; } void setThreadedCompositingEnabled(bool enabled) { m_threadedCompositingEnabled = enabled; } @@ -136,6 +137,7 @@ public: void setDeferred2dCanvasEnabled(bool enabled) { m_deferred2dCanvasEnabled = enabled; } void setAcceleratedPaintingEnabled(bool enabled) { m_acceleratedPaintingEnabled = enabled; } void setPerTilePaintingEnabled(bool); + void setAcceleratedAnimationEnabled(bool); void setDeferredImageDecodingEnabled(bool enabled) { m_deferredImageDecodingEnabled = enabled; } #if defined(OS_WIN) // Access to the finished event. Used by the static WatchDog thread. @@ -227,6 +229,7 @@ private: int m_timeout; // timeout value in millisecond bool m_allowExternalPages; bool m_acceleratedCompositingForVideoEnabled; + bool m_acceleratedCompositingForFixedPositionEnabled; bool m_softwareCompositingEnabled; bool m_threadedCompositingEnabled; bool m_forceCompositingMode; diff --git a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp index 7080bef18..414db2c1c 100644 --- a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp +++ b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp @@ -206,6 +206,8 @@ void TestWebPlugin::updateGeometry(const WebRect& frameRect, if (clipRect == m_rect) return; m_rect = clipRect; + if (m_rect.isEmpty()) + return; m_context->reshape(m_rect.width, m_rect.height); m_context->viewport(0, 0, m_rect.width, m_rect.height); diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.cpp b/Tools/DumpRenderTree/chromium/WebPreferences.cpp index 5c8c92c99..46afbbdb2 100644 --- a/Tools/DumpRenderTree/chromium/WebPreferences.cpp +++ b/Tools/DumpRenderTree/chromium/WebPreferences.cpp @@ -85,6 +85,7 @@ void WebPreferences::reset() javaEnabled = false; javaScriptCanAccessClipboard = true; javaScriptCanOpenWindowsAutomatically = true; + supportsMultipleWindows = true; javaScriptEnabled = true; loadsImagesAutomatically = true; localStorageEnabled = true; @@ -111,6 +112,7 @@ void WebPreferences::reset() tabsToLinks = false; hyperlinkAuditingEnabled = false; acceleratedCompositingForVideoEnabled = false; + acceleratedCompositingForFixedPositionEnabled = false; acceleratedCompositingEnabled = false; accelerated2dCanvasEnabled = false; deferred2dCanvasEnabled = false; @@ -120,6 +122,7 @@ void WebPreferences::reset() mediaPlaybackRequiresUserGesture = false; mockScrollbarsEnabled = false; cssCustomFilterEnabled = false; + shouldRespectImageOrientation = false; } static void setStandardFontFamilyWrapper(WebSettings* settings, const WebKit::WebString& font, UScriptCode script) @@ -201,6 +204,7 @@ void WebPreferences::applyTo(WebView* webView) settings->setJavaEnabled(javaEnabled); settings->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard); settings->setJavaScriptCanOpenWindowsAutomatically(javaScriptCanOpenWindowsAutomatically); + settings->setSupportsMultipleWindows(supportsMultipleWindows); settings->setJavaScriptEnabled(javaScriptEnabled); settings->setLoadsImagesAutomatically(loadsImagesAutomatically); settings->setLocalStorageEnabled(localStorageEnabled); @@ -221,6 +225,8 @@ void WebPreferences::applyTo(WebView* webView) settings->setCaretBrowsingEnabled(caretBrowsingEnabled); settings->setAcceleratedCompositingEnabled(acceleratedCompositingEnabled); settings->setAcceleratedCompositingForVideoEnabled(acceleratedCompositingForVideoEnabled); + settings->setAcceleratedCompositingForFixedPositionEnabled(acceleratedCompositingForFixedPositionEnabled); + settings->setFixedPositionCreatesStackingContext(acceleratedCompositingForFixedPositionEnabled); settings->setForceCompositingMode(forceCompositingMode); settings->setAccelerated2dCanvasEnabled(accelerated2dCanvasEnabled); settings->setDeferred2dCanvasEnabled(deferred2dCanvasEnabled); @@ -229,6 +235,7 @@ void WebPreferences::applyTo(WebView* webView) settings->setMediaPlaybackRequiresUserGesture(mediaPlaybackRequiresUserGesture); settings->setMockScrollbarsEnabled(mockScrollbarsEnabled); settings->setApplyDefaultDeviceScaleFactorInCompositor(forceCompositingMode); + settings->setShouldRespectImageOrientation(shouldRespectImageOrientation); // Fixed values. settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.h b/Tools/DumpRenderTree/chromium/WebPreferences.h index e0315f2d0..36fcd196f 100644 --- a/Tools/DumpRenderTree/chromium/WebPreferences.h +++ b/Tools/DumpRenderTree/chromium/WebPreferences.h @@ -87,6 +87,7 @@ struct WebPreferences { bool javaEnabled; bool javaScriptCanAccessClipboard; bool javaScriptCanOpenWindowsAutomatically; + bool supportsMultipleWindows; bool javaScriptEnabled; bool loadsImagesAutomatically; bool localStorageEnabled; @@ -104,6 +105,7 @@ struct WebPreferences { bool hyperlinkAuditingEnabled; bool caretBrowsingEnabled; bool acceleratedCompositingForVideoEnabled; + bool acceleratedCompositingForFixedPositionEnabled; bool acceleratedCompositingEnabled; bool forceCompositingMode; bool accelerated2dCanvasEnabled; @@ -113,6 +115,7 @@ struct WebPreferences { bool mediaPlaybackRequiresUserGesture; bool mockScrollbarsEnabled; bool cssCustomFilterEnabled; + bool shouldRespectImageOrientation; WebPreferences() { reset(); } void reset(); diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp index 18422db58..98b87bf8e 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp +++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp @@ -696,6 +696,12 @@ void WebViewHost::postAccessibilityNotification(const WebAccessibilityObject& ob case WebAccessibilityNotificationInvalidStatusChanged: notificationName = "InvalidStatusChanged"; break; + case WebAccessibilityNotificationTextChanged: + notificationName = "TextChanged"; + break; + case WebAccessibilityNotificationAriaAttributeChanged: + notificationName = "AriaAttributeChanged"; + break; default: notificationName = "UnknownNotification"; break; @@ -1480,7 +1486,7 @@ void WebViewHost::setGamepadData(const WebGamepads& pads) webkit_support::SetGamepadData(pads); } -void WebViewHost::printMessage(const std::string& message) const +void WebViewHost::printMessage(const std::string& message) { printf("%s", message.c_str()); } @@ -1500,6 +1506,16 @@ WebString WebViewHost::registerIsolatedFileSystem(const WebVector<WebString>& ab return webkit_support::RegisterIsolatedFileSystem(absoluteFilenames); } +long long WebViewHost::getCurrentTimeInMillisecond() +{ + return webkit_support::GetCurrentTimeInMillisecond(); +} + +WebKit::WebString WebViewHost::getAbsoluteWebStringFromUTF8Path(const std::string& path) +{ + return webkit_support::GetAbsoluteWebStringFromUTF8Path(path); +} + // Public functions ----------------------------------------------------------- WebViewHost::WebViewHost(TestShell* shell) diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h index 41237cba9..86007194b 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.h +++ b/Tools/DumpRenderTree/chromium/WebViewHost.h @@ -135,10 +135,12 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, virtual void clearEditCommand() OVERRIDE; virtual void fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) OVERRIDE; virtual void setGamepadData(const WebKit::WebGamepads&) OVERRIDE; - virtual void printMessage(const std::string& message) const OVERRIDE; + virtual void printMessage(const std::string& message) OVERRIDE; virtual void postTask(WebTestRunner::WebTask*) OVERRIDE; virtual void postDelayedTask(WebTestRunner::WebTask*, long long ms) OVERRIDE; virtual WebKit::WebString registerIsolatedFileSystem(const WebKit::WebVector<WebKit::WebString>& absoluteFilenames) OVERRIDE; + virtual long long getCurrentTimeInMillisecond() OVERRIDE; + virtual WebKit::WebString getAbsoluteWebStringFromUTF8Path(const std::string& path) OVERRIDE; // NavigationHost virtual bool navigate(const TestNavigationEntry&, bool reload); diff --git a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp index a0dec4e7a..3d1c112e0 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp @@ -66,6 +66,7 @@ RefPtr<TestRunner> gTestRunner; volatile bool done = false; static bool dumpPixelsForCurrentTest; +static int dumpPixelsForAllTests = false; static int dumpTree = true; static int printSeparators = true; @@ -192,6 +193,7 @@ static bool parseCommandLineOptions(int argc, char** argv) { static const option options[] = { {"notree", no_argument, &dumpTree, false}, + {"pixel-tests", no_argument, &dumpPixelsForAllTests, true}, {"tree", no_argument, &dumpTree, true}, {0, 0, 0, 0} }; @@ -258,7 +260,7 @@ static void runTest(const char* inputLine) TestCommand command = parseInputLine(inputLine); const String testPathOrURL(command.pathOrURL.c_str()); ASSERT(!testPathOrURL.isEmpty()); - dumpPixelsForCurrentTest = command.shouldDumpPixels; + dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests; const String expectedPixelHash(command.expectedPixelHash.c_str()); // Convert the path into a full file URL if it does not look @@ -419,7 +421,11 @@ void dump() static Ecore_Evas* initEcoreEvas() { - Ecore_Evas* ecoreEvas = ecore_evas_new(0, 0, 0, 800, 600, 0); + const char* engine = 0; +#if defined(WTF_USE_ACCELERATED_COMPOSITING) && defined(HAVE_ECORE_X) + engine = "opengl_x11"; +#endif + Ecore_Evas* ecoreEvas = ecore_evas_new(engine, 0, 0, 800, 600, 0); if (!ecoreEvas) { shutdownEfl(); exit(EXIT_FAILURE); diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp index d1ba5ff8f..fb9c717e2 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp @@ -196,6 +196,8 @@ void DumpRenderTreeChrome::removeWindow(Evas_Object* view) bool DumpRenderTreeChrome::initialize() { + // Notifies that DRT is running for ewkView to create testable objects. + DumpRenderTreeSupportEfl::setDumpRenderTreeModeEnabled(true); DumpRenderTreeSupportEfl::setMockScrollbarsEnabled(true); m_mainView = createView(); @@ -308,6 +310,7 @@ void DumpRenderTreeChrome::resetDefaultsToConsistentValues() DumpRenderTreeSupportEfl::clearOpener(mainFrame()); DumpRenderTreeSupportEfl::clearUserScripts(mainView()); DumpRenderTreeSupportEfl::clearUserStyleSheets(mainView()); + DumpRenderTreeSupportEfl::resetGeolocationClientMock(mainView()); DumpRenderTreeSupportEfl::setInteractiveFormValidationEnabled(mainView(), true); DumpRenderTreeSupportEfl::setValidationMessageTimerMagnification(mainView(), -1); DumpRenderTreeSupportEfl::setAuthorAndUserStylesEnabled(mainView(), true); diff --git a/Tools/DumpRenderTree/efl/EventSender.cpp b/Tools/DumpRenderTree/efl/EventSender.cpp index 78d2dbcf3..e2ff5e1f6 100644 --- a/Tools/DumpRenderTree/efl/EventSender.cpp +++ b/Tools/DumpRenderTree/efl/EventSender.cpp @@ -269,6 +269,102 @@ static unsigned modifiersFromJSValue(JSContextRef context, const JSValueRef modi return modifier; } +static JSValueRef getMenuItemTitleCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) +{ + Ewk_Context_Menu_Item* item = static_cast<Ewk_Context_Menu_Item*>(JSObjectGetPrivate(object)); + CString label; + if (ewk_context_menu_item_type_get(item) == EWK_SEPARATOR_TYPE) + label = "<separator>"; + else + label = ewk_context_menu_item_title_get(item); + + return JSValueMakeString(context, JSStringCreateWithUTF8CString(label.data())); +} + +static bool setMenuItemTitleCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) +{ + return true; +} + +static JSValueRef menuItemClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + Ewk_Context_Menu_Item* item = static_cast<Ewk_Context_Menu_Item*>(JSObjectGetPrivate(thisObject)); + ewk_context_menu_item_select(ewk_context_menu_item_parent_get(item), item); + return JSValueMakeUndefined(context); +} + +static JSStaticFunction staticMenuItemFunctions[] = { + { "click", menuItemClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +static JSStaticValue staticMenuItemValues[] = { + { "title", getMenuItemTitleCallback, setMenuItemTitleCallback, kJSPropertyAttributeNone }, + { 0, 0, 0, 0 } +}; + +static JSClassRef getMenuItemClass() +{ + static JSClassRef menuItemClass = 0; + + if (!menuItemClass) { + JSClassDefinition classDefinition = { + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + classDefinition.staticFunctions = staticMenuItemFunctions; + classDefinition.staticValues = staticMenuItemValues; + + menuItemClass = JSClassCreate(&classDefinition); + } + + return menuItemClass; +} + +static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + Evas_Object* view = ewk_frame_view_get(browser->mainFrame()); + if (!view) + return JSValueMakeUndefined(context); + + Evas* evas = evas_object_evas_get(view); + if (!evas) + return JSValueMakeUndefined(context); + + Evas_Event_Mouse_Down mouseDown; + mouseDown.button = 3; + mouseDown.output.x = gLastMousePositionX; + mouseDown.output.y = gLastMousePositionY; + mouseDown.canvas.x = gLastMousePositionX; + mouseDown.canvas.y = gLastMousePositionY; + mouseDown.data = 0; + mouseDown.modifiers = const_cast<Evas_Modifier*>(evas_key_modifier_get(evas)); + mouseDown.locks = const_cast<Evas_Lock*>(evas_key_lock_get(evas)); + mouseDown.flags = EVAS_BUTTON_NONE; + mouseDown.timestamp = ecore_loop_time_get(); + mouseDown.event_flags = EVAS_EVENT_FLAG_NONE; + mouseDown.dev = 0; + + ewk_view_context_menu_forward_event(view, &mouseDown); + Ewk_Context_Menu* ewkMenu = ewk_view_context_menu_get(view); + + JSValueRef valueRef = JSObjectMakeArray(context, 0, 0, 0); + if (ewkMenu) { + const Eina_List* ewkMenuItems = ewk_context_menu_item_list_get(ewkMenu); + JSValueRef arrayValues[eina_list_count(ewkMenuItems)]; + + const Eina_List* listIterator; + void* data; + int index = 0; + EINA_LIST_FOREACH(ewkMenuItems, listIterator, data) + arrayValues[index++] = JSObjectMake(context, getMenuItemClass(), data); + + if (index) + valueRef = JSObjectMakeArray(context, index - 1, arrayValues, 0); + } + + return valueRef; +} + static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { int button = 0; @@ -803,6 +899,7 @@ static JSValueRef setTouchModifierCallback(JSContextRef context, JSObjectRef fun } static JSStaticFunction staticFunctions[] = { + { "contextClick", contextClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "mouseScrollBy", mouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "continuousMouseScrollBy", continuousMouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "mouseDown", mouseDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp b/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp index efc506160..446483652 100644 --- a/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp +++ b/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp @@ -47,13 +47,12 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool, bool, bool, bool const Evas_Object* mainFrame = browser->mainFrame(); int x, y, width, height; - if (!ewk_frame_visible_content_geometry_get(mainFrame, EINA_TRUE, &x, &y, &width, &height)) - return 0; + evas_object_geometry_get(browser->mainFrame(), &x, &y, &width, &height); + const Eina_Rectangle rect = { x, y, width, height }; - RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height)); + RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, rect.w, rect.h)); RefPtr<cairo_t> context = adoptRef(cairo_create(surface.get())); - const Eina_Rectangle rect = { x, y, width, height }; if (!ewk_view_paint(privateData, context.get(), &rect)) return 0; diff --git a/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp b/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp index 19703aee6..cd78b10aa 100644 --- a/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp +++ b/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp @@ -365,30 +365,41 @@ void TestRunner::setMockDeviceOrientation(bool, double, bool, double, bool, doub notImplemented(); } -void TestRunner::setMockGeolocationPosition(double, double, double, bool, double, bool, double, bool, double, bool, double) +void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool canProvideAltitude, double altitude, bool canProvideAltitudeAccuracy, double altitudeAccuracy, bool canProvideHeading, double heading, bool canProvideSpeed, double speed) { - // FIXME: Implement for Geolocation layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=28264. - notImplemented(); + Evas_Object* view = browser->mainView(); + if (browser->extraViews().size() > 0) + view = browser->extraViews().last(); + + DumpRenderTreeSupportEfl::setMockGeolocationPosition(view, latitude, longitude, accuracy, canProvideAltitude, altitude, canProvideAltitudeAccuracy, altitudeAccuracy, canProvideHeading, heading, canProvideSpeed, speed); } -void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef) +void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message) { - // FIXME: Implement for Geolocation layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=28264. - notImplemented(); + Evas_Object* view = browser->mainView(); + if (browser->extraViews().size() > 0) + view = browser->extraViews().last(); + + DumpRenderTreeSupportEfl::setMockGeolocationPositionUnavailableError(view, message->string().utf8().data()); } void TestRunner::setGeolocationPermission(bool allow) { - // FIXME: Implement for Geolocation layout tests. setGeolocationPermissionCommon(allow); + Evas_Object* view = browser->mainView(); + if (browser->extraViews().size() > 0) + view = browser->extraViews().last(); + + DumpRenderTreeSupportEfl::setMockGeolocationPermission(view, allow); } int TestRunner::numberOfPendingGeolocationPermissionRequests() { - // FIXME: Implement for Geolocation layout tests. - return -1; + Evas_Object* view = browser->mainView(); + if (browser->extraViews().size() > 0) + view = browser->extraViews().last(); + + return DumpRenderTreeSupportEfl::numberOfPendingGeolocationPermissionRequests(view); } void TestRunner::addMockSpeechInputResult(JSStringRef, double, JSStringRef) diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp index f574c11e8..bf687b2d3 100644 --- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -73,6 +73,7 @@ extern gchar* webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame); volatile bool done; static bool printSeparators; +static int dumpPixelsForAllTests = false; static bool dumpPixelsForCurrentTest; static int dumpTree = 1; static int useTimeoutWatchdog = 1; @@ -548,6 +549,7 @@ static void initializeGlobalsFromCommandLineOptions(int argc, char *argv[]) { struct option options[] = { {"notree", no_argument, &dumpTree, false}, + {"pixel-tests", no_argument, &dumpPixelsForAllTests, true}, {"tree", no_argument, &dumpTree, true}, {"no-timeout", no_argument, &useTimeoutWatchdog, false}, {NULL, 0, NULL, 0} @@ -645,10 +647,6 @@ static void setDefaultsToConsistentStateValuesForTesting() { resetDefaultsToConsistentValues(); - /* Disable the default auth dialog for testing */ - SoupSession* session = webkit_get_default_session(); - soup_session_remove_feature_by_type(session, WEBKIT_TYPE_SOUP_AUTH_DIALOG); - #if PLATFORM(X11) webkit_web_settings_add_extra_plugin_directory(webView, TEST_PLUGIN_DIR); #endif @@ -696,7 +694,7 @@ static void runTest(const string& inputLine) TestCommand command = parseInputLine(inputLine); string& testURL = command.pathOrURL; - dumpPixelsForCurrentTest = command.shouldDumpPixels; + dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests; // Convert the path into a full file URL if it does not look // like an HTTP/S URL (doesn't start with http:// or https://). diff --git a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig index 3bc7a2a84..be91f5e50 100644 --- a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig +++ b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig @@ -21,8 +21,8 @@ // (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 "CompilerVersion.xcconfig" - +CLANG_CXX_LANGUAGE_STANDARD = gnu++0x; +CLANG_CXX_LIBRARY = libc++; CLANG_WARN_CXX0X_EXTENSIONS = NO; HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include ForwardingHeaders mac/InternalHeaders $(NEXT_ROOT)/usr/local/include/WebCoreTestSupport ${SRCROOT}/../../Source/JavaScriptCore/icu; FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks; @@ -34,29 +34,17 @@ GCC_ENABLE_CPP_RTTI = NO; GCC_OBJC_CALL_CXX_CDTORS = YES GCC_PRECOMPILE_PREFIX_HEADER = YES GCC_TREAT_WARNINGS_AS_ERRORS = YES +GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO GCC_WARN_UNUSED_FUNCTION = YES GCC_WARN_UNUSED_VARIABLE = YES WARNING_CFLAGS = -Wall -W -Wno-unused-parameter -Wundef LINKER_DISPLAYS_MANGLED_NAMES = YES; -CLANG_CXX_LIBRARY = $(CLANG_CXX_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -CLANG_CXX_LIBRARY_1060 = libstdc++; -CLANG_CXX_LIBRARY_1070 = libc++; -CLANG_CXX_LIBRARY_1080 = libc++; -CLANG_CXX_LIBRARY_1090 = libc++; - -REAL_PLATFORM_NAME = $(REAL_PLATFORM_NAME_$(PLATFORM_NAME)); -REAL_PLATFORM_NAME_ = $(REAL_PLATFORM_NAME_macosx); -REAL_PLATFORM_NAME_iphoneos = iphoneos; -REAL_PLATFORM_NAME_iphonesimulator = iphonesimulator; -REAL_PLATFORM_NAME_macosx = macosx; - TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; diff --git a/Tools/DumpRenderTree/mac/Configurations/CompilerVersion.xcconfig b/Tools/DumpRenderTree/mac/Configurations/CompilerVersion.xcconfig deleted file mode 100644 index a8c7f75a0..000000000 --- a/Tools/DumpRenderTree/mac/Configurations/CompilerVersion.xcconfig +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2009, 2010, 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. - -IS_XCODE_0400 = $(IS_XCODE_0400_$(XCODE_VERSION_MINOR)); -IS_XCODE_0400_0400 = YES; - -IS_XCODE_0400_OR_0410 = $(IS_XCODE_0400_OR_0410_$(XCODE_VERSION_MINOR)); -IS_XCODE_0400_OR_0410_0400 = YES; -IS_XCODE_0400_OR_0410_0410 = YES; - -// The version of the LLVM Compiler in Xcode 4.0 and earlier have difficulty compiling our code. -LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS = $(LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_$(XCODE_VERSION_MAJOR)); -LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_0300 = YES; -LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_0400 = $(LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_IS_XCODE_0400_$(IS_XCODE_0400)); -LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_IS_XCODE_0400_YES = YES; - -// The version of the LLVM Compiler in Xcode 4.1 and earlier do not generate fast enough code. -LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS = $(LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_$(XCODE_VERSION_MAJOR)); -LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_0300 = YES; -LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_0400 = $(LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_IS_XCODE_0400_OR_0410_$(IS_XCODE_0400_OR_0410)); -LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_IS_XCODE_0400_OR_0410_YES = YES; - -LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS = $(LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS_$(LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS)); -LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS_ = YES; -LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS_YES = NO; - -LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS = $(LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS_$(LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS)); -LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS_ = YES; -LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS_YES = NO; - - -// Use GCC 4.2 with Xcode 3.1, which includes GCC 4.2 but defaults to GCC 4.0. -// Note that Xcode versions as new as 3.1.2 use XCODE_VERSION_ACTUAL for the minor version -// number. Newer versions of Xcode use XCODE_VERSION_MINOR for the minor version, and -// XCODE_VERSION_ACTUAL for the full version number. -TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(REAL_PLATFORM_NAME)); -TARGET_GCC_VERSION_iphoneos = LLVM_GCC_42; -TARGET_GCC_VERSION_iphonesimulator = GCC_42; -TARGET_GCC_VERSION_macosx = $(TARGET_GCC_VERSION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); - -TARGET_GCC_VERSION_macosx_1050 = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_MINOR)); -TARGET_GCC_VERSION_macosx_1050_ = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_ACTUAL)); -TARGET_GCC_VERSION_macosx_1050_0310 = GCC_42; -TARGET_GCC_VERSION_macosx_1050_0320 = GCC_42; - -TARGET_GCC_VERSION_macosx_1060 = $(TARGET_GCC_VERSION_macosx_1060_AND_1070_$(CONFIGURATION)); -TARGET_GCC_VERSION_macosx_1070 = $(TARGET_GCC_VERSION_macosx_1060_AND_1070_$(CONFIGURATION)); -TARGET_GCC_VERSION_macosx_1060_AND_1070_Debug = $(TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_$(LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS)); -TARGET_GCC_VERSION_macosx_1060_AND_1070_Release = $(TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_$(LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS)); -TARGET_GCC_VERSION_macosx_1060_AND_1070_Production = $(TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_$(LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS)); -TARGET_GCC_VERSION_macosx_1060_NON_LLVM_FALLBACK = GCC_42; -TARGET_GCC_VERSION_macosx_1070_NON_LLVM_FALLBACK = LLVM_GCC_42; - -TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_YES = LLVM_COMPILER; -TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_NO = $(TARGET_GCC_VERSION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)_NON_LLVM_FALLBACK); - -TARGET_GCC_VERSION_macosx_1080 = LLVM_COMPILER; -TARGET_GCC_VERSION_macosx_1090 = LLVM_COMPILER; - -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; diff --git a/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig b/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig index 8e3528d2d..fd5ebdbd1 100644 --- a/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig +++ b/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig @@ -23,28 +23,19 @@ #include "Base.xcconfig" -ARCHS = $(ARCHS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ARCHS_1050 = $(NATIVE_ARCH); -ARCHS_1060 = $(ARCHS_STANDARD_32_64_BIT); -ARCHS_1070 = $(ARCHS_STANDARD_32_64_BIT); -ARCHS_1080 = $(ARCHS_STANDARD_32_64_BIT); -ARCHS_1090 = $(ARCHS_STANDARD_32_64_BIT); +ARCHS = $(ARCHS_STANDARD_32_64_BIT); ONLY_ACTIVE_ARCH = YES; MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(TARGET_MAC_OS_X_VERSION_MAJOR)) -MACOSX_DEPLOYMENT_TARGET_1050 = 10.5; -MACOSX_DEPLOYMENT_TARGET_1060 = 10.6; MACOSX_DEPLOYMENT_TARGET_1070 = 10.7; MACOSX_DEPLOYMENT_TARGET_1080 = 10.8; MACOSX_DEPLOYMENT_TARGET_1090 = 10.9; -WEBKIT_SYSTEM_INTERFACE_LIBRARY = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_$(REAL_PLATFORM_NAME)); +WEBKIT_SYSTEM_INTERFACE_LIBRARY = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_$(PLATFORM_NAME)); WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphoneos = WebKitSystemInterface; WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphonesimulator = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphoneos); WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1050 = WebKitSystemInterfaceLeopard; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1060 = WebKitSystemInterfaceSnowLeopard; WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1070 = WebKitSystemInterfaceLion; WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1080 = WebKitSystemInterfaceMountainLion; WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1090 = WebKitSystemInterfaceMountainLion; diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm index 029b358a0..3cd121488 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm @@ -145,6 +145,7 @@ static HistoryDelegate *historyDelegate; PolicyDelegate *policyDelegate; StorageTrackerDelegate *storageDelegate; +static int dumpPixelsForAllTests = NO; static bool dumpPixelsForCurrentTest; static int threaded; static int dumpTree = YES; @@ -328,6 +329,7 @@ static NSSet *allowedFontFamilySet() @"STFangsong", @"STHeiti", @"STIXGeneral", + @"STIXSizeOneSym", @"STKaiti", @"STSong", @"Symbol", @@ -614,6 +616,8 @@ static void resetDefaultsToConsistentValues() [defaults setObject:[path stringByAppendingPathComponent:@"LocalStorage"] forKey:WebStorageDirectoryDefaultsKey]; [defaults setObject:[path stringByAppendingPathComponent:@"LocalCache"] forKey:WebKitLocalCacheDefaultsKey]; + [defaults setBool:NO forKey:@"WebKitKerningAndLigaturesEnabledByDefault"]; + WebPreferences *preferences = [WebPreferences standardPreferences]; [preferences setAllowUniversalAccessFromFileURLs:YES]; @@ -789,6 +793,7 @@ static void initializeGlobalsFromCommandLineOptions(int argc, const char *argv[] { struct option options[] = { {"notree", no_argument, &dumpTree, NO}, + {"pixel-tests", no_argument, &dumpPixelsForAllTests, YES}, {"tree", no_argument, &dumpTree, YES}, {"threaded", no_argument, &threaded, YES}, {"complex-text", no_argument, &forceComplexText, YES}, @@ -1297,7 +1302,7 @@ static void runTest(const string& inputLine) TestCommand command = parseInputLine(inputLine); const string& pathOrURL = command.pathOrURL; - dumpPixelsForCurrentTest = command.shouldDumpPixels; + dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests; NSString *pathOrURLString = [NSString stringWithUTF8String:pathOrURL.c_str()]; if (!pathOrURLString) { diff --git a/Tools/DumpRenderTree/mac/EventSendingController.mm b/Tools/DumpRenderTree/mac/EventSendingController.mm index 482bf93db..6f328a566 100644 --- a/Tools/DumpRenderTree/mac/EventSendingController.mm +++ b/Tools/DumpRenderTree/mac/EventSendingController.mm @@ -57,6 +57,13 @@ enum MouseButton { NoMouseButton = -1 }; +struct KeyMappingEntry { + int macKeyCode; + int macNumpadKeyCode; + unichar character; + NSString* characterName; +}; + NSPoint lastMousePosition; NSPoint lastClickPosition; int lastClickButton = NoMouseButton; @@ -699,14 +706,6 @@ static int buildModifierFlags(const WebScriptObject* modifiers) keyCode = 0x4C; else if ([character isEqualToString:@"\x8"]) keyCode = 0x33; - else if ([character isEqualToString:@"7"]) - keyCode = 0x1A; - else if ([character isEqualToString:@"5"]) - keyCode = 0x17; - else if ([character isEqualToString:@"9"]) - keyCode = 0x19; - else if ([character isEqualToString:@"0"]) - keyCode = 0x1D; else if ([character isEqualToString:@"a"]) keyCode = 0x00; else if ([character isEqualToString:@"b"]) @@ -716,6 +715,38 @@ static int buildModifierFlags(const WebScriptObject* modifiers) else if ([character isEqualToString:@"e"]) keyCode = 0x0E; + KeyMappingEntry table[] = { + {0x2F, 0x41, '.', nil}, + {0, 0x43, '*', nil}, + {0, 0x45, '+', nil}, + {0, 0x47, NSClearLineFunctionKey, @"clear"}, + {0x2C, 0x4B, '/', nil}, + {0, 0x4C, 3, @"enter" }, + {0x1B, 0x4E, '-', nil}, + {0x18, 0x51, '=', nil}, + {0x1D, 0x52, '0', nil}, + {0x12, 0x53, '1', nil}, + {0x13, 0x54, '2', nil}, + {0x14, 0x55, '3', nil}, + {0x15, 0x56, '4', nil}, + {0x17, 0x57, '5', nil}, + {0x16, 0x58, '6', nil}, + {0x1A, 0x59, '7', nil}, + {0x1C, 0x5B, '8', nil}, + {0x19, 0x5C, '9', nil}, + }; + for (unsigned i = 0; i < WTF_ARRAY_LENGTH(table); ++i) { + NSString* currentCharacterString = [NSString stringWithCharacters:&table[i].character length:1]; + if ([character isEqualToString:currentCharacterString] || [character isEqualToString:table[i].characterName]) { + if (keyLocation == DOM_KEY_LOCATION_NUMPAD) + keyCode = table[i].macNumpadKeyCode; + else + keyCode = table[i].macKeyCode; + eventCharacter = currentCharacterString; + break; + } + } + NSString *charactersIgnoringModifiers = eventCharacter; int modifierFlags = 0; diff --git a/Tools/DumpRenderTree/mac/MockGeolocationProvider.mm b/Tools/DumpRenderTree/mac/MockGeolocationProvider.mm index 6f75b7e16..4acaac04b 100644 --- a/Tools/DumpRenderTree/mac/MockGeolocationProvider.mm +++ b/Tools/DumpRenderTree/mac/MockGeolocationProvider.mm @@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <wtf/Platform.h> +#import "config.h" #import "MockGeolocationProvider.h" @implementation MockGeolocationProvider diff --git a/Tools/DumpRenderTree/qt/DumpRenderTree.pro b/Tools/DumpRenderTree/qt/DumpRenderTree.pro index 1b8d8d3d7..0bd0b16a6 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTree.pro +++ b/Tools/DumpRenderTree/qt/DumpRenderTree.pro @@ -14,6 +14,7 @@ WEBKIT += wtf javascriptcore webcore INCLUDEPATH += \ $$PWD/ \ $$PWD/.. \ + $${ROOT_WEBKIT_DIR}/Source/WebCore/platform/qt \ $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/WebCoreSupport \ $${ROOT_WEBKIT_DIR}/Source/WTF @@ -21,8 +22,6 @@ QT = core gui network testlib webkitwidgets widgets have?(QTPRINTSUPPORT): QT += printsupport macx: QT += xml -have?(FONTCONFIG): PKGCONFIG += fontconfig - HEADERS += \ $$PWD/../WorkQueue.h \ $$PWD/../DumpRenderTree.h \ @@ -32,7 +31,6 @@ HEADERS += \ WorkQueueItemQt.h \ TestRunnerQt.h \ GCControllerQt.h \ - QtInitializeTestFonts.h \ testplugin.h SOURCES += \ @@ -44,7 +42,6 @@ SOURCES += \ WorkQueueItemQt.cpp \ TestRunnerQt.cpp \ GCControllerQt.cpp \ - QtInitializeTestFonts.cpp \ testplugin.cpp \ DumpRenderTreeMain.cpp diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp index 260360142..70b5d14e6 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp @@ -29,8 +29,7 @@ #include "DumpRenderTreeQt.h" -#include "QtInitializeTestFonts.h" - +#include "QtTestSupport.h" #include <qapplication.h> #include <qdebug.h> #include <qdir.h> @@ -66,11 +65,11 @@ void messageHandler(QtMsgType type, const QMessageLogContext&, const QString &me // do nothing } -// We only support -v or --stdout or --stderr or -, all the others will be +// We only support -v, -p, --pixel-tests, --stdout, --stderr and -, 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") + return str == QString("-v") || str == QString("-p") || str == QString("--pixel-tests") || str == QString("--stdout") || str == QString("--stderr") || str == QString("--timeout") || str == QString("--no-timeout") || str == QString("-"); @@ -89,8 +88,8 @@ QString takeOptionValue(QStringList& arguments, int index) void printUsage() { - fprintf(stderr, "Usage: DumpRenderTree [-v] [--stdout output_filename] [-stderr error_filename] [--no-timeout] [--timeout timeout_MS] filename [filename2..n]\n"); - fprintf(stderr, "Or folder containing test files: DumpRenderTree [-v] dirpath\n"); + fprintf(stderr, "Usage: DumpRenderTree [-v|-p|--pixel-tests] [--stdout output_filename] [-stderr error_filename] [--no-timeout] [--timeout timeout_MS] filename [filename2..n]\n"); + fprintf(stderr, "Or folder containing test files: DumpRenderTree [-v|--pixel-tests] dirpath\n"); fflush(stderr); } @@ -115,7 +114,7 @@ int main(int argc, char* argv[]) if (suppressQtDebugOutput) qInstallMessageHandler(messageHandler); - WebKit::initializeTestFonts(); + WebKit::QtTestSupport::initializeTestFonts(); QApplication::setStyle(new QWindowsStyle); QApplication::setDesktopSettingsAware(false); @@ -156,6 +155,14 @@ int main(int argc, char* argv[]) exit(1); } } + index = args.indexOf("--pixel-tests"); + if (index == -1) + index = args.indexOf("-p"); + if (index != -1) { + dumper.setShouldDumpPixelsForAllTests(); + args.removeAt(index); + } + QWebDatabase::removeAllDatabases(); index = args.indexOf(QLatin1String("--timeout")); diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index 0d28cbcc1..ea114e6e0 100755 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -36,9 +36,9 @@ #include "DumpRenderTreeSupportQt.h" #include "EventSenderQt.h" #include "GCControllerQt.h" +#include "QtTestSupport.h" #include "TestRunnerQt.h" #include "TextInputControllerQt.h" -#include "QtInitializeTestFonts.h" #include "testplugin.h" #include "WorkQueue.h" @@ -49,7 +49,6 @@ #include <QFile> #include <QFileInfo> #include <QFocusEvent> -#include <QFontDatabase> #include <QLabel> #include <QLocale> #include <QNetworkAccessManager> @@ -389,7 +388,8 @@ WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent) } DumpRenderTree::DumpRenderTree() - : m_stdin(0) + : m_dumpPixelsForAllTests(false) + , m_stdin(0) , m_enableTextOutput(false) , m_standAloneMode(false) , m_graphicsBased(false) @@ -623,9 +623,9 @@ void DumpRenderTree::open(const QUrl& url) QFocusEvent ev(QEvent::FocusIn); m_page->event(&ev); - QWebSettings::clearMemoryCaches(); - QFontDatabase::removeAllApplicationFonts(); - WebKit::initializeTestFonts(); + WebKit::QtTestSupport::clearMemoryCaches(); + + WebKit::QtTestSupport::initializeTestFonts(); DumpRenderTreeSupportQt::dumpFrameLoader(url.toString().contains("loading/")); setTextOutputEnabled(true); @@ -692,7 +692,7 @@ void DumpRenderTree::processLine(const QString &input) { TestCommand command = parseInputLine(std::string(input.toLatin1().constData())); QString pathOrURL = QLatin1String(command.pathOrURL.c_str()); - m_dumpPixelsForCurrentTest = command.shouldDumpPixels; + m_dumpPixelsForCurrentTest = command.shouldDumpPixels || m_dumpPixelsForAllTests; m_expectedHash = QLatin1String(command.expectedPixelHash.c_str()); if (pathOrURL.startsWith(QLatin1String("http:")) diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h index 710f17343..98429c44e 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -105,6 +105,7 @@ public: void setTimeout(int); void setShouldTimeout(bool flag); + void setShouldDumpPixelsForAllTests() { m_dumpPixelsForAllTests = true; } public Q_SLOTS: void initJSObjects(); @@ -141,6 +142,7 @@ private: TestRunner *m_controller; bool m_dumpPixelsForCurrentTest; + bool m_dumpPixelsForAllTests; QString m_expectedHash; QStringList m_standAloneModeTestList; diff --git a/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp b/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp deleted file mode 100644 index c69347e8d..000000000 --- a/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) - * - * 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. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE 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 OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "QtInitializeTestFonts.h" - -#if HAVE(FONTCONFIG) -#include <QByteArray> -#include <QDir> -#include <fontconfig/fontconfig.h> -#endif - -namespace WebKit { - -void initializeTestFonts() -{ -#if HAVE(FONTCONFIG) - static int numFonts = -1; - - FcInit(); - - // Some test cases may add or remove application fonts (via @font-face). - // Make sure to re-initialize the font set if necessary. - FcFontSet* appFontSet = FcConfigGetFonts(0, FcSetApplication); - if (appFontSet && numFonts >= 0 && appFontSet->nfont == numFonts) - return; - - QByteArray fontDir = getenv("WEBKIT_TESTFONTS"); - if (fontDir.isEmpty() || !QDir(QString::fromLatin1(fontDir)).exists()) { - qFatal("\n\n" - "----------------------------------------------------------------------\n" - "WEBKIT_TESTFONTS environment variable is not set correctly.\n" - "This variable has to point to the directory containing the fonts\n" - "you can clone from git://gitorious.org/qtwebkit/testfonts.git\n" - "----------------------------------------------------------------------\n" - ); - } - - QByteArray configFile = fontDir + "/fonts.conf"; - FcConfig* config = FcConfigCreate(); - if (!FcConfigParseAndLoad(config, reinterpret_cast<const FcChar8*>(configFile.constData()), FcTrue)) - qFatal("Couldn't load font configuration file"); - if (!FcConfigAppFontAddDir(config, reinterpret_cast<const FcChar8*>(fontDir.data()))) - qFatal("Couldn't add font dir!"); - FcConfigSetCurrent(config); - - appFontSet = FcConfigGetFonts(config, FcSetApplication); - numFonts = appFontSet->nfont; -#endif -} - -} diff --git a/Tools/DumpRenderTree/qt/QtInitializeTestFonts.h b/Tools/DumpRenderTree/qt/QtInitializeTestFonts.h deleted file mode 100644 index 60e4761b6..000000000 --- a/Tools/DumpRenderTree/qt/QtInitializeTestFonts.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) - * - * 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. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. - */ - -#ifndef QtInitializeTestFonts_h -#define QtInitializeTestFonts_h - -namespace WebKit { - -// Helper to share code between test font users. -void initializeTestFonts(); - -} - -#endif diff --git a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro index f7b638dfc..f962ee18b 100644 --- a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro +++ b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro @@ -24,6 +24,7 @@ SOURCES += \ Tests/NPDeallocateCalledBeforeNPShutdown.cpp \ Tests/NPPNewFails.cpp \ Tests/NPPSetWindowCalledDuringDestruction.cpp \ + Tests/NPRuntimeCallsWithNullNPP.cpp \ Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \ Tests/NPRuntimeRemoveProperty.cpp \ Tests/NullNPPGetValuePointer.cpp \ diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp index 81f781430..98fa7100b 100644 --- a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp +++ b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp @@ -408,11 +408,6 @@ QString TestRunner::decodeHostName(const QString& host) return decoded; } -void TestRunner::setMediaType(const QString& type) -{ - DumpRenderTreeSupportQt::setMediaType(m_drt->webPage()->mainFrame(), type); -} - void TestRunner::closeWebInspector() { DumpRenderTreeSupportQt::webInspectorClose(m_drt->webPage()); diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.h b/Tools/DumpRenderTree/qt/TestRunnerQt.h index 9c58f1d83..e54fde09e 100644 --- a/Tools/DumpRenderTree/qt/TestRunnerQt.h +++ b/Tools/DumpRenderTree/qt/TestRunnerQt.h @@ -155,7 +155,6 @@ public Q_SLOTS: void closeWebInspector(); void evaluateInWebInspector(long callId, const QString& script); void removeAllVisitedLinks(); - void setMediaType(const QString&); void setFrameFlatteningEnabled(bool); void setAllowUniversalAccessFromFileURLs(bool enable); void setAllowFileAccessFromFileURLs(bool enable); diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp index ad1726dc9..173f34574 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/win/DumpRenderTree.cpp @@ -80,6 +80,7 @@ static LPCWSTR fontsEnvironmentVariable = L"WEBKIT_TESTFONTS"; const LPCWSTR kDumpRenderTreeClassName = L"DumpRenderTreeWindow"; static bool dumpTree = true; +static bool dumpPixelsForAllTests = false; static bool dumpPixelsForCurrentTest; static bool dumpAllPixels; static bool printSeparators; @@ -952,7 +953,7 @@ static void runTest(const string& inputLine) { TestCommand command = parseInputLine(inputLine); const string& pathOrURL = command.pathOrURL; - dumpPixelsForCurrentTest = command.shouldDumpPixels; + dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests; static BSTR methodBStr = SysAllocString(TEXT("GET")); @@ -1341,6 +1342,11 @@ extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(int argc, cons continue; } + if (!stricmp(argv[i], "--pixel-tests")) { + dumpPixelsForAllTests = true; + continue; + } + tests.append(argv[i]); } diff --git a/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp b/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp index 538ff249d..cadecaf8f 100644 --- a/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp +++ b/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp @@ -50,6 +50,7 @@ volatile bool done = true; volatile bool notified = false; static bool printSeparators = true; +static int dumpPixelsForAllTests = false; static int dumpPixelsForCurrentTest; static int dumpTree = 1; time_t startTime; // to detect timeouts / failed tests @@ -225,7 +226,7 @@ static void runTest(const wxString inputLine) TestCommand command = parseInputLine(std::string(inputLine.ToAscii())); string& pathOrURL = command.pathOrURL; - dumpPixelsForCurrentTest = command.shouldDumpPixels; + dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests; // CURL isn't happy if we don't have a protocol. size_t http = pathOrURL.find("http://"); @@ -281,6 +282,11 @@ bool MyApp::OnInit() dumpTree = true; continue; } + + if (!option.CmpNoCase(_T("--pixel-tests"))) { + dumpPixelsForAllTests = true; + continue; + } } wxInitAllImageHandlers(); |