diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-12 09:27:39 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-12 09:27:39 +0200 |
commit | 3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch) | |
tree | 73dc228333948738bbe02976cacca8cd382bc978 /Tools/DumpRenderTree/chromium | |
parent | b32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff) | |
download | qtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz |
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Tools/DumpRenderTree/chromium')
20 files changed, 245 insertions, 72 deletions
diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp index 6155f441f..ae5502cd2 100644 --- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp @@ -29,11 +29,12 @@ */ #include "config.h" +#include "DumpRenderTree.h" #include "MockWebKitPlatformSupport.h" #include "TestShell.h" -#include "WebCompositor.h" #include "webkit/support/webkit_support.h" +#include <public/WebCompositor.h> #include <v8/include/v8-testing.h> #include <v8/include/v8.h> #include <wtf/OwnPtr.h> @@ -44,7 +45,6 @@ using namespace std; static const char optionComplexText[] = "--complex-text"; static const char optionDumpAllPixels[] = "--dump-all-pixels"; static const char optionNotree[] = "--notree"; -static const char optionPixelTests[] = "--pixel-tests"; static const char optionThreaded[] = "--threaded"; static const char optionDebugRenderTree[] = "--debug-render-tree"; static const char optionDebugLayerTree[] = "--debug-layer-tree"; @@ -85,17 +85,12 @@ private: OwnPtr<MockWebKitPlatformSupport> m_mockPlatform; }; -static void runTest(TestShell& shell, TestParams& params, const string& testName) +static void runTest(TestShell& shell, TestParams& params, const string& inputLine) { int oldTimeoutMsec = shell.layoutTestTimeout(); - params.pixelHash = ""; - string pathOrURL = testName; - string::size_type separatorPosition = pathOrURL.find("'"); - if (separatorPosition != string::npos) { - params.pixelHash = pathOrURL.substr(separatorPosition + 1); - pathOrURL.erase(separatorPosition); - } - params.testUrl = webkit_support::CreateURLForPathOrURL(pathOrURL); + TestCommand command = parseInputLine(inputLine); + params.testUrl = webkit_support::CreateURLForPathOrURL(command.pathOrURL); + params.pixelHash = command.shouldDumpPixels; webkit_support::SetCurrentDirectoryForFileURL(params.testUrl); v8::V8::SetFlagsFromString(shell.javaScriptFlags().c_str(), shell.javaScriptFlags().length()); if (shell.stressOpt() || shell.stressDeopt()) { @@ -108,11 +103,11 @@ static void runTest(TestShell& shell, TestParams& params, const string& testName bool isLastLoad = (i == (v8::Testing::GetStressRuns() - 1)); shell.setDumpWhenFinished(isLastLoad); shell.resetTestController(); - shell.runFileTest(params); + shell.runFileTest(params, command.shouldDumpPixels); } } else { shell.resetTestController(); - shell.runFileTest(params); + shell.runFileTest(params, command.shouldDumpPixels); } shell.setLayoutTestTimeout(oldTimeoutMsec); } @@ -146,8 +141,6 @@ int main(int argc, char* argv[]) serverMode = true; else if (argument == optionNotree) params.dumpTree = false; - else if (argument == optionPixelTests) - params.dumpPixels = true; else if (argument == optionDebugRenderTree) params.debugRenderTree = true; else if (argument == optionDebugLayerTree) diff --git a/Tools/DumpRenderTree/chromium/LayoutTestHelper.mm b/Tools/DumpRenderTree/chromium/LayoutTestHelper.mm index 978f74c06..5ecac6692 100644 --- a/Tools/DumpRenderTree/chromium/LayoutTestHelper.mm +++ b/Tools/DumpRenderTree/chromium/LayoutTestHelper.mm @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2012 Apple Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -40,13 +41,97 @@ namespace { +#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + +CFURLRef sUserColorProfileURL; + +void installLayoutTestColorProfile() +{ + // To make sure we get consistent colors (not dependent on the chosen color + // space of the main display), we force the generic RGB color profile. + // This causes a change the user can see. + + CFUUIDRef mainDisplayID = CGDisplayCreateUUIDFromDisplayID(CGMainDisplayID()); + + if (!sUserColorProfileURL) { + CFDictionaryRef deviceInfo = ColorSyncDeviceCopyDeviceInfo(kColorSyncDisplayDeviceClass, mainDisplayID); + + if (!deviceInfo) { + NSLog(@"No display attached to system; not setting main display's color profile."); + CFRelease(mainDisplayID); + return; + } + + CFDictionaryRef profileInfo = (CFDictionaryRef)CFDictionaryGetValue(deviceInfo, kColorSyncCustomProfiles); + if (profileInfo) { + sUserColorProfileURL = (CFURLRef)CFDictionaryGetValue(profileInfo, CFSTR("1")); + CFRetain(sUserColorProfileURL); + } else { + profileInfo = (CFDictionaryRef)CFDictionaryGetValue(deviceInfo, kColorSyncFactoryProfiles); + CFDictionaryRef factoryProfile = (CFDictionaryRef)CFDictionaryGetValue(profileInfo, CFSTR("1")); + sUserColorProfileURL = (CFURLRef)CFDictionaryGetValue(factoryProfile, kColorSyncDeviceProfileURL); + CFRetain(sUserColorProfileURL); + } + + CFRelease(deviceInfo); + } + + ColorSyncProfileRef genericRGBProfile = ColorSyncProfileCreateWithName(kColorSyncGenericRGBProfile); + CFErrorRef error; + CFURLRef profileURL = ColorSyncProfileGetURL(genericRGBProfile, &error); + if (!profileURL) { + NSLog(@"Failed to get URL of Generic RGB color profile! Many pixel tests may fail as a result. Error: %@", error); + + if (sUserColorProfileURL) { + CFRelease(sUserColorProfileURL); + sUserColorProfileURL = 0; + } + + CFRelease(genericRGBProfile); + CFRelease(mainDisplayID); + return; + } + + CFMutableDictionaryRef profileInfo = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + CFDictionarySetValue(profileInfo, kColorSyncDeviceDefaultProfileID, profileURL); + + if (!ColorSyncDeviceSetCustomProfiles(kColorSyncDisplayDeviceClass, mainDisplayID, profileInfo)) { + NSLog(@"Failed to set color profile for main display! Many pixel tests may fail as a result."); + + if (sUserColorProfileURL) { + CFRelease(sUserColorProfileURL); + sUserColorProfileURL = 0; + } + } + + CFRelease(profileInfo); + CFRelease(genericRGBProfile); + CFRelease(mainDisplayID); +} + +void restoreUserColorProfile(void) +{ + // This is used as a signal handler, and thus the calls into ColorSync are unsafe. + // But we might as well try to restore the user's color profile, we're going down anyway... + + if (!sUserColorProfileURL) + return; + + CFUUIDRef mainDisplayID = CGDisplayCreateUUIDFromDisplayID(CGMainDisplayID()); + CFMutableDictionaryRef profileInfo = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + CFDictionarySetValue(profileInfo, kColorSyncDeviceDefaultProfileID, sUserColorProfileURL); + ColorSyncDeviceSetCustomProfiles(kColorSyncDisplayDeviceClass, mainDisplayID, profileInfo); + CFRelease(mainDisplayID); + CFRelease(profileInfo); +} + +#else // For Snow Leopard and before, use older CM* API. + const char colorProfilePath[] = "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc"; CMProfileLocation initialColorProfileLocation; // The locType field is initialized to 0 which is the same as cmNoProfileBase. -} // namespace - -static void installLayoutTestColorProfile() +void installLayoutTestColorProfile() { // To make sure we get consistent colors (not dependent on the Main display), // we force the generic rgb color profile. This cases a change the user can @@ -76,7 +161,7 @@ static void installLayoutTestColorProfile() } } -static void restoreUserColorProfile(void) +void restoreUserColorProfile(void) { // This is used as a signal handler, and thus the calls into ColorSync are unsafe. // But we might as well try to restore the user's color profile, we're going down anyway... @@ -90,13 +175,17 @@ static void restoreUserColorProfile(void) } } -static void simpleSignalHandler(int sig) +#endif + +void simpleSignalHandler(int sig) { // Try to restore the color profile and try to go down cleanly restoreUserColorProfile(); exit(128 + sig); } +} // namespace + int main(int argc, char* argv[]) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp index 7204732de..502addea9 100644 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp +++ b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp @@ -118,7 +118,6 @@ void MockWebSpeechRecognizer::start(const WebSpeechRecognitionHandle& handle, co m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didStart))); m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didStartAudio))); m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didStartSound))); - m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didStartSpeech))); if (!m_mockTranscripts.isEmpty()) { ASSERT(m_mockTranscripts.size() == m_mockConfidences.size()); @@ -131,7 +130,6 @@ void MockWebSpeechRecognizer::start(const WebSpeechRecognitionHandle& handle, co } else m_taskQueue.append(adoptPtr(new NoMatchTask(this))); - m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEndSpeech))); m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEndSound))); m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEndAudio))); m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd))); @@ -153,7 +151,7 @@ void MockWebSpeechRecognizer::abort(const WebSpeechRecognitionHandle& handle, We m_handle = handle; m_client = client; - m_taskQueue.clear(); + clearTaskQueue(); m_wasAborted = true; m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd))); startTaskQueue(); @@ -167,7 +165,7 @@ void MockWebSpeechRecognizer::addMockResult(const WebString& transcript, float c void MockWebSpeechRecognizer::setError(int code, const WebString& message) { - m_taskQueue.clear(); + clearTaskQueue(); m_taskQueue.append(adoptPtr(new ErrorTask(this, code, message))); m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd))); startTaskQueue(); @@ -191,17 +189,22 @@ void MockWebSpeechRecognizer::startTaskQueue() m_taskQueueRunning = true; } -void MockWebSpeechRecognizer::StepTask::runIfValid() +void MockWebSpeechRecognizer::clearTaskQueue() { - ASSERT(m_object->m_taskQueueRunning); + m_taskQueue.clear(); + m_taskQueueRunning = false; +} +void MockWebSpeechRecognizer::StepTask::runIfValid() +{ if (m_object->m_taskQueue.isEmpty()) { m_object->m_taskQueueRunning = false; return; } - m_object->m_taskQueue[0]->run(); + OwnPtr<Task> task = m_object->m_taskQueue[0].release(); m_object->m_taskQueue.remove(0); + task->run(); if (m_object->m_taskQueue.isEmpty()) { m_object->m_taskQueueRunning = false; diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h index 7716186d1..eb7c3e95b 100644 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h +++ b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h @@ -72,6 +72,7 @@ public: private: MockWebSpeechRecognizer(); void startTaskQueue(); + void clearTaskQueue(); TaskList m_taskList; WebKit::WebSpeechRecognitionHandle m_handle; diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp index c6e4404c2..b1d2948ae 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp @@ -29,7 +29,7 @@ */ #include "config.h" -#include "AccessibilityController.h" +#include "AccessibilityControllerChromium.h" #include "WebAccessibilityObject.h" #include "WebFrame.h" diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.h b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.h index 967259536..11c082b3e 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.h @@ -28,10 +28,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef AccessibilityController_h -#define AccessibilityController_h +#ifndef AccessibilityControllerChromium_h +#define AccessibilityControllerChromium_h -#include "AccessibilityUIElement.h" +#include "AccessibilityUIElementChromium.h" #include "CppBoundClass.h" namespace WebKit { @@ -81,4 +81,4 @@ private: WebKit::WebView* m_webView; }; -#endif // AccessibilityController_h +#endif // AccessibilityControllerChromium_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.cpp b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp index 583806585..c56b151e6 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp @@ -29,7 +29,7 @@ */ #include "config.h" -#include "AccessibilityUIElement.h" +#include "AccessibilityUIElementChromium.h" #include "WebAccessibilityObject.h" #include "platform/WebCString.h" diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.h b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h index 8ae6d412f..1b48a53b6 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h @@ -28,8 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef AccessibilityUIElement_h -#define AccessibilityUIElement_h +#ifndef AccessibilityUIElementChromium_h +#define AccessibilityUIElementChromium_h #include "CppBoundClass.h" #include "WebAccessibilityObject.h" @@ -164,4 +164,4 @@ private: ElementList m_elements; }; -#endif // AccessibilityUIElement_h +#endif // AccessibilityUIElementChromium_h diff --git a/Tools/DumpRenderTree/chromium/EventSender.cpp b/Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp index 5f49b8fdf..cafaca9ac 100644 --- a/Tools/DumpRenderTree/chromium/EventSender.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp @@ -286,6 +286,7 @@ EventSender::EventSender() bindMethod("gestureScrollFirstPoint", &EventSender::gestureScrollFirstPoint); bindMethod("gestureScrollUpdate", &EventSender::gestureScrollUpdate); bindMethod("gestureTap", &EventSender::gestureTap); + bindMethod("gestureTapDown", &EventSender::gestureTapDown); bindMethod("gestureLongPress", &EventSender::gestureLongPress); bindMethod("gestureTwoFingerTap", &EventSender::gestureTwoFingerTap); bindMethod("zoomPageIn", &EventSender::zoomPageIn); @@ -1112,6 +1113,12 @@ void EventSender::gestureTap(const CppArgumentList& arguments, CppVariant* resul gestureEvent(WebInputEvent::GestureTap, arguments); } +void EventSender::gestureTapDown(const CppArgumentList& arguments, CppVariant* result) +{ + result->setNull(); + gestureEvent(WebInputEvent::GestureTapDown, arguments); +} + void EventSender::gestureLongPress(const CppArgumentList& arguments, CppVariant* result) { result->setNull(); @@ -1166,13 +1173,17 @@ void EventSender::gestureEvent(WebInputEvent::Type type, const CppArgumentList& event.y = m_currentGestureLocation.y; break; case WebInputEvent::GestureTap: - if (arguments.size() >= 4) { + if (arguments.size() >= 3) { + // Tap count. event.deltaX = static_cast<float>(arguments[2].toDouble()); - event.deltaY = static_cast<float>(arguments[3].toDouble()); } event.x = point.x; event.y = point.y; break; + case WebInputEvent::GestureTapDown: + event.x = point.x; + event.y = point.y; + break; case WebInputEvent::GestureLongPress: event.x = point.x; event.y = point.y; diff --git a/Tools/DumpRenderTree/chromium/EventSender.h b/Tools/DumpRenderTree/chromium/TestRunner/EventSender.h index c187f0e47..828e7c842 100644 --- a/Tools/DumpRenderTree/chromium/EventSender.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/EventSender.h @@ -105,6 +105,7 @@ public: void gestureScrollFirstPoint(const CppArgumentList&, CppVariant*); void gestureScrollUpdate(const CppArgumentList&, CppVariant*); void gestureTap(const CppArgumentList&, CppVariant*); + void gestureTapDown(const CppArgumentList&, CppVariant*); void gestureLongPress(const CppArgumentList&, CppVariant*); void gestureTwoFingerTap(const CppArgumentList&, CppVariant*); void gestureEvent(WebKit::WebInputEvent::Type, const CppArgumentList&); diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp index edd50dfab..ccec086aa 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp @@ -31,7 +31,8 @@ #include "config.h" #include "TestInterfaces.h" -#include "AccessibilityController.h" +#include "AccessibilityControllerChromium.h" +#include "EventSender.h" #include "GamepadController.h" #include "TextInputController.h" #include "platform/WebString.h" @@ -53,9 +54,11 @@ public: 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; }; @@ -63,6 +66,7 @@ private: TestInterfaces::Internal::Internal() { m_accessibilityController = adoptPtr(new AccessibilityController()); + m_eventSender = adoptPtr(new EventSender()); m_gamepadController = adoptPtr(new GamepadController()); m_textInputController = adoptPtr(new TextInputController()); } @@ -70,10 +74,12 @@ TestInterfaces::Internal::Internal() TestInterfaces::Internal::~Internal() { m_accessibilityController->setWebView(0); + m_eventSender->setWebView(0); // m_gamepadController doesn't depend on WebView. m_textInputController->setWebView(0); // m_accessibilityController doesn't depend on TestDelegate. + m_eventSender->setDelegate(0); m_gamepadController->setDelegate(0); // m_textInputController doesn't depend on TestDelegate. } @@ -81,6 +87,7 @@ TestInterfaces::Internal::~Internal() void TestInterfaces::Internal::setWebView(WebView* webView) { m_accessibilityController->setWebView(webView); + m_eventSender->setWebView(webView); // m_gamepadController doesn't depend on WebView. m_textInputController->setWebView(webView); } @@ -88,6 +95,7 @@ void TestInterfaces::Internal::setWebView(WebView* webView) void TestInterfaces::Internal::setDelegate(TestDelegate* delegate) { // m_accessibilityController doesn't depend on TestDelegate. + m_eventSender->setDelegate(delegate); m_gamepadController->setDelegate(delegate); // m_textInputController doesn't depend on TestDelegate. } @@ -95,6 +103,7 @@ void TestInterfaces::Internal::setDelegate(TestDelegate* delegate) void TestInterfaces::Internal::bindTo(WebFrame* frame) { m_accessibilityController->bindToJavascript(frame, WebString::fromUTF8("accessibilityController")); + m_eventSender->bindToJavascript(frame, WebString::fromUTF8("eventSender")); m_gamepadController->bindToJavascript(frame, WebString::fromUTF8("gamepadController")); m_textInputController->bindToJavascript(frame, WebString::fromUTF8("textInputController")); } @@ -102,6 +111,7 @@ void TestInterfaces::Internal::bindTo(WebFrame* frame) void TestInterfaces::Internal::resetAll() { m_accessibilityController->reset(); + m_eventSender->reset(); m_gamepadController->reset(); // m_textInputController doesn't have any state to reset. } @@ -140,3 +150,8 @@ AccessibilityController* TestInterfaces::accessibilityController() { return m_internal->accessibilityController(); } + +EventSender* TestInterfaces::eventSender() +{ + return m_internal->eventSender(); +} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h index 5615223e6..917695461 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h @@ -37,6 +37,7 @@ class WebView; } class AccessibilityController; +class EventSender; class TestDelegate; class TestInterfaces { @@ -50,6 +51,7 @@ public: void resetAll(); AccessibilityController* accessibilityController(); + EventSender* eventSender(); private: class Internal; diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp index 6f991ff33..29a2a3130 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.cpp +++ b/Tools/DumpRenderTree/chromium/TestShell.cpp @@ -36,7 +36,6 @@ #include "LayoutTestController.h" #include "MockWebPrerenderingSupport.h" #include "platform/WebArrayBufferView.h" -#include "WebCompositor.h" #include "WebDataSource.h" #include "WebDocument.h" #include "WebElement.h" @@ -44,23 +43,23 @@ #include "WebHistoryItem.h" #include "WebIDBFactory.h" #include "WebTestingSupport.h" -#include "platform/WebThread.h" -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" #include "WebPermissions.h" -#include "platform/WebPoint.h" #include "WebRuntimeFeatures.h" #include "WebScriptController.h" #include "WebSettings.h" -#include "platform/WebSize.h" -#include "platform/WebString.h" -#include "platform/WebURLRequest.h" -#include "platform/WebURLResponse.h" #include "WebView.h" #include "WebViewHost.h" #include "skia/ext/platform_canvas.h" #include "webkit/support/webkit_support.h" #include "webkit/support/webkit_support_gfx.h" +#include <public/Platform.h> +#include <public/WebCompositor.h> +#include <public/WebPoint.h> +#include <public/WebSize.h> +#include <public/WebString.h> +#include <public/WebThread.h> +#include <public/WebURLRequest.h> +#include <public/WebURLResponse.h> #include <algorithm> #include <cctype> #include <vector> @@ -106,6 +105,7 @@ TestShell::TestShell() , m_testIsPreparing(false) , m_focusedWidget(0) , m_devTools(0) + , m_dumpPixelsForCurrentTest(false) , m_allowExternalPages(false) , m_acceleratedCompositingForVideoEnabled(false) , m_threadedCompositingEnabled(false) @@ -152,7 +152,6 @@ void TestShell::initialize() m_webPermissions = adoptPtr(new WebPermissions(this)); m_testInterfaces = adoptPtr(new TestInterfaces()); m_layoutTestController = adoptPtr(new LayoutTestController(this)); - m_eventSender = adoptPtr(new EventSender()); #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) m_notificationPresenter = adoptPtr(new NotificationPresenter(this)); #endif @@ -163,7 +162,7 @@ void TestShell::initialize() WTF::initializeThreading(); if (m_threadedCompositingEnabled) { - m_webCompositorThread = adoptPtr(WebKit::webKitPlatformSupport()->createThread("Compositor")); + m_webCompositorThread = adoptPtr(WebKit::Platform::current()->createThread("Compositor")); WebCompositor::initialize(m_webCompositorThread.get()); } else WebCompositor::initialize(0); @@ -178,8 +177,6 @@ void TestShell::createMainWindow() 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); m_drtDevToolsAgent->setWebView(m_webView); } @@ -187,8 +184,6 @@ TestShell::~TestShell() { m_testInterfaces->setDelegate(0); m_testInterfaces->setWebView(0); - m_eventSender->setDelegate(0); - m_eventSender->setWebView(0); m_drtDevToolsAgent->setWebView(0); } @@ -237,13 +232,16 @@ void TestShell::resetWebSettings(WebView& webView) m_prefs.applyTo(&webView); } -void TestShell::runFileTest(const TestParams& params) +void TestShell::runFileTest(const TestParams& params, bool shouldDumpPixels) { ASSERT(params.testUrl.isValid()); + m_dumpPixelsForCurrentTest = shouldDumpPixels; m_testIsPreparing = true; m_params = params; string testUrl = m_params.testUrl.spec(); + m_layoutTestController->setShouldGeneratePixelResults(shouldDumpPixels); + if (testUrl.find("loading/") != string::npos || testUrl.find("loading\\") != string::npos) m_layoutTestController->setShouldDumpFrameLoadCallbacks(true); @@ -301,7 +299,6 @@ void TestShell::resetTestController() m_webPermissions->reset(); m_testInterfaces->resetAll(); m_layoutTestController->reset(); - m_eventSender->reset(); m_webViewHost->reset(); #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) m_notificationPresenter->reset(); @@ -609,7 +606,7 @@ void TestShell::dump() if (dumpedAnything && m_params.printSeparators) m_printer.handleTextFooter(); - if (m_params.dumpPixels && shouldGeneratePixelResults) { + if (m_dumpPixelsForCurrentTest && shouldGeneratePixelResults) { // Image output: we write the image data to the file given on the // command line (for the dump pixels argument), and the MD5 sum to // stdout. @@ -730,7 +727,6 @@ void TestShell::bindJSObjectsToWindow(WebFrame* frame) m_testInterfaces->bindTo(frame); m_layoutTestController->bindToJavascript(frame, WebString::fromUTF8("layoutTestController")); m_layoutTestController->bindToJavascript(frame, WebString::fromUTF8("testRunner")); - m_eventSender->bindToJavascript(frame, WebString::fromUTF8("eventSender")); } WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url) diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h index 07781636b..005d374a2 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.h +++ b/Tools/DumpRenderTree/chromium/TestShell.h @@ -31,8 +31,7 @@ #ifndef TestShell_h #define TestShell_h -#include "AccessibilityController.h" -#include "EventSender.h" +#include "AccessibilityControllerChromium.h" #include "GamepadController.h" #include "LayoutTestController.h" #include "NotificationPresenter.h" @@ -64,7 +63,6 @@ class WebPermissions; struct TestParams { bool dumpTree; - bool dumpPixels; bool debugRenderTree; bool debugLayerTree; bool printSeparators; @@ -73,7 +71,6 @@ struct TestParams { TestParams() : dumpTree(true) - , dumpPixels(false) , debugRenderTree(false) , debugLayerTree(false) , printSeparators(false) { } @@ -91,7 +88,7 @@ public: // Returns the host for the main WebView. WebViewHost* webViewHost() const { return m_webViewHost.get(); } LayoutTestController* layoutTestController() const { return m_layoutTestController.get(); } - EventSender* eventSender() const { return m_eventSender.get(); } + EventSender* eventSender() const { return m_testInterfaces->eventSender(); } AccessibilityController* accessibilityController() const { return m_testInterfaces->accessibilityController(); } #if ENABLE(NOTIFICATIONS) NotificationPresenter* notificationPresenter() const { return m_notificationPresenter.get(); } @@ -104,7 +101,7 @@ public: WebPermissions* webPermissions() { return m_webPermissions.get(); } void bindJSObjectsToWindow(WebKit::WebFrame*); - void runFileTest(const TestParams&); + void runFileTest(const TestParams&, bool shouldDumpPixelTests); void callJSGC(); void resetTestController(); void waitTestFinished(); @@ -214,7 +211,6 @@ private: OwnPtr<DRTDevToolsAgent> m_drtDevToolsAgent; OwnPtr<DRTDevToolsClient> m_drtDevToolsClient; OwnPtr<TestInterfaces> m_testInterfaces; - OwnPtr<EventSender> m_eventSender; OwnPtr<LayoutTestController> m_layoutTestController; #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) OwnPtr<NotificationPresenter> m_notificationPresenter; @@ -226,6 +222,7 @@ private: #endif TestParams m_params; + bool m_dumpPixelsForCurrentTest; int m_timeout; // timeout value in millisecond bool m_allowExternalPages; bool m_acceleratedCompositingForVideoEnabled; diff --git a/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp b/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp index 5f04fff5b..188158440 100644 --- a/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp +++ b/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp @@ -44,9 +44,12 @@ namespace { -const char fontMainConfigFile[] = "/data/drt/android_main_fonts.xml"; -const char fontFallbackConfigFile[] = "/data/drt/android_fallback_fonts.xml"; -const char fontsDir[] = "/data/drt/fonts/"; +// Must be same as DEVICE_DRT_DIR in Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py. +#define DEVICE_DRT_DIR "/data/local/tmp/drt/" + +const char fontMainConfigFile[] = DEVICE_DRT_DIR "android_main_fonts.xml"; +const char fontFallbackConfigFile[] = DEVICE_DRT_DIR "android_fallback_fonts.xml"; +const char fontsDir[] = DEVICE_DRT_DIR "fonts/"; const char optionInFIFO[] = "--in-fifo="; const char optionOutFIFO[] = "--out-fifo="; @@ -72,7 +75,9 @@ void removeArg(int index, int* argc, char*** argv) void createFIFO(const char* fifoPath) { unlink(fifoPath); - if (mkfifo(fifoPath, 0600)) { + // 0666 is rw-rw-rw-, to allow adb shell to read/write the fifo. + // Explicitly call chmod to ensure the mode is set despite umask. + if (mkfifo(fifoPath, 0666) || chmod(fifoPath, 0666)) { androidLogError("Failed to create fifo %s: %s\n", fifoPath, strerror(errno)); exit(EXIT_FAILURE); } diff --git a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp index 570192cbb..bbeba6f9b 100644 --- a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp +++ b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp @@ -27,6 +27,7 @@ #include "TestWebPlugin.h" #include "WebFrame.h" +#include "WebInputEvent.h" #include "platform/WebGraphicsContext3D.h" #include "WebKit.h" #include "platform/WebKitPlatformSupport.h" @@ -364,3 +365,47 @@ unsigned TestWebPlugin::loadProgram(const CString& vertexSource, return program; } +bool TestWebPlugin::handleInputEvent(const WebKit::WebInputEvent& event, WebKit::WebCursorInfo& info) +{ + const char* eventName = 0; + switch (event.type) { + case WebKit::WebInputEvent::Undefined: eventName = "unknown"; break; + + case WebKit::WebInputEvent::MouseDown: eventName = "MouseDown"; break; + case WebKit::WebInputEvent::MouseUp: eventName = "MouseUp"; break; + case WebKit::WebInputEvent::MouseMove: eventName = "MouseMove"; break; + case WebKit::WebInputEvent::MouseEnter: eventName = "MouseEnter"; break; + case WebKit::WebInputEvent::MouseLeave: eventName = "MouseLeave"; break; + case WebKit::WebInputEvent::ContextMenu: eventName = "ContextMenu"; break; + + case WebKit::WebInputEvent::MouseWheel: eventName = "MouseWheel"; break; + + case WebKit::WebInputEvent::RawKeyDown: eventName = "RawKeyDown"; break; + case WebKit::WebInputEvent::KeyDown: eventName = "KeyDown"; break; + case WebKit::WebInputEvent::KeyUp: eventName = "KeyUp"; break; + case WebKit::WebInputEvent::Char: eventName = "Char"; break; + + case WebKit::WebInputEvent::GestureScrollBegin: eventName = "GestureScrollBegin"; break; + case WebKit::WebInputEvent::GestureScrollEnd: eventName = "GestureScrollEnd"; break; + case WebKit::WebInputEvent::GestureScrollUpdate: eventName = "GestureScrollUpdate"; break; + case WebKit::WebInputEvent::GestureFlingStart: eventName = "GestureFlingStart"; break; + case WebKit::WebInputEvent::GestureFlingCancel: eventName = "GestureFlingCancel"; break; + case WebKit::WebInputEvent::GestureTap: eventName = "GestureTap"; break; + case WebKit::WebInputEvent::GestureTapDown: eventName = "GestureTapDown"; break; + case WebKit::WebInputEvent::GestureDoubleTap: eventName = "GestureDoubleTap"; break; + case WebKit::WebInputEvent::GestureTwoFingerTap: eventName = "GestureTwoFingerTap"; break; + case WebKit::WebInputEvent::GestureLongPress: eventName = "GestureLongPress"; break; + case WebKit::WebInputEvent::GesturePinchBegin: eventName = "GesturePinchBegin"; break; + case WebKit::WebInputEvent::GesturePinchEnd: eventName = "GesturePinchEnd"; break; + case WebKit::WebInputEvent::GesturePinchUpdate: eventName = "GesturePinchUpdate"; break; + + case WebKit::WebInputEvent::TouchStart: eventName = "TouchStart"; break; + case WebKit::WebInputEvent::TouchMove: eventName = "TouchMove"; break; + case WebKit::WebInputEvent::TouchEnd: eventName = "TouchEnd"; break; + case WebKit::WebInputEvent::TouchCancel: eventName = "TouchCancel"; break; + } + + printf("Plugin received event: %s\n", eventName ? eventName : "unknown"); + return false; +} + diff --git a/Tools/DumpRenderTree/chromium/TestWebPlugin.h b/Tools/DumpRenderTree/chromium/TestWebPlugin.h index 4c9f2f4d2..025b11095 100644 --- a/Tools/DumpRenderTree/chromium/TestWebPlugin.h +++ b/Tools/DumpRenderTree/chromium/TestWebPlugin.h @@ -60,8 +60,8 @@ public: bool isVisible); virtual void updateFocus(bool) { } virtual void updateVisibility(bool) { } - virtual bool acceptsInputEvents() { return false; } - virtual bool handleInputEvent(const WebKit::WebInputEvent&, WebKit::WebCursorInfo&) { return false; } + virtual bool acceptsInputEvents() { return true; } + virtual bool handleInputEvent(const WebKit::WebInputEvent&, WebKit::WebCursorInfo&); virtual void didReceiveResponse(const WebKit::WebURLResponse&) { } virtual void didReceiveData(const char* data, int dataLength) { } virtual void didFinishLoading() { } diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp index ba5ecf0c8..115c405ec 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp +++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "WebViewHost.h" +#include "EventSender.h" #include "LayoutTestController.h" #include "MockGrammarCheck.h" #include "MockWebSpeechInputController.h" diff --git a/Tools/DumpRenderTree/chromium/android_main_fonts.xml b/Tools/DumpRenderTree/chromium/android_main_fonts.xml index 8a4cbe0f8..b6afa7944 100644 --- a/Tools/DumpRenderTree/chromium/android_main_fonts.xml +++ b/Tools/DumpRenderTree/chromium/android_main_fonts.xml @@ -23,6 +23,8 @@ <name>Times</name> <name>Times New Roman</name> <name>Monaco</name> + <!-- Match chromium-linux. See comments of SubpixelPositioning in fonts.conf --> + <name>SubpixelPositioning</name> </nameset> <fileset> <file>Times_New_Roman.ttf</file> @@ -107,10 +109,12 @@ <family> <nameset> <name>Ahem</name> + <!-- Match chromium-linux. See comments of SubpixelPositioning in fonts.conf --> + <name>SubpixelPositioningAhem</name> </nameset> <fileset> <file>AHEM____.TTF</file> </fileset> </family> -</familyset>
\ No newline at end of file +</familyset> diff --git a/Tools/DumpRenderTree/chromium/fonts.conf b/Tools/DumpRenderTree/chromium/fonts.conf index 8e4f8d712..d337b1243 100644 --- a/Tools/DumpRenderTree/chromium/fonts.conf +++ b/Tools/DumpRenderTree/chromium/fonts.conf @@ -239,4 +239,14 @@ </edit> </match> + <match target="pattern"> + <!-- See comments above --> + <test name="family" compare="eq"> + <string>SubpixelPositioningAhem</string> + </test> + <edit name="family" mode="assign"> + <string>ahem</string> + </edit> + </match> + </fontconfig> |