summaryrefslogtreecommitdiff
path: root/Tools/DumpRenderTree/chromium
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-29 12:18:48 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-29 12:18:57 +0100
commit4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064 (patch)
treebed2fe914fe0f7ec70abfb47d2d84af8a3604d09 /Tools/DumpRenderTree/chromium
parent01485457c9a5da3f1121015afd25bb53af77662e (diff)
downloadqtwebkit-4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064.tar.gz
Imported WebKit commit c60cfe0fc09efd257aa0111d7b133b02deb8a63e (http://svn.webkit.org/repository/webkit/trunk@136119)
New snapshot that includes the fix for installing the QtWebProcess into libexec Change-Id: I01344e079cbdac5678c4cba6ffcc05f4597cf0d7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Tools/DumpRenderTree/chromium')
-rw-r--r--Tools/DumpRenderTree/chromium/DRTTestRunner.cpp8
-rw-r--r--Tools/DumpRenderTree/chromium/DRTTestRunner.h15
-rw-r--r--Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp20
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp19
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h1
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp10
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h1
-rw-r--r--Tools/DumpRenderTree/chromium/TestShell.h1
-rw-r--r--Tools/DumpRenderTree/chromium/TestWebPlugin.cpp18
-rw-r--r--Tools/DumpRenderTree/chromium/TestWebPlugin.h3
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.cpp21
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.h1
12 files changed, 108 insertions, 10 deletions
diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp b/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp
index 2f8397bee..e2255c793 100644
--- a/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp
+++ b/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp
@@ -139,6 +139,7 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
bindMethod("dumpProgressFinishedCallback", &DRTTestRunner::dumpProgressFinishedCallback);
bindMethod("dumpUserGestureInFrameLoadCallbacks", &DRTTestRunner::dumpUserGestureInFrameLoadCallbacks);
bindMethod("dumpResourceLoadCallbacks", &DRTTestRunner::dumpResourceLoadCallbacks);
+ bindMethod("dumpResourceRequestCallbacks", &DRTTestRunner::dumpResourceRequestCallbacks);
bindMethod("dumpResourceResponseMIMETypes", &DRTTestRunner::dumpResourceResponseMIMETypes);
bindMethod("dumpSelectionRect", &DRTTestRunner::dumpSelectionRect);
bindMethod("dumpStatusCallbacks", &DRTTestRunner::dumpWindowStatusChanges);
@@ -322,6 +323,12 @@ void DRTTestRunner::dumpResourceLoadCallbacks(const CppArgumentList&, CppVariant
result->setNull();
}
+void DRTTestRunner::dumpResourceRequestCallbacks(const CppArgumentList&, CppVariant* result)
+{
+ m_dumpResourceRequestCallbacks = true;
+ result->setNull();
+}
+
void DRTTestRunner::dumpResourceResponseMIMETypes(const CppArgumentList&, CppVariant* result)
{
m_dumpResourceResponseMIMETypes = true;
@@ -556,6 +563,7 @@ void DRTTestRunner::reset()
m_dumpProgressFinishedCallback = false;
m_dumpUserGestureInFrameLoadCallbacks = false;
m_dumpResourceLoadCallbacks = false;
+ m_dumpResourceRequestCallbacks = false;
m_dumpResourceResponseMIMETypes = false;
m_dumpBackForwardList = false;
m_dumpChildFrameScrollPositions = false;
diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.h b/Tools/DumpRenderTree/chromium/DRTTestRunner.h
index 9f02e1c53..49f27c36b 100644
--- a/Tools/DumpRenderTree/chromium/DRTTestRunner.h
+++ b/Tools/DumpRenderTree/chromium/DRTTestRunner.h
@@ -116,7 +116,12 @@ public:
// line for each resource load callback. It takes no arguments, and ignores
// any that may be present.
void dumpResourceLoadCallbacks(const CppArgumentList&, CppVariant*);
-
+
+ // This function sets a flag that tells the test_shell to print a line of
+ // descriptive text for each element that requested a resource. It takes no
+ // arguments, and ignores any that may be present.
+ void dumpResourceRequestCallbacks(const CppArgumentList&, CppVariant*);
+
// This function sets a flag that tells the test_shell to dump the MIME type
// for each resource that was loaded. It takes no arguments, and ignores any
// that may be present.
@@ -318,6 +323,8 @@ public:
bool shouldDumpUserGestureInFrameLoadCallbacks() { return m_dumpUserGestureInFrameLoadCallbacks; }
void setShouldDumpUserGestureInFrameLoadCallbacks(bool value) { m_dumpUserGestureInFrameLoadCallbacks = value; }
bool shouldDumpResourceLoadCallbacks() {return m_dumpResourceLoadCallbacks; }
+ void setShouldDumpResourceRequestCallbacks(bool value) { m_dumpResourceRequestCallbacks = value; }
+ bool shouldDumpResourceRequestCallbacks() { return m_dumpResourceRequestCallbacks; }
void setShouldDumpResourceResponseMIMETypes(bool value) { m_dumpResourceResponseMIMETypes = value; }
bool shouldDumpResourceResponseMIMETypes() {return m_dumpResourceResponseMIMETypes; }
bool shouldDumpStatusCallbacks() { return m_dumpWindowStatusChanges; }
@@ -451,7 +458,11 @@ private:
// If true, the test_shell will output a descriptive line for each resource
// load callback.
bool m_dumpResourceLoadCallbacks;
-
+
+ // If true, the test_shell will output a descriptive line for each resource
+ // request callback.
+ bool m_dumpResourceRequestCallbacks;
+
// If true, the test_shell will output the MIME type for each resource that
// was loaded.
bool m_dumpResourceResponseMIMETypes;
diff --git a/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp b/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp
index b7178f099..e0f761934 100644
--- a/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp
+++ b/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp
@@ -33,6 +33,7 @@
#include "MockWebMediaStreamCenter.h"
+#include <public/WebAudioDestinationConsumer.h>
#include <public/WebMediaStreamCenterClient.h>
#include <public/WebMediaStreamComponent.h>
#include <public/WebMediaStreamDescriptor.h>
@@ -85,8 +86,25 @@ void MockWebMediaStreamCenter::didStopLocalMediaStream(const WebMediaStreamDescr
videoComponents[i].source().setReadyState(WebMediaStreamSource::ReadyStateEnded);
}
-void MockWebMediaStreamCenter::didCreateMediaStream(WebMediaStreamDescriptor&)
+class MockWebAudioDestinationConsumer : public WebAudioDestinationConsumer {
+public:
+ virtual ~MockWebAudioDestinationConsumer() { }
+ virtual void consumeAudio(const WebVector<const float*>&, size_t number_of_frames) OVERRIDE { }
+};
+
+void MockWebMediaStreamCenter::didCreateMediaStream(WebMediaStreamDescriptor& stream)
{
+ WebVector<WebMediaStreamComponent> audioComponents;
+ stream.audioSources(audioComponents);
+ for (size_t i = 0; i < audioComponents.size(); ++i) {
+ WebMediaStreamSource source = audioComponents[i].source();
+ if (source.requiresAudioConsumer()) {
+ MockWebAudioDestinationConsumer* consumer = new MockWebAudioDestinationConsumer();
+ source.addAudioConsumer(consumer);
+ source.removeAudioConsumer(consumer);
+ delete consumer;
+ }
+ }
}
#endif // ENABLE(MEDIA_STREAM)
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp
index 171e25ddb..773a56b17 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp
@@ -296,6 +296,7 @@ EventSender::EventSender()
bindMethod("gestureTapDown", &EventSender::gestureTapDown);
bindMethod("gestureTapCancel", &EventSender::gestureTapCancel);
bindMethod("gestureLongPress", &EventSender::gestureLongPress);
+ bindMethod("gestureLongTap", &EventSender::gestureLongTap);
bindMethod("gestureTwoFingerTap", &EventSender::gestureTwoFingerTap);
bindMethod("zoomPageIn", &EventSender::zoomPageIn);
bindMethod("zoomPageOut", &EventSender::zoomPageOut);
@@ -1137,6 +1138,12 @@ void EventSender::gestureLongPress(const CppArgumentList& arguments, CppVariant*
gestureEvent(WebInputEvent::GestureLongPress, arguments);
}
+void EventSender::gestureLongTap(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ gestureEvent(WebInputEvent::GestureLongTap, arguments);
+}
+
void EventSender::gestureTwoFingerTap(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
@@ -1206,8 +1213,16 @@ void EventSender::gestureEvent(WebInputEvent::Type type, const CppArgumentList&
event.x = point.x;
event.y = point.y;
if (arguments.size() >= 4) {
- event.data.tapDown.width = static_cast<float>(arguments[2].toDouble());
- event.data.tapDown.height = static_cast<float>(arguments[3].toDouble());
+ event.data.longPress.width = static_cast<float>(arguments[2].toDouble());
+ event.data.longPress.height = static_cast<float>(arguments[3].toDouble());
+ }
+ break;
+ case WebInputEvent::GestureLongTap:
+ event.x = point.x;
+ event.y = point.y;
+ if (arguments.size() >= 4) {
+ event.data.longPress.width = static_cast<float>(arguments[2].toDouble());
+ event.data.longPress.height = static_cast<float>(arguments[3].toDouble());
}
break;
case WebInputEvent::GestureTwoFingerTap:
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h
index c5d742b5f..b1da68487 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h
@@ -111,6 +111,7 @@ public:
void gestureTapDown(const CppArgumentList&, CppVariant*);
void gestureTapCancel(const CppArgumentList&, CppVariant*);
void gestureLongPress(const CppArgumentList&, CppVariant*);
+ void gestureLongTap(const CppArgumentList&, CppVariant*);
void gestureTwoFingerTap(const CppArgumentList&, CppVariant*);
void gestureEvent(WebKit::WebInputEvent::Type, const CppArgumentList&);
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp
index 37078927d..8aa817a2b 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp
@@ -98,6 +98,7 @@ TestRunner::TestRunner()
bindMethod("setPageVisibility", &TestRunner::setPageVisibility);
bindMethod("setTextDirection", &TestRunner::setTextDirection);
bindMethod("textSurroundingNode", &TestRunner::textSurroundingNode);
+ bindMethod("setTouchDragDropEnabled", &TestRunner::setTouchDragDropEnabled);
// Properties.
bindProperty("workerThreadCount", &TestRunner::workerThreadCount);
@@ -664,6 +665,15 @@ void TestRunner::textSurroundingNode(const CppArgumentList& arguments, CppVarian
result->set(surroundingText.textContent().utf8());
}
+void TestRunner::setTouchDragDropEnabled(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() != 1 || !arguments[0].isBool())
+ return;
+
+ m_webView->settings()->setTouchDragDropEnabled(arguments[0].toBoolean());
+}
+
void TestRunner::workerThreadCount(CppVariant* result)
{
result->set(static_cast<int>(WebWorkerInfo::dedicatedWorkerCount()));
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
index f9e9f7a24..4691e5579 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
@@ -147,6 +147,7 @@ private:
// point coordinates relative to the node and the fourth the maximum text
// length to retrieve.
void textSurroundingNode(const CppArgumentList&, CppVariant*);
+ void setTouchDragDropEnabled(const CppArgumentList&, CppVariant*);
///////////////////////////////////////////////////////////////////////////
// Properties
diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h
index 9120121db..306f35cd1 100644
--- a/Tools/DumpRenderTree/chromium/TestShell.h
+++ b/Tools/DumpRenderTree/chromium/TestShell.h
@@ -112,6 +112,7 @@ public:
void setFocus(WebKit::WebWidget*, bool enable);
bool shouldDumpFrameLoadCallbacks() const { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpFrameLoadCallbacks(); }
+ bool shouldDumpResourceRequestCallbacks() const { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpResourceRequestCallbacks(); }
bool shouldDumpUserGestureInFrameLoadCallbacks() const { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpUserGestureInFrameLoadCallbacks(); }
bool shouldDumpResourceLoadCallbacks() const { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpResourceLoadCallbacks(); }
bool shouldDumpResourceResponseMIMETypes() const { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpResourceResponseMIMETypes(); }
diff --git a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp
index 2960dc0bd..ea2fded18 100644
--- a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp
+++ b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp
@@ -118,12 +118,24 @@ static void printEventDetails(const WebKit::WebInputEvent& event)
}
}
+static WebKit::WebPluginContainer::TouchEventRequestType parseTouchEventRequestType(const WebString& string)
+{
+ DEFINE_STATIC_LOCAL(const WebString, kPrimitiveRaw, (WebString::fromUTF8("raw")));
+ DEFINE_STATIC_LOCAL(const WebString, kPrimitiveSynthetic, (WebString::fromUTF8("synthetic")));
+
+ if (string == kPrimitiveRaw)
+ return WebKit::WebPluginContainer::TouchEventRequestTypeRaw;
+ if (string == kPrimitiveSynthetic)
+ return WebKit::WebPluginContainer::TouchEventRequestTypeSynthesizedMouse;
+ return WebKit::WebPluginContainer::TouchEventRequestTypeNone;
+}
+
TestWebPlugin::TestWebPlugin(WebKit::WebFrame* frame,
const WebKit::WebPluginParams& params)
: m_frame(frame)
, m_container(0)
, m_context(0)
- , m_acceptsTouchEvent(false)
+ , m_touchEventRequest(WebKit::WebPluginContainer::TouchEventRequestTypeNone)
, m_printEventDetails(false)
, m_canProcessDrag(false)
{
@@ -150,7 +162,7 @@ TestWebPlugin::TestWebPlugin(WebKit::WebFrame* frame,
else if (attributeName == kAttributeOpacity)
m_scene.opacity = parseOpacity(attributeValue);
else if (attributeName == kAttributeAcceptsTouch)
- m_acceptsTouchEvent = parseBoolean(attributeValue);
+ m_touchEventRequest = parseTouchEventRequestType(attributeValue);
else if (attributeName == kAttributePrintEventDetails)
m_printEventDetails = parseBoolean(attributeValue);
else if (attributeName == kAttributeCanProcessDrag)
@@ -183,7 +195,7 @@ bool TestWebPlugin::initialize(WebPluginContainer* container)
m_container = container;
m_container->setBackingTextureId(m_colorTexture);
- m_container->setIsAcceptingTouchEvents(m_acceptsTouchEvent);
+ m_container->requestTouchEventType(m_touchEventRequest);
m_container->setWantsWheelEvents(true);
return true;
}
diff --git a/Tools/DumpRenderTree/chromium/TestWebPlugin.h b/Tools/DumpRenderTree/chromium/TestWebPlugin.h
index 49fde85aa..e6f5b47a4 100644
--- a/Tools/DumpRenderTree/chromium/TestWebPlugin.h
+++ b/Tools/DumpRenderTree/chromium/TestWebPlugin.h
@@ -27,6 +27,7 @@
#define TestWebPlugin_h
#include "WebPlugin.h"
+#include "WebPluginContainer.h"
#include "platform/WebRect.h"
namespace WebKit {
@@ -131,7 +132,7 @@ private:
unsigned m_framebuffer;
Scene m_scene;
- bool m_acceptsTouchEvent;
+ WebKit::WebPluginContainer::TouchEventRequestType m_touchEventRequest;
bool m_printEventDetails;
bool m_canProcessDrag;
};
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
index baf8d0d9e..bc5f9942b 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
@@ -39,6 +39,7 @@
#include "TestNavigationController.h"
#include "TestShell.h"
#include "TestWebPlugin.h"
+#include "WebCachedURLRequest.h"
#include "WebConsoleMessage.h"
#include "WebContextMenuData.h"
#include "WebDOMMessageEvent.h"
@@ -1139,6 +1140,23 @@ static bool hostIsUsedBySomeTestsToGenerateError(const string& host)
return host == "255.255.255.255";
}
+void WebViewHost::willRequestResource(WebKit::WebFrame* frame, const WebKit::WebCachedURLRequest& request)
+{
+ if (m_shell->shouldDumpResourceRequestCallbacks()) {
+ printFrameDescription(frame);
+ WebElement element = request.initiatorElement();
+ if (!element.isNull()) {
+ printf(" - element with ");
+ if (element.hasAttribute("id"))
+ printf("id '%s'", element.getAttribute("id").utf8().data());
+ else
+ printf("no id");
+ } else
+ printf(" - %s", request.initiatorName().utf8().data());
+ printf(" requested '%s'\n", URLDescription(request.urlRequest().url()).c_str());
+ }
+}
+
void WebViewHost::willSendRequest(WebFrame* frame, unsigned identifier, WebURLRequest& request, const WebURLResponse& redirectResponse)
{
// Need to use GURL for host() and SchemeIs()
@@ -1605,7 +1623,8 @@ void WebViewHost::updateForCommittedLoad(WebFrame* frame, bool isNewNavigation)
{
// Code duplicated from RenderView::DidCommitLoadForFrame.
TestShellExtraData* extraData = static_cast<TestShellExtraData*>(frame->dataSource()->extraData());
- bool nonBlankPageAfterReset = m_pageId == -1 && strcmp(frame->dataSource()->request().url().spec().data(), "about:blank");
+ const WebURL& url = frame->dataSource()->request().url();
+ bool nonBlankPageAfterReset = m_pageId == -1 && !url.isEmpty() && strcmp(url.spec().data(), "about:blank");
if (isNewNavigation || nonBlankPageAfterReset) {
// New navigation.
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h
index eb41d54a4..97906eb26 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.h
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.h
@@ -260,6 +260,7 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
virtual void didChangeLocationWithinPage(WebKit::WebFrame*);
virtual void assignIdentifierToRequest(WebKit::WebFrame*, unsigned identifier, const WebKit::WebURLRequest&);
virtual void removeIdentifierForRequest(unsigned identifier);
+ virtual void willRequestResource(WebKit::WebFrame*, const WebKit::WebCachedURLRequest&);
virtual void willSendRequest(WebKit::WebFrame*, unsigned identifier, WebKit::WebURLRequest&, const WebKit::WebURLResponse&);
virtual void didReceiveResponse(WebKit::WebFrame*, unsigned identifier, const WebKit::WebURLResponse&);
virtual void didFinishResourceLoad(WebKit::WebFrame*, unsigned identifier);