44#include " extension_qt/q_view_executor.h"
55#include " webdriver_logging.h"
66
7- #include < QtCore/QtGlobal>
8-
97#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
108#include < QtWebKitWidgets/QWebView>
119#include < QtWebKit/QWebHistory>
@@ -19,88 +17,7 @@ namespace webdriver {
1917
2018class FramePath ;
2119class ValueParser ;
22-
23- class QPageLoader : public QObject {
24- Q_OBJECT
25- public:
26- explicit QPageLoader (QWebView* view) :
27- QObject(NULL ) {webView = view; is_loading = false ;}
28-
29- void loadPage (QUrl url);
30- void reloadPage ();
31- bool isLoading () {return is_loading;}
32-
33- signals:
34- void loaded ();
35-
36- public slots:
37- void pageLoadStarted ();
38- void pageLoadFinished ();
39- private:
40- bool is_loading;
41- QWebView* webView;
42-
43- };
44-
45- // Notify automation module about end of execution of async script
46- class JSNotifier : public QObject
47- {
48- Q_OBJECT
49-
50- public:
51- JSNotifier ();
52- QVariant getResult ();
53- bool IsCompleted ();
54-
55-
56- public slots:
57- void setResult (QVariant result);
58-
59- signals:
60- void completed ();
61-
62- private:
63- QVariant res;
64- bool isCompleted;
65- };
66-
67- class JSLogger : public QObject
68- {
69- Q_OBJECT
70-
71- public:
72- JSLogger ();
73- base::ListValue* getLog ();
74- void SetMinLogLevel (LogLevel level);
75-
76- public slots:
77- void log (QVariant message);
78- void warn (QVariant message);
79- void error (QVariant message);
80-
81- private:
82- InMemoryLog browserLog;
83- Logger browserLogger;
84- };
85-
86- class BrowserLogHandler : public QObject
87- {
88- Q_OBJECT
89-
90- public:
91- BrowserLogHandler (QObject* parent);
92- base::ListValue* getLog ();
93- void SetMinLogLevel (LogLevel level);
94- void loadConsoleJS (const QWebView* view);
95- void loadJSLogObject (QWebFrame *frame);
96-
97- public slots:
98- void loadJSLogObject ();
99- void loadConsoleJS ();
100-
101- private:
102- JSLogger jslogger;
103- };
20+ class QWebkitProxy ;
10421
10522class QWebViewCmdExecutorCreator : public ViewCmdExecutorCreator {
10623public:
@@ -203,97 +120,11 @@ class QWebViewCmdExecutor : public QViewCmdExecutor {
203120
204121protected:
205122 QWebView* getView (const ViewId& viewId, Error** error);
206- QWebFrame* FindFrameByPath (QWebFrame* parent, const FramePath &frame_path);
207- QWebFrame* GetFrame (QWebView* view, const FramePath& frame_path);
208- Error* ExecuteScriptAndParse (QWebFrame* frame,
209- const std::string& anonymous_func_script,
210- const std::string& script_name,
211- const base::ListValue* args,
212- const ValueParser* parser);
213- Error* ExecuteAsyncScript (QWebFrame* frame,
214- const std::string& script,
215- const base::ListValue* const args,
216- base::Value** value);
217- Error* ExecuteScript (QWebFrame* frame,
218- const std::string& script,
219- const base::ListValue* const args,
220- base::Value** value);
221- Error* ExecuteScriptAndParseValue (QWebFrame* frame,
222- const std::string& script,
223- base::Value** script_result, bool isAsync);
224- Error* ExecuteScriptImpl (QWebFrame* frame,
225- const std::string &script,
226- std::string *result,
227- bool isAsync);
228-
229- Error* FindElementsHelper (QWebFrame* frame,
230- const ElementId& root_element,
231- const std::string& locator,
232- const std::string& query,
233- bool find_one,
234- std::vector<ElementId>* elements);
235-
236- Error* ExecuteFindElementScriptAndParse (
237- QWebFrame* frame,
238- const ElementId& root_element,
239- const std::string& locator,
240- const std::string& query,
241- bool find_one,
242- std::vector<ElementId>* elements);
243-
244- Error* GetElementRegionInViewHelper (
245- QWebFrame* frame,
246- const ElementId& element,
247- const Rect& region,
248- bool center,
249- bool verify_clickable_at_middle,
250- Point* location);
251-
252- Error* GetElementRegionInView (
253- QWebView* view,
254- const ElementId& element,
255- const Rect& region,
256- bool center,
257- bool verify_clickable_at_middle,
258- Point* location);
259-
260- Error* VerifyElementIsClickable (
261- QWebFrame* frame,
262- const ElementId& element,
263- const Point& location);
264-
265- Error* GetElementBorder (QWebFrame* frame,
266- const ElementId& element,
267- int * border_left,
268- int * border_top);
269-
270- Error* GetElementEffectiveStyle (
271- QWebFrame* frame,
272- const ElementId& element,
273- const std::string& prop,
274- std::string* value);
275-
276- QWebFrame* FindFrameByMeta (QWebFrame* parent, const FramePath &frame_path);
277-
278- void AddIdToCurrentFrame (QWebView* view, const FramePath &frame_path);
279-
280- Error* SwitchToFrameWithJavaScriptLocatedFrame (
281- QWebView* view,
282- QWebFrame* frame,
283- const std::string& script,
284- base::ListValue* args);
285-
286- Error* GetElementFirstClientRect (QWebFrame* frame,
287- const ElementId& element,
288- Rect* rect);
289-
290- Error* GetClickableLocation (QWebView* view, const ElementId& element, Point* location);
291-
292- Error* ToggleOptionElement (const ElementId& element);
293-
294- void AddBrowserLoggerToView (QWebView* view);
295123
296124private:
125+ QWebkitProxy* webkitProxy_;
126+ QWebView* view_;
127+
297128 DISALLOW_COPY_AND_ASSIGN (QWebViewCmdExecutor);
298129 friend class QWebViewVisualizerSourceCommand ;
299130 friend class QWebViewVisualizerShowPointCommand ;
0 commit comments