diff options
Diffstat (limited to 'WebKitTools/WebKitTestRunner')
49 files changed, 926 insertions, 182 deletions
diff --git a/WebKitTools/WebKitTestRunner/Configurations/Base.xcconfig b/WebKitTools/WebKitTestRunner/Configurations/Base.xcconfig index 7ceab07..feabe9a 100644 --- a/WebKitTools/WebKitTestRunner/Configurations/Base.xcconfig +++ b/WebKitTools/WebKitTestRunner/Configurations/Base.xcconfig @@ -21,7 +21,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -HEADER_SEARCH_PATHS = ForwardingHeaders; +HEADER_SEARCH_PATHS = $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders; FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks; GCC_PREPROCESSOR_DEFINITIONS = ENABLE_DASHBOARD_SUPPORT WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST; DEBUG_INFORMATION_FORMAT = dwarf diff --git a/WebKitTools/WebKitTestRunner/DerivedSources.pro b/WebKitTools/WebKitTestRunner/DerivedSources.pro new file mode 100644 index 0000000..bab70cc --- /dev/null +++ b/WebKitTools/WebKitTestRunner/DerivedSources.pro @@ -0,0 +1,57 @@ +# DerivedSources - qmake build info + +CONFIG -= debug_and_release + +TEMPLATE = lib +TARGET = dummy + +QMAKE_EXTRA_TARGETS += generated_files + +GENERATED_SOURCES_DIR = generated + +IDL_BINDINGS += \ + InjectedBundle/Bindings/EventSendingController.idl \ + InjectedBundle/Bindings/GCController.idl \ + InjectedBundle/Bindings/LayoutTestController.idl \ + +defineTest(addExtraCompiler) { + eval($${1}.CONFIG = target_predeps no_link) + eval($${1}.variable_out =) + eval($${1}.dependency_type = TYPE_C) + + wkScript = $$eval($${1}.wkScript) + eval($${1}.depends += $$wkScript) + + export($${1}.CONFIG) + export($${1}.variable_out) + export($${1}.dependency_type) + export($${1}.depends) + + QMAKE_EXTRA_COMPILERS += $$1 + generated_files.depends += compiler_$${1}_make_all + export(QMAKE_EXTRA_COMPILERS) + export(generated_files.depends) + return(true) +} + +SRC_ROOT_DIR = $$replace(PWD, /WebKitTools/WebKitTestRunner, /) + +# Make sure forwarded headers needed by this project are present +fwheader_generator.commands = perl $${SRC_ROOT_DIR}/WebKitTools/Scripts/generate-forwarding-headers.pl $${SRC_ROOT_DIR}/WebKitTools/WebKitTestRunner $${OUTPUT_DIR}/include qt +fwheader_generator.depends = $${SRC_ROOT_DIR}/WebKitTools/Scripts/generate-forwarding-headers.pl +generated_files.depends += fwheader_generator +QMAKE_EXTRA_TARGETS += fwheader_generator + +# GENERATOR 1: IDL compiler +idl.output = $${GENERATED_SOURCES_DIR}/JS${QMAKE_FILE_BASE}.cpp +idl.input = IDL_BINDINGS +idl.wkScript = $$PWD/../../WebCore/bindings/scripts/generate-bindings.pl +idl.commands = perl -I$$PWD/../../WebCore/bindings/scripts -I$$PWD/InjectedBundle/Bindings $$idl.wkScript --defines \"\" --generator TestRunner --include $$PWD/InjectedBundle/Bindings --outputDir $$GENERATED_SOURCES_DIR --preprocessor \"$${QMAKE_MOC} -E\" ${QMAKE_FILE_NAME} +idl.depends = $$PWD/../../WebCore/bindings/scripts/CodeGenerator.pm \ + $$PWD/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm \ + $$PWD/../../WebCore/bindings/scripts/IDLParser.pm \ + $$PWD/../../WebCore/bindings/scripts/IDLStructure.pm \ + $$PWD/../../WebCore/bindings/scripts/InFilesParser.pm \ + $$PWD/../../WebCore/bindings/scripts/generate-bindings.pl +addExtraCompiler(idl) + diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ASCIICType.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ASCIICType.h deleted file mode 100644 index f2258d2..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ASCIICType.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/ASCIICType.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Assertions.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Assertions.h deleted file mode 100644 index 2144410..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Assertions.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/Assertions.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Atomics.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Atomics.h deleted file mode 100644 index 37b1892..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Atomics.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/Atomics.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/FastMalloc.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/FastMalloc.h deleted file mode 100644 index 1701231..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/FastMalloc.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/FastMalloc.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/GetPtr.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/GetPtr.h deleted file mode 100644 index aedd784..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/GetPtr.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/GetPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashMap.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashMap.h deleted file mode 100644 index 9f262e2..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashMap.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/HashMap.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashSet.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashSet.h deleted file mode 100644 index cfe2d80..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashSet.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/HashSet.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashTraits.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashTraits.h deleted file mode 100644 index 412fa98..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashTraits.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/HashTraits.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Locker.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Locker.h deleted file mode 100644 index 75b0acd..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Locker.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/Locker.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/MainThread.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/MainThread.h deleted file mode 100644 index ff75971..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/MainThread.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/MainThread.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/MathExtras.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/MathExtras.h deleted file mode 100644 index 2955786..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/MathExtras.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/MathExtras.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Noncopyable.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Noncopyable.h deleted file mode 100644 index f8484d2..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Noncopyable.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/Noncopyable.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/OwnPtr.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/OwnPtr.h deleted file mode 100644 index 9211d38..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/OwnPtr.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/OwnPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/OwnPtrCommon.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/OwnPtrCommon.h deleted file mode 100644 index 6064e88..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/OwnPtrCommon.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/PassOwnPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/PassOwnPtr.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/PassOwnPtr.h deleted file mode 100644 index 6064e88..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/PassOwnPtr.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/PassOwnPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/PassRefPtr.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/PassRefPtr.h deleted file mode 100644 index aafd1a2..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/PassRefPtr.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/PassRefPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Platform.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Platform.h deleted file mode 100644 index 3b22955..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Platform.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/Platform.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RefCounted.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RefCounted.h deleted file mode 100644 index 628a63b..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RefCounted.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/RefCounted.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RefPtr.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RefPtr.h deleted file mode 100644 index 0ff6213..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RefPtr.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/RefPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RetainPtr.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RetainPtr.h deleted file mode 100644 index 65fc27b..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RetainPtr.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/RetainPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/StringExtras.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/StringExtras.h deleted file mode 100644 index 063d500..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/StringExtras.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/StringExtras.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ThreadSafeShared.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ThreadSafeShared.h deleted file mode 100644 index 4a7a77f..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ThreadSafeShared.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/ThreadSafeShared.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Threading.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Threading.h deleted file mode 100644 index 17359e5..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Threading.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/Threading.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ThreadingPrimitives.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ThreadingPrimitives.h deleted file mode 100644 index a7ee117..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ThreadingPrimitives.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/ThreadingPrimitives.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Vector.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Vector.h deleted file mode 100644 index c6d15fd..0000000 --- a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Vector.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/Vector.h> diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrappable.h b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrappable.h index 9cb97af..5ec7197 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrappable.h +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrappable.h @@ -26,7 +26,7 @@ #ifndef JSWrappable_h #define JSWrappable_h -#include <JavaScriptCore/JavaScriptCore.h> +#include <JavaScriptCore/JavaScript.h> #include <wtf/RefCounted.h> namespace WTR { diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp index ecc302f..af8bb69 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp @@ -32,10 +32,8 @@ #include <WebKit2/WKBundlePagePrivate.h> #include <WebKit2/WKBundlePrivate.h> #include <WebKit2/WKRetainPtr.h> -#include <WebKit2/WKStringCF.h> #include <WebKit2/WebKit2.h> #include <wtf/PassOwnPtr.h> -#include <wtf/RetainPtr.h> #include <wtf/Vector.h> namespace WTR { @@ -105,18 +103,19 @@ void InjectedBundle::willDestroyPage(WKBundlePageRef page) void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody) { - CFStringRef cfMessage = WKStringCopyCFString(0, messageName); - if (CFEqual(cfMessage, CFSTR("BeginTest"))) { - WKRetainPtr<WKStringRef> ackMessageName(AdoptWK, WKStringCreateWithCFString(CFSTR("Ack"))); - WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest"))); + if (WKStringIsEqualToUTF8CString(messageName, "BeginTest")) { + ASSERT(!messageBody); + + WKRetainPtr<WKStringRef> ackMessageName(AdoptWK, WKStringCreateWithUTF8CString("Ack")); + WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithUTF8CString("BeginTest")); WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get()); beginTesting(); return; } - WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithCFString(CFSTR("Error"))); - WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithCFString(CFSTR("Unknown"))); + WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error")); + WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithUTF8CString("Unknown")); WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get()); } @@ -140,13 +139,12 @@ void InjectedBundle::beginTesting() void InjectedBundle::done() { - m_mainPage->stopLoading(); + m_state = Stopping; - WKRetainPtr<WKStringRef> doneMessageName(AdoptWK, WKStringCreateWithCFString(CFSTR("Done"))); + m_mainPage->stopLoading(); - std::string output = m_outputStream.str(); - RetainPtr<CFStringRef> outputCFString(AdoptCF, CFStringCreateWithCString(0, output.c_str(), kCFStringEncodingUTF8)); - WKRetainPtr<WKStringRef> doneMessageBody(AdoptWK, WKStringCreateWithCFString(outputCFString.get())); + WKRetainPtr<WKStringRef> doneMessageName(AdoptWK, WKStringCreateWithUTF8CString("Done")); + WKRetainPtr<WKStringRef> doneMessageBody(AdoptWK, WKStringCreateWithUTF8CString(m_outputStream.str().c_str())); WKBundlePostMessage(m_bundle, doneMessageName.get(), doneMessageBody.get()); diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h index 520ea1f..6c5c69e 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h @@ -88,7 +88,8 @@ private: enum State { Idle, - Testing + Testing, + Stopping }; State m_state; }; diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp index 32b92cb..22af6ff 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp @@ -27,6 +27,7 @@ #include "InjectedBundle.h" #include "StringFunctions.h" +#include <cmath> #include <JavaScriptCore/JSRetainPtr.h> #include <WebKit2/WKArray.h> #include <WebKit2/WKBundleFrame.h> @@ -240,9 +241,9 @@ void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBu static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReceiveServerRedirectForProvisionalLoadForFrame(frame); } -void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void *clientInfo) +void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef error, WKTypeRef*, const void *clientInfo) { - static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFailProvisionalLoadWithErrorForFrame(frame); + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFailProvisionalLoadWithErrorForFrame(frame, error); } void InjectedBundlePage::didCommitLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void *clientInfo) @@ -260,9 +261,9 @@ void InjectedBundlePage::didFinishDocumentLoadForFrame(WKBundlePageRef page, WKB static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFinishDocumentLoadForFrame(frame); } -void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void *clientInfo) +void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef error, WKTypeRef*, const void *clientInfo) { - static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFailLoadWithErrorForFrame(frame); + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFailLoadWithErrorForFrame(frame, error); } void InjectedBundlePage::didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, WKTypeRef*, const void *clientInfo) @@ -319,7 +320,7 @@ void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBu { } -void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame) +void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef error) { } @@ -433,7 +434,7 @@ void InjectedBundlePage::didFinishLoadForFrame(WKBundleFrameRef frame) dump(); } -void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame) +void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef) { if (!InjectedBundle::shared().isTestRunning()) return; diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h index c814c85..737ad18 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h @@ -49,11 +49,11 @@ private: // Loader Client static void didStartProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); static void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); - static void didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); + static void didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef, WKBundleFrameRef, WKErrorRef, WKTypeRef*, const void*); static void didCommitLoadForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); static void didFinishLoadForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); static void didFinishDocumentLoadForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); - static void didFailLoadWithErrorForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); + static void didFailLoadWithErrorForFrame(WKBundlePageRef, WKBundleFrameRef, WKErrorRef, WKTypeRef*, const void*); static void didReceiveTitleForFrame(WKBundlePageRef, WKStringRef title, WKBundleFrameRef, WKTypeRef*, const void*); static void didClearWindowForFrame(WKBundlePageRef, WKBundleFrameRef, WKBundleScriptWorldRef, const void*); static void didCancelClientRedirectForFrame(WKBundlePageRef, WKBundleFrameRef, const void*); @@ -64,10 +64,10 @@ private: static void didRunInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, const void*); void didStartProvisionalLoadForFrame(WKBundleFrameRef); void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef); - void didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef); + void didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef, WKErrorRef); void didCommitLoadForFrame(WKBundleFrameRef); void didFinishLoadForFrame(WKBundleFrameRef); - void didFailLoadWithErrorForFrame(WKBundleFrameRef); + void didFailLoadWithErrorForFrame(WKBundleFrameRef, WKErrorRef); void didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef); void didClearWindowForFrame(WKBundleFrameRef, WKBundleScriptWorldRef); void didCancelClientRedirectForFrame(WKBundleFrameRef); diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h index 6ae20d8..c892ba0 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h @@ -28,9 +28,18 @@ #include "JSWrappable.h" #include <JavaScriptCore/JSRetainPtr.h> +#include <string> #include <wtf/PassRefPtr.h> + +#if PLATFORM(MAC) #include <wtf/RetainPtr.h> -#include <string> +typedef RetainPtr<CFRunLoopTimerRef> PlatformTimerRef; +#elif PLATFORM(WIN) +typedef UINT_PTR PlatformTimerRef; +#elif PLATFORM(QT) +#include <QTimer> +typedef QTimer PlatformTimerRef; +#endif namespace WTR { @@ -124,11 +133,7 @@ private: bool m_testRepaint; bool m_testRepaintSweepHorizontally; -#if PLATFORM(MAC) - RetainPtr<CFRunLoopTimerRef> m_waitToDumpWatchdogTimer; -#elif PLATFORM(WIN) - UINT_PTR m_waitToDumpWatchdogTimer; -#endif + PlatformTimerRef m_waitToDumpWatchdogTimer; }; } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp new file mode 100644 index 0000000..ec920dc --- /dev/null +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "ActivateFonts.h" + +#include <QByteArray> +#include <QDir> + +#ifdef Q_WS_X11 +#include <fontconfig/fontconfig.h> +#endif + +#include <limits.h> + +namespace WTR { + +void activateFonts() +{ +#if defined(Q_WS_X11) + static int numFonts = -1; + + // Some test cases may add or remove application fonts (via @font-face). + // Make sure to re-initialize the font set if necessary. + FcFontSet* appFontSet = FcConfigGetFonts(0, FcSetApplication); + if (appFontSet && numFonts >= 0 && appFontSet->nfont == numFonts) + return; + + QByteArray fontDir = getenv("WEBKIT_TESTFONTS"); + if (fontDir.isEmpty() || !QDir(fontDir).exists()) { + fprintf(stderr, + "\n\n" + "----------------------------------------------------------------------\n" + "WEBKIT_TESTFONTS environment variable is not set correctly.\n" + "This variable has to point to the directory containing the fonts\n" + "you can clone from git://gitorious.org/qtwebkit/testfonts.git\n" + "----------------------------------------------------------------------\n" + ); + exit(1); + } + char currentPath[PATH_MAX+1]; + if (!getcwd(currentPath, PATH_MAX)) + qFatal("Couldn't get current working directory"); + QByteArray configFile = currentPath; + FcConfig* config = FcConfigCreate(); + configFile += "/WebKitTools/DumpRenderTree/qt/fonts.conf"; + if (!FcConfigParseAndLoad (config, (FcChar8*) configFile.data(), true)) + qFatal("Couldn't load font configuration file"); + if (!FcConfigAppFontAddDir (config, (FcChar8*) fontDir.data())) + qFatal("Couldn't add font dir!"); + FcConfigSetCurrent(config); + + appFontSet = FcConfigGetFonts(config, FcSetApplication); + numFonts = appFontSet->nfont; +#endif +} + +} diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro b/WebKitTools/WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro new file mode 100644 index 0000000..d596f33 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro @@ -0,0 +1,69 @@ +TEMPLATE = lib + +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. + +SOURCES += \ + ../InjectedBundle.cpp \ + ../InjectedBundle.h \ + ../InjectedBundleMain.cpp \ + ../InjectedBundlePage.cpp \ + ../InjectedBundlePage.h \ + ../EventSendingController.cpp \ + ../EventSendingController.h \ + ../GCController.cpp \ + ../GCController.h \ + ../LayoutTestController.cpp \ + ../LayoutTestController.h \ + ../Bindings/JSWrapper.cpp \ + ActivateFontsQt.cpp \ + LayoutTestControllerQt.cpp \ + $$OUTPUT_DIR/WebKitTools/WebKitTestRunner/generated/JSEventSendingController.cpp \ + $$OUTPUT_DIR/WebKitTools/WebKitTestRunner/generated/JSGCController.cpp \ + $$OUTPUT_DIR/WebKitTools/WebKitTestRunner/generated/JSLayoutTestController.cpp \ + +HEADERS += \ + ../ActivateFonts.h \ + ../EventSendingController.h \ + ../GCController.h \ + ../InjectedBundle.h \ + ../InjectedBundlePage.h \ + ../LayoutTestController.h \ + +!CONFIG(release, debug|release) { + OBJECTS_DIR = obj/debug +} else { # Release + OBJECTS_DIR = obj/release +} + +include(../../../../WebKit.pri) +include(../../../../JavaScriptCore/JavaScriptCore.pri) +addJavaScriptCoreLib(../../../../JavaScriptCore) +include(../../../../WebKit2/WebKit2.pri) +addWebKit2Lib(../../../../WebKit2) + +INCLUDEPATH += \ + $$PWD \ + $$PWD/.. \ + $$PWD/../.. \ + $$PWD/../Bindings \ + $$PWD/../../../../JavaScriptCore \ + $$PWD/../../../../JavaScriptCore/wtf \ + $$PWD/../../../../WebKit2 \ + $$PWD/../../../../WebKit2/Shared \ + $$OUTPUT_DIR/WebKitTools/WebKitTestRunner/generated + +INCLUDEPATH += \ + $$OUTPUT_DIR/include \ + $$OUTPUT_DIR/WebCore/generated + +PREFIX_HEADER = $$PWD/../../WebKitTestRunnerPrefix.h +QMAKE_CXXFLAGS += "-include $$PREFIX_HEADER" + +unix:!mac { + CONFIG += link_pkgconfig + PKGCONFIG += fontconfig +} + +TARGET = WTRInjectedBundle +DESTDIR = $$OUTPUT_DIR/lib +!CONFIG(standalone_package): CONFIG -= app_bundle diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp new file mode 100644 index 0000000..b515326 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 University of Szeged. 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 "LayoutTestController.h" + +#include "InjectedBundle.h" +#include <QObject> + +namespace WTR { + +class WatchdogTimerHelper : public QObject { + Q_OBJECT + +public: + static WatchdogTimerHelper* instance() + { + static WatchdogTimerHelper* theInstance = new WatchdogTimerHelper; + return theInstance; + } + +public slots: + void timerFired() + { + InjectedBundle::shared().layoutTestController()->waitToDumpWatchdogTimerFired(); + } + +private: + WatchdogTimerHelper() {} +}; + +void LayoutTestController::platformInitialize() +{ + QObject::connect(&m_waitToDumpWatchdogTimer, SIGNAL(timeout()), WatchdogTimerHelper::instance(), SLOT(timerFired())); +} + +void LayoutTestController::invalidateWaitToDumpWatchdogTimer() +{ + m_waitToDumpWatchdogTimer.stop(); +} + +void LayoutTestController::initializeWaitToDumpWatchdogTimerIfNeeded() +{ + if (m_waitToDumpWatchdogTimer.isActive()) + return; + + m_waitToDumpWatchdogTimer.start(waitToDumpWatchdogTimerInterval * 1000); +} + +} // namespace WTR + +#include "LayoutTestControllerQt.moc" diff --git a/WebKitTools/WebKitTestRunner/PlatformWebView.h b/WebKitTools/WebKitTestRunner/PlatformWebView.h index 29c63ae..72de868 100644 --- a/WebKitTools/WebKitTestRunner/PlatformWebView.h +++ b/WebKitTools/WebKitTestRunner/PlatformWebView.h @@ -26,7 +26,14 @@ #ifndef PlatformWebView_h #define PlatformWebView_h -#if __APPLE__ +#if defined(BUILDING_QT__) +namespace WTR { +class WebView; +} +typedef WTR::WebView* PlatformWKView; +class QMainWindow; +typedef QMainWindow* PlatformWindow; +#elif defined(__APPLE__) && __APPLE__ #if __OBJC__ @class WKView; @class NSWindow; @@ -53,6 +60,9 @@ public: void resizeTo(unsigned width, unsigned height); void focus(); + WKRect windowFrame(); + void setWindowFrame(WKRect); + private: PlatformWKView m_view; PlatformWindow m_window; diff --git a/WebKitTools/WebKitTestRunner/StringFunctions.h b/WebKitTools/WebKitTestRunner/StringFunctions.h index 8195606..2d0ca72 100644 --- a/WebKitTools/WebKitTestRunner/StringFunctions.h +++ b/WebKitTools/WebKitTestRunner/StringFunctions.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 University of Szeged. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,54 +28,35 @@ #define StringFunctions_h #include <JavaScriptCore/JSRetainPtr.h> -#include <JavaScriptCore/JavaScriptCore.h> +#include <JavaScriptCore/JavaScript.h> +#include <sstream> +#include <string> #include <WebKit2/WKRetainPtr.h> #include <WebKit2/WKString.h> -#include <WebKit2/WKStringCF.h> +#include <WebKit2/WKStringPrivate.h> #include <WebKit2/WKURL.h> -#include <WebKit2/WKURLCF.h> -#include <sstream> +#include <wtf/OwnArrayPtr.h> +#include <wtf/PassOwnArrayPtr.h> #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 RetainPtr<CFURLRef> toCF(WKURLRef url) -{ - return RetainPtr<CFURLRef>(AdoptCF, WKURLCopyCFURL(0, url)); -} - -inline RetainPtr<CFURLRef> toCF(const WKRetainPtr<WKURLRef>& url) -{ - return toCF(url.get()); -} - inline WKRetainPtr<WKStringRef> toWK(JSStringRef string) { - return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithCFString(toCF(string).get())); + return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithJSString(string)); } inline WKRetainPtr<WKStringRef> toWK(JSRetainPtr<JSStringRef> string) { - return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithCFString(toCF(string.get()).get())); + return toWK(string.get()); } inline JSRetainPtr<JSStringRef> toJS(WKStringRef string) { - return JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithCFString(toCF(string).get())); + return JSRetainPtr<JSStringRef>(Adopt, WKStringCopyJSString(string)); } inline JSRetainPtr<JSStringRef> toJS(const WKRetainPtr<WKStringRef>& string) @@ -82,29 +64,27 @@ inline JSRetainPtr<JSStringRef> toJS(const WKRetainPtr<WKStringRef>& string) return toJS(string.get()); } -// Streaming functions - -inline std::ostream& operator<<(std::ostream& out, CFStringRef stringRef) +inline std::string toSTD(WKStringRef string) { - 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(); + size_t bufferSize = WKStringGetMaximumUTF8CStringSize(string); + OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]); + size_t stringLength = WKStringGetUTF8CString(string, buffer.get(), bufferSize); + return std::string(buffer.get(), stringLength - 1); } -inline std::ostream& operator<<(std::ostream& out, const RetainPtr<CFStringRef>& stringRef) +inline std::string toSTD(const WKRetainPtr<WKStringRef>& string) { - return out << stringRef.get(); + return toSTD(string.get()); } +// Streaming functions + inline std::ostream& operator<<(std::ostream& out, WKStringRef stringRef) { if (!stringRef) return out; - return out << toCF(stringRef); + + return out << toSTD(stringRef); } inline std::ostream& operator<<(std::ostream& out, const WKRetainPtr<WKStringRef>& stringRef) @@ -112,24 +92,6 @@ inline std::ostream& operator<<(std::ostream& out, const WKRetainPtr<WKStringRef 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/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp index fc2e28d..aff8798 100644 --- a/WebKitTools/WebKitTestRunner/TestController.cpp +++ b/WebKitTools/WebKitTestRunner/TestController.cpp @@ -28,12 +28,19 @@ #include "PlatformWebView.h" #include "StringFunctions.h" #include "TestInvocation.h" +#include <cstdio> #include <WebKit2/WKContextPrivate.h> #include <WebKit2/WKPreferencesPrivate.h> #include <wtf/PassOwnPtr.h> namespace WTR { +static WKURLRef blankURL() +{ + static WKURLRef staticBlankURL = WKURLCreateWithUTF8CString("about:blank"); + return staticBlankURL; +} + static TestController* controller; TestController& TestController::shared() @@ -60,6 +67,30 @@ TestController::~TestController() { } +static WKRect getWindowFrameMainPage(WKPageRef page, const void* clientInfo) +{ + PlatformWebView* view = static_cast<TestController*>(const_cast<void*>(clientInfo))->mainWebView(); + return view->windowFrame(); +} + +static void setWindowFrameMainPage(WKPageRef page, WKRect frame, const void* clientInfo) +{ + PlatformWebView* view = static_cast<TestController*>(const_cast<void*>(clientInfo))->mainWebView(); + view->setWindowFrame(frame); +} + +static WKRect getWindowFrameOtherPage(WKPageRef page, const void* clientInfo) +{ + PlatformWebView* view = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo)); + return view->windowFrame(); +} + +static void setWindowFrameOtherPage(WKPageRef page, WKRect frame, const void* clientInfo) +{ + PlatformWebView* view = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo)); + view->setWindowFrame(frame); +} + static void closeOtherPage(WKPageRef page, const void* clientInfo) { WKPageClose(page); @@ -78,15 +109,19 @@ static WKPageRef createOtherPage(WKPageRef oldPage, const void*) 0, view, createOtherPage, - 0, + 0, // showPage closeOtherPage, - 0, - 0, - 0, - 0, - 0, - 0, - 0 + 0, // runJavaScriptAlert + 0, // runJavaScriptConfirm + 0, // runJavaScriptPrompt + 0, // setStatusText + 0, // mouseDidMoveOverElement + 0, // contentsSizeChanged + 0, // didNotHandleKeyEvent + getWindowFrameOtherPage, + setWindowFrameOtherPage, + 0, // runBeforeUnloadConfirmPanel + 0 // didDraw }; WKPageSetPageUIClient(newPage, &otherPageUIClient); @@ -159,39 +194,43 @@ void TestController::initialize(int argc, const char* argv[]) 0, this, createOtherPage, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 + 0, // showPage + 0, // close + 0, // runJavaScriptAlert + 0, // runJavaScriptConfirm + 0, // runJavaScriptPrompt + 0, // setStatusText + 0, // mouseDidMoveOverElement + 0, // contentsSizeChanged + 0, // didNotHandleKeyEvent + getWindowFrameMainPage, + setWindowFrameMainPage, + 0, // runBeforeUnloadConfirmPanel + 0 // didDraw }; WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient); WKPageLoaderClient pageLoaderClient = { 0, this, - 0, - 0, - 0, - 0, - 0, + 0, // didStartProvisionalLoadForFrame + 0, // didReceiveServerRedirectForProvisionalLoadForFrame + 0, // didFailProvisionalLoadWithErrorForFrame + 0, // didCommitLoadForFrame + 0, // didFinishDocumentLoadForFrame didFinishLoadForFrame, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 + 0, // didFailLoadWithErrorForFrame + 0, // didReceiveTitleForFrame + 0, // didFirstLayoutForFrame + 0, // didFirstVisuallyNonEmptyLayoutForFrame + 0, // didRemoveFrameFromHierarchy + 0, // didStartProgress + 0, // didChangeProgress + 0, // didFinishProgress + 0, // didBecomeUnresponsive + 0, // didBecomeResponsive + 0, // processDidExit + 0 // didChangeBackForwardList }; WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient); } @@ -208,13 +247,26 @@ void TestController::resetStateToConsistentValues() WKPreferencesSetFontSmoothingLevel(preferences, kWKFontSmoothingLevelNoSubpixelAntiAliasing); WKPreferencesSetXSSAuditorEnabled(preferences, false); + static WKStringRef standardFontFamily = WKStringCreateWithUTF8CString("Times"); + static WKStringRef cursiveFontFamily = WKStringCreateWithUTF8CString("Apple Chancery"); + static WKStringRef fantasyFontFamily = WKStringCreateWithUTF8CString("Papyrus"); + static WKStringRef fixedFontFamily = WKStringCreateWithUTF8CString("Courier"); + static WKStringRef sansSerifFontFamily = WKStringCreateWithUTF8CString("Helvetica"); + static WKStringRef serifFontFamily = WKStringCreateWithUTF8CString("Times"); + + WKPreferencesSetStandardFontFamily(preferences, standardFontFamily); + WKPreferencesSetCursiveFontFamily(preferences, cursiveFontFamily); + WKPreferencesSetFantasyFontFamily(preferences, fantasyFontFamily); + WKPreferencesSetFixedFontFamily(preferences, fixedFontFamily); + WKPreferencesSetSansSerifFontFamily(preferences, sansSerifFontFamily); + WKPreferencesSetSerifFontFamily(preferences, serifFontFamily); + m_mainWebView->focus(); // Reset main page back to about:blank m_doneResetting = false; - WKRetainPtr<WKURLRef> url(AdoptWK, createWKURL("about:blank")); - WKPageLoadURL(m_mainWebView->page(), url.get()); + WKPageLoadURL(m_mainWebView->page(), blankURL()); TestController::runUntil(m_doneResetting); } @@ -281,9 +333,7 @@ void TestController::didFinishLoadForFrame(WKPageRef page, WKFrameRef frame) return; WKRetainPtr<WKURLRef> wkURL(AdoptWK, WKFrameCopyURL(frame)); - RetainPtr<CFURLRef> cfURL= toCF(wkURL); - CFStringRef cfURLString = CFURLGetString(cfURL.get()); - if (!CFEqual(cfURLString, CFSTR("about:blank"))) + if (!WKURLIsEqual(wkURL.get(), blankURL())) return; m_doneResetting = true; diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.cpp b/WebKitTools/WebKitTestRunner/TestInvocation.cpp index 47df66b..c1bf894 100644 --- a/WebKitTools/WebKitTestRunner/TestInvocation.cpp +++ b/WebKitTools/WebKitTestRunner/TestInvocation.cpp @@ -28,15 +28,62 @@ #include "PlatformWebView.h" #include "StringFunctions.h" #include "TestController.h" +#include <climits> +#include <cstdio> #include <WebKit2/WKContextPrivate.h> #include <WebKit2/WKRetainPtr.h> -#include <wtf/RetainPtr.h> +#include <wtf/OwnArrayPtr.h> +#include <wtf/PassOwnArrayPtr.h> + +#if OS(WINDOWS) +#include <direct.h> // For _getcwd. +#define getcwd _getcwd // MSDN says getcwd is deprecated. +#define PATH_MAX _MAX_PATH +#endif using namespace WebKit; using namespace std; namespace WTR { +static WKURLRef createWKURL(const char* pathOrURL) +{ + if (strstr(pathOrURL, "http://") || strstr(pathOrURL, "https://") || strstr(pathOrURL, "file://")) + return WKURLCreateWithUTF8CString(pathOrURL); + + // Creating from filesytem path. + size_t length = strlen(pathOrURL); + if (!length) + return 0; + + const char* filePrefix = "file://"; + static const size_t prefixLength = strlen(filePrefix); +#if OS(WINDOWS) + const char separator = '\\'; + bool isAbsolutePath = length >= 3 && pathOrURL[1] == ':' && pathOrURL[2] == separator; +#else + const char separator = '/'; + bool isAbsolutePath = pathOrURL[0] == separator; +#endif + + OwnArrayPtr<char> buffer; + if (isAbsolutePath) { + buffer = adoptArrayPtr(new char[prefixLength + length + 1]); + strcpy(buffer.get(), filePrefix); + strcpy(buffer.get() + prefixLength, pathOrURL); + } else { + buffer = adoptArrayPtr(new char[prefixLength + PATH_MAX + length + 2]); // 1 for the separator + strcpy(buffer.get(), filePrefix); + if (!getcwd(buffer.get() + prefixLength, PATH_MAX)) + return 0; + size_t numCharacters = strlen(buffer.get()); + buffer[numCharacters] = separator; + strcpy(buffer.get() + numCharacters + 1, pathOrURL); + } + + return WKURLCreateWithUTF8CString(buffer.get()); +} + TestInvocation::TestInvocation(const char* pathOrURL) : m_url(AdoptWK, createWKURL(pathOrURL)) , m_pathOrURL(fastStrDup(pathOrURL)) @@ -70,9 +117,8 @@ void TestInvocation::invoke() { sizeWebViewForCurrentTest(m_pathOrURL); - WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest"))); - WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithCFString(CFSTR(""))); - WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), messageBody.get()); + WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("BeginTest")); + WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), 0); TestController::runUntil(m_gotInitialResponse); if (m_error) { @@ -104,8 +150,7 @@ void TestInvocation::dump(const char* stringToDump) void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody) { - RetainPtr<CFStringRef> cfMessageName(AdoptCF, WKStringCopyCFString(0, messageName)); - if (CFEqual(cfMessageName.get(), CFSTR("Error"))) { + if (WKStringIsEqualToUTF8CString(messageName, "Error")) { // Set all states to true to stop spinning the runloop. m_gotInitialResponse = true; m_gotFinalMessage = true; @@ -113,11 +158,10 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName return; } - if (CFEqual(cfMessageName.get(), CFSTR("Ack"))) { + if (WKStringIsEqualToUTF8CString(messageName, "Ack")) { ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID()); - RetainPtr<CFStringRef> cfMessageBody(AdoptCF, WKStringCopyCFString(0, static_cast<WKStringRef>(messageBody))); - - if (CFEqual(cfMessageBody.get(), CFSTR("BeginTest"))) { + WKStringRef messageBodyString = static_cast<WKStringRef>(messageBody); + if (WKStringIsEqualToUTF8CString(messageBodyString, "BeginTest")) { m_gotInitialResponse = true; return; } @@ -125,12 +169,11 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName ASSERT_NOT_REACHED(); } - if (CFEqual(cfMessageName.get(), CFSTR("Done"))) { + if (WKStringIsEqualToUTF8CString(messageName, "Done")) { ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID()); - ostringstream out; - out << static_cast<WKStringRef>(messageBody); + WKStringRef messageBodyString = static_cast<WKStringRef>(messageBody); - dump(out.str().c_str()); + dump(toSTD(messageBodyString).c_str()); m_gotFinalMessage = true; return; diff --git a/WebKitTools/WebKitTestRunner/WebKitTestRunner.pro b/WebKitTools/WebKitTestRunner/WebKitTestRunner.pro new file mode 100644 index 0000000..677abb3 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/WebKitTestRunner.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs + +SUBDIRS = qt/WebKitTestRunner.pro \ + InjectedBundle/qt/InjectedBundle.pro \ + diff --git a/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj b/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj index 6ecbef9..599e09e 100644 --- a/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj +++ b/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj @@ -368,7 +368,14 @@ isa = PBXProject; buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "WebKitTestRunner" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); mainGroup = 08FB7794FE84155DC02AAC07 /* WebKitTestRunner */; projectDirPath = ""; projectRoot = ""; diff --git a/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm b/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm index 96e6526..6080c1f 100644 --- a/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm +++ b/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm @@ -63,4 +63,21 @@ void PlatformWebView::focus() // Implement. } +WKRect PlatformWebView::windowFrame() +{ + NSRect frame = [m_window frame]; + + WKRect wkFrame; + wkFrame.origin.x = frame.origin.x; + wkFrame.origin.y = frame.origin.y; + wkFrame.size.width = frame.size.width; + wkFrame.size.height = frame.size.height; + return wkFrame; +} + +void PlatformWebView::setWindowFrame(WKRect frame) +{ + [m_window setFrame:NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height) display:YES]; +} + } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/qt/PlatformWebViewQt.cpp b/WebKitTools/WebKitTestRunner/qt/PlatformWebViewQt.cpp new file mode 100644 index 0000000..d405a0f --- /dev/null +++ b/WebKitTools/WebKitTestRunner/qt/PlatformWebViewQt.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 University of Szeged. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PlatformWebView.h" +#include "qgraphicswkview.h" +#include <QtGui> + +namespace WTR { + +class WebView : public QGraphicsView { +public: + WebView(WKPageNamespaceRef); + + QGraphicsWKView* wkView() const { return m_item; } + + virtual ~WebView() { delete m_item; } + +private: + QGraphicsWKView* m_item; +}; + +WebView::WebView(WKPageNamespaceRef namespaceRef) + : QGraphicsView() + , m_item(new QGraphicsWKView(namespaceRef)) +{ + setScene(new QGraphicsScene(this)); + scene()->addItem(m_item); +} + +PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef) + : m_view(new WebView(namespaceRef)) + , m_window(new QMainWindow()) +{ + m_view->setParent(m_window); + m_window->setCentralWidget(m_view); + m_window->setGeometry(0, 0, 800, 600); +} + +PlatformWebView::~PlatformWebView() +{ + delete m_window; +} + +void PlatformWebView::resizeTo(unsigned width, unsigned height) +{ + m_window->resize(width, height); +} + +WKPageRef PlatformWebView::page() +{ + return m_view->wkView()->page()->pageRef(); +} + +void PlatformWebView::focus() +{ + m_view->setFocus(Qt::OtherFocusReason); +} + +WKRect PlatformWebView::windowFrame() +{ + // Implement. + + WKRect wkFrame; + wkFrame.origin.x = 0; + wkFrame.origin.y = 0; + wkFrame.size.width = 0; + wkFrame.size.height = 0; + return wkFrame; +} + +void PlatformWebView::setWindowFrame(WKRect) +{ + // Implement. +} + +} // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/qt/TestControllerQt.cpp b/WebKitTools/WebKitTestRunner/qt/TestControllerQt.cpp new file mode 100644 index 0000000..d3aee4a --- /dev/null +++ b/WebKitTools/WebKitTestRunner/qt/TestControllerQt.cpp @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 University of Szeged. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "TestController.h" + +#include "WKStringQt.h" + +#include <cstdlib> +#include <QCoreApplication> +#include <QEventLoop> +#include <QFileInfo> +#include <QLibrary> +#include <QObject> +#include <QtGlobal> +#include <wtf/Platform.h> +#include <wtf/text/WTFString.h> + +namespace WTR { + +// With a bigger interval we would waste to much time +// after the test had been finished. +static const unsigned kTimerIntervalMS = 1; + +class RunUntilConditionLoop : public QObject { + Q_OBJECT + +public: + static void start(bool& done) + { + static RunUntilConditionLoop* instance = new RunUntilConditionLoop; + instance->run(done); + } + +private: + RunUntilConditionLoop() {} + + void run(bool& done) + { + m_condition = &done; + m_timerID = startTimer(kTimerIntervalMS); + ASSERT(m_timerID); + m_eventLoop.exec(QEventLoop::ExcludeUserInputEvents); + } + + virtual void timerEvent(QTimerEvent*) + { + if (!*m_condition) + return; + + killTimer(m_timerID); + m_eventLoop.exit(); + } + + QEventLoop m_eventLoop; + bool* m_condition; + int m_timerID; +}; + +void TestController::platformInitialize() +{ +} + +void TestController::runUntil(bool& done) +{ + RunUntilConditionLoop::start(done); + ASSERT(done); +} + +static bool isExistingLibrary(const QString& path) +{ +#if OS(WINDOWS) || OS(SYMBIAN) + const char* librarySuffixes[] = { ".dll" }; +#elif PLATFORM(MAC) + const char* librarySuffixes[] = { ".bundle", ".dylib", ".so" }; +#elif OS(UNIX) + const char* librarySuffixes[] = { ".so" }; +#else +#error Library path suffix should be specified for this platform +#endif + for (unsigned i = 0; i < sizeof(librarySuffixes) / sizeof(const char*); ++i) { + if (QLibrary::isLibrary(path + librarySuffixes[i])) + return true; + } + + return false; +} + +void TestController::initializeInjectedBundlePath() +{ + QString path = QLatin1String(getenv("WTR_INJECTEDBUNDLE_PATH")); + if (path.isEmpty()) + path = QFileInfo(QCoreApplication::applicationDirPath() + "/../lib/libWTRInjectedBundle").absoluteFilePath(); + if (!isExistingLibrary(path)) + qFatal("Cannot find the injected bundle at %s\n", qPrintable(path)); + + m_injectedBundlePath = WKStringCreateWithQString(path); +} + +void TestController::initializeTestPluginDirectory() +{ + // This is called after initializeInjectedBundlePath. + m_testPluginDirectory = m_injectedBundlePath; +} + +void TestController::platformInitializeContext() +{ +} + +#include "TestControllerQt.moc" + +} // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/qt/WebKitTestRunner.pro b/WebKitTools/WebKitTestRunner/qt/WebKitTestRunner.pro new file mode 100644 index 0000000..a638e65 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/qt/WebKitTestRunner.pro @@ -0,0 +1,68 @@ +TARGET = WebKitTestRunner +CONFIG -= app_bundle + +BASEDIR = $$PWD/../ +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../.. + +include(../../../WebKit.pri) + +!CONFIG(release, debug|release) { + OBJECTS_DIR = obj/debug +} else { # Release + OBJECTS_DIR = obj/release +} + +DEFINES += USE_SYSTEM_MALLOC + +INCLUDEPATH += \ + $$BASEDIR \ + $$BASEDIR/../../JavaScriptCore \ + $$BASEDIR/../../WebKit2 \ + $$BASEDIR/../../WebKit2/Shared \ + $$BASEDIR/../../WebKit2/UIProcess/API/qt \ + $$BASEDIR/../../WebKit2/UIProcess/API/cpp/qt \ + +INCLUDEPATH += \ + $$OUTPUT_DIR/include \ + + +DESTDIR = $$OUTPUT_DIR/bin + +unix:!mac { + CONFIG += link_pkgconfig + PKGCONFIG += fontconfig +} + +QT = core gui network + +HEADERS = \ + $$BASEDIR/PlatformWebView.h \ + $$BASEDIR/StringFunctions.h \ + $$BASEDIR/TestController.h \ + $$BASEDIR/TestInvocation.h + +SOURCES = \ + main.cpp \ + PlatformWebViewQt.cpp \ + TestControllerQt.cpp \ + $$BASEDIR/TestController.cpp \ + $$BASEDIR/TestInvocation.cpp \ + +PREFIX_HEADER = $$BASEDIR/WebKitTestRunnerPrefix.h +QMAKE_CXXFLAGS += "-include $$PREFIX_HEADER" + +linux-* { + # From Creator's src/rpath.pri: + # Do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR + # this expands to $ORIGIN (after qmake and make), it does NOT read a qmake var. + QMAKE_RPATHDIR = \$\$ORIGIN/../lib $$QMAKE_RPATHDIR + MY_RPATH = $$join(QMAKE_RPATHDIR, ":") + + QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,$${MY_RPATH}\' + QMAKE_RPATHDIR = +} else { + QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR +} + +include(../../../JavaScriptCore/JavaScriptCore.pri) +addJavaScriptCoreLib(../../../JavaScriptCore) diff --git a/WebKitTools/WebKitTestRunner/qt/main.cpp b/WebKitTools/WebKitTestRunner/qt/main.cpp new file mode 100644 index 0000000..4312a05 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/qt/main.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 University of Szeged. + * + * 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 "TestController.h" + +#include <QApplication> +#include <QObject> +#include <QTimer> + +class Launcher : public QObject { + Q_OBJECT + +public: + Launcher(int argc, char** argv) + : m_argc(argc) + , m_argv(argv) + { + } + + ~Launcher() + { + delete m_controller; + } + +public slots: + void launch() + { + m_controller = new WTR::TestController(m_argc, const_cast<const char**>(m_argv)); + QApplication::exit(); + } + +private: + WTR::TestController* m_controller; + int m_argc; + char** m_argv; +}; + +int main(int argc, char** argv) +{ + QApplication app(argc, argv); + Launcher launcher(argc, argv); + QTimer::singleShot(0, &launcher, SLOT(launch())); + return app.exec();; +} + +#include "main.moc" diff --git a/WebKitTools/WebKitTestRunner/win/PlatformWebViewWin.cpp b/WebKitTools/WebKitTestRunner/win/PlatformWebViewWin.cpp index b9854c4..9acd236 100644 --- a/WebKitTools/WebKitTestRunner/win/PlatformWebViewWin.cpp +++ b/WebKitTools/WebKitTestRunner/win/PlatformWebViewWin.cpp @@ -78,4 +78,21 @@ void PlatformWebView::focus() ::SetFocus(::WKViewGetWindow(m_view)); } +WKRect PlatformWebView::windowFrame() +{ + // Implement. + + WKRect wkFrame; + wkFrame.origin.x = 0; + wkFrame.origin.y = 0; + wkFrame.size.width = 0; + wkFrame.size.height = 0; + return wkFrame; +} + +void PlatformWebView::setWindowFrame(WKRect) +{ + // Implement. +} + } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.vcproj b/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.vcproj index e4cd870..c852f64 100644 --- a/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.vcproj +++ b/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.vcproj @@ -23,7 +23,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders\wtf"

xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders\wtf"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

"
/>
<Tool
Name="VCCustomBuildTool"
@@ -39,7 +39,7 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebKitTestRunner\ForwardingHeaders";"$(WebKitLibrariesDir)\Include""
+ AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include""
PreprocessorDefinitions="__WIN32__;_CONSOLE"
DisableSpecificWarnings="4146"
ForcedIncludeFiles="WebKitTestRunnerPrefix.h"
@@ -95,7 +95,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders\wtf"

xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders\wtf"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

"
/>
<Tool
Name="VCCustomBuildTool"
@@ -111,7 +111,7 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebKitTestRunner\ForwardingHeaders";"$(WebKitLibrariesDir)\Include""
+ AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include""
PreprocessorDefinitions="__WIN32__;_CONSOLE"
DisableSpecificWarnings="4146"
ForcedIncludeFiles="WebKitTestRunnerPrefix.h"
@@ -166,7 +166,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders\wtf"

xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders\wtf"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

"
/>
<Tool
Name="VCCustomBuildTool"
@@ -182,7 +182,7 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebKitTestRunner\ForwardingHeaders";"$(WebKitLibrariesDir)\Include""
+ AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include""
PreprocessorDefinitions="__WIN32__;_CONSOLE"
DisableSpecificWarnings="4146"
ForcedIncludeFiles="WebKitTestRunnerPrefix.h"
@@ -236,7 +236,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders\wtf"

xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders\wtf"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

"
/>
<Tool
Name="VCCustomBuildTool"
@@ -252,7 +252,7 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebKitTestRunner\ForwardingHeaders";"$(WebKitLibrariesDir)\Include""
+ AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include""
PreprocessorDefinitions="__WIN32__;_CONSOLE"
DisableSpecificWarnings="4146"
ForcedIncludeFiles="WebKitTestRunnerPrefix.h"
@@ -308,7 +308,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders\wtf"

xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders\wtf"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

"
/>
<Tool
Name="VCCustomBuildTool"
@@ -324,7 +324,7 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebKitTestRunner\ForwardingHeaders";"$(WebKitLibrariesDir)\Include""
+ AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include""
PreprocessorDefinitions="__WIN32__;_CONSOLE"
DisableSpecificWarnings="4146"
ForcedIncludeFiles="WebKitTestRunnerPrefix.h"
@@ -382,7 +382,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders\wtf"

xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebKitTestRunner\ForwardingHeaders\wtf"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

"
/>
<Tool
Name="VCCustomBuildTool"
@@ -398,7 +398,7 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebKitTestRunner\ForwardingHeaders";"$(WebKitLibrariesDir)\Include""
+ AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include""
PreprocessorDefinitions="__WIN32__;_CONSOLE"
DisableSpecificWarnings="4146"
ForcedIncludeFiles="WebKitTestRunnerPrefix.h"
|