diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-30 11:37:48 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-30 11:38:52 +0200 |
commit | 89e2486a48b739f8d771d69ede5a6a1b244a10fc (patch) | |
tree | 503b1a7812cf97d93704c32437eb5f62dc1a1ff9 /Tools/DumpRenderTree/chromium | |
parent | 625f028249cb37c55bbbd153f3902afd0b0756d9 (diff) | |
download | qtwebkit-89e2486a48b739f8d771d69ede5a6a1b244a10fc.tar.gz |
Imported WebKit commit 0282df8ca7c11d8c8a66ea18543695c69f545a27 (http://svn.webkit.org/repository/webkit/trunk@124002)
New snapshot with prospective Mountain Lion build fix
Diffstat (limited to 'Tools/DumpRenderTree/chromium')
16 files changed, 396 insertions, 72 deletions
diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp index d5c9019b8..046e1ec2d 100644 --- a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp +++ b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp @@ -169,7 +169,6 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("numberOfPendingGeolocationPermissionRequests", &LayoutTestController:: numberOfPendingGeolocationPermissionRequests); bindMethod("objCIdentityIsEqual", &LayoutTestController::objCIdentityIsEqual); bindMethod("overridePreference", &LayoutTestController::overridePreference); - bindMethod("pageNumberForElementById", &LayoutTestController::pageNumberForElementById); bindMethod("pageProperty", &LayoutTestController::pageProperty); bindMethod("pageSizeAndMarginsInPixels", &LayoutTestController::pageSizeAndMarginsInPixels); bindMethod("pathToLocalResource", &LayoutTestController::pathToLocalResource); @@ -1722,24 +1721,6 @@ void LayoutTestController::setPrinting(const CppArgumentList& arguments, CppVari result->setNull(); } -void LayoutTestController::pageNumberForElementById(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - int pageWidthInPixels = 0; - int pageHeightInPixels = 0; - if (!parsePageSizeParameters(arguments, 1, - &pageWidthInPixels, &pageHeightInPixels)) - return; - if (!arguments[0].isString()) - return; - WebFrame* frame = m_shell->webView()->mainFrame(); - if (!frame) - return; - result->set(frame->pageNumberForElementById(cppVariantToWebString(arguments[0]), - static_cast<float>(pageWidthInPixels), - static_cast<float>(pageHeightInPixels))); -} - void LayoutTestController::pageSizeAndMarginsInPixels(const CppArgumentList& arguments, CppVariant* result) { result->set(""); diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.h b/Tools/DumpRenderTree/chromium/LayoutTestController.h index 08c724410..9cfd12359 100644 --- a/Tools/DumpRenderTree/chromium/LayoutTestController.h +++ b/Tools/DumpRenderTree/chromium/LayoutTestController.h @@ -41,27 +41,11 @@ #ifndef LayoutTestController_h #define LayoutTestController_h -#include "CppBoundClass.h" -#include "Task.h" -#include "WebDeliveredIntentClient.h" -#include "platform/WebArrayBufferView.h" -#include "platform/WebString.h" -#include "WebTextDirection.h" -#include "platform/WebURL.h" -#include <wtf/Deque.h> -#include <wtf/OwnPtr.h> - -namespace WebKit { -class WebGeolocationClientMock; -} - -namespace webkit_support { -class ScopedTempDirectory; -} +#include "TestRunner.h" class TestShell; -class LayoutTestController : public CppBoundClass { +class LayoutTestController : public TestRunner { public: // Builds the property and method lists needed to bind this class to a JS // object. @@ -327,9 +311,6 @@ public: // Causes layout to happen as if targetted to printed pages. void setPrinting(const CppArgumentList&, CppVariant*); - // Gets the number of page where the specified element will be put. - void pageNumberForElementById(const CppArgumentList&, CppVariant*); - // Gets the page size and margins for a printed page. void pageSizeAndMarginsInPixels(const CppArgumentList&, CppVariant*); diff --git a/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.cpp b/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.cpp index 23b5aa7db..0a8b29507 100644 --- a/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.cpp +++ b/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.cpp @@ -31,13 +31,15 @@ #include "config.h" #include "MockWebKitPlatformSupport.h" +#include "MockWebMediaStreamCenter.h" #include <wtf/Assertions.h> +#include <wtf/PassOwnPtr.h> using namespace WebKit; PassOwnPtr<MockWebKitPlatformSupport> MockWebKitPlatformSupport::create() { - return WTF::adoptPtr(new MockWebKitPlatformSupport()); + return adoptPtr(new MockWebKitPlatformSupport()); } MockWebKitPlatformSupport::MockWebKitPlatformSupport() @@ -53,7 +55,12 @@ void MockWebKitPlatformSupport::cryptographicallyRandomValues(unsigned char*, si CRASH(); } -WebMediaStreamCenter* MockWebKitPlatformSupport::createMediaStreamCenter(WebMediaStreamCenterClient*) +#if ENABLE(MEDIA_STREAM) +WebMediaStreamCenter* MockWebKitPlatformSupport::createMediaStreamCenter(WebMediaStreamCenterClient* client) { - return 0; + if (!m_mockMediaStreamCenter) + m_mockMediaStreamCenter = adoptPtr(new MockWebMediaStreamCenter(client)); + + return m_mockMediaStreamCenter.get(); } +#endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.h b/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.h index 5e8977d55..1c9d30b9c 100644 --- a/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.h +++ b/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.h @@ -32,6 +32,7 @@ #define MockWebKitPlatformSupport_h #include <public/Platform.h> +#include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> class MockWebKitPlatformSupport : public WebKit::Platform { @@ -41,10 +42,16 @@ public: virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) OVERRIDE; +#if ENABLE(MEDIA_STREAM) virtual WebKit::WebMediaStreamCenter* createMediaStreamCenter(WebKit::WebMediaStreamCenterClient*) OVERRIDE; +#endif // ENABLE(MEDIA_STREAM) private: MockWebKitPlatformSupport(); + +#if ENABLE(MEDIA_STREAM) + OwnPtr<WebKit::WebMediaStreamCenter> m_mockMediaStreamCenter; +#endif // ENABLE(MEDIA_STREAM) }; #endif // MockWebKitPlatformSupport_h diff --git a/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp b/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp new file mode 100644 index 000000000..30b56f1f1 --- /dev/null +++ b/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp @@ -0,0 +1,104 @@ +/* + * 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" +#if ENABLE(MEDIA_STREAM) + +#include "MockWebMediaStreamCenter.h" + +#include "platform/WebICECandidateDescriptor.h" +#include "platform/WebMediaStreamCenterClient.h" +#include "platform/WebMediaStreamComponent.h" +#include "platform/WebMediaStreamDescriptor.h" +#include "platform/WebMediaStreamSource.h" +#include "platform/WebMediaStreamSourcesRequest.h" +#include "platform/WebSessionDescriptionDescriptor.h" +#include "platform/WebVector.h" + +using namespace WebKit; + +MockWebMediaStreamCenter::MockWebMediaStreamCenter(WebMediaStreamCenterClient* client) +{ +} + +void MockWebMediaStreamCenter::queryMediaStreamSources(const WebMediaStreamSourcesRequest& request) +{ + WebVector<WebMediaStreamSource> audioSources, videoSources; + request.didCompleteQuery(audioSources, videoSources); +} + +void MockWebMediaStreamCenter::didEnableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent& component) +{ + component.source().setReadyState(WebMediaStreamSource::ReadyStateLive); +} + +void MockWebMediaStreamCenter::didDisableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent& component) +{ + component.source().setReadyState(WebMediaStreamSource::ReadyStateMuted); +} + +void MockWebMediaStreamCenter::didStopLocalMediaStream(const WebMediaStreamDescriptor& stream) +{ + WebVector<WebMediaStreamComponent> audioComponents; + stream.audioSources(audioComponents); + for (size_t i = 0; i < audioComponents.size(); ++i) + audioComponents[i].source().setReadyState(WebMediaStreamSource::ReadyStateEnded); + + WebVector<WebMediaStreamComponent> videoComponents; + stream.videoSources(videoComponents); + for (size_t i = 0; i < videoComponents.size(); ++i) + videoComponents[i].source().setReadyState(WebMediaStreamSource::ReadyStateEnded); +} + +void MockWebMediaStreamCenter::didCreateMediaStream(WebMediaStreamDescriptor&) +{ +} + +WebString MockWebMediaStreamCenter::constructSDP(const WebICECandidateDescriptor& iceCandidate) +{ + string16 result = iceCandidate.label(); + result += WebString(":"); + result += iceCandidate.candidateLine(); + result += WebString(";"); + return result; +} + +WebString MockWebMediaStreamCenter::constructSDP(const WebSessionDescriptionDescriptor& sessionDescription) +{ + string16 result = sessionDescription.initialSDP(); + result += WebString(";"); + for (size_t i = 0; i < sessionDescription.numberOfAddedCandidates(); ++i) { + result += constructSDP(sessionDescription.candidate(i)); + result += WebString(";"); + } + return result; +} + +#endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.h b/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.h new file mode 100644 index 000000000..75baf247a --- /dev/null +++ b/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.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 MockWebMediaStreamCenter_h +#define MockWebMediaStreamCenter_h + +#if ENABLE(MEDIA_STREAM) +#include "platform/WebMediaStreamCenter.h" + +namespace WebKit { +class WebMediaStreamCenterClient; +}; + +class MockWebMediaStreamCenter : public WebKit::WebMediaStreamCenter { +public: + explicit MockWebMediaStreamCenter(WebKit::WebMediaStreamCenterClient*); + + virtual void queryMediaStreamSources(const WebKit::WebMediaStreamSourcesRequest&) OVERRIDE; + virtual void didEnableMediaStreamTrack(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaStreamComponent&) OVERRIDE; + virtual void didDisableMediaStreamTrack(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaStreamComponent&) OVERRIDE; + virtual void didStopLocalMediaStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE; + virtual void didCreateMediaStream(WebKit::WebMediaStreamDescriptor&) OVERRIDE; + virtual WebKit::WebString constructSDP(const WebKit::WebICECandidateDescriptor&) OVERRIDE; + virtual WebKit::WebString constructSDP(const WebKit::WebSessionDescriptionDescriptor&) OVERRIDE; + +private: + MockWebMediaStreamCenter() { } +}; + +#endif // ENABLE(MEDIA_STREAM) +#endif // MockWebMediaStreamCenter_h + diff --git a/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.cpp index cdf1befc3..35b7dfa38 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.cpp @@ -30,6 +30,7 @@ #include "config.h" #include "GamepadController.h" +#include "TestDelegate.h" using namespace WebKit; @@ -53,9 +54,14 @@ void GamepadController::bindToJavascript(WebFrame* frame, const WebString& class CppBoundClass::bindToJavascript(frame, classname); } +void GamepadController::setDelegate(TestDelegate* delegate) +{ + m_delegate = delegate; +} + void GamepadController::reset() { - memset(&internalData, 0, sizeof(internalData)); + memset(&m_gamepads, 0, sizeof(m_gamepads)); } void GamepadController::connect(const CppArgumentList& args, CppVariant* result) @@ -67,12 +73,12 @@ void GamepadController::connect(const CppArgumentList& args, CppVariant* result) int index = args[0].toInt32(); if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap)) return; - internalData.items[index].connected = true; - internalData.length = 0; + m_gamepads.items[index].connected = true; + m_gamepads.length = 0; for (unsigned i = 0; i < WebKit::WebGamepads::itemsLengthCap; ++i) - if (internalData.items[i].connected) - internalData.length = i + 1; - webkit_support::SetGamepadData(internalData); + if (m_gamepads.items[i].connected) + m_gamepads.length = i + 1; + m_delegate->setGamepadData(m_gamepads); result->setNull(); } @@ -85,12 +91,12 @@ void GamepadController::disconnect(const CppArgumentList& args, CppVariant* resu int index = args[0].toInt32(); if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap)) return; - internalData.items[index].connected = false; - internalData.length = 0; + m_gamepads.items[index].connected = false; + m_gamepads.length = 0; for (unsigned i = 0; i < WebKit::WebGamepads::itemsLengthCap; ++i) - if (internalData.items[i].connected) - internalData.length = i + 1; - webkit_support::SetGamepadData(internalData); + if (m_gamepads.items[i].connected) + m_gamepads.length = i + 1; + m_delegate->setGamepadData(m_gamepads); result->setNull(); } @@ -105,10 +111,10 @@ void GamepadController::setId(const CppArgumentList& args, CppVariant* result) return; std::string src = args[1].toString(); const char* p = src.c_str(); - memset(internalData.items[index].id, 0, sizeof(internalData.items[index].id)); + memset(m_gamepads.items[index].id, 0, sizeof(m_gamepads.items[index].id)); for (unsigned i = 0; *p && i < WebKit::WebGamepad::idLengthCap - 1; ++i) - internalData.items[index].id[i] = *p++; - webkit_support::SetGamepadData(internalData); + m_gamepads.items[index].id[i] = *p++; + m_delegate->setGamepadData(m_gamepads); result->setNull(); } @@ -122,8 +128,8 @@ void GamepadController::setButtonCount(const CppArgumentList& args, CppVariant* if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap)) return; int buttons = args[1].toInt32(); - internalData.items[index].buttonsLength = buttons; - webkit_support::SetGamepadData(internalData); + m_gamepads.items[index].buttonsLength = buttons; + m_delegate->setGamepadData(m_gamepads); result->setNull(); } @@ -138,8 +144,8 @@ void GamepadController::setButtonData(const CppArgumentList& args, CppVariant* r return; int button = args[1].toInt32(); double data = args[2].toDouble(); - internalData.items[index].buttons[button] = data; - webkit_support::SetGamepadData(internalData); + m_gamepads.items[index].buttons[button] = data; + m_delegate->setGamepadData(m_gamepads); result->setNull(); } @@ -153,8 +159,8 @@ void GamepadController::setAxisCount(const CppArgumentList& args, CppVariant* re if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap)) return; int axes = args[1].toInt32(); - internalData.items[index].axesLength = axes; - webkit_support::SetGamepadData(internalData); + m_gamepads.items[index].axesLength = axes; + m_delegate->setGamepadData(m_gamepads); result->setNull(); } @@ -169,8 +175,8 @@ void GamepadController::setAxisData(const CppArgumentList& args, CppVariant* res return; int axis = args[1].toInt32(); double data = args[2].toDouble(); - internalData.items[index].axes[axis] = data; - webkit_support::SetGamepadData(internalData); + m_gamepads.items[index].axes[axis] = data; + m_delegate->setGamepadData(m_gamepads); result->setNull(); } diff --git a/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.h b/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.h index 8cf4cb824..4e65e922f 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.h @@ -34,6 +34,8 @@ #include "CppBoundClass.h" #include "platform/WebGamepads.h" +class TestDelegate; + namespace WebKit { class WebGamepads; class WebFrame; @@ -44,6 +46,7 @@ public: GamepadController(); void bindToJavascript(WebKit::WebFrame*, const WebKit::WebString& classname); + void setDelegate(TestDelegate*); void reset(); private: @@ -57,7 +60,9 @@ private: void setAxisData(const CppArgumentList&, CppVariant*); void fallbackCallback(const CppArgumentList&, CppVariant*); - WebKit::WebGamepads internalData; + WebKit::WebGamepads m_gamepads; + + TestDelegate* m_delegate; }; #endif // GamepadController_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestDelegate.h b/Tools/DumpRenderTree/chromium/TestRunner/TestDelegate.h index 4d1af7a72..599e11d4c 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TestDelegate.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/TestDelegate.h @@ -36,6 +36,7 @@ namespace WebKit { struct WebContextMenuData; +class WebGamepads; } class TestDelegate { @@ -45,6 +46,7 @@ public: virtual void fillSpellingSuggestionList(const WebKit::WebString& word, Vector<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 // TestDelegate_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp index b7c85edfb..edd50dfab 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp @@ -47,7 +47,8 @@ public: Internal(); ~Internal(); - void setWebView(WebView* webView); + void setWebView(WebView*); + void setDelegate(TestDelegate*); void bindTo(WebFrame*); void resetAll(); @@ -71,6 +72,10 @@ TestInterfaces::Internal::~Internal() m_accessibilityController->setWebView(0); // m_gamepadController doesn't depend on WebView. m_textInputController->setWebView(0); + + // m_accessibilityController doesn't depend on TestDelegate. + m_gamepadController->setDelegate(0); + // m_textInputController doesn't depend on TestDelegate. } void TestInterfaces::Internal::setWebView(WebView* webView) @@ -80,6 +85,13 @@ void TestInterfaces::Internal::setWebView(WebView* webView) m_textInputController->setWebView(webView); } +void TestInterfaces::Internal::setDelegate(TestDelegate* delegate) +{ + // m_accessibilityController doesn't depend on TestDelegate. + m_gamepadController->setDelegate(delegate); + // m_textInputController doesn't depend on TestDelegate. +} + void TestInterfaces::Internal::bindTo(WebFrame* frame) { m_accessibilityController->bindToJavascript(frame, WebString::fromUTF8("accessibilityController")); @@ -109,6 +121,11 @@ 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); diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h index 304434fb9..5615223e6 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h @@ -37,13 +37,15 @@ class WebView; } class AccessibilityController; +class TestDelegate; class TestInterfaces { public: TestInterfaces(); ~TestInterfaces(); - void setWebView(WebKit::WebView* webView); + void setWebView(WebKit::WebView*); + void setDelegate(TestDelegate*); void bindTo(WebKit::WebFrame*); void resetAll(); diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestRunner.cpp b/Tools/DumpRenderTree/chromium/TestRunner/TestRunner.cpp new file mode 100644 index 000000000..e6ead1551 --- /dev/null +++ b/Tools/DumpRenderTree/chromium/TestRunner/TestRunner.cpp @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2010 Pawel Hajdan (phajdan.jr@chromium.org) + * + * 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 "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/TestRunner.h b/Tools/DumpRenderTree/chromium/TestRunner/TestRunner.h new file mode 100644 index 000000000..f7069401a --- /dev/null +++ b/Tools/DumpRenderTree/chromium/TestRunner/TestRunner.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2010 Pawel Hajdan (phajdan.jr@chromium.org) + * + * 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 TestRunner_h +#define TestRunner_h + +#include "CppBoundClass.h" +#include "Task.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: + TestRunner(); +}; + +#endif // TestRunner_h diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp index 0cc942a19..6f991ff33 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.cpp +++ b/Tools/DumpRenderTree/chromium/TestShell.cpp @@ -122,6 +122,11 @@ TestShell::TestShell() WebRuntimeFeatures::enableGeolocation(true); WebRuntimeFeatures::enablePointerLock(true); WebRuntimeFeatures::enableIndexedDatabase(true); + WebRuntimeFeatures::enableInputTypeDateTime(true); + WebRuntimeFeatures::enableInputTypeDateTimeLocal(true); + WebRuntimeFeatures::enableInputTypeMonth(true); + WebRuntimeFeatures::enableInputTypeTime(true); + WebRuntimeFeatures::enableInputTypeWeek(true); WebRuntimeFeatures::enableFileSystem(true); WebRuntimeFeatures::enableJavaScriptI18NAPI(true); WebRuntimeFeatures::enableMediaSource(true); @@ -171,6 +176,7 @@ void TestShell::createMainWindow() m_drtDevToolsAgent = adoptPtr(new DRTDevToolsAgent); m_webViewHost = adoptPtr(createNewWindow(WebURL(), m_drtDevToolsAgent.get())); m_webView = m_webViewHost->webView(); + m_testInterfaces->setDelegate(m_webViewHost.get()); m_testInterfaces->setWebView(m_webView); m_eventSender->setDelegate(m_webViewHost.get()); m_eventSender->setWebView(m_webView); @@ -179,6 +185,7 @@ void TestShell::createMainWindow() TestShell::~TestShell() { + m_testInterfaces->setDelegate(0); m_testInterfaces->setWebView(0); m_eventSender->setDelegate(0); m_eventSender->setWebView(0); diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp index 1dca46053..ba5ecf0c8 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp +++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp @@ -1279,8 +1279,8 @@ void WebViewHost::willSendRequest(WebFrame* frame, unsigned identifier, WebURLRe GURL url = request.url(); string requestURL = url.possibly_invalid_spec(); + GURL mainDocumentURL = request.firstPartyForCookies(); if (layoutTestController()->shouldDumpResourceLoadCallbacks()) { - GURL mainDocumentURL = request.firstPartyForCookies(); printResourceDescription(identifier); printf(" - willSendRequest <NSURLRequest URL %s, main document URL %s," " http method %s> redirectResponse ", @@ -1306,9 +1306,8 @@ void WebViewHost::willSendRequest(WebFrame* frame, unsigned identifier, WebURLRe string host = url.host(); if (!host.empty() && (url.SchemeIs("http") || url.SchemeIs("https"))) { - GURL testURL = webView()->mainFrame()->document().url(); - const string& testHost = testURL.host(); - if (!isLocalhost(host) && !hostIsUsedBySomeTestsToGenerateError(host) && ((!testURL.SchemeIs("http") && !testURL.SchemeIs("https")) || isLocalhost(testHost)) + if (!isLocalhost(host) && !hostIsUsedBySomeTestsToGenerateError(host) + && ((!mainDocumentURL.SchemeIs("http") && !mainDocumentURL.SchemeIs("https")) || isLocalhost(mainDocumentURL.host())) && !m_shell->allowExternalPages()) { printf("Blocked access to external URL %s\n", requestURL.c_str()); blockRequest(request); @@ -1763,6 +1762,11 @@ void WebViewHost::setPendingExtraData(PassOwnPtr<TestShellExtraData> extraData) m_pendingExtraData = extraData; } +void WebViewHost::setGamepadData(const WebGamepads& pads) +{ + webkit_support::SetGamepadData(pads); +} + void WebViewHost::setPageTitle(const WebString&) { // Nothing to do in layout test. diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h index 4ff4921d1..13f2e1ec5 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.h +++ b/Tools/DumpRenderTree/chromium/WebViewHost.h @@ -99,6 +99,8 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, virtual void clearEditCommand() OVERRIDE; void setPendingExtraData(PassOwnPtr<TestShellExtraData>); + virtual void setGamepadData(const WebKit::WebGamepads&); + void paintRect(const WebKit::WebRect&); void updatePaintRect(const WebKit::WebRect&); void paintInvalidatedRegion(); |