capybara-webkit 0.12.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. data/.gitignore +2 -1
  2. data/GOALS +9 -0
  3. data/Gemfile.lock +15 -12
  4. data/LICENSE +1 -1
  5. data/NEWS.md +18 -0
  6. data/README.md +81 -2
  7. data/capybara-webkit.gemspec +1 -1
  8. data/lib/capybara/webkit.rb +11 -6
  9. data/lib/capybara/{driver/webkit → webkit}/browser.rb +90 -4
  10. data/lib/capybara/{driver/webkit → webkit}/connection.rb +48 -47
  11. data/lib/capybara/{driver/webkit → webkit}/cookie_jar.rb +1 -1
  12. data/lib/capybara/webkit/driver.rb +186 -0
  13. data/lib/capybara/webkit/errors.rb +10 -0
  14. data/lib/capybara/{driver/webkit → webkit}/node.rb +12 -4
  15. data/lib/capybara/{driver/webkit → webkit}/socket_debugger.rb +4 -1
  16. data/lib/capybara/{driver/webkit → webkit}/version.rb +1 -1
  17. data/lib/capybara_webkit_builder.rb +17 -3
  18. data/spec/browser_spec.rb +95 -7
  19. data/spec/connection_spec.rb +16 -5
  20. data/spec/cookie_jar_spec.rb +3 -3
  21. data/spec/driver_rendering_spec.rb +19 -26
  22. data/spec/driver_resize_window_spec.rb +3 -3
  23. data/spec/driver_spec.rb +1200 -822
  24. data/spec/integration/driver_spec.rb +4 -3
  25. data/spec/selenium_compatibility_spec.rb +49 -0
  26. data/spec/spec_helper.rb +14 -6
  27. data/spec/support/app_runner.rb +94 -0
  28. data/src/Authenticate.cpp +18 -0
  29. data/src/Authenticate.h +12 -0
  30. data/src/Body.h +3 -5
  31. data/src/ClearCookies.cpp +3 -5
  32. data/src/ClearCookies.h +3 -5
  33. data/src/ClearPromptText.cpp +11 -0
  34. data/src/ClearPromptText.h +9 -0
  35. data/src/Command.cpp +4 -15
  36. data/src/Command.h +3 -14
  37. data/src/CommandFactory.cpp +20 -6
  38. data/src/CommandFactory.h +3 -2
  39. data/src/CommandParser.cpp +1 -1
  40. data/src/Connection.cpp +22 -21
  41. data/src/Connection.h +5 -6
  42. data/src/ConsoleMessages.cpp +2 -1
  43. data/src/ConsoleMessages.h +3 -5
  44. data/src/CurrentUrl.cpp +9 -48
  45. data/src/CurrentUrl.h +8 -8
  46. data/src/EnableLogging.cpp +10 -0
  47. data/src/EnableLogging.h +12 -0
  48. data/src/Evaluate.cpp +2 -1
  49. data/src/Evaluate.h +3 -5
  50. data/src/Execute.cpp +2 -1
  51. data/src/Execute.h +3 -5
  52. data/src/Find.cpp +3 -2
  53. data/src/Find.h +3 -5
  54. data/src/FrameFocus.cpp +3 -2
  55. data/src/FrameFocus.h +3 -4
  56. data/src/GetCookies.cpp +3 -4
  57. data/src/GetCookies.h +3 -5
  58. data/src/GetTimeout.cpp +9 -0
  59. data/src/GetTimeout.h +11 -0
  60. data/src/GetWindowHandle.cpp +11 -0
  61. data/src/GetWindowHandle.h +10 -0
  62. data/src/GetWindowHandles.cpp +20 -0
  63. data/src/GetWindowHandles.h +10 -0
  64. data/src/Header.cpp +2 -1
  65. data/src/Header.h +3 -5
  66. data/src/Headers.cpp +8 -2
  67. data/src/Headers.h +3 -5
  68. data/src/IgnoreSslErrors.cpp +4 -3
  69. data/src/IgnoreSslErrors.h +3 -5
  70. data/src/JavascriptAlertMessages.cpp +10 -0
  71. data/src/JavascriptAlertMessages.h +9 -0
  72. data/src/JavascriptConfirmMessages.cpp +10 -0
  73. data/src/JavascriptConfirmMessages.h +9 -0
  74. data/src/JavascriptInvocation.cpp +1 -1
  75. data/src/JavascriptInvocation.h +1 -1
  76. data/src/JavascriptPromptMessages.cpp +10 -0
  77. data/src/JavascriptPromptMessages.h +9 -0
  78. data/src/NetworkAccessManager.cpp +38 -5
  79. data/src/NetworkAccessManager.h +20 -0
  80. data/src/Node.cpp +6 -1
  81. data/src/Node.h +4 -5
  82. data/src/NullCommand.cpp +5 -2
  83. data/src/NullCommand.h +4 -3
  84. data/src/PageLoadingCommand.cpp +12 -7
  85. data/src/PageLoadingCommand.h +6 -9
  86. data/src/Render.cpp +2 -1
  87. data/src/Render.h +3 -5
  88. data/src/RequestedUrl.cpp +2 -1
  89. data/src/RequestedUrl.h +3 -5
  90. data/src/Reset.cpp +3 -17
  91. data/src/Reset.h +3 -8
  92. data/src/ResizeWindow.cpp +2 -1
  93. data/src/ResizeWindow.h +3 -5
  94. data/src/Response.cpp +4 -0
  95. data/src/Response.h +1 -0
  96. data/src/Server.cpp +2 -3
  97. data/src/Server.h +0 -2
  98. data/src/SetConfirmAction.cpp +11 -0
  99. data/src/SetConfirmAction.h +9 -0
  100. data/src/SetCookie.cpp +3 -4
  101. data/src/SetCookie.h +3 -5
  102. data/src/SetPromptAction.cpp +11 -0
  103. data/src/SetPromptAction.h +9 -0
  104. data/src/SetPromptText.cpp +11 -0
  105. data/src/SetPromptText.h +9 -0
  106. data/src/SetProxy.cpp +2 -1
  107. data/src/SetProxy.h +3 -5
  108. data/src/SetSkipImageLoading.cpp +12 -0
  109. data/src/SetSkipImageLoading.h +9 -0
  110. data/src/SetTimeout.cpp +19 -0
  111. data/src/SetTimeout.h +9 -0
  112. data/src/SocketCommand.cpp +21 -0
  113. data/src/SocketCommand.h +29 -0
  114. data/src/Source.cpp +3 -2
  115. data/src/Source.h +3 -4
  116. data/src/Status.cpp +2 -1
  117. data/src/Status.h +3 -5
  118. data/src/TimeoutCommand.cpp +69 -0
  119. data/src/TimeoutCommand.h +41 -0
  120. data/src/UnsupportedContentHandler.cpp +11 -17
  121. data/src/UnsupportedContentHandler.h +5 -3
  122. data/src/Url.cpp +2 -1
  123. data/src/Url.h +3 -5
  124. data/src/Visit.cpp +3 -2
  125. data/src/Visit.h +3 -5
  126. data/src/WebPage.cpp +129 -44
  127. data/src/WebPage.h +37 -11
  128. data/src/WebPageManager.cpp +127 -0
  129. data/src/WebPageManager.h +59 -0
  130. data/src/WindowFocus.cpp +32 -0
  131. data/src/WindowFocus.h +15 -0
  132. data/src/body.cpp +2 -1
  133. data/src/capybara.js +38 -10
  134. data/src/find_command.h +17 -2
  135. data/src/main.cpp +0 -2
  136. data/src/webkit_server.pro +36 -0
  137. data/templates/Command.cpp +2 -4
  138. data/templates/Command.h +3 -3
  139. metadata +106 -27
  140. data/ChangeLog +0 -70
  141. data/lib/capybara/driver/webkit.rb +0 -136
@@ -1,10 +1,16 @@
1
1
  #include "Headers.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
 
4
- Headers::Headers(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
5
+ Headers::Headers(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
5
6
  }
6
7
 
7
8
  void Headers::start() {
8
- emit finished(new Response(true, page()->pageHeaders()));
9
+ QStringList headers;
10
+
11
+ foreach(QNetworkReply::RawHeaderPair header, page()->pageHeaders())
12
+ headers << header.first+": "+header.second;
13
+
14
+ emit finished(new Response(true, headers.join("\n")));
9
15
  }
10
16
 
@@ -1,12 +1,10 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
 
3
- class WebPage;
4
-
5
- class Headers : public Command {
3
+ class Headers : public SocketCommand {
6
4
  Q_OBJECT
7
5
 
8
6
  public:
9
- Headers(WebPage *page, QStringList &arguments, QObject *parent = 0);
7
+ Headers(WebPageManager *, QStringList &arguments, QObject *parent = 0);
10
8
  virtual void start();
11
9
  };
12
10
 
@@ -1,12 +1,13 @@
1
1
  #include "IgnoreSslErrors.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
 
4
- IgnoreSslErrors::IgnoreSslErrors(WebPage *page, QStringList &arguments, QObject *parent) :
5
- Command(page, arguments, parent) {
5
+ IgnoreSslErrors::IgnoreSslErrors(WebPageManager *manager, QStringList &arguments, QObject *parent) :
6
+ SocketCommand(manager, arguments, parent) {
6
7
  }
7
8
 
8
9
  void IgnoreSslErrors::start() {
9
- page()->ignoreSslErrors();
10
+ manager()->setIgnoreSslErrors(true);
10
11
  emit finished(new Response(true));
11
12
  }
12
13
 
@@ -1,12 +1,10 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
 
3
- class WebPage;
4
-
5
- class IgnoreSslErrors : public Command {
3
+ class IgnoreSslErrors : public SocketCommand {
6
4
  Q_OBJECT
7
5
 
8
6
  public:
9
- IgnoreSslErrors(WebPage *page, QStringList &arguments, QObject *parent = 0);
7
+ IgnoreSslErrors(WebPageManager *manager, QStringList &arguments, QObject *parent = 0);
10
8
  virtual void start();
11
9
  };
12
10
 
@@ -0,0 +1,10 @@
1
+ #include "JavascriptAlertMessages.h"
2
+ #include "WebPage.h"
3
+ #include "WebPageManager.h"
4
+
5
+ JavascriptAlertMessages::JavascriptAlertMessages(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {}
6
+
7
+ void JavascriptAlertMessages::start()
8
+ {
9
+ emit finished(new Response(true, page()->alertMessages()));
10
+ }
@@ -0,0 +1,9 @@
1
+ #include "SocketCommand.h"
2
+
3
+ class JavascriptAlertMessages : public SocketCommand {
4
+ Q_OBJECT
5
+
6
+ public:
7
+ JavascriptAlertMessages(WebPageManager *manager, QStringList &arguments, QObject *parent = 0);
8
+ virtual void start();
9
+ };
@@ -0,0 +1,10 @@
1
+ #include "JavascriptConfirmMessages.h"
2
+ #include "WebPage.h"
3
+ #include "WebPageManager.h"
4
+
5
+ JavascriptConfirmMessages::JavascriptConfirmMessages(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {}
6
+
7
+ void JavascriptConfirmMessages::start()
8
+ {
9
+ emit finished(new Response(true, page()->confirmMessages()));
10
+ }
@@ -0,0 +1,9 @@
1
+ #include "SocketCommand.h"
2
+
3
+ class JavascriptConfirmMessages : public SocketCommand {
4
+ Q_OBJECT
5
+
6
+ public:
7
+ JavascriptConfirmMessages(WebPageManager *manager, QStringList &arguments, QObject *parent = 0);
8
+ virtual void start();
9
+ };
@@ -1,6 +1,6 @@
1
1
  #include "JavascriptInvocation.h"
2
2
 
3
- JavascriptInvocation::JavascriptInvocation(QString &functionName, QStringList &arguments, QObject *parent) : QObject(parent) {
3
+ JavascriptInvocation::JavascriptInvocation(const QString &functionName, const QStringList &arguments, QObject *parent) : QObject(parent) {
4
4
  m_functionName = functionName;
5
5
  m_arguments = arguments;
6
6
  }
@@ -8,7 +8,7 @@ class JavascriptInvocation : public QObject {
8
8
  Q_PROPERTY(QStringList arguments READ arguments)
9
9
 
10
10
  public:
11
- JavascriptInvocation(QString &functionName, QStringList &arguments, QObject *parent = 0);
11
+ JavascriptInvocation(const QString &functionName, const QStringList &arguments, QObject *parent = 0);
12
12
  QString &functionName();
13
13
  QStringList &arguments();
14
14
 
@@ -0,0 +1,10 @@
1
+ #include "JavascriptPromptMessages.h"
2
+ #include "WebPage.h"
3
+ #include "WebPageManager.h"
4
+
5
+ JavascriptPromptMessages::JavascriptPromptMessages(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {}
6
+
7
+ void JavascriptPromptMessages::start()
8
+ {
9
+ emit finished(new Response(true, page()->promptMessages()));
10
+ }
@@ -0,0 +1,9 @@
1
+ #include "SocketCommand.h"
2
+
3
+ class JavascriptPromptMessages : public SocketCommand {
4
+ Q_OBJECT
5
+
6
+ public:
7
+ JavascriptPromptMessages(WebPageManager *manager, QStringList &arguments, QObject *parent = 0);
8
+ virtual void start();
9
+ };
@@ -1,13 +1,16 @@
1
1
  #include "NetworkAccessManager.h"
2
2
  #include "WebPage.h"
3
3
  #include <iostream>
4
-
4
+ #include <fstream>
5
5
 
6
6
  NetworkAccessManager::NetworkAccessManager(QObject *parent):QNetworkAccessManager(parent) {
7
+ connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), SLOT(provideAuthentication(QNetworkReply*,QAuthenticator*)));
8
+ connect(this, SIGNAL(finished(QNetworkReply *)), this, SLOT(finished(QNetworkReply *)));
7
9
  }
8
10
 
9
11
  QNetworkReply* NetworkAccessManager::createRequest(QNetworkAccessManager::Operation operation, const QNetworkRequest &request, QIODevice * outgoingData = 0) {
10
12
  QNetworkRequest new_request(request);
13
+ QByteArray url = new_request.url().toEncoded();
11
14
  if (operation != QNetworkAccessManager::PostOperation && operation != QNetworkAccessManager::PutOperation) {
12
15
  new_request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant());
13
16
  }
@@ -16,14 +19,44 @@ QNetworkReply* NetworkAccessManager::createRequest(QNetworkAccessManager::Operat
16
19
  item.next();
17
20
  new_request.setRawHeader(item.key().toAscii(), item.value().toAscii());
18
21
  }
19
- return QNetworkAccessManager::createRequest(operation, new_request, outgoingData);
20
- };
22
+ QNetworkReply *reply = QNetworkAccessManager::createRequest(operation, new_request, outgoingData);
23
+ emit requestCreated(url, reply);
24
+ return reply;
25
+ }
26
+
27
+ void NetworkAccessManager::finished(QNetworkReply *reply) {
28
+ NetworkResponse response;
29
+ response.statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
30
+ response.headers = reply->rawHeaderPairs();
31
+ m_responses[reply->url()] = response;
32
+ }
21
33
 
22
34
  void NetworkAccessManager::addHeader(QString key, QString value) {
23
35
  m_headers.insert(key, value);
24
- };
36
+ }
25
37
 
26
38
  void NetworkAccessManager::resetHeaders() {
27
39
  m_headers.clear();
28
- };
40
+ }
41
+
42
+ void NetworkAccessManager::setUserName(const QString &userName) {
43
+ m_userName = userName;
44
+ }
29
45
 
46
+ void NetworkAccessManager::setPassword(const QString &password) {
47
+ m_password = password;
48
+ }
49
+
50
+ void NetworkAccessManager::provideAuthentication(QNetworkReply *reply, QAuthenticator *authenticator) {
51
+ Q_UNUSED(reply);
52
+ authenticator->setUser(m_userName);
53
+ authenticator->setPassword(m_password);
54
+ }
55
+
56
+ int NetworkAccessManager::statusFor(QUrl url) {
57
+ return m_responses[url].statusCode;
58
+ }
59
+
60
+ const QList<QNetworkReply::RawHeaderPair> &NetworkAccessManager::headersFor(QUrl url) {
61
+ return m_responses[url].headers;
62
+ }
@@ -6,14 +6,34 @@ class NetworkAccessManager : public QNetworkAccessManager {
6
6
 
7
7
  Q_OBJECT
8
8
 
9
+ struct NetworkResponse {
10
+ int statusCode;
11
+ QList<QNetworkReply::RawHeaderPair> headers;
12
+ NetworkResponse() : statusCode(0) { }
13
+ };
14
+
9
15
  public:
10
16
  NetworkAccessManager(QObject *parent = 0);
11
17
  void addHeader(QString key, QString value);
12
18
  void resetHeaders();
19
+ void setUserName(const QString &userName);
20
+ void setPassword(const QString &password);
21
+ int statusFor(QUrl url);
22
+ const QList<QNetworkReply::RawHeaderPair> &headersFor(QUrl url);
13
23
 
14
24
  protected:
15
25
  QNetworkReply* createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice * outgoingData);
26
+ QString m_userName;
27
+ QString m_password;
16
28
 
17
29
  private:
18
30
  QHash<QString, QString> m_headers;
31
+ QHash<QUrl, NetworkResponse> m_responses;
32
+
33
+ private slots:
34
+ void provideAuthentication(QNetworkReply *reply, QAuthenticator *authenticator);
35
+ void finished(QNetworkReply *);
36
+
37
+ signals:
38
+ void requestCreated(QByteArray &url, QNetworkReply *reply);
19
39
  };
@@ -1,7 +1,8 @@
1
1
  #include "Node.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
 
4
- Node::Node(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
5
+ Node::Node(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
5
6
  }
6
7
 
7
8
  void Node::start() {
@@ -12,3 +13,7 @@ void Node::start() {
12
13
  emit finished(new Response(true, attributeValue));
13
14
  }
14
15
 
16
+ QString Node::toString() const {
17
+ QStringList functionArguments(arguments());
18
+ return QString("Node.") + functionArguments.takeFirst();
19
+ }
data/src/Node.h CHANGED
@@ -1,13 +1,12 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
  #include <QStringList>
3
3
 
4
- class WebPage;
5
-
6
- class Node : public Command {
4
+ class Node : public SocketCommand {
7
5
  Q_OBJECT
8
6
 
9
7
  public:
10
- Node(WebPage *page, QStringList &arguments, QObject *parent = 0);
8
+ Node(WebPageManager *manager, QStringList &arguments, QObject *parent = 0);
11
9
  virtual void start();
10
+ virtual QString toString() const;
12
11
  };
13
12
 
@@ -1,10 +1,13 @@
1
1
  #include "NullCommand.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
 
4
- NullCommand::NullCommand(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {}
5
+ NullCommand::NullCommand(QString name, QObject *parent) : Command(parent) {
6
+ m_name = name;
7
+ }
5
8
 
6
9
  void NullCommand::start() {
7
- QString failure = QString("[Capybara WebKit] Unknown command: ") + arguments()[0] + "\n";
10
+ QString failure = QString("[Capybara WebKit] Unknown command: ") + m_name + "\n";
8
11
  emit finished(new Response(false, failure));
9
12
  }
10
13
 
@@ -1,11 +1,12 @@
1
1
  #include "Command.h"
2
2
 
3
- class WebPage;
4
-
5
3
  class NullCommand : public Command {
6
4
  Q_OBJECT
7
5
 
8
6
  public:
9
- NullCommand(WebPage *page, QStringList &arguments, QObject *parent = 0);
7
+ NullCommand(QString name, QObject *parent = 0);
10
8
  virtual void start();
9
+
10
+ private:
11
+ QString m_name;
11
12
  };
@@ -1,18 +1,20 @@
1
1
  #include "PageLoadingCommand.h"
2
- #include "Command.h"
2
+ #include "SocketCommand.h"
3
3
  #include "WebPage.h"
4
+ #include "WebPageManager.h"
4
5
 
5
- PageLoadingCommand::PageLoadingCommand(Command *command, WebPage *page, QObject *parent) : QObject(parent) {
6
- m_page = page;
6
+ PageLoadingCommand::PageLoadingCommand(Command *command, WebPageManager *manager, QObject *parent) : Command(parent) {
7
+ m_manager = manager;
7
8
  m_command = command;
8
9
  m_pageLoadingFromCommand = false;
9
10
  m_pageSuccess = true;
10
11
  m_pendingResponse = NULL;
11
- connect(m_page, SIGNAL(loadStarted()), this, SLOT(pageLoadingFromCommand()));
12
- connect(m_page, SIGNAL(pageFinished(bool)), this, SLOT(pendingLoadFinished(bool)));
12
+ connect(m_manager, SIGNAL(loadStarted()), this, SLOT(pageLoadingFromCommand()));
13
+ connect(m_manager, SIGNAL(pageFinished(bool)), this, SLOT(pendingLoadFinished(bool)));
13
14
  }
14
15
 
15
16
  void PageLoadingCommand::start() {
17
+ m_manager->logger() << "Started" << m_command->toString();
16
18
  connect(m_command, SIGNAL(finished(Response *)), this, SLOT(commandFinished(Response *)));
17
19
  m_command->start();
18
20
  };
@@ -22,10 +24,11 @@ void PageLoadingCommand::pendingLoadFinished(bool success) {
22
24
  if (m_pageLoadingFromCommand) {
23
25
  m_pageLoadingFromCommand = false;
24
26
  if (m_pendingResponse) {
27
+ m_manager->logger() << "Page load from command finished";
25
28
  if (m_pageSuccess) {
26
29
  emit finished(m_pendingResponse);
27
30
  } else {
28
- QString message = m_page->failureString();
31
+ QString message = m_manager->currentPage()->failureString();
29
32
  emit finished(new Response(false, message));
30
33
  }
31
34
  }
@@ -33,11 +36,13 @@ void PageLoadingCommand::pendingLoadFinished(bool success) {
33
36
  }
34
37
 
35
38
  void PageLoadingCommand::pageLoadingFromCommand() {
39
+ m_manager->logger() << m_command->toString() << "started page load";
36
40
  m_pageLoadingFromCommand = true;
37
41
  }
38
42
 
39
43
  void PageLoadingCommand::commandFinished(Response *response) {
40
- disconnect(m_page, SIGNAL(loadStarted()), this, SLOT(pageLoadingFromCommand()));
44
+ disconnect(m_manager, SIGNAL(loadStarted()), this, SLOT(pageLoadingFromCommand()));
45
+ m_manager->logger() << "Finished" << m_command->toString() << "with response" << response->toString();
41
46
  m_command->deleteLater();
42
47
  if (m_pageLoadingFromCommand)
43
48
  m_pendingResponse = response;
@@ -1,9 +1,9 @@
1
1
  #include <QObject>
2
2
  #include <QStringList>
3
+ #include "Command.h"
3
4
 
4
- class Command;
5
5
  class Response;
6
- class WebPage;
6
+ class WebPageManager;
7
7
 
8
8
  /*
9
9
  * Decorates a Command by deferring the finished() signal until any pending
@@ -15,23 +15,20 @@ class WebPage;
15
15
  * If a pending page load fails, the command's response will be discarded and a
16
16
  * failure response will be emitted instead.
17
17
  */
18
- class PageLoadingCommand : public QObject {
18
+ class PageLoadingCommand : public Command {
19
19
  Q_OBJECT
20
20
 
21
21
  public:
22
- PageLoadingCommand(Command *command, WebPage *page, QObject *parent = 0);
23
- void start();
22
+ PageLoadingCommand(Command *command, WebPageManager *page, QObject *parent = 0);
23
+ virtual void start();
24
24
 
25
25
  public slots:
26
26
  void pageLoadingFromCommand();
27
27
  void pendingLoadFinished(bool success);
28
28
  void commandFinished(Response *response);
29
29
 
30
- signals:
31
- void finished(Response *response);
32
-
33
30
  private:
34
- WebPage *m_page;
31
+ WebPageManager *m_manager;
35
32
  Command *m_command;
36
33
  Response *m_pendingResponse;
37
34
  bool m_pageSuccess;
@@ -1,7 +1,8 @@
1
1
  #include "Render.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
 
4
- Render::Render(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
5
+ Render::Render(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
5
6
  }
6
7
 
7
8
  void Render::start() {
@@ -1,12 +1,10 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
  #include <QStringList>
3
3
 
4
- class WebPage;
5
-
6
- class Render : public Command {
4
+ class Render : public SocketCommand {
7
5
  Q_OBJECT
8
6
 
9
7
  public:
10
- Render(WebPage *page, QStringList &arguments, QObject *parent = 0);
8
+ Render(WebPageManager *page, QStringList &arguments, QObject *parent = 0);
11
9
  virtual void start();
12
10
  };