WebKitTestRunner needs layoutTestController.elementDoesAutoCompleteForElementWithId
[WebKit-https.git] / Source / WebKit / qt / WebCoreSupport / DumpRenderTreeSupportQt.h
1 /*
2     Copyright (C) 2010 Robert Hogan <robert@roberthogan.net>
3     Copyright (C) 2008,2009,2010 Nokia Corporation and/or its subsidiary(-ies)
4     Copyright (C) 2007 Staikos Computing Services Inc.
5     Copyright (C) 2007, 2012 Apple Inc.
6
7     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Library General Public
9     License as published by the Free Software Foundation; either
10     version 2 of the License, or (at your option) any later version.
11
12     This library is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15     Library General Public License for more details.
16
17     You should have received a copy of the GNU Library General Public License
18     along with this library; see the file COPYING.LIB.  If not, write to
19     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20     Boston, MA 02110-1301, USA.
21 */
22
23 #ifndef DumpRenderTreeSupportQt_h
24 #define DumpRenderTreeSupportQt_h
25
26 #include "qwebkitglobal.h"
27 #include <QNetworkCookieJar>
28 #include <QVariant>
29 #include <QVector>
30
31 typedef const struct OpaqueJSContext* JSContextRef;
32 typedef struct OpaqueJSValue* JSObjectRef;
33
34 namespace WebCore {
35 class Text;
36 class Node;
37 }
38
39 namespace JSC {
40 namespace Bindings {
41 class QtDRTNodeRuntime;
42 }
43 }
44
45 class QWebElement;
46 class QWebFrame;
47 class QWebFrameAdapter;
48 class QWebPageAdapter;
49 class QWebHistoryItem;
50 class QWebScriptWorld;
51
52 QT_BEGIN_NAMESPACE
53 class QUrl;
54 QT_END_NAMESPACE
55
56 extern QMap<int, QWebScriptWorld*> m_worldMap;
57
58 // Used to pass WebCore::Node's to layout tests using TestRunner
59 class QWEBKIT_EXPORT QDRTNode {
60 public:
61     QDRTNode();
62     QDRTNode(const QDRTNode&);
63     QDRTNode &operator=(const QDRTNode&);
64     ~QDRTNode();
65
66 private:
67     explicit QDRTNode(WebCore::Node*);
68
69     friend class DumpRenderTreeSupportQt;
70
71     friend class QtDRTNodeRuntime;
72
73     WebCore::Node* m_node;
74 };
75
76 Q_DECLARE_METATYPE(QDRTNode)
77
78 class QtDRTNodeRuntime {
79 public:
80     static QDRTNode create(WebCore::Node*);
81     static WebCore::Node* get(const QDRTNode&);
82     static void initialize();
83 };
84
85 class QWEBKIT_EXPORT DumpRenderTreeSupportQt {
86
87 public:
88
89     DumpRenderTreeSupportQt();
90     ~DumpRenderTreeSupportQt();
91
92     static void initialize();
93
94     static void executeCoreCommandByName(QWebPageAdapter*, const QString& name, const QString& value);
95     static bool isCommandEnabled(QWebPageAdapter*, const QString& name);
96     static bool findString(QWebPageAdapter*, const QString&, const QStringList& optionArray);
97     static void setSmartInsertDeleteEnabled(QWebPageAdapter*, bool enabled);
98     static void setSelectTrailingWhitespaceEnabled(QWebPageAdapter*, bool enabled);
99     static QVariantList selectedRange(QWebPageAdapter*);
100     static QVariantList firstRectForCharacterRange(QWebPageAdapter*, int location, int length);
101     static void confirmComposition(QWebPageAdapter*, const char* text);
102
103     static void setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme);
104     static void setFrameFlatteningEnabled(QWebPageAdapter*, bool);
105     static void setCaretBrowsingEnabled(QWebPageAdapter*, bool value);
106     static void setAuthorAndUserStylesEnabled(QWebPageAdapter*, bool);
107     static void setDumpRenderTreeModeEnabled(bool);
108
109     static void garbageCollectorCollect();
110     static void garbageCollectorCollectOnAlternateThread(bool waitUntilDone);
111     static void setValueForUser(const QWebElement&, const QString& value);
112     static int javaScriptObjectsCount();
113     static void clearScriptWorlds();
114     static void evaluateScriptInIsolatedWorld(QWebFrameAdapter*, int worldID, const QString& script);
115
116     static void webInspectorExecuteScript(QWebPageAdapter*, long callId, const QString& script);
117     static void webInspectorShow(QWebPageAdapter*);
118     static void webInspectorClose(QWebPageAdapter*);
119
120     static QString webPageGroupName(QWebPageAdapter*);
121     static void webPageSetGroupName(QWebPageAdapter*, const QString& groupName);
122     static void clearFrameName(QWebFrameAdapter*);
123     static void overwritePluginDirectories();
124     static bool hasDocumentElement(QWebFrameAdapter*);
125     static void setWindowsBehaviorAsEditingBehavior(QWebPageAdapter*);
126
127     static void clearAllApplicationCaches();
128
129     static void whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains);
130     static void removeWhiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains);
131     static void resetOriginAccessWhiteLists();
132
133     static void setMockDeviceOrientation(QWebPageAdapter*, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
134
135     static void resetGeolocationMock(QWebPageAdapter*);
136     static void setMockGeolocationPermission(QWebPageAdapter*, bool allowed);
137     static void setMockGeolocationPosition(QWebPageAdapter*, double latitude, double longitude, double accuracy);
138     static void setMockGeolocationPositionUnavailableError(QWebPageAdapter*, const QString& message);
139     static int numberOfPendingGeolocationPermissionRequests(QWebPageAdapter*);
140
141     static void dumpFrameLoader(bool);
142     static void dumpProgressFinishedCallback(bool);
143     static void dumpUserGestureInFrameLoader(bool);
144     static void dumpResourceLoadCallbacks(bool);
145     static void dumpResourceResponseMIMETypes(bool);
146     static void dumpResourceLoadCallbacksPath(const QString& path);
147     static void dumpWillCacheResponseCallbacks(bool);
148     static void setWillSendRequestReturnsNullOnRedirect(bool);
149     static void setWillSendRequestReturnsNull(bool);
150     static void setWillSendRequestClearHeaders(const QStringList&);
151     static void dumpHistoryCallbacks(bool);
152     static void dumpVisitedLinksCallbacks(bool);
153
154     static void setDeferMainResourceDataLoad(bool);
155
156     static void dumpEditingCallbacks(bool);
157     static void dumpSetAcceptsEditing(bool);
158
159     static void dumpNotification(bool);
160     static QString viewportAsText(QWebPageAdapter*, int deviceDPI, const QSize& deviceSize, const QSize& availableSize);
161
162     static QMap<QString, QWebHistoryItem> getChildHistoryItems(const QWebHistoryItem&);
163     static bool isTargetItem(const QWebHistoryItem&);
164     static QString historyItemTarget(const QWebHistoryItem&);
165
166     static bool shouldClose(QWebFrameAdapter*);
167
168     static void setCustomPolicyDelegate(bool enabled, bool permissive);
169
170     static void addUserStyleSheet(QWebPageAdapter*, const QString& sourceCode);
171     static void removeUserStyleSheets(QWebPageAdapter*);
172     static void simulateDesktopNotificationClick(const QString& title);
173
174     static void scalePageBy(QWebFrameAdapter*, float scale, const QPoint& origin);
175
176     static QString responseMimeType(QWebFrameAdapter*);
177     static void clearOpener(QWebFrameAdapter*);
178     static void addURLToRedirect(const QString& origin, const QString& destination);
179     static QStringList contextMenu(QWebPageAdapter*);
180
181     static QUrl mediaContentUrlByElementId(QWebFrameAdapter*, const QString& elementId);
182     static void setAlternateHtml(QWebFrameAdapter*, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl);
183
184     static void injectInternalsObject(QWebFrameAdapter*);
185     static void injectInternalsObject(JSContextRef);
186     static void resetInternalsObject(QWebFrameAdapter*);
187     static void resetInternalsObject(JSContextRef);
188
189     static void setInteractiveFormValidationEnabled(QWebPageAdapter*, bool);
190
191     static void setDefersLoading(QWebPageAdapter*, bool flag);
192     static void goBack(QWebPageAdapter*);
193
194     static bool thirdPartyCookiePolicyAllows(QWebPageAdapter*, const QUrl&, const QUrl& firstPartyUrl);
195
196     static void enableMockScrollbars();
197
198     static QImage paintPagesWithBoundaries(QWebFrameAdapter*);
199
200     static void setTrackRepaintRects(QWebFrameAdapter*, bool enable);
201     static bool trackRepaintRects(QWebFrameAdapter*);
202     static void getTrackedRepaintRects(QWebFrameAdapter*, QVector<QRect>& result);
203
204     static void setSeamlessIFramesEnabled(bool);
205
206     static QString frameRenderTreeDump(QWebFrameAdapter*);
207     static void clearNotificationPermissions();
208
209     static void getJSWindowObject(QWebFrameAdapter*, JSContextRef*, JSObjectRef*);
210 };
211
212 #endif