summaryrefslogtreecommitdiff
path: root/Tools/DumpRenderTree/chromium
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-06-01 10:36:58 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-06-01 10:36:58 +0200
commitb1e9e47fa11f608ae16bc07f97a2acf95bf80272 (patch)
treec88c45e80c9c44506e7cdf9a3bb39ebf82a8cd5b /Tools/DumpRenderTree/chromium
parentbe01689f43cf6882cf670d33df49ead1f570c53a (diff)
downloadqtwebkit-b1e9e47fa11f608ae16bc07f97a2acf95bf80272.tar.gz
Imported WebKit commit 499c84c99aa98e9870fa7eaa57db476c6d160d46 (http://svn.webkit.org/repository/webkit/trunk@119200)
Weekly update :). Particularly relevant changes for Qt are the use of the WebCore image decoders and direct usage of libpng/libjpeg if available in the system.
Diffstat (limited to 'Tools/DumpRenderTree/chromium')
-rw-r--r--Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp9
-rw-r--r--Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h1
-rw-r--r--Tools/DumpRenderTree/chromium/LayoutTestController.cpp9
-rw-r--r--Tools/DumpRenderTree/chromium/LayoutTestController.h3
-rw-r--r--Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.cpp58
-rw-r--r--Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.h47
-rw-r--r--Tools/DumpRenderTree/chromium/TestShell.cpp6
-rw-r--r--Tools/DumpRenderTree/chromium/TestShell.h4
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.cpp51
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.h7
10 files changed, 157 insertions, 38 deletions
diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
index 21aed1b9d..b6659a47f 100644
--- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
+++ b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
@@ -112,15 +112,6 @@ void DRTDevToolsAgent::detach()
m_drtDevToolsClient = 0;
}
-bool DRTDevToolsAgent::setJavaScriptProfilingEnabled(bool enabled)
-{
- WebDevToolsAgent* agent = webDevToolsAgent();
- if (!agent)
- return false;
- agent->setJavaScriptProfilingEnabled(enabled);
- return true;
-}
-
bool DRTDevToolsAgent::evaluateInWebInspector(long callID, const std::string& script)
{
WebDevToolsAgent* agent = webDevToolsAgent();
diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h
index 6e491ad53..f3564bd78 100644
--- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h
+++ b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h
@@ -69,7 +69,6 @@ public:
void detach();
bool evaluateInWebInspector(long callID, const std::string& script);
- bool setJavaScriptProfilingEnabled(bool);
TaskList* taskList() { return &m_taskList; }
private:
diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
index 38c2ad652..c739143e0 100644
--- a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -196,7 +196,6 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPermission);
bindMethod("setIconDatabaseEnabled", &LayoutTestController::setIconDatabaseEnabled);
bindMethod("setJavaScriptCanAccessClipboard", &LayoutTestController::setJavaScriptCanAccessClipboard);
- bindMethod("setJavaScriptProfilingEnabled", &LayoutTestController::setJavaScriptProfilingEnabled);
bindMethod("setMinimumTimerInterval", &LayoutTestController::setMinimumTimerInterval);
bindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOrientation);
bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError);
@@ -1831,14 +1830,6 @@ void LayoutTestController::logErrorToConsole(const std::string& text)
WebString(), 0);
}
-void LayoutTestController::setJavaScriptProfilingEnabled(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() < 1 || !arguments[0].isBool())
- return;
- m_shell->drtDevToolsAgent()->setJavaScriptProfilingEnabled(arguments[0].toBoolean());
-}
-
void LayoutTestController::evaluateInWebInspector(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.h b/Tools/DumpRenderTree/chromium/LayoutTestController.h
index 0703ef010..37978657e 100644
--- a/Tools/DumpRenderTree/chromium/LayoutTestController.h
+++ b/Tools/DumpRenderTree/chromium/LayoutTestController.h
@@ -349,9 +349,6 @@ public:
// Gets the number of geolocation permissions requests pending.
void numberOfPendingGeolocationPermissionRequests(const CppArgumentList&, CppVariant*);
- // Allows layout tests to start JavaScript profiling.
- void setJavaScriptProfilingEnabled(const CppArgumentList&, CppVariant*);
-
// Allows layout tests to exec scripts at WebInspector side.
void evaluateInWebInspector(const CppArgumentList&, CppVariant*);
diff --git a/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.cpp b/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.cpp
new file mode 100644
index 000000000..d667d8865
--- /dev/null
+++ b/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.cpp
@@ -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.
+ */
+
+#include "config.h"
+#include "MockWebPrerenderingSupport.h"
+
+#include <wtf/Assertions.h>
+
+MockWebPrerenderingSupport::MockWebPrerenderingSupport()
+{
+ ASSERT(!current());
+ initialize(this);
+}
+
+MockWebPrerenderingSupport::~MockWebPrerenderingSupport()
+{
+ ASSERT(current() == this);
+ shutdown();
+}
+
+void MockWebPrerenderingSupport::add(const WebKit::WebPrerender&)
+{
+}
+
+void MockWebPrerenderingSupport::cancel(const WebKit::WebPrerender&)
+{
+}
+
+void MockWebPrerenderingSupport::abandon(const WebKit::WebPrerender&)
+{
+}
diff --git a/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.h b/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.h
new file mode 100644
index 000000000..b5d4af53d
--- /dev/null
+++ b/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.h
@@ -0,0 +1,47 @@
+/*
+ * 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 MockWebPrerenderingSupport_h
+#define MockWebPrerenderingSupport_h
+
+#include "third_party/WebKit/Source/Platform/chromium/public/WebPrerenderingSupport.h"
+
+class MockWebPrerenderingSupport : public WebKit::WebPrerenderingSupport {
+public:
+ MockWebPrerenderingSupport();
+ virtual ~MockWebPrerenderingSupport();
+
+private:
+ void add(const WebKit::WebPrerender&) OVERRIDE;
+ void cancel(const WebKit::WebPrerender&) OVERRIDE;
+ void abandon(const WebKit::WebPrerender&) OVERRIDE;
+};
+
+#endif // MockWebPrerenderingSupport_h
diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp
index 07a72e3f4..9b9ca4a5b 100644
--- a/Tools/DumpRenderTree/chromium/TestShell.cpp
+++ b/Tools/DumpRenderTree/chromium/TestShell.cpp
@@ -34,6 +34,7 @@
#include "DRTDevToolsAgent.h"
#include "DRTDevToolsClient.h"
#include "LayoutTestController.h"
+#include "MockWebPrerenderingSupport.h"
#include "platform/WebArrayBufferView.h"
#include "WebCompositor.h"
#include "WebDataSource.h"
@@ -66,6 +67,7 @@
#include <wtf/MD5.h>
#include <wtf/OwnArrayPtr.h>
+
using namespace WebKit;
using namespace std;
@@ -147,6 +149,7 @@ void TestShell::initialize()
m_webPermissions = adoptPtr(new WebPermissions(this));
m_accessibilityController = adoptPtr(new AccessibilityController(this));
m_gamepadController = adoptPtr(new GamepadController(this));
+
m_layoutTestController = adoptPtr(new LayoutTestController(this));
m_eventSender = adoptPtr(new EventSender(this));
m_textInputController = adoptPtr(new TextInputController(this));
@@ -154,6 +157,9 @@ void TestShell::initialize()
m_notificationPresenter = adoptPtr(new NotificationPresenter(this));
#endif
m_printer = m_testShellMode ? TestEventPrinter::createTestShellPrinter() : TestEventPrinter::createDRTPrinter();
+#if ENABLE(LINK_PRERENDER)
+ m_prerenderingSupport = adoptPtr(new MockWebPrerenderingSupport());
+#endif
WTF::initializeThreading();
diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h
index fc340248d..ae9d8d8a1 100644
--- a/Tools/DumpRenderTree/chromium/TestShell.h
+++ b/Tools/DumpRenderTree/chromium/TestShell.h
@@ -59,6 +59,7 @@ class WebURL;
class DRTDevToolsAgent;
class DRTDevToolsCallArgs;
class DRTDevToolsClient;
+class MockWebPrerenderingSupport;
class WebPermissions;
struct TestParams {
@@ -224,6 +225,9 @@ private:
#endif
OwnPtr<WebViewHost> m_webViewHost;
OwnPtr<WebKit::WebThread> m_webCompositorThread;
+#if ENABLE(LINK_PRERENDER)
+ OwnPtr<MockWebPrerenderingSupport> m_prerenderingSupport;
+#endif
TestParams m_params;
int m_timeout; // timeout value in millisecond
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
index ef82f2b88..6c48bc1e1 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
@@ -450,6 +450,15 @@ bool WebViewHost::handleCurrentKeyboardEvent()
return frame->executeCommand(WebString::fromUTF8(m_editCommandName), WebString::fromUTF8(m_editCommandValue));
}
+// WebKit::WebPrerendererClient
+
+void WebViewHost::willAddPrerender(WebKit::WebPrerender*)
+{
+}
+
+
+// WebKit::WebSpellCheckClient
+
void WebViewHost::spellCheck(const WebString& text, int& misspelledOffset, int& misspelledLength, WebVector<WebString>* optionalSuggestions)
{
// Check the spelling of the given text.
@@ -1206,6 +1215,21 @@ void WebViewHost::removeIdentifierForRequest(unsigned identifier)
m_resourceIdentifierMap.remove(identifier);
}
+static void blockRequest(WebURLRequest& request)
+{
+ request.setURL(WebURL());
+}
+
+static bool isLocalhost(const string& host)
+{
+ return host == "127.0.0.1" || host == "localhost";
+}
+
+static bool hostIsUsedBySomeTestsToGenerateError(const string& host)
+{
+ return host == "255.255.255.255";
+}
+
void WebViewHost::willSendRequest(WebFrame* frame, unsigned identifier, WebURLRequest& request, const WebURLResponse& redirectResponse)
{
// Need to use GURL for host() and SchemeIs()
@@ -1228,29 +1252,25 @@ void WebViewHost::willSendRequest(WebFrame* frame, unsigned identifier, WebURLRe
if (!redirectResponse.isNull() && m_blocksRedirects) {
fputs("Returning null for this redirect\n", stdout);
- // To block the request, we set its URL to an empty one.
- request.setURL(WebURL());
+ blockRequest(request);
return;
}
if (m_requestReturnNull) {
- // To block the request, we set its URL to an empty one.
- request.setURL(WebURL());
+ blockRequest(request);
return;
}
string host = url.host();
- // 255.255.255.255 is used in some tests that expect to get back an error.
- if (!host.empty() && (url.SchemeIs("http") || url.SchemeIs("https"))
- && host != "127.0.0.1"
- && host != "255.255.255.255"
- && host != "localhost"
- && !m_shell->allowExternalPages()) {
- printf("Blocked access to external URL %s\n", requestURL.c_str());
-
- // To block the request, we set its URL to an empty one.
- request.setURL(WebURL());
- return;
+ 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))
+ && !m_shell->allowExternalPages()) {
+ printf("Blocked access to external URL %s\n", requestURL.c_str());
+ blockRequest(request);
+ return;
+ }
}
HashSet<String>::const_iterator end = m_clearHeaders.end();
@@ -1409,6 +1429,7 @@ void WebViewHost::setWebWidget(WebKit::WebWidget* widget)
{
m_webWidget = widget;
webView()->setSpellCheckClient(this);
+ webView()->setPrerendererClient(this);
webView()->setCompositorSurfaceReady();
}
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h
index c5f930127..21dbb4c8d 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.h
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.h
@@ -38,6 +38,7 @@
#include "WebCursorInfo.h"
#include "WebFrameClient.h"
#include "WebIntentRequest.h"
+#include "WebPrerendererClient.h"
#include "WebSpellCheckClient.h"
#include "WebViewClient.h"
#include <wtf/HashMap.h>
@@ -74,7 +75,8 @@ class MediaStreamUtil;
class TestMediaStreamClient;
}
-class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewClient, public WebKit::WebFrameClient, public NavigationHost {
+class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, public NavigationHost,
+ public WebKit::WebPrerendererClient, public WebKit::WebSpellCheckClient {
public:
WebViewHost(TestShell*);
virtual ~WebViewHost();
@@ -124,6 +126,9 @@ class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewCl
// NavigationHost
virtual bool navigate(const TestNavigationEntry&, bool reload);
+ // WebKit::WebPrerendererClient
+ virtual void willAddPrerender(WebKit::WebPrerender*) OVERRIDE;
+
// WebKit::WebSpellCheckClient
virtual void spellCheck(const WebKit::WebString&, int& offset, int& length, WebKit::WebVector<WebKit::WebString>* optionalSuggestions);
virtual void requestCheckingOfText(const WebKit::WebString&, WebKit::WebTextCheckingCompletion*);