summaryrefslogtreecommitdiffstats
path: root/WebKitTools/WebKitTestRunner
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/WebKitTestRunner')
-rw-r--r--WebKitTools/WebKitTestRunner/DerivedSources.make2
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm35
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl43
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/GCController.idl34
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrapper.h7
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl1
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp128
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/EventSendingController.h63
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/GCController.cpp74
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/GCController.h54
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp11
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h12
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp228
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h62
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp38
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h4
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp74
-rw-r--r--WebKitTools/WebKitTestRunner/StringFunctions.h125
-rw-r--r--WebKitTools/WebKitTestRunner/TestInvocation.cpp44
-rw-r--r--WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj56
-rw-r--r--WebKitTools/WebKitTestRunner/win/InjectedBundle.vcproj32
-rw-r--r--WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp62
-rw-r--r--WebKitTools/WebKitTestRunner/win/WebKitTestRunner.vcproj8
23 files changed, 985 insertions, 212 deletions
diff --git a/WebKitTools/WebKitTestRunner/DerivedSources.make b/WebKitTools/WebKitTestRunner/DerivedSources.make
index 6134380..c308a8a 100644
--- a/WebKitTools/WebKitTestRunner/DerivedSources.make
+++ b/WebKitTools/WebKitTestRunner/DerivedSources.make
@@ -26,6 +26,8 @@ VPATH = \
#
INTERFACES = \
+ EventSendingController \
+ GCController \
LayoutTestController \
#
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm
index fa47143..0de2fd0 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm
@@ -245,30 +245,31 @@ JSValueRef ${className}::@{[$function->signature->name]}(JSContextRef context, J
${implementationClassName}* impl = to${implementationClassName}(context, thisObject);
if (!impl)
return JSValueMakeUndefined(context);
+
EOF
- my @parameters = ();
- my @specifiedParameters = @{$function->parameters};
+ my $functionCall;
+ if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
+ $functionCall = "impl->" . $function->signature->name . "(context, argumentCount, arguments, exception)";
+ } else {
+ my @parameters = ();
+ my @specifiedParameters = @{$function->parameters};
- push(@contents, "\n") if scalar @specifiedParameters;
+ $self->_includeHeaders(\%contentsIncludes, $function->signature->type, $function->signature);
- $self->_includeHeaders(\%contentsIncludes, $function->signature->type, $function->signature);
+ foreach my $i (0..$#specifiedParameters) {
+ my $parameter = $specifiedParameters[$i];
- foreach my $i (0..$#specifiedParameters) {
- my $parameter = $specifiedParameters[$i];
+ $self->_includeHeaders(\%contentsIncludes, $idlType, $parameter);
- $self->_includeHeaders(\%contentsIncludes, $idlType, $parameter);
+ push(@contents, " " . $self->_platformTypeVariableDeclaration($parameter, $parameter->name, "arguments[$i]", "argumentCount > $i") . "\n");
+
+ push(@parameters, $self->_parameterExpression($parameter));
+ }
- push(@contents, " " . $self->_platformTypeVariableDeclaration($parameter, $parameter->name, "arguments[$i]", "argumentCount > $i") . "\n");
-
- push(@parameters, $self->_parameterExpression($parameter));
+ $functionCall = "impl->" . $function->signature->name . "(" . join(", ", @parameters) . ")";
}
-
- my $isVoidReturn = $function->signature->type eq "void";
- my $functionName = "impl->" . $function->signature->name;
- my $functionCall = $functionName . "(" . join(", ", @parameters) . ")";
-
- push(@contents, "\n") unless scalar @specifiedParameters == 1;
- push(@contents, " ${functionCall};\n\n") if $isVoidReturn;
+
+ push(@contents, " ${functionCall};\n\n") if $function->signature->type eq "void";
push(@contents, " return " . $self->_returnExpression($function->signature, $functionCall) . ";\n}\n");
}
}
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl
new file mode 100644
index 0000000..1e47772
--- /dev/null
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+module WTR {
+
+ interface EventSendingController {
+ [CustomArgumentHandling] void mouseDown();
+ [CustomArgumentHandling] void mouseUp();
+ [CustomArgumentHandling] void mouseMoveTo();
+ [CustomArgumentHandling] void keyDown();
+ [CustomArgumentHandling] void contextClick(); // CustomArgumentHandling only to throw exception while not implemented.
+ [CustomArgumentHandling] void leapForward(/*in unsigned long delay*/); // CustomArgumentHandling only to throw exception while not implemented.
+
+ // Zoom functions.
+ void textZoomIn();
+ void textZoomOut();
+ void zoomPageIn();
+ void zoomPageOut();
+ };
+
+}
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/GCController.idl b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/GCController.idl
new file mode 100644
index 0000000..eb3ddee
--- /dev/null
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/GCController.idl
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2010 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+module WTR {
+
+ interface GCController {
+ void collect();
+ void collectOnAlternateThread(in boolean waitUntilDone);
+ unsigned long long getJSObjectCount();
+ };
+
+}
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrapper.h b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrapper.h
index 9839cb4..d885801 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrapper.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrapper.h
@@ -27,6 +27,7 @@
#define JSWrapper_h
#include "JSWrappable.h"
+#include <JavaScriptCore/JSRetainPtr.h>
namespace WTR {
@@ -45,6 +46,12 @@ inline JSValueRef toJS(JSContextRef context, JSWrappable* impl)
return JSWrapper::wrap(context, impl);
}
+inline void setProperty(JSContextRef context, JSObjectRef object, const char* propertyName, JSWrappable* value, JSPropertyAttributes attributes, JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> propertyNameString(Adopt, JSStringCreateWithUTF8CString(propertyName));
+ JSObjectSetProperty(context, object, propertyNameString.get(), JSWrapper::wrap(context, value), attributes, exception);
+}
+
} // namespace WTR
#endif // JSWrapper_h
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
index 2eca583..7993d78 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
@@ -37,6 +37,7 @@ module WTR {
void dumpEditingCallbacks();
void dumpSelectionRect();
void dumpStatusCallbacks();
+ void dumpTitleChanges();
// Special options.
void keepWebHistory();
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
new file mode 100644
index 0000000..472cf6c
--- /dev/null
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2010 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "EventSendingController.h"
+
+#include "InjectedBundle.h"
+#include "InjectedBundlePage.h"
+#include "JSEventSendingController.h"
+#include <WebKit2/WKBundlePage.h>
+#include <WebKit2/WKBundlePagePrivate.h>
+#include <WebKit2/WKBundlePrivate.h>
+
+namespace WTR {
+
+static const float ZoomMultiplierRatio = 1.2f;
+
+PassRefPtr<EventSendingController> EventSendingController::create()
+{
+ return adoptRef(new EventSendingController);
+}
+
+EventSendingController::EventSendingController()
+{
+}
+
+EventSendingController::~EventSendingController()
+{
+}
+
+JSClassRef EventSendingController::wrapperClass()
+{
+ return JSEventSendingController::eventSendingControllerClass();
+}
+
+static void setExceptionForString(JSContextRef context, JSValueRef* exception, const char* string)
+{
+ JSRetainPtr<JSStringRef> exceptionString(Adopt, JSStringCreateWithUTF8CString(string));
+ *exception = JSValueMakeString(context, exceptionString.get());
+}
+
+void EventSendingController::mouseDown(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ setExceptionForString(context, exception, "EventSender.mouseDown is not yet supported.");
+}
+
+void EventSendingController::mouseUp(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ setExceptionForString(context, exception, "EventSender.mouseUp is not yet supported.");
+}
+
+void EventSendingController::mouseMoveTo(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ setExceptionForString(context, exception, "EventSender.mouseMoveTo is not yet supported.");
+}
+
+void EventSendingController::keyDown(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ setExceptionForString(context, exception, "EventSender.keyDown is not yet supported.");
+}
+
+void EventSendingController::contextClick(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ setExceptionForString(context, exception, "EventSender.contextClick is not yet supported.");
+}
+
+void EventSendingController::leapForward(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ setExceptionForString(context, exception, "EventSender.leapForward is not yet supported.");
+}
+
+void EventSendingController::textZoomIn()
+{
+ WKBundlePageSetZoomMode(InjectedBundle::shared().page()->page(), kWKBundlePageZoomModeTextOnly);
+ float zoomFactor = WKBundlePageGetZoomFactor(InjectedBundle::shared().page()->page());
+ WKBundlePageSetZoomFactor(InjectedBundle::shared().page()->page(), zoomFactor * ZoomMultiplierRatio);
+}
+
+void EventSendingController::textZoomOut()
+{
+ WKBundlePageSetZoomMode(InjectedBundle::shared().page()->page(), kWKBundlePageZoomModeTextOnly);
+ float zoomFactor = WKBundlePageGetZoomFactor(InjectedBundle::shared().page()->page());
+ WKBundlePageSetZoomFactor(InjectedBundle::shared().page()->page(), zoomFactor / ZoomMultiplierRatio);
+}
+
+void EventSendingController::zoomPageIn()
+{
+ WKBundlePageSetZoomMode(InjectedBundle::shared().page()->page(), kWKBundlePageZoomModePage);
+ float zoomFactor = WKBundlePageGetZoomFactor(InjectedBundle::shared().page()->page());
+ WKBundlePageSetZoomFactor(InjectedBundle::shared().page()->page(), zoomFactor * ZoomMultiplierRatio);
+}
+
+void EventSendingController::zoomPageOut()
+{
+ WKBundlePageSetZoomMode(InjectedBundle::shared().page()->page(), kWKBundlePageZoomModePage);
+ float zoomFactor = WKBundlePageGetZoomFactor(InjectedBundle::shared().page()->page());
+ WKBundlePageSetZoomFactor(InjectedBundle::shared().page()->page(), zoomFactor / ZoomMultiplierRatio);
+}
+
+// Object Creation
+
+void EventSendingController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
+{
+ setProperty(context, windowObject, "eventSender", this, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
+}
+
+} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/EventSendingController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/EventSendingController.h
new file mode 100644
index 0000000..400f60d
--- /dev/null
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/EventSendingController.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2010 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 EventSendingController_h
+#define EventSendingController_h
+
+#include "JSWrappable.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WTR {
+
+class EventSendingController : public JSWrappable {
+public:
+ static PassRefPtr<EventSendingController> create();
+ virtual ~EventSendingController();
+
+ void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
+
+ // JSWrappable
+ virtual JSClassRef wrapperClass();
+
+ void mouseDown(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+ void mouseUp(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+ void mouseMoveTo(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+ void keyDown(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+ void contextClick(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+ void leapForward(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+
+ // Zoom functions.
+ void textZoomIn();
+ void textZoomOut();
+ void zoomPageIn();
+ void zoomPageOut();
+
+private:
+ EventSendingController();
+};
+
+} // namespace WTR
+
+#endif // EventSendingController_h
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/GCController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/GCController.cpp
new file mode 100644
index 0000000..0eba2df
--- /dev/null
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/GCController.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2010 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "GCController.h"
+
+#include "InjectedBundle.h"
+#include "JSGCController.h"
+#include <WebKit2/WKBundlePrivate.h>
+
+namespace WTR {
+
+PassRefPtr<GCController> GCController::create()
+{
+ return adoptRef(new GCController);
+}
+
+GCController::GCController()
+{
+}
+
+GCController::~GCController()
+{
+}
+
+JSClassRef GCController::wrapperClass()
+{
+ return JSGCController::gCControllerClass();
+}
+
+void GCController::collect()
+{
+ WKBundleGarbageCollectJavaScriptObjects(InjectedBundle::shared().bundle());
+}
+
+void GCController::collectOnAlternateThread(bool waitUntilDone)
+{
+ WKBundleGarbageCollectJavaScriptObjectsOnAlternateThreadForDebugging(InjectedBundle::shared().bundle(), waitUntilDone);
+}
+
+size_t GCController::getJSObjectCount()
+{
+ return WKBundleGetJavaScriptObjectsCount(InjectedBundle::shared().bundle());
+}
+
+// Object Creation
+
+void GCController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
+{
+ setProperty(context, windowObject, "GCController", this, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
+}
+
+} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/GCController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/GCController.h
new file mode 100644
index 0000000..760fbb1
--- /dev/null
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/GCController.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2010 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 GCController_h
+#define GCController_h
+
+#include "JSWrappable.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WTR {
+
+class GCController : public JSWrappable {
+public:
+ static PassRefPtr<GCController> create();
+ virtual ~GCController();
+
+ void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
+
+ // JSWrappable
+ virtual JSClassRef wrapperClass();
+
+ void collect();
+ void collectOnAlternateThread(bool waitUntilDone);
+ size_t getJSObjectCount();
+
+private:
+ GCController();
+};
+
+} // namespace WTR
+
+#endif // GCController_h
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
index 095bd9c..02dfeb1 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
@@ -81,6 +81,7 @@ void InjectedBundle::initialize(WKBundleRef bundle)
WKBundleSetClient(m_bundle, &client);
activateFonts();
+ WKBundleActivateMacFontAscentHack(m_bundle);
}
void InjectedBundle::done()
@@ -132,15 +133,15 @@ void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messag
void InjectedBundle::reset()
{
m_outputStream.str("");
+
m_layoutTestController = LayoutTestController::create();
+ m_gcController = GCController::create();
+ m_eventSendingController = EventSendingController::create();
+
WKBundleSetShouldTrackVisitedLinks(m_bundle, false);
WKBundleRemoveAllVisitedLinks(m_bundle);
- m_mainPage->reset();
-}
-void InjectedBundle::setShouldTrackVisitedLinks()
-{
- WKBundleSetShouldTrackVisitedLinks(m_bundle, true);
+ m_mainPage->reset();
}
void InjectedBundle::closeOtherPages()
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
index 42eb3a1..ba021b1 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
@@ -26,6 +26,8 @@
#ifndef InjectedBundle_h
#define InjectedBundle_h
+#include "EventSendingController.h"
+#include "GCController.h"
#include "LayoutTestController.h"
#include <WebKit2/WKBase.h>
#include <WebKit2/WKBundleBase.h>
@@ -46,17 +48,19 @@ public:
// Initialize the InjectedBundle.
void initialize(WKBundleRef);
- void done();
+ WKBundleRef bundle() const { return m_bundle; }
LayoutTestController* layoutTestController() { return m_layoutTestController.get(); }
+ GCController* gcController() { return m_gcController.get(); }
+ EventSendingController* eventSendingController() { return m_eventSendingController.get(); }
+
InjectedBundlePage* page() { return m_mainPage.get(); }
size_t pageCount() { return !!m_mainPage + m_otherPages.size(); }
void closeOtherPages();
+ void done();
std::ostringstream& os() { return m_outputStream; }
- void setShouldTrackVisitedLinks();
-
private:
InjectedBundle();
~InjectedBundle();
@@ -76,6 +80,8 @@ private:
OwnPtr<InjectedBundlePage> m_mainPage;
RefPtr<LayoutTestController> m_layoutTestController;
+ RefPtr<GCController> m_gcController;
+ RefPtr<EventSendingController> m_eventSendingController;
std::ostringstream m_outputStream;
};
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 406787e..40a098e 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -26,6 +26,7 @@
#include "InjectedBundlePage.h"
#include "InjectedBundle.h"
+#include "StringFunctions.h"
#include <JavaScriptCore/JSRetainPtr.h>
#include <WebKit2/WKArray.h>
#include <WebKit2/WKBundleFrame.h>
@@ -34,43 +35,27 @@
#include <WebKit2/WKBundlePagePrivate.h>
#include <WebKit2/WKRetainPtr.h>
#include <WebKit2/WKBundleRange.h>
-#include <WebKit2/WKString.h>
-#include <WebKit2/WKStringCF.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/RetainPtr.h>
-#include <wtf/Vector.h>
using namespace std;
namespace WTR {
-static ostream& operator<<(ostream& out, CFStringRef stringRef)
-{
- if (!stringRef)
- return out;
- CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(stringRef), kCFStringEncodingUTF8) + 1;
- Vector<char> buffer(bufferLength);
- if (!CFStringGetCString(stringRef, buffer.data(), bufferLength, kCFStringEncodingUTF8))
- return out;
- return out << buffer.data();
-}
-
-static ostream& operator<<(ostream& out, const RetainPtr<CFStringRef>& stringRef)
-{
- return out << stringRef.get();
-}
-
-static ostream& operator<<(ostream& out, WKStringRef stringRef)
-{
- if (!stringRef)
- return out;
- RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, stringRef));
- return out << cfString;
-}
+static ostream& operator<<(ostream& out, WKBundleFrameRef frame)
+{
+ WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame));
+ if (WKBundleFrameIsMainFrame(frame)) {
+ if (!WKStringIsEmpty(name.get()))
+ out << "main frame \"" << name << "\"";
+ else
+ out << "main frame";
+ } else {
+ if (!WKStringIsEmpty(name.get()))
+ out << "frame \"" << name << "\"";
+ else
+ out << "frame (anonymous)";
+ }
-static ostream& operator<<(ostream& out, const WKRetainPtr<WKStringRef>& stringRef)
-{
- return out << stringRef.get();
+ return out;
}
static string dumpPath(WKBundleNodeRef node)
@@ -111,42 +96,49 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
WKBundlePageLoaderClient loaderClient = {
0,
this,
- _didStartProvisionalLoadForFrame,
- _didReceiveServerRedirectForProvisionalLoadForFrame,
- _didFailProvisionalLoadWithErrorForFrame,
- _didCommitLoadForFrame,
- _didFinishLoadForFrame,
- _didFailLoadWithErrorForFrame,
- _didReceiveTitleForFrame,
- _didClearWindowForFrame
+ didStartProvisionalLoadForFrame,
+ didReceiveServerRedirectForProvisionalLoadForFrame,
+ didFailProvisionalLoadWithErrorForFrame,
+ didCommitLoadForFrame,
+ didFinishLoadForFrame,
+ didFailLoadWithErrorForFrame,
+ didReceiveTitleForFrame,
+ didClearWindowForFrame,
+ didCancelClientRedirectForFrame,
+ willPerformClientRedirectForFrame,
+ didChangeLocationWithinPageForFrame,
+ didFinishDocumentLoadForFrame,
+ didHandleOnloadEventsForFrame,
+ didDisplayInsecureContentForFrame,
+ didRunInsecureContentForFrame
};
WKBundlePageSetLoaderClient(m_page, &loaderClient);
WKBundlePageUIClient uiClient = {
0,
this,
- _willAddMessageToConsole,
- _willSetStatusbarText,
- _willRunJavaScriptAlert,
- _willRunJavaScriptConfirm,
- _willRunJavaScriptPrompt
+ willAddMessageToConsole,
+ willSetStatusbarText,
+ willRunJavaScriptAlert,
+ willRunJavaScriptConfirm,
+ willRunJavaScriptPrompt
};
WKBundlePageSetUIClient(m_page, &uiClient);
WKBundlePageEditorClient editorClient = {
0,
this,
- _shouldBeginEditing,
- _shouldEndEditing,
- _shouldInsertNode,
- _shouldInsertText,
- _shouldDeleteRange,
- _shouldChangeSelectedRange,
- _shouldApplyStyle,
- _didBeginEditing,
- _didEndEditing,
- _didChange,
- _didChangeSelection
+ shouldBeginEditing,
+ shouldEndEditing,
+ shouldInsertNode,
+ shouldInsertText,
+ shouldDeleteRange,
+ shouldChangeSelectedRange,
+ shouldApplyStyle,
+ didBeginEditing,
+ didEndEditing,
+ didChange,
+ didChangeSelection
};
WKBundlePageSetEditorClient(m_page, &editorClient);
}
@@ -158,50 +150,89 @@ InjectedBundlePage::~InjectedBundlePage()
void InjectedBundlePage::reset()
{
WKBundlePageClearMainFrameName(m_page);
+
+ WKBundlePageSetZoomFactor(m_page, 1.0f);
+ WKBundlePageSetZoomMode(m_page, kWKBundlePageZoomModePage);
}
// Loader Client Callbacks
-void InjectedBundlePage::_didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
+void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didStartProvisionalLoadForFrame(frame);
}
-void InjectedBundlePage::_didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
+void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReceiveServerRedirectForProvisionalLoadForFrame(frame);
}
-void InjectedBundlePage::_didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
+void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFailProvisionalLoadWithErrorForFrame(frame);
}
-void InjectedBundlePage::_didCommitLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
+void InjectedBundlePage::didCommitLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didCommitLoadForFrame(frame);
}
-void InjectedBundlePage::_didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
+void InjectedBundlePage::didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFinishLoadForFrame(frame);
}
-void InjectedBundlePage::_didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
+void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFailLoadWithErrorForFrame(frame);
}
-void InjectedBundlePage::_didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, const void *clientInfo)
+void InjectedBundlePage::didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReceiveTitleForFrame(title, frame);
}
-void InjectedBundlePage::_didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window, const void *clientInfo)
+void InjectedBundlePage::didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didClearWindowForFrame(frame, context, window);
}
+void InjectedBundlePage::didCancelClientRedirectForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo)
+{
+ static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didCancelClientRedirectForFrame(frame);
+}
+
+void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, double delay, double date, const void* clientInfo)
+{
+ static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willPerformClientRedirectForFrame(frame, url, delay, date);
+}
+
+void InjectedBundlePage::didChangeLocationWithinPageForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo)
+{
+ static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didChangeLocationWithinPageForFrame(frame);
+}
+
+void InjectedBundlePage::didFinishDocumentLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo)
+{
+ static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFinishDocumentLoadForFrame(frame);
+}
+
+void InjectedBundlePage::didHandleOnloadEventsForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo)
+{
+ static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didHandleOnloadEventsForFrame(frame);
+}
+
+void InjectedBundlePage::didDisplayInsecureContentForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo)
+{
+ static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didDisplayInsecureContentForFrame(frame);
+}
+
+void InjectedBundlePage::didRunInsecureContentForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo)
+{
+ static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didRunInsecureContentForFrame(frame);
+}
+
+
void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundleFrameRef frame)
{
if (frame == WKBundlePageGetMainFrame(m_page))
@@ -355,37 +386,74 @@ void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame)
void InjectedBundlePage::didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef frame)
{
+ if (!InjectedBundle::shared().layoutTestController()->shouldDumpTitleChanges())
+ return;
+
+ InjectedBundle::shared().os() << "TITLE CHANGED: " << title << "\n";
}
void InjectedBundlePage::didClearWindowForFrame(WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window)
{
JSValueRef exception = 0;
InjectedBundle::shared().layoutTestController()->makeWindowObject(context, window, &exception);
+ InjectedBundle::shared().gcController()->makeWindowObject(context, window, &exception);
+ InjectedBundle::shared().eventSendingController()->makeWindowObject(context, window, &exception);
+}
+
+void InjectedBundlePage::didCancelClientRedirectForFrame(WKBundleFrameRef frame)
+{
+}
+
+void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundleFrameRef frame, WKURLRef url, double delay, double date)
+{
+}
+
+void InjectedBundlePage::didChangeLocationWithinPageForFrame(WKBundleFrameRef frame)
+{
+}
+
+void InjectedBundlePage::didFinishDocumentLoadForFrame(WKBundleFrameRef frame)
+{
+ unsigned pendingFrameUnloadEvents = WKBundleFrameGetPendingUnloadCount(frame);
+ if (pendingFrameUnloadEvents)
+ InjectedBundle::shared().os() << frame << " - has " << pendingFrameUnloadEvents << " onunload handler(s)\n";
+}
+
+void InjectedBundlePage::didHandleOnloadEventsForFrame(WKBundleFrameRef frame)
+{
+}
+
+void InjectedBundlePage::didDisplayInsecureContentForFrame(WKBundleFrameRef frame)
+{
+}
+
+void InjectedBundlePage::didRunInsecureContentForFrame(WKBundleFrameRef frame)
+{
}
// UI Client Callbacks
-void InjectedBundlePage::_willAddMessageToConsole(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo)
+void InjectedBundlePage::willAddMessageToConsole(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willAddMessageToConsole(message, lineNumber);
}
-void InjectedBundlePage::_willSetStatusbarText(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo)
+void InjectedBundlePage::willSetStatusbarText(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willSetStatusbarText(statusbarText);
}
-void InjectedBundlePage::_willRunJavaScriptAlert(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo)
+void InjectedBundlePage::willRunJavaScriptAlert(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willRunJavaScriptAlert(message, frame);
}
-void InjectedBundlePage::_willRunJavaScriptConfirm(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo)
+void InjectedBundlePage::willRunJavaScriptConfirm(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo)
{
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willRunJavaScriptConfirm(message, frame);
}
-void InjectedBundlePage::_willRunJavaScriptPrompt(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void *clientInfo)
+void InjectedBundlePage::willRunJavaScriptPrompt(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willRunJavaScriptPrompt(message, defaultValue, frame);
}
@@ -421,57 +489,57 @@ void InjectedBundlePage::willRunJavaScriptPrompt(WKStringRef message, WKStringRe
// Editor Client Callbacks
-bool InjectedBundlePage::_shouldBeginEditing(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
+bool InjectedBundlePage::shouldBeginEditing(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
{
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldBeginEditing(range);
}
-bool InjectedBundlePage::_shouldEndEditing(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
+bool InjectedBundlePage::shouldEndEditing(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
{
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldEndEditing(range);
}
-bool InjectedBundlePage::_shouldInsertNode(WKBundlePageRef page, WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo)
+bool InjectedBundlePage::shouldInsertNode(WKBundlePageRef page, WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo)
{
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldInsertNode(node, rangeToReplace, action);
}
-bool InjectedBundlePage::_shouldInsertText(WKBundlePageRef page, WKStringRef text, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo)
+bool InjectedBundlePage::shouldInsertText(WKBundlePageRef page, WKStringRef text, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo)
{
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldInsertText(text, rangeToReplace, action);
}
-bool InjectedBundlePage::_shouldDeleteRange(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
+bool InjectedBundlePage::shouldDeleteRange(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
{
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldDeleteRange(range);
}
-bool InjectedBundlePage::_shouldChangeSelectedRange(WKBundlePageRef page, WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType affinity, bool stillSelecting, const void* clientInfo)
+bool InjectedBundlePage::shouldChangeSelectedRange(WKBundlePageRef page, WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType affinity, bool stillSelecting, const void* clientInfo)
{
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldChangeSelectedRange(fromRange, toRange, affinity, stillSelecting);
}
-bool InjectedBundlePage::_shouldApplyStyle(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo)
+bool InjectedBundlePage::shouldApplyStyle(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo)
{
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldApplyStyle(style, range);
}
-void InjectedBundlePage::_didBeginEditing(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
+void InjectedBundlePage::didBeginEditing(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didBeginEditing(notificationName);
}
-void InjectedBundlePage::_didEndEditing(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
+void InjectedBundlePage::didEndEditing(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didEndEditing(notificationName);
}
-void InjectedBundlePage::_didChange(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
+void InjectedBundlePage::didChange(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didChange(notificationName);
}
-void InjectedBundlePage::_didChangeSelection(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
+void InjectedBundlePage::didChangeSelection(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didChangeSelection(notificationName);
}
@@ -492,7 +560,7 @@ bool InjectedBundlePage::shouldEndEditing(WKBundleRangeRef range)
bool InjectedBundlePage::shouldInsertNode(WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action)
{
- static const char *insertactionstring[] = {
+ static const char* insertactionstring[] = {
"WebViewInsertActionTyped",
"WebViewInsertActionPasted",
"WebViewInsertActionDropped",
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
index f7d64f9..8909883 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
@@ -44,14 +44,21 @@ public:
private:
// Loader Client
- static void _didStartProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo);
- static void _didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo);
- static void _didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo);
- static void _didCommitLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo);
- static void _didFinishLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo);
- static void _didFailLoadWithErrorForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo);
- static void _didReceiveTitleForFrame(WKBundlePageRef, WKStringRef title, WKBundleFrameRef, const void* clientInfo);
- static void _didClearWindowForFrame(WKBundlePageRef, WKBundleFrameRef, JSGlobalContextRef, JSObjectRef window, const void* clientInfo);
+ static void didStartProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
+ static void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
+ static void didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
+ static void didCommitLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
+ static void didFinishLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
+ static void didFailLoadWithErrorForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
+ static void didReceiveTitleForFrame(WKBundlePageRef, WKStringRef title, WKBundleFrameRef, const void*);
+ static void didClearWindowForFrame(WKBundlePageRef, WKBundleFrameRef, JSGlobalContextRef, JSObjectRef window, const void*);
+ static void didCancelClientRedirectForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
+ static void willPerformClientRedirectForFrame(WKBundlePageRef, WKBundleFrameRef, WKURLRef url, double delay, double date, const void*);
+ static void didChangeLocationWithinPageForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
+ static void didFinishDocumentLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
+ static void didHandleOnloadEventsForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
+ static void didDisplayInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
+ static void didRunInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
void didStartProvisionalLoadForFrame(WKBundleFrameRef);
void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef);
void didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef);
@@ -60,13 +67,20 @@ private:
void didFailLoadWithErrorForFrame(WKBundleFrameRef);
void didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef);
void didClearWindowForFrame(WKBundleFrameRef, JSGlobalContextRef, JSObjectRef window);
+ void didCancelClientRedirectForFrame(WKBundleFrameRef);
+ void willPerformClientRedirectForFrame(WKBundleFrameRef, WKURLRef url, double delay, double date);
+ void didChangeLocationWithinPageForFrame(WKBundleFrameRef);
+ void didFinishDocumentLoadForFrame(WKBundleFrameRef);
+ void didHandleOnloadEventsForFrame(WKBundleFrameRef);
+ void didDisplayInsecureContentForFrame(WKBundleFrameRef);
+ void didRunInsecureContentForFrame(WKBundleFrameRef);
// UI Client
- static void _willAddMessageToConsole(WKBundlePageRef, WKStringRef message, uint32_t lineNumber, const void* clientInfo);
- static void _willSetStatusbarText(WKBundlePageRef, WKStringRef statusbarText, const void* clientInfo);
- static void _willRunJavaScriptAlert(WKBundlePageRef, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo);
- static void _willRunJavaScriptConfirm(WKBundlePageRef, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo);
- static void _willRunJavaScriptPrompt(WKBundlePageRef, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void* clientInfo);
+ static void willAddMessageToConsole(WKBundlePageRef, WKStringRef message, uint32_t lineNumber, const void* clientInfo);
+ static void willSetStatusbarText(WKBundlePageRef, WKStringRef statusbarText, const void* clientInfo);
+ static void willRunJavaScriptAlert(WKBundlePageRef, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo);
+ static void willRunJavaScriptConfirm(WKBundlePageRef, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo);
+ static void willRunJavaScriptPrompt(WKBundlePageRef, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void* clientInfo);
void willAddMessageToConsole(WKStringRef message, uint32_t lineNumber);
void willSetStatusbarText(WKStringRef statusbarText);
void willRunJavaScriptAlert(WKStringRef message, WKBundleFrameRef);
@@ -74,17 +88,17 @@ private:
void willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef);
// Editor client
- static bool _shouldBeginEditing(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
- static bool _shouldEndEditing(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
- static bool _shouldInsertNode(WKBundlePageRef, WKBundleNodeRef, WKBundleRangeRef rangeToReplace, WKInsertActionType, const void* clientInfo);
- static bool _shouldInsertText(WKBundlePageRef, WKStringRef, WKBundleRangeRef rangeToReplace, WKInsertActionType, const void* clientInfo);
- static bool _shouldDeleteRange(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
- static bool _shouldChangeSelectedRange(WKBundlePageRef, WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType, bool stillSelecting, const void* clientInfo);
- static bool _shouldApplyStyle(WKBundlePageRef, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo);
- static void _didBeginEditing(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
- static void _didEndEditing(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
- static void _didChange(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
- static void _didChangeSelection(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
+ static bool shouldBeginEditing(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
+ static bool shouldEndEditing(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
+ static bool shouldInsertNode(WKBundlePageRef, WKBundleNodeRef, WKBundleRangeRef rangeToReplace, WKInsertActionType, const void* clientInfo);
+ static bool shouldInsertText(WKBundlePageRef, WKStringRef, WKBundleRangeRef rangeToReplace, WKInsertActionType, const void* clientInfo);
+ static bool shouldDeleteRange(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
+ static bool shouldChangeSelectedRange(WKBundlePageRef, WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType, bool stillSelecting, const void* clientInfo);
+ static bool shouldApplyStyle(WKBundlePageRef, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo);
+ static void didBeginEditing(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
+ static void didEndEditing(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
+ static void didChange(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
+ static void didChangeSelection(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
bool shouldBeginEditing(WKBundleRangeRef);
bool shouldEndEditing(WKBundleRangeRef);
bool shouldInsertNode(WKBundleNodeRef, WKBundleRangeRef rangeToReplace, WKInsertActionType);
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
index 8fda21e..f2393f1 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
@@ -28,12 +28,12 @@
#include "InjectedBundle.h"
#include "InjectedBundlePage.h"
#include "JSLayoutTestController.h"
-#include <JavaScriptCore/JSRetainPtr.h>
+#include "StringFunctions.h"
#include <WebKit2/WKBundleFrame.h>
#include <WebKit2/WKBundleFramePrivate.h>
#include <WebKit2/WKBundlePagePrivate.h>
+#include <WebKit2/WKBundlePrivate.h>
#include <WebKit2/WKRetainPtr.h>
-#include <WebKit2/WKStringCF.h>
#include <WebKit2/WebKit2.h>
namespace WTR {
@@ -42,37 +42,6 @@ namespace WTR {
// Eventually it should be changed to match.
static const CFTimeInterval waitToDumpWatchdogInterval = 6.0;
-static RetainPtr<CFStringRef> toCF(JSStringRef string)
-{
- return RetainPtr<CFStringRef>(AdoptCF, JSStringCopyCFString(0, string));
-}
-
-static RetainPtr<CFStringRef> toCF(WKStringRef string)
-{
- return RetainPtr<CFStringRef>(AdoptCF, WKStringCopyCFString(0, string));
-}
-
-static WKRetainPtr<WKStringRef> toWK(JSStringRef string)
-{
- return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithCFString(toCF(string).get()));
-}
-
-static JSRetainPtr<JSStringRef> toJS(WKStringRef string)
-{
- return JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithCFString(toCF(string).get()));
-}
-
-static JSRetainPtr<JSStringRef> toJS(const WKRetainPtr<WKStringRef>& string)
-{
- return toJS(string.get());
-}
-
-static void setProperty(JSContextRef context, JSObjectRef object, const char* propertyName, JSWrappable* value, JSPropertyAttributes attributes, JSValueRef* exception)
-{
- JSRetainPtr<JSStringRef> propertyNameString(Adopt, JSStringCreateWithUTF8CString(propertyName));
- JSObjectSetProperty(context, object, propertyNameString.get(), JSWrapper::wrap(context, value), attributes, exception);
-}
-
static JSValueRef propertyValue(JSContextRef context, JSObjectRef object, const char* propertyName)
{
if (!object)
@@ -119,6 +88,7 @@ LayoutTestController::LayoutTestController()
, m_shouldCloseExtraWindows(false)
, m_dumpEditingCallbacks(false)
, m_dumpStatusCallbacks(false)
+ , m_dumpTitleChanges(false)
, m_waitToDump(false)
, m_testRepaint(false)
, m_testRepaintSweepHorizontally(false)
@@ -195,7 +165,7 @@ bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef anima
void LayoutTestController::keepWebHistory()
{
- InjectedBundle::shared().setShouldTrackVisitedLinks();
+ WKBundleSetShouldTrackVisitedLinks(InjectedBundle::shared().bundle(), true);
}
JSValueRef LayoutTestController::computedStyleIncludingVisitedInfo(JSValueRef element)
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
index 75aeb9e..7c3125c 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
@@ -27,7 +27,6 @@
#define LayoutTestController_h
#include "JSWrappable.h"
-#include <JavaScriptCore/JavaScriptCore.h>
#include <JavaScriptCore/JSRetainPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RetainPtr.h>
@@ -56,6 +55,7 @@ public:
void dumpEditingCallbacks() { m_dumpEditingCallbacks = true; }
void dumpSelectionRect() { } // Will need to do something when we support pixel tests.
void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; }
+ void dumpTitleChanges() { m_dumpTitleChanges = true; }
// Special options.
void keepWebHistory();
@@ -88,6 +88,7 @@ public:
bool shouldDumpMainFrameScrollPosition() const { return m_whatToDump == RenderTree; }
bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; }
+ bool shouldDumpTitleChanges() const { return m_dumpTitleChanges; }
bool waitToDump() const { return m_waitToDump; }
void waitToDumpWatchdogTimerFired();
@@ -108,6 +109,7 @@ private:
bool m_dumpEditingCallbacks;
bool m_dumpStatusCallbacks;
+ bool m_dumpTitleChanges;
bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
bool m_testRepaint;
bool m_testRepaintSweepHorizontally;
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp
index c7532ce..d9f08c9 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp
@@ -25,11 +25,83 @@
#include "ActivateFonts.h"
+#include <string>
+#include <wtf/Vector.h>
+
+static LPCWSTR fontsEnvironmentVariable = L"WEBKIT_TESTFONTS";
+
namespace WTR {
+using namespace std;
+
+static const wstring& fontsPath()
+{
+ static wstring path;
+ static bool initialized;
+
+ if (initialized)
+ return path;
+ initialized = true;
+
+ DWORD size = ::GetEnvironmentVariableW(fontsEnvironmentVariable, 0, 0);
+ Vector<WCHAR> buffer(size);
+ if (!::GetEnvironmentVariableW(fontsEnvironmentVariable, buffer.data(), buffer.size()))
+ return path;
+
+ path = buffer.data();
+ if (path[path.length() - 1] != '\\')
+ path.append(L"\\");
+
+ return path;
+}
+
+
void activateFonts()
{
- // FIXME: Not implemented.
+ static LPCWSTR fontsToInstall[] = {
+ TEXT("AHEM____.ttf"),
+ TEXT("Apple Chancery.ttf"),
+ TEXT("Courier Bold.ttf"),
+ TEXT("Courier.ttf"),
+ TEXT("Helvetica Bold Oblique.ttf"),
+ TEXT("Helvetica Bold.ttf"),
+ TEXT("Helvetica Oblique.ttf"),
+ TEXT("Helvetica.ttf"),
+ TEXT("Helvetica Neue Bold Italic.ttf"),
+ TEXT("Helvetica Neue Bold.ttf"),
+ TEXT("Helvetica Neue Condensed Black.ttf"),
+ TEXT("Helvetica Neue Condensed Bold.ttf"),
+ TEXT("Helvetica Neue Italic.ttf"),
+ TEXT("Helvetica Neue Light Italic.ttf"),
+ TEXT("Helvetica Neue Light.ttf"),
+ TEXT("Helvetica Neue UltraLight Italic.ttf"),
+ TEXT("Helvetica Neue UltraLight.ttf"),
+ TEXT("Helvetica Neue.ttf"),
+ TEXT("Lucida Grande.ttf"),
+ TEXT("Lucida Grande Bold.ttf"),
+ TEXT("Monaco.ttf"),
+ TEXT("Papyrus.ttf"),
+ TEXT("Times Bold Italic.ttf"),
+ TEXT("Times Bold.ttf"),
+ TEXT("Times Italic.ttf"),
+ TEXT("Times Roman.ttf"),
+ TEXT("WebKit Layout Tests 2.ttf"),
+ TEXT("WebKit Layout Tests.ttf"),
+ TEXT("WebKitWeightWatcher100.ttf"),
+ TEXT("WebKitWeightWatcher200.ttf"),
+ TEXT("WebKitWeightWatcher300.ttf"),
+ TEXT("WebKitWeightWatcher400.ttf"),
+ TEXT("WebKitWeightWatcher500.ttf"),
+ TEXT("WebKitWeightWatcher600.ttf"),
+ TEXT("WebKitWeightWatcher700.ttf"),
+ TEXT("WebKitWeightWatcher800.ttf"),
+ TEXT("WebKitWeightWatcher900.ttf")
+ };
+
+ wstring resourcesPath = fontsPath();
+
+ for (unsigned i = 0; i < ARRAYSIZE(fontsToInstall); ++i)
+ ::AddFontResourceExW(wstring(resourcesPath + fontsToInstall[i]).c_str(), FR_PRIVATE, 0);
}
}
diff --git a/WebKitTools/WebKitTestRunner/StringFunctions.h b/WebKitTools/WebKitTestRunner/StringFunctions.h
new file mode 100644
index 0000000..4f8fe93
--- /dev/null
+++ b/WebKitTools/WebKitTestRunner/StringFunctions.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2010 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 StringFunctions_h
+#define StringFunctions_h
+
+#include <JavaScriptCore/JSRetainPtr.h>
+#include <JavaScriptCore/JavaScriptCore.h>
+#include <WebKit2/WKRetainPtr.h>
+#include <WebKit2/WKString.h>
+#include <WebKit2/WKStringCF.h>
+#include <WebKit2/WKURL.h>
+#include <WebKit2/WKURLCF.h>
+#include <sstream>
+#include <wtf/Platform.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/Vector.h>
+
+namespace WTR {
+
+// Conversion functions
+
+inline RetainPtr<CFStringRef> toCF(JSStringRef string)
+{
+ return RetainPtr<CFStringRef>(AdoptCF, JSStringCopyCFString(0, string));
+}
+
+inline RetainPtr<CFStringRef> toCF(WKStringRef string)
+{
+ return RetainPtr<CFStringRef>(AdoptCF, WKStringCopyCFString(0, string));
+}
+
+inline WKRetainPtr<WKStringRef> toWK(JSStringRef string)
+{
+ return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithCFString(toCF(string).get()));
+}
+
+inline WKRetainPtr<WKStringRef> toWK(JSRetainPtr<JSStringRef> string)
+{
+ return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithCFString(toCF(string.get()).get()));
+}
+
+inline JSRetainPtr<JSStringRef> toJS(WKStringRef string)
+{
+ return JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithCFString(toCF(string).get()));
+}
+
+inline JSRetainPtr<JSStringRef> toJS(const WKRetainPtr<WKStringRef>& string)
+{
+ return toJS(string.get());
+}
+
+// Streaming functions
+
+inline std::ostream& operator<<(std::ostream& out, CFStringRef stringRef)
+{
+ if (!stringRef)
+ return out;
+ CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(stringRef), kCFStringEncodingUTF8) + 1;
+ Vector<char> buffer(bufferLength);
+ if (!CFStringGetCString(stringRef, buffer.data(), bufferLength, kCFStringEncodingUTF8))
+ return out;
+ return out << buffer.data();
+}
+
+inline std::ostream& operator<<(std::ostream& out, const RetainPtr<CFStringRef>& stringRef)
+{
+ return out << stringRef.get();
+}
+
+inline std::ostream& operator<<(std::ostream& out, WKStringRef stringRef)
+{
+ if (!stringRef)
+ return out;
+ return out << toCF(stringRef);
+}
+
+inline std::ostream& operator<<(std::ostream& out, const WKRetainPtr<WKStringRef>& stringRef)
+{
+ return out << stringRef.get();
+}
+
+// URL creation
+
+inline WKURLRef createWKURL(const char* pathOrURL)
+{
+ RetainPtr<CFStringRef> pathOrURLCFString(AdoptCF, CFStringCreateWithCString(0, pathOrURL, kCFStringEncodingUTF8));
+ RetainPtr<CFURLRef> cfURL;
+ if (CFStringHasPrefix(pathOrURLCFString.get(), CFSTR("http://")) || CFStringHasPrefix(pathOrURLCFString.get(), CFSTR("https://")))
+ cfURL.adoptCF(CFURLCreateWithString(0, pathOrURLCFString.get(), 0));
+ else
+#if PLATFORM(WIN)
+ cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLWindowsPathStyle, false));
+#else
+ cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLPOSIXPathStyle, false));
+#endif
+ return WKURLCreateWithCFURL(cfURL.get());
+}
+
+
+} // namespace WTR
+
+#endif // StringFunctions_h
diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.cpp b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
index 658911b..9a0f0aa 100644
--- a/WebKitTools/WebKitTestRunner/TestInvocation.cpp
+++ b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
@@ -26,47 +26,18 @@
#include "TestInvocation.h"
#include "PlatformWebView.h"
+#include "StringFunctions.h"
#include "TestController.h"
#include <WebKit2/WKContextPrivate.h>
+#include <WebKit2/WKPreferencesPrivate.h>
#include <WebKit2/WKRetainPtr.h>
-#include <WebKit2/WKStringCF.h>
-#include <WebKit2/WKURLCF.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/RetainPtr.h>
-#include <wtf/Vector.h>
using namespace WebKit;
+using namespace std;
namespace WTR {
-static WKURLRef createWKURL(const char* pathOrURL)
-{
- RetainPtr<CFStringRef> pathOrURLCFString(AdoptCF, CFStringCreateWithCString(0, pathOrURL, kCFStringEncodingUTF8));
- RetainPtr<CFURLRef> cfURL;
- if (CFStringHasPrefix(pathOrURLCFString.get(), CFSTR("http://")) || CFStringHasPrefix(pathOrURLCFString.get(), CFSTR("https://")))
- cfURL.adoptCF(CFURLCreateWithString(0, pathOrURLCFString.get(), 0));
- else
-#if defined(WIN32) || defined(_WIN32)
- cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLWindowsPathStyle, false));
-#else
- cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLPOSIXPathStyle, false));
-#endif
- return WKURLCreateWithCFURL(cfURL.get());
-}
-
-static PassOwnPtr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef)
-{
- RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, wkStringRef));
- CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfString.get()), kCFStringEncodingUTF8) + 1;
- OwnPtr<Vector<char> > buffer(new Vector<char>(bufferLength));
- if (!CFStringGetCString(cfString.get(), buffer->data(), bufferLength, kCFStringEncodingUTF8)) {
- buffer->shrink(1);
- (*buffer)[0] = 0;
- } else
- buffer->shrink(strlen(buffer->data()) + 1);
- return buffer.release();
-}
-
TestInvocation::TestInvocation(const char* pathOrURL)
: m_url(AdoptWK, createWKURL(pathOrURL))
, m_pathOrURL(fastStrDup(pathOrURL))
@@ -99,8 +70,8 @@ static void sizeWebViewForCurrentTest(char* pathOrURL)
void TestInvocation::resetPreferencesToConsistentValues()
{
WKPreferencesRef preferences = WKContextGetPreferences(TestController::shared().context());
-
WKPreferencesSetOfflineWebApplicationCacheEnabled(preferences, true);
+ WKPreferencesSetFontSmoothingLevel(preferences, kWKFontSmoothingLevelNoSubpixelAntiAliasing);
}
void TestInvocation::invoke()
@@ -165,8 +136,11 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
if (CFEqual(cfMessageName.get(), CFSTR("Done"))) {
ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
- OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(static_cast<WKStringRef>(messageBody));
- dump(utf8Message->data());
+ ostringstream out;
+ out << static_cast<WKStringRef>(messageBody);
+
+ dump(out.str().c_str());
+
m_gotFinalMessage = true;
return;
}
diff --git a/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj b/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
index eccf330..6f78289 100644
--- a/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
+++ b/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
@@ -33,6 +33,8 @@
6510A78B11EC643800410867 /* WebKitWeightWatcher800.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A78011EC643800410867 /* WebKitWeightWatcher800.ttf */; };
6510A78C11EC643800410867 /* WebKitWeightWatcher900.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A78111EC643800410867 /* WebKitWeightWatcher900.ttf */; };
65EB85A011EC67CC0034D300 /* ActivateFonts.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65EB859F11EC67CC0034D300 /* ActivateFonts.mm */; };
+ BC14E4DB120E02D000826C0C /* GCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC14E4D9120E02D000826C0C /* GCController.cpp */; };
+ BC14E4EA120E03D800826C0C /* JSGCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC14E4E8120E03D800826C0C /* JSGCController.cpp */; };
BC25193E11D15D8B002EBC01 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC7934A411906584005EA8E2 /* Cocoa.framework */; };
BC25193F11D15D8B002EBC01 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC7934AB1190658C005EA8E2 /* WebKit2.framework */; };
BC25194011D15D8B002EBC01 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCDA2B991191051F00C3BC47 /* JavaScriptCore.framework */; };
@@ -43,6 +45,8 @@
BC7934AC1190658C005EA8E2 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC7934AB1190658C005EA8E2 /* WebKit2.framework */; };
BC7934E811906846005EA8E2 /* PlatformWebViewMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC7934E711906846005EA8E2 /* PlatformWebViewMac.mm */; };
BC8C795C11D2785D004535A1 /* TestControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC8C795B11D2785D004535A1 /* TestControllerMac.mm */; };
+ BC8FD8CA120E527F00F3E71A /* EventSendingController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8FD8C9120E527F00F3E71A /* EventSendingController.cpp */; };
+ BC8FD8D2120E545B00F3E71A /* JSEventSendingController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8FD8D0120E545B00F3E71A /* JSEventSendingController.cpp */; };
BC952C0D11F3B965003398B4 /* JSWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC952C0C11F3B965003398B4 /* JSWrapper.cpp */; };
BC952F1F11F3C652003398B4 /* JSLayoutTestController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC952F1D11F3C652003398B4 /* JSLayoutTestController.cpp */; };
BCC997A411D3C8F60017BCA2 /* InjectedBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC997A011D3C8F60017BCA2 /* InjectedBundle.cpp */; };
@@ -85,6 +89,11 @@
65EB859D11EC67CC0034D300 /* ActivateFonts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActivateFonts.h; sourceTree = "<group>"; };
65EB859F11EC67CC0034D300 /* ActivateFonts.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ActivateFonts.mm; sourceTree = "<group>"; };
8DD76FA10486AA7600D96B5E /* WebKitTestRunner */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = WebKitTestRunner; sourceTree = BUILT_PRODUCTS_DIR; };
+ BC14E4D8120E02D000826C0C /* GCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCController.h; sourceTree = "<group>"; };
+ BC14E4D9120E02D000826C0C /* GCController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GCController.cpp; sourceTree = "<group>"; };
+ BC14E4E1120E032000826C0C /* GCController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GCController.idl; sourceTree = "<group>"; };
+ BC14E4E8120E03D800826C0C /* JSGCController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSGCController.cpp; path = DerivedSources/WebKitTestRunner/JSGCController.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
+ BC14E4E9120E03D800826C0C /* JSGCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSGCController.h; path = DerivedSources/WebKitTestRunner/JSGCController.h; sourceTree = BUILT_PRODUCTS_DIR; };
BC25184611D15767002EBC01 /* InjectedBundleMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMain.cpp; sourceTree = "<group>"; };
BC25186211D15D54002EBC01 /* InjectedBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InjectedBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
BC25186311D15D54002EBC01 /* InjectedBundle-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "InjectedBundle-Info.plist"; sourceTree = "<group>"; };
@@ -101,6 +110,11 @@
BC7934DD119066EC005EA8E2 /* PlatformWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformWebView.h; sourceTree = "<group>"; };
BC7934E711906846005EA8E2 /* PlatformWebViewMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformWebViewMac.mm; sourceTree = "<group>"; };
BC8C795B11D2785D004535A1 /* TestControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestControllerMac.mm; sourceTree = "<group>"; };
+ BC8FD8C8120E527F00F3E71A /* EventSendingController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventSendingController.h; sourceTree = "<group>"; };
+ BC8FD8C9120E527F00F3E71A /* EventSendingController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventSendingController.cpp; sourceTree = "<group>"; };
+ BC8FD8CB120E52B000F3E71A /* EventSendingController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventSendingController.idl; sourceTree = "<group>"; };
+ BC8FD8D0120E545B00F3E71A /* JSEventSendingController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSEventSendingController.cpp; path = DerivedSources/WebKitTestRunner/JSEventSendingController.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
+ BC8FD8D1120E545B00F3E71A /* JSEventSendingController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSEventSendingController.h; path = DerivedSources/WebKitTestRunner/JSEventSendingController.h; sourceTree = BUILT_PRODUCTS_DIR; };
BC952C0B11F3B965003398B4 /* JSWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWrapper.h; sourceTree = "<group>"; };
BC952C0C11F3B965003398B4 /* JSWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWrapper.cpp; sourceTree = "<group>"; };
BC952C0E11F3B97B003398B4 /* JSWrappable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWrappable.h; sourceTree = "<group>"; };
@@ -109,6 +123,7 @@
BC952ED311F3C318003398B4 /* CodeGeneratorTestRunner.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = CodeGeneratorTestRunner.pm; sourceTree = "<group>"; };
BC952F1D11F3C652003398B4 /* JSLayoutTestController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSLayoutTestController.cpp; path = DerivedSources/WebKitTestRunner/JSLayoutTestController.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
BC952F1E11F3C652003398B4 /* JSLayoutTestController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSLayoutTestController.h; path = DerivedSources/WebKitTestRunner/JSLayoutTestController.h; sourceTree = BUILT_PRODUCTS_DIR; };
+ BC99A4841208901A007E9F08 /* StringFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringFunctions.h; sourceTree = "<group>"; };
BCC997A011D3C8F60017BCA2 /* InjectedBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundle.cpp; sourceTree = "<group>"; };
BCC997A111D3C8F60017BCA2 /* InjectedBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundle.h; sourceTree = "<group>"; };
BCC997A211D3C8F60017BCA2 /* InjectedBundlePage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePage.cpp; sourceTree = "<group>"; };
@@ -149,7 +164,8 @@
isa = PBXGroup;
children = (
BC952EC511F3C10F003398B4 /* DerivedSources.make */,
- 08FB7795FE84155DC02AAC07 /* Source */,
+ BC99CBF11207642D00FDEE76 /* Shared */,
+ 08FB7795FE84155DC02AAC07 /* TestRunner */,
BC25183511D1571D002EBC01 /* InjectedBundle */,
BC793401118F7C8A005EA8E2 /* Configurations */,
08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */,
@@ -159,7 +175,7 @@
name = WebKitTestRunner;
sourceTree = "<group>";
};
- 08FB7795FE84155DC02AAC07 /* Source */ = {
+ 08FB7795FE84155DC02AAC07 /* TestRunner */ = {
isa = PBXGroup;
children = (
BC7933FE118F7C74005EA8E2 /* mac */,
@@ -170,7 +186,7 @@
BCD7D2F611921278006DB7EE /* TestInvocation.h */,
BCD7D2F711921278006DB7EE /* TestInvocation.cpp */,
);
- name = Source;
+ name = TestRunner;
sourceTree = "<group>";
};
08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = {
@@ -200,11 +216,25 @@
path = mac;
sourceTree = "<group>";
};
+ BC14E4E0120E02F900826C0C /* Controllers */ = {
+ isa = PBXGroup;
+ children = (
+ BC8FD8C9120E527F00F3E71A /* EventSendingController.cpp */,
+ BC8FD8C8120E527F00F3E71A /* EventSendingController.h */,
+ BC14E4D9120E02D000826C0C /* GCController.cpp */,
+ BC14E4D8120E02D000826C0C /* GCController.h */,
+ BCC9981711D3F51E0017BCA2 /* LayoutTestController.cpp */,
+ BCC9981611D3F51E0017BCA2 /* LayoutTestController.h */,
+ );
+ name = Controllers;
+ sourceTree = "<group>";
+ };
BC25183511D1571D002EBC01 /* InjectedBundle */ = {
isa = PBXGroup;
children = (
BC952D3A11F3BF1F003398B4 /* Derived Sources */,
BC952C0A11F3B939003398B4 /* Bindings */,
+ BC14E4E0120E02F900826C0C /* Controllers */,
65EB859E11EC67CC0034D300 /* mac */,
65EB859D11EC67CC0034D300 /* ActivateFonts.h */,
BCC997A011D3C8F60017BCA2 /* InjectedBundle.cpp */,
@@ -212,8 +242,6 @@
BC25184611D15767002EBC01 /* InjectedBundleMain.cpp */,
BCC997A211D3C8F60017BCA2 /* InjectedBundlePage.cpp */,
BCC997A311D3C8F60017BCA2 /* InjectedBundlePage.h */,
- BCC9981711D3F51E0017BCA2 /* LayoutTestController.cpp */,
- BCC9981611D3F51E0017BCA2 /* LayoutTestController.h */,
);
path = InjectedBundle;
sourceTree = "<group>";
@@ -266,6 +294,8 @@
BC952C0E11F3B97B003398B4 /* JSWrappable.h */,
BC952C0C11F3B965003398B4 /* JSWrapper.cpp */,
BC952C0B11F3B965003398B4 /* JSWrapper.h */,
+ BC8FD8CB120E52B000F3E71A /* EventSendingController.idl */,
+ BC14E4E1120E032000826C0C /* GCController.idl */,
BC952ED211F3C29F003398B4 /* LayoutTestController.idl */,
);
path = Bindings;
@@ -274,12 +304,24 @@
BC952D3A11F3BF1F003398B4 /* Derived Sources */ = {
isa = PBXGroup;
children = (
+ BC8FD8D0120E545B00F3E71A /* JSEventSendingController.cpp */,
+ BC8FD8D1120E545B00F3E71A /* JSEventSendingController.h */,
+ BC14E4E8120E03D800826C0C /* JSGCController.cpp */,
+ BC14E4E9120E03D800826C0C /* JSGCController.h */,
BC952F1D11F3C652003398B4 /* JSLayoutTestController.cpp */,
BC952F1E11F3C652003398B4 /* JSLayoutTestController.h */,
);
name = "Derived Sources";
sourceTree = "<group>";
};
+ BC99CBF11207642D00FDEE76 /* Shared */ = {
+ isa = PBXGroup;
+ children = (
+ BC99A4841208901A007E9F08 /* StringFunctions.h */,
+ );
+ name = Shared;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -401,6 +443,10 @@
65EB85A011EC67CC0034D300 /* ActivateFonts.mm in Sources */,
BC952C0D11F3B965003398B4 /* JSWrapper.cpp in Sources */,
BC952F1F11F3C652003398B4 /* JSLayoutTestController.cpp in Sources */,
+ BC14E4DB120E02D000826C0C /* GCController.cpp in Sources */,
+ BC14E4EA120E03D800826C0C /* JSGCController.cpp in Sources */,
+ BC8FD8CA120E527F00F3E71A /* EventSendingController.cpp in Sources */,
+ BC8FD8D2120E545B00F3E71A /* JSEventSendingController.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKitTools/WebKitTestRunner/win/InjectedBundle.vcproj b/WebKitTools/WebKitTestRunner/win/InjectedBundle.vcproj
index d283083..71dcf95 100644
--- a/WebKitTools/WebKitTestRunner/win/InjectedBundle.vcproj
+++ b/WebKitTools/WebKitTestRunner/win/InjectedBundle.vcproj
@@ -288,6 +288,22 @@
Name="Derived Sources"
>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEventSendingController.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEventSendingController.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSGCController.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSGCController.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSLayoutTestController.cpp"
>
</File>
@@ -321,6 +337,22 @@
>
</File>
<File
+ RelativePath="..\InjectedBundle\EventSendingController.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\InjectedBundle\EventSendingController.h"
+ >
+ </File>
+ <File
+ RelativePath="..\InjectedBundle\GCController.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\InjectedBundle\GCController.h"
+ >
+ </File>
+ <File
RelativePath="..\InjectedBundle\LayoutTestController.cpp"
>
</File>
diff --git a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
index 9bec373..f650d7f 100644
--- a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
+++ b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
@@ -27,14 +27,67 @@
#include <fcntl.h>
#include <io.h>
+#include <shlwapi.h>
+#include <string>
#include <WebKit2/WKStringCF.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/Vector.h>
+
+using namespace std;
namespace WTR {
+#if !defined(NDEBUG) && (!defined(DEBUG_INTERNAL) || defined(DEBUG_ALL))
+const LPWSTR testPluginDirectoryName = L"TestNetscapePlugin_Debug";
+#else
+const LPWSTR testPluginDirectoryName = L"TestNetscapePlugin";
+#endif
+
+static void addQTDirToPATH()
+{
+ static LPCWSTR pathEnvironmentVariable = L"PATH";
+ static LPCWSTR quickTimeKeyName = L"Software\\Apple Computer, Inc.\\QuickTime";
+ static LPCWSTR quickTimeSysDir = L"QTSysDir";
+ static bool initialized;
+
+ if (initialized)
+ return;
+ initialized = true;
+
+ // Get the QuickTime dll directory from the registry. The key can be in either HKLM or HKCU.
+ WCHAR qtPath[MAX_PATH];
+ DWORD qtPathBufferLen = sizeof(qtPath);
+ DWORD keyType;
+ HRESULT result = ::SHGetValueW(HKEY_LOCAL_MACHINE, quickTimeKeyName, quickTimeSysDir, &keyType, (LPVOID)qtPath, &qtPathBufferLen);
+ if (result != ERROR_SUCCESS || !qtPathBufferLen || keyType != REG_SZ) {
+ qtPathBufferLen = sizeof(qtPath);
+ result = ::SHGetValueW(HKEY_CURRENT_USER, quickTimeKeyName, quickTimeSysDir, &keyType, (LPVOID)qtPath, &qtPathBufferLen);
+ if (result != ERROR_SUCCESS || !qtPathBufferLen || keyType != REG_SZ)
+ return;
+ }
+
+ // Read the current PATH.
+ DWORD pathSize = ::GetEnvironmentVariableW(pathEnvironmentVariable, 0, 0);
+ Vector<WCHAR> oldPath(pathSize);
+ if (!::GetEnvironmentVariableW(pathEnvironmentVariable, oldPath.data(), oldPath.size()))
+ return;
+
+ // And add the QuickTime dll.
+ wstring newPath;
+ newPath.append(qtPath);
+ newPath.append(L";");
+ newPath.append(oldPath.data(), oldPath.size());
+ ::SetEnvironmentVariableW(pathEnvironmentVariable, newPath.data());
+}
+
void TestController::platformInitialize()
{
_setmode(1, _O_BINARY);
_setmode(2, _O_BINARY);
+
+ // Add the QuickTime dll directory to PATH or QT 7.6 will fail to initialize on systems
+ // linked with older versions of qtmlclientlib.dll.
+ addQTDirToPATH();
}
void TestController::initializeInjectedBundlePath()
@@ -52,9 +105,12 @@ void TestController::initializeInjectedBundlePath()
void TestController::initializeTestPluginDirectory()
{
- CFStringRef exeContainerPath = CFURLCopyFileSystemPath(CFURLCreateCopyDeletingLastPathComponent(0, CFBundleCopyExecutableURL(CFBundleGetMainBundle())), kCFURLWindowsPathStyle);
- CFMutableStringRef bundlePath = CFStringCreateMutableCopy(0, 0, exeContainerPath);
- m_testPluginDirectory.adopt(WKStringCreateWithCFString(bundlePath));
+ RetainPtr<CFURLRef> bundleURL(AdoptCF, CFBundleCopyExecutableURL(CFBundleGetMainBundle()));
+ RetainPtr<CFURLRef> bundleDirectoryURL(AdoptCF, CFURLCreateCopyDeletingLastPathComponent(0, bundleURL.get()));
+ RetainPtr<CFStringRef> testPluginDirectoryNameString(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(testPluginDirectoryName), wcslen(testPluginDirectoryName)));
+ RetainPtr<CFURLRef> testPluginDirectoryURL(AdoptCF, CFURLCreateCopyAppendingPathComponent(0, bundleDirectoryURL.get(), testPluginDirectoryNameString.get(), true));
+ RetainPtr<CFStringRef> testPluginDirectoryPath(AdoptCF, CFURLCopyFileSystemPath(testPluginDirectoryURL.get(), kCFURLWindowsPathStyle));
+ m_testPluginDirectory.adopt(WKStringCreateWithCFString(testPluginDirectoryPath.get()));
}
} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.vcproj b/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.vcproj
index 4802c3a..7375bd4 100644
--- a/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.vcproj
+++ b/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.vcproj
@@ -56,7 +56,7 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/NXCOMPAT"
- AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib"
+ AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib shlwapi.lib"
SubSystem="1"
TargetMachine="1"
/>
@@ -128,7 +128,7 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/NXCOMPAT"
- AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib"
+ AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib shlwapi.lib"
SubSystem="1"
TargetMachine="1"
/>
@@ -199,7 +199,7 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/NXCOMPAT"
- AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib"
+ AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib shlwapi.lib"
SubSystem="1"
/>
<Tool
@@ -269,7 +269,7 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/NXCOMPAT"
- AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib"
+ AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib shlwapi.lib"
SubSystem="1"
/>
<Tool