diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-22 15:40:17 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-22 15:40:17 +0200 |
commit | 43a42f108af6bcbd91f2672731c3047c26213af1 (patch) | |
tree | 7fa092e5f5d873c72f2486a70e26be26f7a38bec /Tools/DumpRenderTree | |
parent | d9cf437c840c6eb7417bdd97e6c40979255d3158 (diff) | |
download | qtwebkit-43a42f108af6bcbd91f2672731c3047c26213af1.tar.gz |
Imported WebKit commit 302e7806bff028bd1167a1ec7c86a1ee00ecfb49 (http://svn.webkit.org/repository/webkit/trunk@132067)
New snapshot that fixes build without QtWidgets
Diffstat (limited to 'Tools/DumpRenderTree')
54 files changed, 757 insertions, 185 deletions
diff --git a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp index a24051584..a81284b0b 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp +++ b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp @@ -77,9 +77,13 @@ { 'target_name': 'TestRunner', 'type': 'static_library', + 'defines': [ + 'WEBTESTRUNNER_IMPLEMENTATION=1', + ], 'dependencies': [ 'TestRunner_resources', '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit', + '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit_test_support', '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf', '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', ], @@ -87,11 +91,12 @@ '<(chromium_src_dir)', '<(source_dir)/WebKit/chromium/public', '<(DEPTH)', - '../chromium/TestRunner', + '../chromium/TestRunner/public', + '../chromium/TestRunner/src', ], 'direct_dependent_settings': { 'include_dirs': [ - '../chromium/TestRunner', + '../chromium/TestRunner/public', ], }, 'sources': [ @@ -358,20 +363,6 @@ '<(chromium_src_dir)/webkit/support/setup_third_party.gyp:third_party_headers', ] }], - ['inside_chromium_build==0 or component!="shared_library"', { - 'dependencies': [ - '<(source_dir)/WebCore/WebCore.gyp/WebCore.gyp:webcore_test_support', - ], - 'include_dirs': [ - # WARNING: Do not view this particular case as a precedent for - # including WebCore headers in DumpRenderTree project. - '<(source_dir)/WebCore/testing/v8', # for WebCoreTestSupport.h, needed to link in window.internals code. - ], - 'sources': [ - '<(source_dir)/WebKit/chromium/src/WebTestingSupport.cpp', - '<(source_dir)/WebKit/chromium/public/WebTestingSupport.h', - ], - }], ], }, { diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi index 4562aaf73..7e7d69bad 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gypi +++ b/Tools/DumpRenderTree/DumpRenderTree.gypi @@ -1,6 +1,8 @@ { 'variables': { 'drt_files': [ + 'DumpRenderTree.h', + 'DumpRenderTreeCommon.cpp', 'chromium/DRTDevToolsAgent.cpp', 'chromium/DRTDevToolsAgent.h', 'chromium/DRTDevToolsClient.cpp', @@ -62,28 +64,33 @@ 'chromium/WebViewHostSoftwareOutputDevice.h', ], 'test_runner_files': [ - 'DumpRenderTree.h', - 'DumpRenderTreeCommon.cpp', - 'chromium/TestRunner/AccessibilityControllerChromium.cpp', - 'chromium/TestRunner/AccessibilityControllerChromium.h', - 'chromium/TestRunner/AccessibilityUIElementChromium.cpp', - 'chromium/TestRunner/AccessibilityUIElementChromium.h', - 'chromium/TestRunner/CppBoundClass.cpp', - 'chromium/TestRunner/CppBoundClass.h', - 'chromium/TestRunner/CppVariant.cpp', - 'chromium/TestRunner/CppVariant.h', - 'chromium/TestRunner/EventSender.cpp', - 'chromium/TestRunner/EventSender.h', - 'chromium/TestRunner/GamepadController.cpp', - 'chromium/TestRunner/GamepadController.h', - 'chromium/TestRunner/Task.cpp', - 'chromium/TestRunner/Task.h', - 'chromium/TestRunner/TestInterfaces.cpp', - 'chromium/TestRunner/TestInterfaces.h', - 'chromium/TestRunner/TextInputController.cpp', - 'chromium/TestRunner/TextInputController.h', - 'chromium/TestRunner/TestRunner.cpp', - 'chromium/TestRunner/TestRunner.h', + 'chromium/TestRunner/public/WebAccessibilityController.h', + 'chromium/TestRunner/public/WebTestDelegate.h', + 'chromium/TestRunner/public/WebEventSender.h', + 'chromium/TestRunner/public/WebTestInterfaces.h', + 'chromium/TestRunner/src/AccessibilityControllerChromium.cpp', + 'chromium/TestRunner/src/AccessibilityControllerChromium.h', + 'chromium/TestRunner/src/AccessibilityUIElementChromium.cpp', + 'chromium/TestRunner/src/AccessibilityUIElementChromium.h', + 'chromium/TestRunner/src/CppBoundClass.cpp', + 'chromium/TestRunner/src/CppBoundClass.h', + 'chromium/TestRunner/src/CppVariant.cpp', + 'chromium/TestRunner/src/CppVariant.h', + 'chromium/TestRunner/src/EventSender.cpp', + 'chromium/TestRunner/src/EventSender.h', + 'chromium/TestRunner/src/GamepadController.cpp', + 'chromium/TestRunner/src/GamepadController.h', + 'chromium/TestRunner/src/Task.cpp', + 'chromium/TestRunner/src/Task.h', + 'chromium/TestRunner/src/TestInterfaces.cpp', + 'chromium/TestRunner/src/TestInterfaces.h', + 'chromium/TestRunner/src/TextInputController.cpp', + 'chromium/TestRunner/src/TextInputController.h', + 'chromium/TestRunner/src/TestRunner.cpp', + 'chromium/TestRunner/src/TestRunner.h', + 'chromium/TestRunner/src/WebAccessibilityController.cpp', + 'chromium/TestRunner/src/WebEventSender.cpp', + 'chromium/TestRunner/src/WebTestInterfaces.cpp', ], 'test_plugin_files': [ 'TestNetscapePlugIn/PluginObject.cpp', diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp index 00321ac9b..ebc5c396b 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp @@ -77,6 +77,7 @@ RefPtr<TestRunner> gTestRunner; WebCore::Frame* mainFrame = 0; WebCore::Frame* topLoadingFrame = 0; bool waitForPolicy = false; +bool runFromCommandLine = false; // FIXME: Assuming LayoutTests has been copied to /developer/LayoutTests/ static const char* const kSDCLayoutTestsURI = "file:///developer/LayoutTests/"; @@ -176,20 +177,21 @@ DumpRenderTree::~DumpRenderTree() void DumpRenderTree::runTest(const String& url) { - createFile(m_resultsDir + *m_currentTest + ".dump.crash"); - mainFrame->loader()->stopForUserCancel(); resetToConsistentStateBeforeTesting(); if (shouldLogFrameLoadDelegates(url)) gTestRunner->setDumpFrameLoadCallbacks(true); - String stdoutFile = m_resultsDir + *m_currentTest + ".dump"; - String stderrFile = m_resultsDir + *m_currentTest + ".stderr"; + if (!runFromCommandLine) { + createFile(m_resultsDir + *m_currentTest + ".dump.crash"); - // FIXME: we should preserve the original stdout and stderr here but aren't doing - // that yet due to issues with dup, etc. - freopen(stdoutFile.utf8().data(), "wb", stdout); - freopen(stderrFile.utf8().data(), "wb", stderr); + String stdoutFile = m_resultsDir + *m_currentTest + ".dump"; + String stderrFile = m_resultsDir + *m_currentTest + ".stderr"; + // FIXME: we should preserve the original stdout and stderr here but aren't doing + // that yet due to issues with dup, etc. + freopen(stdoutFile.utf8().data(), "wb", stdout); + freopen(stderrFile.utf8().data(), "wb", stderr); + } FILE* current = fopen(m_currentTestFile.utf8().data(), "w"); fwrite(m_currentTest->utf8().data(), 1, m_currentTest->utf8().length(), current); fclose(current); @@ -219,6 +221,11 @@ void DumpRenderTree::runCurrentTest() void DumpRenderTree::runRemainingTests() { + if (runFromCommandLine) { + doneDrt(); + return; + } + // FIXME: fflush should not be necessary but is temporarily required due to a bug in stdio output. fflush(stdout); fflush(stderr); @@ -328,9 +335,14 @@ void DumpRenderTree::runTests() mainFrame = DumpRenderTreeSupport::corePage(m_page)->mainFrame(); - // Get Test file name from PPS: /pps/services/drt/input - // Example: test_file::fast/js/arguments.html - waitForTest(); + if (getenv("drtTestFile")) { + runFromCommandLine = true; + addTest(testFile); + } else { + // Get Test file name from PPS: /pps/services/drt/input + // Example: test_file::fast/js/arguments.html + waitForTest(); + } } void DumpRenderTree::addTest(const char* testFile) @@ -381,7 +393,7 @@ bool DumpRenderTree::isHTTPTest(const String& test) String testLower = test.lower(); int lenHttpTestSyntax = strlen(httpTestSyntax); return testLower.substring(0, lenHttpTestSyntax) == httpTestSyntax - && testLower.substring(lenHttpTestSyntax, strlen(localTestSyntax)) != localTestSyntax; + && testLower.substring(lenHttpTestSyntax, strlen(localTestSyntax)) != localTestSyntax; } void DumpRenderTree::invalidateAnyPreviousWaitToDumpWatchdog() @@ -500,12 +512,13 @@ void DumpRenderTree::dump() if (m_dumpPixels && !dumpAsText && gTestRunner->generatePixelResults()) dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash()); - String crashFile = dumpFile + ".crash"; - unlink(crashFile.utf8().data()); - - String doneFile = m_resultsDir + *m_currentTest + ".done"; - createFile(doneFile); + if (!runFromCommandLine) { + String crashFile = dumpFile + ".crash"; + unlink(crashFile.utf8().data()); + String doneFile = m_resultsDir + *m_currentTest + ".done"; + createFile(doneFile); + } testDone = true; runRemainingTests(); } @@ -641,7 +654,7 @@ void DumpRenderTree::didReceiveTitleForFrame(const String& title, WebCore::Frame } // ChromeClient delegates. -void DumpRenderTree::addMessageToConsole(const String& message, unsigned int lineNumber, const String& sourceID) +void DumpRenderTree::addMessageToConsole(const String& message, unsigned lineNumber, const String& sourceID) { printf("CONSOLE MESSAGE: "); if (lineNumber) @@ -653,7 +666,7 @@ void DumpRenderTree::addMessageToConsole(const String& message, unsigned int lin String remaining = message.substring(pos); String fileName; int indexFile = remaining.reverseFind('/') + 1; - if (indexFile > 0 && indexFile < remaining.length()) + if (indexFile > 0 && unsigned(indexFile) < remaining.length()) fileName = remaining.substring(indexFile); else fileName = "file:"; diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h index 4ca9a3f2d..dfcf7c86c 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h @@ -77,7 +77,7 @@ public: void didReceiveResponseForFrame(WebCore::Frame*, const WebCore::ResourceResponse&); // ChromeClient delegates - void addMessageToConsole(const String& message, unsigned int lineNumber, const String& sourceID); + void addMessageToConsole(const String& message, unsigned lineNumber, const String& sourceID); void runJavaScriptAlert(const String& message); bool runJavaScriptConfirm(const String& message); String runJavaScriptPrompt(const String& message, const String& defaultValue); diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h index ea6e5aea6..d066b7a71 100644 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h +++ b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h @@ -31,7 +31,7 @@ #ifndef DRTDevToolsAgent_h #define DRTDevToolsAgent_h -#include "Task.h" +#include "TestRunner/src/Task.h" #include "WebDevToolsAgentClient.h" #include "platform/WebString.h" #include <wtf/HashMap.h> diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h index 97a1edc0b..ead396379 100644 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h +++ b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h @@ -31,7 +31,7 @@ #ifndef DRTDevToolsClient_h #define DRTDevToolsClient_h -#include "Task.h" +#include "TestRunner/src/Task.h" #include "WebDevToolsFrontendClient.h" #include "platform/WebString.h" #include <wtf/Noncopyable.h> diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.h b/Tools/DumpRenderTree/chromium/DRTTestRunner.h index 3041b86a7..60a038a27 100644 --- a/Tools/DumpRenderTree/chromium/DRTTestRunner.h +++ b/Tools/DumpRenderTree/chromium/DRTTestRunner.h @@ -42,7 +42,7 @@ #ifndef DRTTestRunner_h #define DRTTestRunner_h -#include "TestRunner/TestRunner.h" +#include "TestRunner/src/TestRunner.h" class TestShell; diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp index 30ce28851..5a3210449 100644 --- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp @@ -64,6 +64,7 @@ static const char optionEnableAcceleratedPainting[] = "--enable-accelerated-pain static const char optionEnableAcceleratedCompositingForVideo[] = "--enable-accelerated-video"; 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"; static const char optionStressOpt[] = "--stress-opt"; static const char optionStressDeopt[] = "--stress-deopt"; @@ -133,6 +134,7 @@ int main(int argc, char* argv[]) bool deferred2DCanvasEnabled = false; bool acceleratedPaintingEnabled = false; bool perTilePaintingEnabled = false; + bool deferredImageDecodingEnabled = false; bool stressOpt = false; bool stressDeopt = false; bool hardwareAcceleratedGL = false; @@ -183,6 +185,8 @@ int main(int argc, char* argv[]) fprintf(stderr, "Unknown GraphicContext3D implementation %s\n", implementation.c_str()); } else if (argument == optionEnablePerTilePainting) perTilePaintingEnabled = true; + else if (argument == optionEnableDeferredImageDecoding) + deferredImageDecodingEnabled = true; else if (argument == optionStressOpt) stressOpt = true; else if (argument == optionStressDeopt) @@ -222,6 +226,7 @@ int main(int argc, char* argv[]) shell.setDeferred2dCanvasEnabled(deferred2DCanvasEnabled); shell.setAcceleratedPaintingEnabled(acceleratedPaintingEnabled); shell.setPerTilePaintingEnabled(perTilePaintingEnabled); + shell.setDeferredImageDecodingEnabled(deferredImageDecodingEnabled); shell.setJavaScriptFlags(javaScriptFlags); shell.setStressOpt(stressOpt); shell.setStressDeopt(stressDeopt); diff --git a/Tools/DumpRenderTree/chromium/MockSpellCheck.cpp b/Tools/DumpRenderTree/chromium/MockSpellCheck.cpp index 56b0f1eff..7593c7190 100644 --- a/Tools/DumpRenderTree/chromium/MockSpellCheck.cpp +++ b/Tools/DumpRenderTree/chromium/MockSpellCheck.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "MockSpellCheck.h" -#include "platform/WebString.h" #include <wtf/ASCIICType.h> #include <wtf/Assertions.h> #include <wtf/text/WTFString.h> @@ -99,10 +98,15 @@ bool MockSpellCheck::spellCheckWord(const WebString& text, int* misspelledOffset return false; } -void MockSpellCheck::fillSuggestionList(const WebString& word, Vector<WebString>* suggestions) +void MockSpellCheck::fillSuggestionList(const WebString& word, WebVector<WebString>* suggestions) { - if (word == WebString::fromUTF8("wellcome")) - suggestions->append(WebString::fromUTF8("welcome")); + if (word == WebString::fromUTF8("wellcome")) { + WebVector<WebString> result(suggestions->size() + 1); + for (size_t i = 0; i < suggestions->size(); ++i) + result[i] = (*suggestions)[i]; + result[suggestions->size()] = WebString::fromUTF8("welcome"); + suggestions->swap(result); + } } bool MockSpellCheck::initializeIfNeeded() diff --git a/Tools/DumpRenderTree/chromium/MockSpellCheck.h b/Tools/DumpRenderTree/chromium/MockSpellCheck.h index bce05c772..b7d07878e 100644 --- a/Tools/DumpRenderTree/chromium/MockSpellCheck.h +++ b/Tools/DumpRenderTree/chromium/MockSpellCheck.h @@ -31,14 +31,12 @@ #ifndef MockSpellCheck_h #define MockSpellCheck_h +#include "platform/WebString.h" +#include "platform/WebVector.h" #include <wtf/HashMap.h> #include <wtf/text/StringHash.h> #include <wtf/text/WTFString.h> -namespace WebKit { -class WebString; -} - // A mock implementation of a spell-checker used for WebKit tests. // This class only implements the minimal functionarities required by WebKit // tests, i.e. this class just compares the given string with known misspelled @@ -62,7 +60,7 @@ public: int* misspelledOffset, int* misspelledLength); - void fillSuggestionList(const WebKit::WebString& word, Vector<WebKit::WebString>* suggestions); + void fillSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions); private: // Initialize the internal resources if we need to initialize it. diff --git a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h index 0e3448f21..5ddd2fc45 100644 --- a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h +++ b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h @@ -33,7 +33,7 @@ #if ENABLE(MEDIA_STREAM) -#include "Task.h" +#include "TestRunner/src/Task.h" #include <public/WebRTCDataChannel.h> #include <public/WebRTCPeerConnectionHandler.h> #include <public/WebRTCSessionDescription.h> diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h b/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h index 8d7519603..6494a7f25 100644 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h +++ b/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h @@ -28,7 +28,7 @@ #if ENABLE(INPUT_SPEECH) -#include "Task.h" +#include "TestRunner/src/Task.h" #include "platform/WebRect.h" #include "WebSpeechInputController.h" #include "WebSpeechInputResult.h" diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h index eb7c3e95b..4cc045669 100644 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h +++ b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h @@ -28,7 +28,7 @@ #if ENABLE(SCRIPTED_SPEECH) -#include "Task.h" +#include "TestRunner/src/Task.h" #include "WebSpeechRecognizer.h" #include <wtf/Compiler.h> #include <wtf/PassOwnPtr.h> diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebAccessibilityController.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebAccessibilityController.h new file mode 100644 index 000000000..f2ec50869 --- /dev/null +++ b/Tools/DumpRenderTree/chromium/TestRunner/public/WebAccessibilityController.h @@ -0,0 +1,58 @@ +/* + * 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 WebAccessibilityController_h +#define WebAccessibilityController_h + +namespace WebKit { +class WebAccessibilityObject; +} + +namespace WebTestRunner { + +class AccessibilityController; + +class WebAccessibilityController { +public: +#if WEBTESTRUNNER_IMPLEMENTATION + explicit WebAccessibilityController(AccessibilityController*); +#endif + + void setFocusedElement(const WebKit::WebAccessibilityObject&); + void notificationReceived(const WebKit::WebAccessibilityObject& target, const char* notificationName); + bool shouldLogAccessibilityEvents(); + +private: + AccessibilityController* m_private; +}; + +} + +#endif // WebAccessibilityController_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebEventSender.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebEventSender.h new file mode 100644 index 000000000..0df88a77d --- /dev/null +++ b/Tools/DumpRenderTree/chromium/TestRunner/public/WebEventSender.h @@ -0,0 +1,59 @@ +/* + * 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 WebEventSender_h +#define WebEventSender_h + +#include "WebDragOperation.h" + +namespace WebKit { +class WebDragData; +} + +namespace WebTestRunner { + +class EventSender; + +class WebEventSender { +public: +#if WEBTESTRUNNER_IMPLEMENTATION + explicit WebEventSender(EventSender*); +#endif + + // Simulate drag&drop system call. + void doDragDrop(const WebKit::WebDragData&, WebKit::WebDragOperationsMask); + +private: + EventSender* m_private; +}; + +} + +#endif // WebEventSender_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h new file mode 100644 index 000000000..a4f62021c --- /dev/null +++ b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h @@ -0,0 +1,56 @@ +/* + * 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 WebTestDelegate_h +#define WebTestDelegate_h + +#include "platform/WebString.h" +#include "platform/WebVector.h" + +namespace WebKit { +struct WebContextMenuData; +class WebGamepads; +} + +namespace WebTestRunner { + +class WebTestDelegate { +public: + virtual void clearContextMenuData() = 0; + virtual void clearEditCommand() = 0; + virtual void fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) = 0; + 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; +}; + +} + +#endif // WebTestDelegate_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h index 917695461..52520a6b5 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h @@ -28,34 +28,38 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TestInterfaces_h -#define TestInterfaces_h +#ifndef WebTestInterfaces_h +#define WebTestInterfaces_h namespace WebKit { class WebFrame; class WebView; } -class AccessibilityController; -class EventSender; -class TestDelegate; +namespace WebTestRunner { -class TestInterfaces { +class WebAccessibilityController; +class WebEventSender; +class WebTestDelegate; + +class WebTestInterfaces { public: - TestInterfaces(); - ~TestInterfaces(); + WebTestInterfaces(); + ~WebTestInterfaces(); void setWebView(WebKit::WebView*); - void setDelegate(TestDelegate*); + void setDelegate(WebTestDelegate*); void bindTo(WebKit::WebFrame*); void resetAll(); - AccessibilityController* accessibilityController(); - EventSender* eventSender(); + WebAccessibilityController* accessibilityController(); + WebEventSender* eventSender(); private: class Internal; Internal* m_internal; }; -#endif // TestInterfaces_h +} + +#endif // WebTestInterfaces_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.cpp index 89d5d5877..8e25db2d2 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.cpp @@ -40,6 +40,8 @@ using namespace WebKit; +namespace WebTestRunner { + AccessibilityController::AccessibilityController() : m_logAccessibilityEvents(false) { @@ -117,6 +119,9 @@ AccessibilityUIElement* AccessibilityController::getAccessibleElementById(const if (m_rootElement.isNull()) m_rootElement = m_webView->accessibilityObject(); + if (!m_rootElement.updateBackingStoreAndCheckValidity()) + return 0; + return findAccessibleElementByIdRecursive(m_rootElement, WebString::fromUTF8(id.c_str())); } @@ -196,3 +201,5 @@ void AccessibilityController::fallbackCallback(const CppArgumentList&, CppVarian "AccessibilityController\n"); result->setNull(); } + +} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.h b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h index f0f5dee85..4dd7f8705 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h @@ -40,6 +40,8 @@ class WebFrame; class WebView; } +namespace WebTestRunner { + class AccessibilityController : public CppBoundClass { public: AccessibilityController(); @@ -85,4 +87,6 @@ private: WebKit::WebView* m_webView; }; +} + #endif // AccessibilityControllerChromium_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp index d60822be8..2157ddb69 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp @@ -774,7 +774,13 @@ void AccessibilityUIElement::cellForColumnAndRowCallback(const CppArgumentList&, void AccessibilityUIElement::titleUIElementCallback(const CppArgumentList&, CppVariant* result) { - result->setNull(); + WebAccessibilityObject obj = accessibilityObject().titleUIElement(); + if (obj.isNull()) { + result->setNull(); + return; + } + + result->set(*(m_factory->getOrCreate(obj)->getAsCppVariant())); } void AccessibilityUIElement::setSelectedTextRangeCallback(const CppArgumentList&arguments, CppVariant* result) diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h index d9e73e57e..d9e73e57e 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.cpp index 1b29d2b0f..1b29d2b0f 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.cpp diff --git a/Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.h b/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.h index 4fb5361e1..4fb5361e1 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/CppVariant.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.cpp index b587d75aa..b587d75aa 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/CppVariant.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.cpp diff --git a/Tools/DumpRenderTree/chromium/TestRunner/CppVariant.h b/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h index 60cc6271e..60cc6271e 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/CppVariant.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp index 23b65d071..310ae6c48 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp @@ -64,10 +64,14 @@ using namespace std; using namespace WebKit; +namespace WebTestRunner { + WebPoint EventSender::lastMousePos; WebMouseEvent::Button EventSender::pressedButton = WebMouseEvent::ButtonNone; WebMouseEvent::Button EventSender::lastButtonType = WebMouseEvent::ButtonNone; +namespace { + struct SavedEvent { enum SavedEventType { Unspecified, @@ -87,27 +91,27 @@ struct SavedEvent { , milliseconds(0) { } }; -static WebDragData currentDragData; -static WebDragOperation currentDragEffect; -static WebDragOperationsMask currentDragEffectsAllowed; -static bool replayingSavedEvents = false; -static Deque<SavedEvent> mouseEventQueue; -static int touchModifiers; -static Vector<WebTouchPoint> touchPoints; +WebDragData currentDragData; +WebDragOperation currentDragEffect; +WebDragOperationsMask currentDragEffectsAllowed; +bool replayingSavedEvents = false; +Deque<SavedEvent> mouseEventQueue; +int touchModifiers; +Vector<WebTouchPoint> touchPoints; // Time and place of the last mouse up event. -static double lastClickTimeSec = 0; -static WebPoint lastClickPos; -static int clickCount = 0; +double lastClickTimeSec = 0; +WebPoint lastClickPos; +int clickCount = 0; // maximum distance (in space and time) for a mouse click // to register as a double or triple click -static const double multipleClickTimeSec = 1; -static const int multipleClickRadiusPixels = 5; +const double multipleClickTimeSec = 1; +const int multipleClickRadiusPixels = 5; // How much we should scroll per event - the value here is chosen to // match the WebKit impl and layout test results. -static const float scrollbarPixelsPerTick = 40.0f; +const float scrollbarPixelsPerTick = 40.0f; inline bool outsideMultiClickRadius(const WebPoint& a, const WebPoint& b) { @@ -118,20 +122,19 @@ inline bool outsideMultiClickRadius(const WebPoint& a, const WebPoint& b) // Used to offset the time the event hander things an event happened. This is // done so tests can run without a delay, but bypass checks that are time // dependent (e.g., dragging has a timeout vs selection). -static uint32 timeOffsetMs = 0; +uint32 timeOffsetMs = 0; -static double getCurrentEventTimeSec() +double getCurrentEventTimeSec() { return (webkit_support::GetCurrentTimeInMillisecond() + timeOffsetMs) / 1000.0; } -static void advanceEventTime(int32_t deltaMs) +void advanceEventTime(int32_t deltaMs) { timeOffsetMs += deltaMs; } -static 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) { e->type = t; e->button = b; @@ -145,7 +148,7 @@ static void initMouseEvent(WebInputEvent::Type t, WebMouseEvent::Button b, } // Returns true if the specified key is the system key. -static bool applyKeyModifier(const string& modifierName, WebInputEvent* event) +bool applyKeyModifier(const string& modifierName, WebInputEvent* event) { bool isSystemKey = false; const char* characters = modifierName.c_str(); @@ -182,7 +185,7 @@ static bool applyKeyModifier(const string& modifierName, WebInputEvent* event) return isSystemKey; } -static bool applyKeyModifiers(const CppVariant* argument, WebInputEvent* event) +bool applyKeyModifiers(const CppVariant* argument, WebInputEvent* event) { bool isSystemKey = false; if (argument->isObject()) { @@ -244,6 +247,8 @@ enum KeyLocationCode { DOMKeyLocationNumpad = 0x03 }; +} + EventSender::EventSender() : m_delegate(0) { @@ -812,7 +817,7 @@ static Vector<WebString> makeMenuItemStringsFor(WebContextMenuData* contextMenu, if (contextMenu->isEditable) { for (const char** item = editableMenuStrings; *item; ++item) strings.append(WebString::fromUTF8(*item)); - Vector<WebString> suggestions; + WebVector<WebString> suggestions; delegate->fillSpellingSuggestionList(contextMenu->misspelledWord, &suggestions); for (size_t i = 0; i < suggestions.size(); ++i) strings.append(suggestions[i]); @@ -1269,3 +1274,5 @@ void EventSender::clearKillRing(const CppArgumentList&, CppVariant* result) { result->setNull(); } + +} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/EventSender.h b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h index e6794a077..65dfccb8c 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/EventSender.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h @@ -50,6 +50,8 @@ class WebView; class TestDelegate; +namespace WebTestRunner { + class EventSender : public CppBoundClass { public: EventSender(); @@ -183,4 +185,6 @@ private: static WebKit::WebMouseEvent::Button lastButtonType; }; +} + #endif // EventSender_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp index cb36bfdfb..cb36bfdfb 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp diff --git a/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.h b/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.h index 4e65e922f..4e65e922f 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/Task.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/Task.cpp index d80beef34..d80beef34 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/Task.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/Task.cpp diff --git a/Tools/DumpRenderTree/chromium/TestRunner/Task.h b/Tools/DumpRenderTree/chromium/TestRunner/src/Task.h index 0b32c472b..0b32c472b 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/Task.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/Task.h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestDelegate.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h index 599e11d4c..0b0d9622e 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TestDelegate.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h @@ -32,7 +32,7 @@ #define TestDelegate_h #include "platform/WebString.h" -#include <wtf/Vector.h> +#include "platform/WebVector.h" namespace WebKit { struct WebContextMenuData; @@ -43,7 +43,7 @@ class TestDelegate { public: virtual void clearContextMenuData() = 0; virtual void clearEditCommand() = 0; - virtual void fillSpellingSuggestionList(const WebKit::WebString& word, Vector<WebKit::WebString>* suggestions) = 0; + virtual void fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) = 0; 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; diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp index ccec086aa..cc821214b 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp @@ -37,33 +37,13 @@ #include "TextInputController.h" #include "platform/WebString.h" -#include <wtf/OwnPtr.h> - +using WebTestRunner::AccessibilityController; +using WebTestRunner::EventSender; using WebKit::WebFrame; using WebKit::WebString; using WebKit::WebView; -class TestInterfaces::Internal { -public: - Internal(); - ~Internal(); - - void setWebView(WebView*); - void setDelegate(TestDelegate*); - void bindTo(WebFrame*); - void resetAll(); - - AccessibilityController* accessibilityController() { return m_accessibilityController.get(); } - EventSender* eventSender() { return m_eventSender.get(); } - -private: - OwnPtr<AccessibilityController> m_accessibilityController; - OwnPtr<EventSender> m_eventSender; - OwnPtr<GamepadController> m_gamepadController; - OwnPtr<TextInputController> m_textInputController; -}; - -TestInterfaces::Internal::Internal() +TestInterfaces::TestInterfaces() { m_accessibilityController = adoptPtr(new AccessibilityController()); m_eventSender = adoptPtr(new EventSender()); @@ -71,7 +51,7 @@ TestInterfaces::Internal::Internal() m_textInputController = adoptPtr(new TextInputController()); } -TestInterfaces::Internal::~Internal() +TestInterfaces::~TestInterfaces() { m_accessibilityController->setWebView(0); m_eventSender->setWebView(0); @@ -84,7 +64,7 @@ TestInterfaces::Internal::~Internal() // m_textInputController doesn't depend on TestDelegate. } -void TestInterfaces::Internal::setWebView(WebView* webView) +void TestInterfaces::setWebView(WebView* webView) { m_accessibilityController->setWebView(webView); m_eventSender->setWebView(webView); @@ -92,7 +72,7 @@ void TestInterfaces::Internal::setWebView(WebView* webView) m_textInputController->setWebView(webView); } -void TestInterfaces::Internal::setDelegate(TestDelegate* delegate) +void TestInterfaces::setDelegate(TestDelegate* delegate) { // m_accessibilityController doesn't depend on TestDelegate. m_eventSender->setDelegate(delegate); @@ -100,7 +80,7 @@ void TestInterfaces::Internal::setDelegate(TestDelegate* delegate) // m_textInputController doesn't depend on TestDelegate. } -void TestInterfaces::Internal::bindTo(WebFrame* frame) +void TestInterfaces::bindTo(WebFrame* frame) { m_accessibilityController->bindToJavascript(frame, WebString::fromUTF8("accessibilityController")); m_eventSender->bindToJavascript(frame, WebString::fromUTF8("eventSender")); @@ -108,7 +88,7 @@ void TestInterfaces::Internal::bindTo(WebFrame* frame) m_textInputController->bindToJavascript(frame, WebString::fromUTF8("textInputController")); } -void TestInterfaces::Internal::resetAll() +void TestInterfaces::resetAll() { m_accessibilityController->reset(); m_eventSender->reset(); @@ -116,42 +96,12 @@ void TestInterfaces::Internal::resetAll() // m_textInputController doesn't have any state to reset. } -TestInterfaces::TestInterfaces() - : m_internal(new TestInterfaces::Internal()) -{ -} - -TestInterfaces::~TestInterfaces() -{ - delete m_internal; -} - -void TestInterfaces::setWebView(WebView* webView) -{ - m_internal->setWebView(webView); -} - -void TestInterfaces::setDelegate(TestDelegate* delegate) -{ - m_internal->setDelegate(delegate); -} - -void TestInterfaces::bindTo(WebFrame* frame) -{ - m_internal->bindTo(frame); -} - -void TestInterfaces::resetAll() -{ - m_internal->resetAll(); -} - AccessibilityController* TestInterfaces::accessibilityController() { - return m_internal->accessibilityController(); + return m_accessibilityController.get(); } EventSender* TestInterfaces::eventSender() { - return m_internal->eventSender(); + return m_eventSender.get(); } diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h new file mode 100644 index 000000000..228658c22 --- /dev/null +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h @@ -0,0 +1,70 @@ +/* + * 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 TestInterfaces_h +#define TestInterfaces_h + +#include <wtf/OwnPtr.h> + +namespace WebKit { +class WebFrame; +class WebView; +} + +namespace WebTestRunner { +class AccessibilityController; +class EventSender; +} + +class GamepadController; +class TestDelegate; +class TextInputController; + +class TestInterfaces { +public: + TestInterfaces(); + ~TestInterfaces(); + + void setWebView(WebKit::WebView*); + void setDelegate(TestDelegate*); + void bindTo(WebKit::WebFrame*); + void resetAll(); + + WebTestRunner::AccessibilityController* accessibilityController(); + WebTestRunner::EventSender* eventSender(); + +private: + OwnPtr<WebTestRunner::AccessibilityController> m_accessibilityController; + OwnPtr<WebTestRunner::EventSender> m_eventSender; + OwnPtr<GamepadController> m_gamepadController; + OwnPtr<TextInputController> m_textInputController; +}; + +#endif // TestInterfaces_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestRunner.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp index e6ead1551..e6ead1551 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TestRunner.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestRunner.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h index f7069401a..f7069401a 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TestRunner.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TextInputController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp index b72a2080d..b72a2080d 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TextInputController.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TextInputController.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.h index a959aa8b3..a959aa8b3 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TextInputController.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/WebAccessibilityController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/WebAccessibilityController.cpp new file mode 100644 index 000000000..3fbe30945 --- /dev/null +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/WebAccessibilityController.cpp @@ -0,0 +1,60 @@ +/* + * 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 "WebAccessibilityController.h" + +#include "AccessibilityControllerChromium.h" + +using WebKit::WebAccessibilityObject; + +namespace WebTestRunner { + +WebAccessibilityController::WebAccessibilityController(AccessibilityController* controller) + : m_private(controller) +{ +} + +void WebAccessibilityController::setFocusedElement(const WebAccessibilityObject& object) +{ + m_private->setFocusedElement(object); +} + +void WebAccessibilityController::notificationReceived(const WebAccessibilityObject& target, const char* notificationName) +{ + m_private->notificationReceived(target, notificationName); +} + +bool WebAccessibilityController::shouldLogAccessibilityEvents() +{ + return m_private->shouldLogAccessibilityEvents(); +} + +} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/WebEventSender.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/WebEventSender.cpp new file mode 100644 index 000000000..93c0bba49 --- /dev/null +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/WebEventSender.cpp @@ -0,0 +1,51 @@ +/* + * 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 "WebEventSender.h" + +#include "EventSender.h" + +using WebKit::WebDragData; +using WebKit::WebDragOperationsMask; + +namespace WebTestRunner { + +WebEventSender::WebEventSender(EventSender* eventSender) + : m_private(eventSender) +{ +} + +void WebEventSender::doDragDrop(const WebDragData& data, WebDragOperationsMask mask) +{ + m_private->doDragDrop(data, mask); +} + +} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp new file mode 100644 index 000000000..3d5b0de3e --- /dev/null +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp @@ -0,0 +1,166 @@ +/* + * 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 "WebTestInterfaces.h" + +#include "TestDelegate.h" +#include "TestInterfaces.h" +#include "WebAccessibilityController.h" +#include "WebEventSender.h" +#include "WebTestDelegate.h" + +using WebKit::WebContextMenuData; +using WebKit::WebFrame; +using WebKit::WebGamepads; +using WebKit::WebString; +using WebKit::WebVector; +using WebKit::WebView; + +namespace WebTestRunner { + +class WebTestInterfaces::Internal : public TestDelegate { +public: + Internal(); + virtual ~Internal(); + + TestInterfaces* testInterfaces() { return &m_interfaces; } + void setDelegate(WebTestDelegate*); + WebAccessibilityController* accessibilityController() { return &m_accessibilityController; } + WebEventSender* eventSender() { return &m_eventSender; } + + // TestDelegate implementation. + virtual void clearContextMenuData(); + virtual void clearEditCommand(); + virtual void fillSpellingSuggestionList(const WebString& word, WebVector<WebString>* suggestions); + virtual void setEditCommand(const std::string& name, const std::string& value); + virtual WebContextMenuData* lastContextMenuData() const; + virtual void setGamepadData(const WebGamepads&); + +private: + TestInterfaces m_interfaces; + WebAccessibilityController m_accessibilityController; + WebEventSender m_eventSender; + WebTestDelegate* m_delegate; +}; + +WebTestInterfaces::Internal::Internal() + : m_accessibilityController(m_interfaces.accessibilityController()) + , m_eventSender(m_interfaces.eventSender()) + , m_delegate(0) +{ +} + +WebTestInterfaces::Internal::~Internal() +{ +} + +void WebTestInterfaces::Internal::setDelegate(WebTestDelegate* delegate) +{ + if (delegate) { + m_delegate = delegate; + m_interfaces.setDelegate(this); + } else { + m_delegate = 0; + m_interfaces.setDelegate(0); + } +} + +void WebTestInterfaces::Internal::clearContextMenuData() +{ + m_delegate->clearContextMenuData(); +} + +void WebTestInterfaces::Internal::clearEditCommand() +{ + m_delegate->clearEditCommand(); +} + +void WebTestInterfaces::Internal::fillSpellingSuggestionList(const WebString& word, WebVector<WebString>* suggestions) +{ + m_delegate->fillSpellingSuggestionList(word, suggestions); +} + +void WebTestInterfaces::Internal::setEditCommand(const std::string& name, const std::string& value) +{ + m_delegate->setEditCommand(name, value); +} + +WebContextMenuData* WebTestInterfaces::Internal::lastContextMenuData() const +{ + return m_delegate->lastContextMenuData(); +} + +void WebTestInterfaces::Internal::setGamepadData(const WebGamepads& pads) +{ + m_delegate->setGamepadData(pads); +} + +WebTestInterfaces::WebTestInterfaces() +{ + m_internal = new Internal; +} + +WebTestInterfaces::~WebTestInterfaces() +{ + delete m_internal; +} + +void WebTestInterfaces::setWebView(WebView* webView) +{ + m_internal->testInterfaces()->setWebView(webView); +} + +void WebTestInterfaces::setDelegate(WebTestDelegate* delegate) +{ + m_internal->setDelegate(delegate); +} + +void WebTestInterfaces::bindTo(WebFrame* frame) +{ + m_internal->testInterfaces()->bindTo(frame); +} + +void WebTestInterfaces::resetAll() +{ + m_internal->testInterfaces()->resetAll(); +} + +WebAccessibilityController* WebTestInterfaces::accessibilityController() +{ + return m_internal->accessibilityController(); +} + +WebEventSender* WebTestInterfaces::eventSender() +{ + return m_internal->eventSender(); +} + +} diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp index 32585faa1..4854f5ea3 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.cpp +++ b/Tools/DumpRenderTree/chromium/TestShell.cpp @@ -114,6 +114,7 @@ TestShell::TestShell() , m_accelerated2dCanvasEnabled(false) , m_deferred2dCanvasEnabled(false) , m_acceleratedPaintingEnabled(false) + , m_deferredImageDecodingEnabled(false) , m_stressOpt(false) , m_stressDeopt(false) , m_dumpWhenFinished(true) @@ -135,6 +136,7 @@ TestShell::TestShell() WebRuntimeFeatures::enableEncryptedMedia(true); WebRuntimeFeatures::enableMediaStream(true); WebRuntimeFeatures::enablePeerConnection(true); + WebRuntimeFeatures::enableDeprecatedPeerConnection(true); WebRuntimeFeatures::enableWebAudio(true); WebRuntimeFeatures::enableVideoTrack(true); WebRuntimeFeatures::enableGamepad(true); @@ -152,7 +154,7 @@ TestShell::TestShell() void TestShell::initialize() { m_webPermissions = adoptPtr(new WebPermissions(this)); - m_testInterfaces = adoptPtr(new TestInterfaces()); + m_testInterfaces = adoptPtr(new WebTestRunner::WebTestInterfaces()); m_testRunner = adoptPtr(new DRTTestRunner(this)); #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) m_notificationPresenter = adoptPtr(new NotificationPresenter(this)); @@ -229,6 +231,7 @@ void TestShell::resetWebSettings(WebView& webView) m_prefs.accelerated2dCanvasEnabled = m_accelerated2dCanvasEnabled; m_prefs.deferred2dCanvasEnabled = m_deferred2dCanvasEnabled; m_prefs.acceleratedPaintingEnabled = m_acceleratedPaintingEnabled; + m_prefs.deferredImageDecodingEnabled = m_deferredImageDecodingEnabled; m_prefs.applyTo(&webView); } diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h index 44b5ae388..03315690e 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.h +++ b/Tools/DumpRenderTree/chromium/TestShell.h @@ -31,13 +31,11 @@ #ifndef TestShell_h #define TestShell_h -#include "AccessibilityControllerChromium.h" #include "DRTTestRunner.h" -#include "GamepadController.h" #include "NotificationPresenter.h" #include "TestEventPrinter.h" -#include "TestInterfaces.h" #include "WebPreferences.h" +#include "WebTestInterfaces.h" #include "WebViewHost.h" #include <string> #include <wtf/OwnPtr.h> @@ -88,8 +86,8 @@ public: // Returns the host for the main WebView. WebViewHost* webViewHost() const { return m_webViewHost.get(); } DRTTestRunner* testRunner() const { return m_testRunner.get(); } - EventSender* eventSender() const { return m_testInterfaces->eventSender(); } - AccessibilityController* accessibilityController() const { return m_testInterfaces->accessibilityController(); } + WebTestRunner::WebEventSender* eventSender() const { return m_testInterfaces->eventSender(); } + WebTestRunner::WebAccessibilityController* accessibilityController() const { return m_testInterfaces->accessibilityController(); } #if ENABLE(NOTIFICATIONS) NotificationPresenter* notificationPresenter() const { return m_notificationPresenter.get(); } #endif @@ -138,6 +136,7 @@ public: void setDeferred2dCanvasEnabled(bool enabled) { m_deferred2dCanvasEnabled = enabled; } void setAcceleratedPaintingEnabled(bool enabled) { m_acceleratedPaintingEnabled = enabled; } void setPerTilePaintingEnabled(bool); + void setDeferredImageDecodingEnabled(bool enabled) { m_deferredImageDecodingEnabled = enabled; } #if defined(OS_WIN) // Access to the finished event. Used by the static WatchDog thread. HANDLE finishedEvent() { return m_finishedEvent; } @@ -212,7 +211,7 @@ private: OwnPtr<WebPermissions> m_webPermissions; OwnPtr<DRTDevToolsAgent> m_drtDevToolsAgent; OwnPtr<DRTDevToolsClient> m_drtDevToolsClient; - OwnPtr<TestInterfaces> m_testInterfaces; + OwnPtr<WebTestRunner::WebTestInterfaces> m_testInterfaces; OwnPtr<DRTTestRunner> m_testRunner; #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) OwnPtr<NotificationPresenter> m_notificationPresenter; @@ -235,6 +234,7 @@ private: bool m_deferred2dCanvasEnabled; bool m_acceleratedPaintingEnabled; bool m_perTilePaintingEnabled; + bool m_deferredImageDecodingEnabled; WebPreferences m_prefs; bool m_stressOpt; bool m_stressDeopt; diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.cpp b/Tools/DumpRenderTree/chromium/WebPreferences.cpp index 3bc2cdd9f..5c8c92c99 100644 --- a/Tools/DumpRenderTree/chromium/WebPreferences.cpp +++ b/Tools/DumpRenderTree/chromium/WebPreferences.cpp @@ -116,6 +116,7 @@ void WebPreferences::reset() deferred2dCanvasEnabled = false; acceleratedPaintingEnabled = false; forceCompositingMode = false; + deferredImageDecodingEnabled = false; mediaPlaybackRequiresUserGesture = false; mockScrollbarsEnabled = false; cssCustomFilterEnabled = false; @@ -224,6 +225,7 @@ void WebPreferences::applyTo(WebView* webView) settings->setAccelerated2dCanvasEnabled(accelerated2dCanvasEnabled); settings->setDeferred2dCanvasEnabled(deferred2dCanvasEnabled); settings->setAcceleratedPaintingEnabled(acceleratedPaintingEnabled); + settings->setDeferredImageDecodingEnabled(deferredImageDecodingEnabled); settings->setMediaPlaybackRequiresUserGesture(mediaPlaybackRequiresUserGesture); settings->setMockScrollbarsEnabled(mockScrollbarsEnabled); settings->setApplyDefaultDeviceScaleFactorInCompositor(forceCompositingMode); diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.h b/Tools/DumpRenderTree/chromium/WebPreferences.h index c36553b35..e0315f2d0 100644 --- a/Tools/DumpRenderTree/chromium/WebPreferences.h +++ b/Tools/DumpRenderTree/chromium/WebPreferences.h @@ -109,6 +109,7 @@ struct WebPreferences { bool accelerated2dCanvasEnabled; bool deferred2dCanvasEnabled; bool acceleratedPaintingEnabled; + bool deferredImageDecodingEnabled; bool mediaPlaybackRequiresUserGesture; bool mockScrollbarsEnabled; bool cssCustomFilterEnabled; diff --git a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h index 9e1beba4a..f43875976 100644 --- a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h +++ b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h @@ -33,7 +33,7 @@ #if ENABLE(MEDIA_STREAM) -#include "Task.h" +#include "TestRunner/src/Task.h" #include "WebUserMediaClient.h" #include "webkit/support/test_media_stream_client.h" #include <public/WebCommon.h> diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp index c7ab475e7..106caa978 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp +++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp @@ -32,13 +32,14 @@ #include "WebViewHost.h" #include "DRTTestRunner.h" -#include "EventSender.h" #include "MockGrammarCheck.h" #include "MockWebSpeechInputController.h" #include "MockWebSpeechRecognizer.h" #include "TestNavigationController.h" #include "TestShell.h" #include "TestWebPlugin.h" +#include "WebAccessibilityController.h" +#include "WebAccessibilityObject.h" #include "WebConsoleMessage.h" #include "WebContextMenuData.h" #include "WebDOMMessageEvent.h" @@ -46,6 +47,7 @@ #include "WebDeviceOrientationClientMock.h" #include "WebDocument.h" #include "WebElement.h" +#include "WebEventSender.h" #include "WebFrame.h" #include "WebGeolocationClientMock.h" #include "WebHistoryItem.h" @@ -525,7 +527,7 @@ void WebViewHost::finishLastTextCheck() m_spellcheck.spellCheckWord(WebString(text.characters(), text.length()), &misspelledPosition, &misspelledLength); if (!misspelledLength) break; - Vector<WebString> suggestions; + WebVector<WebString> suggestions; m_spellcheck.fillSuggestionList(WebString(text.characters() + misspelledPosition, misspelledLength), &suggestions); results.append(WebTextCheckingResult(WebTextCheckingTypeSpelling, offset + misspelledPosition, misspelledLength, suggestions.isEmpty() ? WebString() : suggestions[0])); @@ -772,7 +774,7 @@ MockSpellCheck* WebViewHost::mockSpellCheck() return &m_spellcheck; } -void WebViewHost::fillSpellingSuggestionList(const WebKit::WebString& word, Vector<WebKit::WebString>* suggestions) +void WebViewHost::fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) { mockSpellCheck()->fillSuggestionList(word, suggestions); } diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h index c9e17b07f..ba763503a 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.h +++ b/Tools/DumpRenderTree/chromium/WebViewHost.h @@ -32,15 +32,15 @@ #define WebViewHost_h #include "MockSpellCheck.h" -#include "Task.h" -#include "TestDelegate.h" #include "TestNavigationController.h" +#include "TestRunner/src/Task.h" #include "WebAccessibilityNotification.h" #include "WebCursorInfo.h" #include "WebFrameClient.h" #include "WebIntentRequest.h" #include "WebPrerendererClient.h" #include "WebSpellCheckClient.h" +#include "WebTestDelegate.h" #include "WebViewClient.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> @@ -79,7 +79,7 @@ class TestMediaStreamClient; class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, public NavigationHost, public WebKit::WebPrerendererClient, public WebKit::WebSpellCheckClient, - public TestDelegate { + public WebTestRunner::WebTestDelegate { public: WebViewHost(TestShell*); virtual ~WebViewHost(); @@ -281,7 +281,7 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, // Spellcheck related helper APIs MockSpellCheck* mockSpellCheck(); void finishLastTextCheck(); - virtual void fillSpellingSuggestionList(const WebKit::WebString& word, Vector<WebKit::WebString>* suggestions) OVERRIDE; + virtual void fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) OVERRIDE; // Geolocation client mocks for DRTTestRunner WebKit::WebGeolocationClientMock* geolocationClientMock(); diff --git a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp index 69a4211a0..a0dec4e7a 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp @@ -382,7 +382,8 @@ static void shutdownEfl() void displayWebView() { - notImplemented(); + DumpRenderTreeSupportEfl::setTracksRepaints(browser->mainFrame(), true); + DumpRenderTreeSupportEfl::resetTrackedRepaints(browser->mainFrame()); } void dump() diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp index 993135ee4..d1ba5ff8f 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp @@ -287,6 +287,7 @@ void DumpRenderTreeChrome::resetDefaultsToConsistentValues() ewk_view_setting_web_audio_set(mainView(), EINA_FALSE); ewk_view_setting_allow_universal_access_from_file_urls_set(mainView(), EINA_TRUE); ewk_view_setting_allow_file_access_from_file_urls_set(mainView(), EINA_TRUE); + ewk_view_setting_resizable_textareas_set(mainView(), EINA_TRUE); ewk_view_zoom_set(mainView(), 1.0, 0, 0); ewk_view_scale_set(mainView(), 1.0, 0, 0); @@ -319,6 +320,7 @@ void DumpRenderTreeChrome::resetDefaultsToConsistentValues() DumpRenderTreeSupportEfl::setMinimumLogicalFontSize(mainView(), 9); DumpRenderTreeSupportEfl::setCSSRegionsEnabled(mainView(), true); DumpRenderTreeSupportEfl::setShouldTrackVisitedLinks(false); + DumpRenderTreeSupportEfl::setTracksRepaints(mainFrame(), false); // Reset capacities for the memory cache for dead objects. static const unsigned cacheTotalCapacity = 8192 * 1024; diff --git a/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp b/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp index 4af774d32..efc506160 100644 --- a/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp +++ b/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp @@ -3,6 +3,7 @@ * Copyright (C) 2010 Igalia S.L. * Copyright (C) 2011 ProFUSION Embedded Systems * Copyright (C) 2011 Samsung Electronics + * Copyright (C) 2012 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -56,6 +57,32 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool, bool, bool, bool if (!ewk_view_paint(privateData, context.get(), &rect)) return 0; + if (DumpRenderTreeSupportEfl::isTrackingRepaints(mainFrame)) { + cairo_push_group(context.get()); + + // Paint the gray mask over the original image. + cairo_set_source_rgba(context.get(), 0, 0, 0, 0.66); + cairo_paint(context.get()); + + // Paint transparent rectangles over the mask to show the repainted regions. + cairo_set_source_rgba(context.get(), 0, 0, 0, 0); + cairo_set_operator(context.get(), CAIRO_OPERATOR_SOURCE); + + Eina_List* repaintRects = DumpRenderTreeSupportEfl::trackedRepaintRects(mainFrame); + void* iter = 0; + EINA_LIST_FREE(repaintRects, iter) { + Eina_Rectangle* rect = static_cast<Eina_Rectangle*>(iter); + + cairo_rectangle(context.get(), rect->x, rect->y, rect->w, rect->h); + cairo_fill(context.get()); + + eina_rectangle_free(rect); + } + + cairo_pop_group_to_source(context.get()); + cairo_paint(context.get()); + } + if (drawSelectionRect) { const WebCore::IntRect selectionRect = DumpRenderTreeSupportEfl::selectionRectangle(mainFrame); diff --git a/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm b/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm index 4365d15d0..d80f6ba4e 100644 --- a/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm +++ b/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm @@ -26,7 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "MockWebNotificationProvider.h" + #import <WebKit/WebSecurityOriginPrivate.h> @implementation MockWebNotificationProvider diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.cpp b/Tools/DumpRenderTree/qt/EventSenderQt.cpp index fe1e96b67..dcf9f1bb2 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/Tools/DumpRenderTree/qt/EventSenderQt.cpp @@ -62,6 +62,7 @@ EventSender::EventSender(QWebPage* parent) : QObject(parent) #ifndef QT_NO_GESTURES , m_tapGesture(parent) + , m_tapAndHoldGesture(parent) #endif { m_page = parent; @@ -577,6 +578,15 @@ void EventSender::gestureTap(int x, int y) QGestureEvent event(m_gestures); sendEvent(m_page, &event); } + +void EventSender::gestureLongPress(int x, int y) +{ + m_tapAndHoldGesture.setPosition(QPointF(x, y)); + m_gestures.clear(); + m_gestures.append(&m_tapAndHoldGesture); + QGestureEvent event(m_gestures); + sendEvent(m_page, &event); +} #endif void EventSender::zoomPageIn() diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.h b/Tools/DumpRenderTree/qt/EventSenderQt.h index e6d9257d2..7e4c60a97 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.h +++ b/Tools/DumpRenderTree/qt/EventSenderQt.h @@ -88,6 +88,7 @@ public Q_SLOTS: void cancelTouchPoint(int index); #ifndef QT_NO_GESTURES void gestureTap(int x, int y); + void gestureLongPress(int x, int y); #endif void beginDragWithFiles(const QStringList& files); @@ -123,6 +124,7 @@ private: Qt::KeyboardModifiers m_touchModifiers; #ifndef QT_NO_GESTURES QTapGesture m_tapGesture; + QTapAndHoldGesture m_tapAndHoldGesture; QList<QGesture*> m_gestures; #endif bool m_touchActive; |