summaryrefslogtreecommitdiffstats
path: root/Tools/DumpRenderTree/chromium
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/DumpRenderTree/chromium')
-rw-r--r--Tools/DumpRenderTree/chromium/DumpRenderTree.cpp8
-rw-r--r--Tools/DumpRenderTree/chromium/ImageDiff.cpp2
-rw-r--r--Tools/DumpRenderTree/chromium/LayoutTestController.cpp26
-rw-r--r--Tools/DumpRenderTree/chromium/LayoutTestController.h4
-rw-r--r--Tools/DumpRenderTree/chromium/NotificationPresenter.cpp2
-rw-r--r--Tools/DumpRenderTree/chromium/TestShell.cpp1
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.cpp41
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.h9
8 files changed, 75 insertions, 18 deletions
diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp
index bd5075c..7e9010f 100644
--- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp
+++ b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp
@@ -58,6 +58,7 @@ static const char optionEnableAccelerated2DCanvas[] = "--enable-accelerated-2d-c
static const char optionStressOpt[] = "--stress-opt";
static const char optionStressDeopt[] = "--stress-deopt";
static const char optionJavaScriptFlags[] = "--js-flags=";
+static const char optionNoTimeout[] = "--no-timeout=";
static void runTest(TestShell& shell, TestParams& params, const string& testName, bool testShellMode)
{
@@ -123,6 +124,7 @@ int main(int argc, char* argv[])
bool stressDeopt = false;
bool hardwareAcceleratedGL = false;
string javaScriptFlags;
+ bool noTimeout = false;
for (int i = 1; i < argc; ++i) {
string argument(argv[i]);
if (argument == "-")
@@ -155,6 +157,8 @@ int main(int argc, char* argv[])
stressDeopt = true;
else if (!argument.find(optionJavaScriptFlags))
javaScriptFlags = argument.substr(strlen(optionJavaScriptFlags));
+ else if (!argument.find(optionNoTimeout))
+ noTimeout = true;
else if (argument.size() && argument[0] == '-')
fprintf(stderr, "Unknown option: %s\n", argv[i]);
else
@@ -182,6 +186,10 @@ int main(int argc, char* argv[])
shell.setJavaScriptFlags(javaScriptFlags);
shell.setStressOpt(stressOpt);
shell.setStressDeopt(stressDeopt);
+ if (noTimeout) {
+ // 0x20000000ms is big enough for the purpose to avoid timeout in debugging.
+ shell.setLayoutTestTimeout(0x20000000);
+ }
if (serverMode && !tests.size()) {
params.printSeparators = true;
char testString[2048]; // 2048 is the same as the sizes of other platforms.
diff --git a/Tools/DumpRenderTree/chromium/ImageDiff.cpp b/Tools/DumpRenderTree/chromium/ImageDiff.cpp
index f2875dd..d676430 100644
--- a/Tools/DumpRenderTree/chromium/ImageDiff.cpp
+++ b/Tools/DumpRenderTree/chromium/ImageDiff.cpp
@@ -88,7 +88,7 @@ public:
if (!byteLength)
return false;
- OwnArrayPtr<unsigned char> source(new unsigned char[byteLength]);
+ OwnArrayPtr<unsigned char> source = adoptArrayPtr(new unsigned char[byteLength]);
if (fread(source.get(), 1, byteLength, stdin) != byteLength)
return false;
diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
index 529019b..59537c6 100644
--- a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -89,6 +89,7 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("counterValueForElementById", &LayoutTestController::counterValueForElementById);
bindMethod("disableImageLoading", &LayoutTestController::disableImageLoading);
bindMethod("display", &LayoutTestController::display);
+ bindMethod("displayInvalidatedRegion", &LayoutTestController::displayInvalidatedRegion);
bindMethod("dumpAsText", &LayoutTestController::dumpAsText);
bindMethod("dumpBackForwardList", &LayoutTestController::dumpBackForwardList);
bindMethod("dumpChildFramesAsText", &LayoutTestController::dumpChildFramesAsText);
@@ -106,7 +107,6 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("evaluateInWebInspector", &LayoutTestController::evaluateInWebInspector);
bindMethod("evaluateScriptInIsolatedWorld", &LayoutTestController::evaluateScriptInIsolatedWorld);
bindMethod("execCommand", &LayoutTestController::execCommand);
- bindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelectionColors);
bindMethod("grantDesktopNotificationPermission", &LayoutTestController::grantDesktopNotificationPermission);
bindMethod("isCommandEnabled", &LayoutTestController::isCommandEnabled);
bindMethod("layerTreeAsText", &LayoutTestController::layerTreeAsText);
@@ -628,9 +628,11 @@ void LayoutTestController::setAlwaysAcceptCookies(const CppArgumentList& argumen
result->setNull();
}
-void LayoutTestController::setAsynchronousSpellCheckingEnabled(const CppArgumentList&, CppVariant*)
+void LayoutTestController::setAsynchronousSpellCheckingEnabled(const CppArgumentList& arguments, CppVariant* result)
{
- // FIXME: Implement this.
+ if (arguments.size() > 0 && arguments[0].isBool())
+ m_shell->webView()->settings()->setAsynchronousSpellCheckingEnabled(cppVariantToBool(arguments[0]));
+ result->setNull();
}
void LayoutTestController::showWebInspector(const CppArgumentList&, CppVariant* result)
@@ -800,11 +802,11 @@ void LayoutTestController::pathToLocalResource(const CppArgumentList& arguments,
// We want a temp file.
const unsigned tempPrefixLength = 5;
size_t bufferSize = MAX_PATH;
- OwnArrayPtr<WCHAR> tempPath(new WCHAR[bufferSize]);
+ OwnArrayPtr<WCHAR> tempPath = adoptArrayPtr(new WCHAR[bufferSize]);
DWORD tempLength = ::GetTempPathW(bufferSize, tempPath.get());
if (tempLength + url.length() - tempPrefixLength + 1 > bufferSize) {
bufferSize = tempLength + url.length() - tempPrefixLength + 1;
- tempPath.set(new WCHAR[bufferSize]);
+ tempPath = adoptArrayPtr(new WCHAR[bufferSize]);
tempLength = GetTempPathW(bufferSize, tempPath.get());
ASSERT(tempLength < bufferSize);
}
@@ -1083,6 +1085,14 @@ void LayoutTestController::display(const CppArgumentList& arguments, CppVariant*
result->setNull();
}
+void LayoutTestController::displayInvalidatedRegion(const CppArgumentList& arguments, CppVariant* result)
+{
+ WebViewHost* host = m_shell->webViewHost();
+ host->paintInvalidatedRegion();
+ host->displayRepaintMask();
+ result->setNull();
+}
+
void LayoutTestController::testRepaint(const CppArgumentList&, CppVariant* result)
{
m_testRepaint = true;
@@ -1464,12 +1474,6 @@ void LayoutTestController::evaluateInWebInspector(const CppArgumentList& argumen
m_shell->drtDevToolsAgent()->evaluateInWebInspector(arguments[0].toInt32(), arguments[1].toString());
}
-void LayoutTestController::forceRedSelectionColors(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- m_shell->webView()->setSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, 0xffc0c0c0);
-}
-
void LayoutTestController::addUserScript(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.h b/Tools/DumpRenderTree/chromium/LayoutTestController.h
index 13d1447..0ef8607 100644
--- a/Tools/DumpRenderTree/chromium/LayoutTestController.h
+++ b/Tools/DumpRenderTree/chromium/LayoutTestController.h
@@ -250,6 +250,7 @@ public:
void dumpTitleChanges(const CppArgumentList&, CppVariant*);
void setMainFrameIsFirstResponder(const CppArgumentList&, CppVariant*);
void display(const CppArgumentList&, CppVariant*);
+ void displayInvalidatedRegion(const CppArgumentList&, CppVariant*);
void testRepaint(const CppArgumentList&, CppVariant*);
void repaintSweepHorizontally(const CppArgumentList&, CppVariant*);
void clearBackForwardList(const CppArgumentList&, CppVariant*);
@@ -311,9 +312,6 @@ public:
// Allows layout tests to exec scripts at WebInspector side.
void evaluateInWebInspector(const CppArgumentList&, CppVariant*);
- // Forces the selection colors for testing under Linux.
- void forceRedSelectionColors(const CppArgumentList&, CppVariant*);
-
// Adds a user script or user style sheet to be injected into new documents.
void addUserScript(const CppArgumentList&, CppVariant*);
void addUserStyleSheet(const CppArgumentList&, CppVariant*);
diff --git a/Tools/DumpRenderTree/chromium/NotificationPresenter.cpp b/Tools/DumpRenderTree/chromium/NotificationPresenter.cpp
index 7e7053b..63a70e4 100644
--- a/Tools/DumpRenderTree/chromium/NotificationPresenter.cpp
+++ b/Tools/DumpRenderTree/chromium/NotificationPresenter.cpp
@@ -95,7 +95,7 @@ bool NotificationPresenter::show(const WebNotification& notification)
notification.url().spec().data());
} else {
printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n",
- notification.dir() == "rtl" ? "(RTL)" : "",
+ notification.direction() == WebTextDirectionRightToLeft ? "(RTL)" : "",
notification.iconURL().isEmpty() ? "" :
notification.iconURL().spec().data(),
notification.title().isEmpty() ? "" :
diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp
index ec6a502..11a598f 100644
--- a/Tools/DumpRenderTree/chromium/TestShell.cpp
+++ b/Tools/DumpRenderTree/chromium/TestShell.cpp
@@ -93,6 +93,7 @@ TestShell::TestShell(bool testShellMode)
WebRuntimeFeatures::enableGeolocation(true);
WebRuntimeFeatures::enableIndexedDatabase(true);
WebRuntimeFeatures::enableFileSystem(true);
+ WebRuntimeFeatures::enableJavaScriptI18NAPI(true);
m_accessibilityController.set(new AccessibilityController(this));
m_layoutTestController.set(new LayoutTestController(this));
m_eventSender.set(new EventSender(this));
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
index 18b107f..e1a2fcb 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
@@ -52,6 +52,8 @@
#include "WebSize.h"
#include "WebSpeechInputControllerMock.h"
#include "WebStorageNamespace.h"
+#include "WebTextCheckingCompletion.h"
+#include "WebTextCheckingResult.h"
#include "WebURLRequest.h"
#include "WebURLResponse.h"
#include "WebView.h"
@@ -60,6 +62,7 @@
#include "webkit/support/webkit_support.h"
#include <wtf/Assertions.h>
#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
using namespace WebCore;
using namespace WebKit;
@@ -225,6 +228,12 @@ static string textAffinityDescription(WebTextAffinity affinity)
return "(UNKNOWN AFFINITY)";
}
+static void invokeFinishLastTextCheck(void* context)
+{
+ WebViewHost* wvh = static_cast<WebViewHost*>(context);
+ wvh->finishLastTextCheck();
+}
+
// WebViewClient -------------------------------------------------------------
WebView* WebViewHost::createView(WebFrame*, const WebURLRequest&, const WebWindowFeatures&, const WebString&)
@@ -409,6 +418,35 @@ void WebViewHost::spellCheck(const WebString& text, int& misspelledOffset, int&
m_spellcheck.spellCheckWord(text, &misspelledOffset, &misspelledLength);
}
+void WebViewHost::requestCheckingOfText(const WebString& text, WebTextCheckingCompletion* completion)
+{
+ m_lastRequestedTextCheckingCompletion = completion;
+ m_lastRequestedTextCheckString = text;
+ webkit_support::PostDelayedTask(invokeFinishLastTextCheck, static_cast<void*>(this), 0);
+}
+
+void WebViewHost::finishLastTextCheck()
+{
+ Vector<WebTextCheckingResult> results;
+ // FIXME: Do the grammar check.
+ int offset = 0;
+ String text(m_lastRequestedTextCheckString.data(), m_lastRequestedTextCheckString.length());
+ while (text.length()) {
+ int misspelledPosition = 0;
+ int misspelledLength = 0;
+ m_spellcheck.spellCheckWord(WebString(text.characters(), text.length()), &misspelledPosition, &misspelledLength);
+ if (!misspelledLength)
+ break;
+ results.append(WebTextCheckingResult(WebTextCheckingResult::ErrorSpelling, offset + misspelledPosition, misspelledLength));
+ text = text.substring(misspelledPosition + misspelledLength);
+ offset += misspelledPosition;
+ }
+
+ m_lastRequestedTextCheckingCompletion->didFinishCheckingText(results);
+ m_lastRequestedTextCheckingCompletion = 0;
+}
+
+
WebString WebViewHost::autoCorrectWord(const WebString&)
{
// Returns an empty string as Mac WebKit ('WebKitSupport/WebEditorClient.mm')
@@ -1094,7 +1132,7 @@ void WebViewHost::didDisplayInsecureContent(WebFrame*)
fputs("didDisplayInsecureContent\n", stdout);
}
-void WebViewHost::didRunInsecureContent(WebFrame*, const WebSecurityOrigin& origin)
+void WebViewHost::didRunInsecureContent(WebFrame*, const WebSecurityOrigin& origin, const WebURL& insecureURL)
{
if (m_shell->shouldDumpFrameLoadCallbacks())
fputs("didRunInsecureContent\n", stdout);
@@ -1115,6 +1153,7 @@ void WebViewHost::openFileSystem(WebFrame* frame, WebFileSystem::Type type, long
WebViewHost::WebViewHost(TestShell* shell)
: m_shell(shell)
, m_webWidget(0)
+ , m_lastRequestedTextCheckingCompletion(0)
{
reset();
}
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h
index 83d21dc..e6d82ae 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.h
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.h
@@ -126,6 +126,7 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
virtual void didEndEditing();
virtual bool handleCurrentKeyboardEvent();
virtual void spellCheck(const WebKit::WebString&, int& offset, int& length);
+ virtual void requestCheckingOfText(const WebKit::WebString&, WebKit::WebTextCheckingCompletion*);
virtual WebKit::WebString autoCorrectWord(const WebKit::WebString&);
virtual void runModalAlertDialog(WebKit::WebFrame*, const WebKit::WebString&);
virtual bool runModalConfirmDialog(WebKit::WebFrame*, const WebKit::WebString&);
@@ -202,12 +203,15 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
virtual void didFinishResourceLoad(WebKit::WebFrame*, unsigned identifier);
virtual void didFailResourceLoad(WebKit::WebFrame*, unsigned identifier, const WebKit::WebURLError&);
virtual void didDisplayInsecureContent(WebKit::WebFrame*);
- virtual void didRunInsecureContent(WebKit::WebFrame*, const WebKit::WebSecurityOrigin&);
+ virtual void didRunInsecureContent(WebKit::WebFrame*, const WebKit::WebSecurityOrigin&, const WebKit::WebURL&);
virtual bool allowScript(WebKit::WebFrame*, bool enabledPerSettings);
virtual void openFileSystem(WebKit::WebFrame*, WebKit::WebFileSystem::Type, long long size, bool create, WebKit::WebFileSystemCallbacks*);
WebKit::WebDeviceOrientationClientMock* deviceOrientationClientMock();
+
+ // Spellcheck related helper APIs
MockSpellCheck* mockSpellCheck();
+ void finishLastTextCheck();
// Geolocation client mocks for LayoutTestController
WebKit::WebGeolocationClientMock* geolocationClientMock();
@@ -320,6 +324,9 @@ private:
OwnPtr<WebKit::WebSpeechInputControllerMock> m_speechInputControllerMock;
OwnPtr<TestNavigationController*> m_navigationController;
+
+ WebKit::WebString m_lastRequestedTextCheckString;
+ WebKit::WebTextCheckingCompletion* m_lastRequestedTextCheckingCompletion;
};
#endif // WebViewHost_h