diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Tools/WebKitTestRunner/TestInvocation.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Tools/WebKitTestRunner/TestInvocation.h')
-rw-r--r-- | Tools/WebKitTestRunner/TestInvocation.h | 74 |
1 files changed, 58 insertions, 16 deletions
diff --git a/Tools/WebKitTestRunner/TestInvocation.h b/Tools/WebKitTestRunner/TestInvocation.h index a32678135..df5885c7e 100644 --- a/Tools/WebKitTestRunner/TestInvocation.h +++ b/Tools/WebKitTestRunner/TestInvocation.h @@ -26,23 +26,35 @@ #ifndef TestInvocation_h #define TestInvocation_h +#include "JSWrappable.h" +#include "TestOptions.h" +#include "UIScriptContext.h" +#include <WebKit/WKRetainPtr.h> #include <string> -#include <WebKit2/WKRetainPtr.h> #include <wtf/Noncopyable.h> -#include <wtf/OwnPtr.h> #include <wtf/text/StringBuilder.h> namespace WTR { -class TestInvocation { +class TestInvocation : public UIScriptContextDelegate { WTF_MAKE_NONCOPYABLE(TestInvocation); public: - explicit TestInvocation(const std::string& pathOrURL); + explicit TestInvocation(WKURLRef, const TestOptions&); ~TestInvocation(); + WKURLRef url() const; + bool urlContains(const char*) const; + + const TestOptions& options() const { return m_options; } + void setIsPixelTest(const std::string& expectedPixelHash); - void setCustomTimeout(int duration); + // Milliseconds + void setCustomTimeout(int duration) { m_timeout = duration; } + void setDumpJSConsoleLogInStdErr(bool value) { m_dumpJSConsoleLogInStdErr = value; } + + // Seconds + double shortTimeout() const; void invoke(); void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody); @@ -51,36 +63,66 @@ public: void dumpWebProcessUnresponsiveness(); static void dumpWebProcessUnresponsiveness(const char* errorMessage); void outputText(const WTF::String&); + + void didBeginSwipe(); + void willEndSwipe(); + void didEndSwipe(); + void didRemoveSwipeSnapshot(); + + void notifyDownloadDone(); + private: void dumpResults(); static void dump(const char* textToStdout, const char* textToStderr = 0, bool seenError = false); - void dumpPixelsAndCompareWithExpected(WKImageRef, WKArrayRef repaintRects); + enum class SnapshotResultType { WebView, WebContents }; + void dumpPixelsAndCompareWithExpected(WKImageRef, WKArrayRef repaintRects, SnapshotResultType); void dumpAudio(WKDataRef); bool compareActualHashToExpectedAndDumpResults(const char[33]); static void forceRepaintDoneCallback(WKErrorRef, void* context); + + struct UIScriptInvocationData { + unsigned callbackID; + WebKit::WKRetainPtr<WKStringRef> scriptString; + TestInvocation* testInvocation; + }; + static void runUISideScriptAfterUpdateCallback(WKErrorRef, void* context); - WKRetainPtr<WKURLRef> m_url; - std::string m_pathOrURL; + bool shouldLogFrameLoadDelegates() const; + bool shouldLogHistoryClientCallbacks() const; + + void runUISideScript(WKStringRef, unsigned callbackID); + // UIScriptContextDelegate + void uiScriptDidComplete(const String& result, unsigned callbackID) override; + + const TestOptions m_options; - bool m_dumpPixels; + WKRetainPtr<WKURLRef> m_url; + WTF::String m_urlString; + std::string m_expectedPixelHash; - int m_timeout; + int m_timeout { 0 }; + bool m_dumpJSConsoleLogInStdErr { false }; // Invocation state - bool m_gotInitialResponse; - bool m_gotFinalMessage; - bool m_gotRepaint; - bool m_error; + bool m_gotInitialResponse { false }; + bool m_gotFinalMessage { false }; + bool m_gotRepaint { false }; + bool m_error { false }; + + bool m_dumpPixels { false }; + bool m_pixelResultIsPending { false }; + bool m_webProcessIsUnresponsive { false }; StringBuilder m_textOutput; WKRetainPtr<WKDataRef> m_audioResult; WKRetainPtr<WKImageRef> m_pixelResult; WKRetainPtr<WKArrayRef> m_repaintRects; std::string m_errorMessage; - bool m_webProcessIsUnresponsive; - + + std::unique_ptr<UIScriptContext> m_UIScriptContext; + UIScriptInvocationData* m_pendingUIScriptInvocationData { nullptr }; }; } // namespace WTR |