capybara-webkit 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/.travis.yml +18 -16
  4. data/Appraisals +8 -4
  5. data/Gemfile.lock +29 -14
  6. data/NEWS.md +7 -0
  7. data/README.md +16 -10
  8. data/Rakefile +1 -1
  9. data/capybara-webkit.gemspec +2 -1
  10. data/gemfiles/2.0.gemfile.lock +23 -19
  11. data/gemfiles/2.1.gemfile.lock +33 -20
  12. data/gemfiles/2.2.gemfile +7 -0
  13. data/gemfiles/2.2.gemfile.lock +77 -0
  14. data/gemfiles/2.3.gemfile +7 -0
  15. data/gemfiles/2.3.gemfile.lock +77 -0
  16. data/lib/capybara/webkit/browser.rb +28 -4
  17. data/lib/capybara/webkit/connection.rb +9 -24
  18. data/lib/capybara/webkit/driver.rb +40 -4
  19. data/lib/capybara/webkit/errors.rb +3 -0
  20. data/lib/capybara/webkit/version.rb +1 -1
  21. data/spec/browser_spec.rb +1 -1
  22. data/spec/connection_spec.rb +27 -5
  23. data/spec/driver_rendering_spec.rb +10 -0
  24. data/spec/driver_resize_window_spec.rb +22 -0
  25. data/spec/driver_spec.rb +117 -9
  26. data/spec/selenium_compatibility_spec.rb +3 -0
  27. data/spec/spec_helper.rb +22 -3
  28. data/spec/support/matchers/include_response.rb +24 -0
  29. data/src/CommandFactory.cpp +7 -1
  30. data/src/GoBack.cpp +12 -0
  31. data/src/GoBack.h +10 -0
  32. data/src/GoForward.cpp +12 -0
  33. data/src/GoForward.h +10 -0
  34. data/src/IgnoreDebugOutput.cpp +1 -0
  35. data/src/Render.cpp +10 -1
  36. data/src/Reset.cpp +0 -2
  37. data/src/SocketCommand.cpp +6 -0
  38. data/src/SocketCommand.h +1 -0
  39. data/src/StdinNotifier.cpp +16 -0
  40. data/src/StdinNotifier.h +20 -0
  41. data/src/WebPage.cpp +20 -5
  42. data/src/WebPage.h +4 -1
  43. data/src/WebPageManager.cpp +18 -7
  44. data/src/WebPageManager.h +2 -1
  45. data/src/WindowClose.cpp +10 -0
  46. data/src/WindowClose.h +12 -0
  47. data/src/WindowCommand.cpp +27 -0
  48. data/src/WindowCommand.h +21 -0
  49. data/src/WindowFocus.cpp +2 -25
  50. data/src/WindowFocus.h +4 -7
  51. data/src/WindowMaximize.cpp +14 -0
  52. data/src/WindowMaximize.h +12 -0
  53. data/src/WindowOpen.cpp +12 -0
  54. data/src/WindowOpen.h +10 -0
  55. data/src/WindowResize.cpp +16 -0
  56. data/src/WindowResize.h +12 -0
  57. data/src/WindowSize.cpp +17 -0
  58. data/src/WindowSize.h +12 -0
  59. data/src/capybara.js +19 -3
  60. data/src/find_command.h +7 -1
  61. data/src/main.cpp +4 -0
  62. data/src/webkit_server.pro +25 -4
  63. data/templates/Command.cpp +2 -0
  64. data/templates/Command.h +1 -3
  65. metadata +68 -32
  66. data/src/ResizeWindow.cpp +0 -17
  67. data/src/ResizeWindow.h +0 -10
data/src/Reset.cpp CHANGED
@@ -6,8 +6,6 @@ Reset::Reset(WebPageManager *manager, QStringList &arguments, QObject *parent) :
6
6
  }
7
7
 
8
8
  void Reset::start() {
9
- page()->triggerAction(QWebPage::Stop);
10
-
11
9
  manager()->reset();
12
10
 
13
11
  finish(true);
@@ -19,3 +19,9 @@ WebPageManager *SocketCommand::manager() const {
19
19
  return m_manager;
20
20
  }
21
21
 
22
+ QString SocketCommand::toString() const {
23
+ QString result;
24
+ QTextStream(&result) << metaObject()->className() << QString("(") << m_arguments.join(", ") << QString(")");
25
+ return result;
26
+ }
27
+
data/src/SocketCommand.h CHANGED
@@ -14,6 +14,7 @@ class SocketCommand : public Command {
14
14
 
15
15
  public:
16
16
  SocketCommand(WebPageManager *, QStringList &arguments, QObject *parent = 0);
17
+ virtual QString toString() const;
17
18
 
18
19
  protected:
19
20
  WebPage *page() const;
@@ -0,0 +1,16 @@
1
+ #include "StdinNotifier.h"
2
+
3
+ #include <QTcpServer>
4
+
5
+ StdinNotifier::StdinNotifier(QObject *parent) : QObject(parent) {
6
+ m_notifier = new QSocketNotifier(fileno(stdin), QSocketNotifier::Read, this);
7
+ connect(m_notifier, SIGNAL(activated(int)), this, SLOT(notifierActivated()));
8
+ }
9
+
10
+ void StdinNotifier::notifierActivated() {
11
+ std::string line;
12
+ std::getline(std::cin, line);
13
+ if (std::cin.eof()) {
14
+ emit eof();
15
+ }
16
+ }
@@ -0,0 +1,20 @@
1
+ #include <QObject>
2
+
3
+ class QSocketNotifier;
4
+
5
+ class StdinNotifier : public QObject {
6
+ Q_OBJECT
7
+
8
+ public:
9
+ StdinNotifier(QObject *parent = 0);
10
+
11
+ public slots:
12
+ void notifierActivated();
13
+
14
+ signals:
15
+ void eof();
16
+
17
+ private:
18
+ QSocketNotifier *m_notifier;
19
+ };
20
+
data/src/WebPage.cpp CHANGED
@@ -11,6 +11,8 @@
11
11
  #include <QWebSettings>
12
12
  #include <QUuid>
13
13
  #include <QApplication>
14
+ #include <QWebView>
15
+ #include <QMainWindow>
14
16
 
15
17
  WebPage::WebPage(WebPageManager *manager, QObject *parent) : QWebPage(parent) {
16
18
  m_loading = false;
@@ -33,14 +35,23 @@ WebPage::WebPage(WebPageManager *manager, QObject *parent) : QWebPage(parent) {
33
35
  this, SLOT(frameCreated(QWebFrame *)));
34
36
  connect(this, SIGNAL(unsupportedContent(QNetworkReply*)),
35
37
  this, SLOT(handleUnsupportedContent(QNetworkReply*)));
36
- resetWindowSize();
38
+ connect(this, SIGNAL(windowCloseRequested()), this, SLOT(remove()));
37
39
 
38
40
  settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
41
+ settings()->setAttribute(QWebSettings::JavascriptCanCloseWindows, true);
42
+ settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
43
+
44
+ createWindow();
45
+ }
46
+
47
+ void WebPage::createWindow() {
48
+ QSize size(1680, 1050);
49
+ setViewportSize(size);
39
50
  }
40
51
 
41
- void WebPage::resetWindowSize() {
42
- this->setViewportSize(QSize(1680, 1050));
43
- this->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
52
+ void WebPage::resize(int width, int height) {
53
+ QSize size(width, height);
54
+ setViewportSize(size);
44
55
  }
45
56
 
46
57
  void WebPage::resetLocalStorage() {
@@ -334,7 +345,7 @@ bool WebPage::supportsExtension(Extension extension) const {
334
345
 
335
346
  QWebPage *WebPage::createWindow(WebWindowType type) {
336
347
  Q_UNUSED(type);
337
- return m_manager->createPage(this);
348
+ return m_manager->createPage();
338
349
  }
339
350
 
340
351
  QString WebPage::uuid() {
@@ -361,6 +372,10 @@ void WebPage::setFocus() {
361
372
  m_manager->setCurrentPage(this);
362
373
  }
363
374
 
375
+ void WebPage::remove() {
376
+ m_manager->removePage(this);
377
+ }
378
+
364
379
  void WebPage::setConfirmAction(QString action) {
365
380
  m_confirm = (action == "Yes");
366
381
  }
data/src/WebPage.h CHANGED
@@ -10,6 +10,7 @@
10
10
  class WebPageManager;
11
11
  class InvocationResult;
12
12
  class NetworkReplyProxy;
13
+ class QWebView;
13
14
 
14
15
  class WebPage : public QWebPage {
15
16
  Q_OBJECT
@@ -33,7 +34,7 @@ class WebPage : public QWebPage {
33
34
  QVariantList alertMessages();
34
35
  QVariantList confirmMessages();
35
36
  QVariantList promptMessages();
36
- void resetWindowSize();
37
+ void createWindow();
37
38
  void resetLocalStorage();
38
39
  QWebPage *createWindow(WebWindowType type);
39
40
  QString uuid();
@@ -46,6 +47,7 @@ class WebPage : public QWebPage {
46
47
  QString contentType();
47
48
  void mouseEvent(QEvent::Type type, const QPoint &position, Qt::MouseButton button);
48
49
  bool clickTest(QWebElement element, int absoluteX, int absoluteY);
50
+ void resize(int, int);
49
51
 
50
52
  public slots:
51
53
  bool shouldInterruptJavaScript();
@@ -57,6 +59,7 @@ class WebPage : public QWebPage {
57
59
  void handleSslErrorsForReply(QNetworkReply *reply, const QList<QSslError> &);
58
60
  void handleUnsupportedContent(QNetworkReply *reply);
59
61
  void replyFinished(QUrl &, QNetworkReply *);
62
+ void remove();
60
63
 
61
64
  signals:
62
65
  void pageFinished(bool);
@@ -12,7 +12,7 @@ WebPageManager::WebPageManager(QObject *parent) : QObject(parent) {
12
12
  m_timeout = -1;
13
13
  m_networkAccessManager = new NetworkAccessManager(this);
14
14
  m_networkAccessManager->setCookieJar(m_cookieJar);
15
- createPage(this)->setFocus();
15
+ createPage()->setFocus();
16
16
  }
17
17
 
18
18
  NetworkAccessManager *WebPageManager::networkAccessManager() {
@@ -35,8 +35,8 @@ WebPage *WebPageManager::currentPage() const {
35
35
  return m_currentPage;
36
36
  }
37
37
 
38
- WebPage *WebPageManager::createPage(QObject *parent) {
39
- WebPage *page = new WebPage(this, parent);
38
+ WebPage *WebPageManager::createPage() {
39
+ WebPage *page = new WebPage(this);
40
40
  connect(page, SIGNAL(loadStarted()),
41
41
  this, SLOT(emitLoadStarted()));
42
42
  connect(page, SIGNAL(pageFinished(bool)),
@@ -47,6 +47,15 @@ WebPage *WebPageManager::createPage(QObject *parent) {
47
47
  return page;
48
48
  }
49
49
 
50
+ void WebPageManager::removePage(WebPage *page) {
51
+ m_pages.removeOne(page);
52
+ page->deleteLater();
53
+ if (m_pages.isEmpty())
54
+ createPage()->setFocus();
55
+ else if (page == m_currentPage)
56
+ m_pages.first()->setFocus();
57
+ }
58
+
50
59
  void WebPageManager::emitLoadStarted() {
51
60
  if (m_started.empty()) {
52
61
  logger() << "Load started";
@@ -110,10 +119,12 @@ void WebPageManager::reset() {
110
119
  m_timeout = -1;
111
120
  m_cookieJar->clearCookies();
112
121
  m_networkAccessManager->reset();
113
- m_pages.first()->resetLocalStorage();
114
- m_pages.first()->deleteLater();
115
- m_pages.clear();
116
- createPage(this)->setFocus();
122
+ m_currentPage->resetLocalStorage();
123
+ while (!m_pages.isEmpty()) {
124
+ WebPage *page = m_pages.takeFirst();
125
+ page->deleteLater();
126
+ }
127
+ createPage()->setFocus();
117
128
  }
118
129
 
119
130
  NetworkCookieJar *WebPageManager::cookieJar() {
data/src/WebPageManager.h CHANGED
@@ -20,7 +20,8 @@ class WebPageManager : public QObject {
20
20
  QList<WebPage *> pages() const;
21
21
  void setCurrentPage(WebPage *);
22
22
  WebPage *currentPage() const;
23
- WebPage *createPage(QObject *parent);
23
+ WebPage *createPage();
24
+ void removePage(WebPage *);
24
25
  void setIgnoreSslErrors(bool);
25
26
  bool ignoreSslErrors();
26
27
  void setTimeout(int);
@@ -0,0 +1,10 @@
1
+ #include "WindowClose.h"
2
+ #include "WebPage.h"
3
+
4
+ WindowClose::WindowClose(WebPageManager *manager, QStringList &arguments, QObject *parent) : WindowCommand(manager, arguments, parent) {
5
+ }
6
+
7
+ void WindowClose::windowFound(WebPage *page) {
8
+ page->remove();
9
+ finish(true);
10
+ }
data/src/WindowClose.h ADDED
@@ -0,0 +1,12 @@
1
+ #include "WindowCommand.h"
2
+
3
+ class WindowClose : public WindowCommand {
4
+ Q_OBJECT
5
+
6
+ public:
7
+ WindowClose(WebPageManager *, QStringList &arguments, QObject *parent = 0);
8
+
9
+ protected:
10
+ virtual void windowFound(WebPage *);
11
+ };
12
+
@@ -0,0 +1,27 @@
1
+ #include "WindowCommand.h"
2
+ #include "WebPage.h"
3
+ #include "WebPageManager.h"
4
+ #include "ErrorMessage.h"
5
+
6
+ WindowCommand::WindowCommand(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
7
+ }
8
+
9
+ void WindowCommand::start() {
10
+ findWindow(arguments()[0]);
11
+ }
12
+
13
+ void WindowCommand::findWindow(QString selector) {
14
+ foreach(WebPage *page, manager()->pages()) {
15
+ if (page->matchesWindowSelector(selector)) {
16
+ windowFound(page);
17
+ return;
18
+ }
19
+ }
20
+
21
+ windowNotFound();
22
+ }
23
+
24
+ void WindowCommand::windowNotFound() {
25
+ finish(false,
26
+ new ErrorMessage("NoSuchWindowError", "Unable to locate window."));
27
+ }
@@ -0,0 +1,21 @@
1
+ #ifndef WINDOW_COMMAND_H
2
+ #define WINDOW_COMMAND_H
3
+
4
+ #include "SocketCommand.h"
5
+
6
+ class WindowCommand : public SocketCommand {
7
+ Q_OBJECT
8
+
9
+ public:
10
+ WindowCommand(WebPageManager *, QStringList &arguments, QObject *parent = 0);
11
+ virtual void start();
12
+
13
+ protected:
14
+ virtual void windowFound(WebPage *) = 0;
15
+
16
+ private:
17
+ void findWindow(QString);
18
+ void windowNotFound();
19
+ };
20
+
21
+ #endif
data/src/WindowFocus.cpp CHANGED
@@ -1,33 +1,10 @@
1
1
  #include "WindowFocus.h"
2
- #include "SocketCommand.h"
3
2
  #include "WebPage.h"
4
- #include "CommandFactory.h"
5
- #include "WebPageManager.h"
6
- #include "ErrorMessage.h"
7
3
 
8
- WindowFocus::WindowFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
4
+ WindowFocus::WindowFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) : WindowCommand(manager, arguments, parent) {
9
5
  }
10
6
 
11
- void WindowFocus::start() {
12
- focusWindow(arguments()[0]);
13
- }
14
-
15
- void WindowFocus::windowNotFound() {
16
- finish(false, new ErrorMessage("Unable to locate window."));
17
- }
18
-
19
- void WindowFocus::success(WebPage *page) {
7
+ void WindowFocus::windowFound(WebPage *page) {
20
8
  page->setFocus();
21
9
  finish(true);
22
10
  }
23
-
24
- void WindowFocus::focusWindow(QString selector) {
25
- foreach(WebPage *page, manager()->pages()) {
26
- if (page->matchesWindowSelector(selector)) {
27
- success(page);
28
- return;
29
- }
30
- }
31
-
32
- windowNotFound();
33
- }
data/src/WindowFocus.h CHANGED
@@ -1,15 +1,12 @@
1
- #include "SocketCommand.h"
1
+ #include "WindowCommand.h"
2
2
 
3
- class WindowFocus : public SocketCommand {
3
+ class WindowFocus : public WindowCommand {
4
4
  Q_OBJECT
5
5
 
6
6
  public:
7
7
  WindowFocus(WebPageManager *, QStringList &arguments, QObject *parent = 0);
8
- virtual void start();
9
8
 
10
- private:
11
- void success(WebPage *);
12
- void windowNotFound();
13
- void focusWindow(QString);
9
+ protected:
10
+ virtual void windowFound(WebPage *);
14
11
  };
15
12
 
@@ -0,0 +1,14 @@
1
+ #include <QDesktopWidget>
2
+ #include "WindowMaximize.h"
3
+ #include "WebPage.h"
4
+ #include "WebPageManager.h"
5
+
6
+ WindowMaximize::WindowMaximize(WebPageManager *manager, QStringList &arguments, QObject *parent) : WindowCommand(manager, arguments, parent) {
7
+ }
8
+
9
+ void WindowMaximize::windowFound(WebPage *page) {
10
+ QDesktopWidget *desktop = QApplication::desktop();
11
+ QRect area = desktop->availableGeometry();
12
+ page->resize(area.width(), area.height());
13
+ finish(true);
14
+ }
@@ -0,0 +1,12 @@
1
+ #include "WindowCommand.h"
2
+
3
+ class WindowMaximize : public WindowCommand {
4
+ Q_OBJECT
5
+
6
+ public:
7
+ WindowMaximize(WebPageManager *, QStringList &arguments, QObject *parent = 0);
8
+
9
+ protected:
10
+ virtual void windowFound(WebPage *);
11
+ };
12
+
@@ -0,0 +1,12 @@
1
+ #include "WindowOpen.h"
2
+ #include "SocketCommand.h"
3
+ #include "WebPage.h"
4
+ #include "WebPageManager.h"
5
+
6
+ WindowOpen::WindowOpen(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
7
+ }
8
+
9
+ void WindowOpen::start() {
10
+ manager()->createPage();
11
+ finish(true);
12
+ }
data/src/WindowOpen.h ADDED
@@ -0,0 +1,10 @@
1
+ #include "SocketCommand.h"
2
+
3
+ class WindowOpen : public SocketCommand {
4
+ Q_OBJECT
5
+
6
+ public:
7
+ WindowOpen(WebPageManager *, QStringList &arguments, QObject *parent = 0);
8
+ virtual void start();
9
+ };
10
+
@@ -0,0 +1,16 @@
1
+ #include "WindowResize.h"
2
+ #include "WebPage.h"
3
+ #include "WebPageManager.h"
4
+
5
+ WindowResize::WindowResize(WebPageManager *manager, QStringList &arguments, QObject *parent) : WindowCommand(manager, arguments, parent) {
6
+ }
7
+
8
+ void WindowResize::windowFound(WebPage *page) {
9
+ int width = arguments()[1].toInt();
10
+ int height = arguments()[2].toInt();
11
+
12
+ page->resize(width, height);
13
+
14
+ finish(true);
15
+ }
16
+
@@ -0,0 +1,12 @@
1
+ #include "WindowCommand.h"
2
+
3
+ class WindowResize : public WindowCommand {
4
+ Q_OBJECT
5
+
6
+ public:
7
+ WindowResize(WebPageManager *, QStringList &arguments, QObject *parent = 0);
8
+
9
+ protected:
10
+ virtual void windowFound(WebPage *);
11
+ };
12
+
@@ -0,0 +1,17 @@
1
+ #include "WindowSize.h"
2
+ #include "WebPage.h"
3
+ #include "WebPageManager.h"
4
+ #include "JsonSerializer.h"
5
+
6
+ WindowSize::WindowSize(WebPageManager *manager, QStringList &arguments, QObject *parent) : WindowCommand(manager, arguments, parent) {
7
+ }
8
+
9
+ void WindowSize::windowFound(WebPage *page) {
10
+ QSize size = page->viewportSize();
11
+ QVariantList elements;
12
+ elements << size.width();
13
+ elements << size.height();
14
+ JsonSerializer serializer;
15
+ QByteArray json = serializer.serialize(elements);
16
+ finish(true, json);
17
+ }
data/src/WindowSize.h ADDED
@@ -0,0 +1,12 @@
1
+ #include "WindowCommand.h"
2
+
3
+ class WindowSize : public WindowCommand {
4
+ Q_OBJECT
5
+
6
+ public:
7
+ WindowSize(WebPageManager *, QStringList &arguments, QObject *parent = 0);
8
+
9
+ protected:
10
+ virtual void windowFound(WebPage *);
11
+ };
12
+
data/src/capybara.js CHANGED
@@ -66,7 +66,9 @@ Capybara = {
66
66
  text: function (index) {
67
67
  var node = this.getNode(index);
68
68
  var type = (node.type || node.tagName).toLowerCase();
69
- if (type == "textarea") {
69
+ if (!this.isNodeVisible(node)) {
70
+ return '';
71
+ } else if (type == "textarea") {
70
72
  return node.innerHTML;
71
73
  } else {
72
74
  return node.innerText || node.textContent;
@@ -286,20 +288,34 @@ Capybara = {
286
288
  CapybaraInvocation.keypress(value[strindex]);
287
289
  }
288
290
 
291
+ if (value == '')
292
+ this.trigger(index, "change");
289
293
  } else if (type === "checkbox" || type === "radio") {
290
294
  if (node.checked != (value === "true")) {
291
295
  this.leftClick(index);
292
296
  }
293
-
294
297
  } else if (type === "file") {
295
298
  this.attachedFiles = Array.prototype.slice.call(arguments, 1);
296
299
  this.leftClick(index);
297
-
300
+ } else if (this.isContentEditable(node)) {
301
+ var content = document.createTextNode(value);
302
+ node.innerHTML = '';
303
+ node.appendChild(content);
298
304
  } else {
299
305
  node.value = value;
300
306
  }
301
307
  },
302
308
 
309
+ isContentEditable: function(node) {
310
+ if (node.contentEditable == 'true') {
311
+ return true;
312
+ } else if (node.contentEditable == 'false') {
313
+ return false;
314
+ } else if (node.contentEditable == 'inherit') {
315
+ return this.isContentEditable(node.parentNode);
316
+ }
317
+ },
318
+
303
319
  focus: function(index) {
304
320
  this.getNode(index).focus();
305
321
  },
data/src/find_command.h CHANGED
@@ -21,7 +21,7 @@ CHECK_COMMAND(GetCookies)
21
21
  CHECK_COMMAND(SetProxy)
22
22
  CHECK_COMMAND(ConsoleMessages)
23
23
  CHECK_COMMAND(CurrentUrl)
24
- CHECK_COMMAND(ResizeWindow)
24
+ CHECK_COMMAND(WindowResize)
25
25
  CHECK_COMMAND(IgnoreSslErrors)
26
26
  CHECK_COMMAND(SetSkipImageLoading)
27
27
  CHECK_COMMAND(WindowFocus)
@@ -42,3 +42,9 @@ CHECK_COMMAND(SetUrlBlacklist)
42
42
  CHECK_COMMAND(Title)
43
43
  CHECK_COMMAND(Version)
44
44
  CHECK_COMMAND(FindCss)
45
+ CHECK_COMMAND(WindowClose)
46
+ CHECK_COMMAND(WindowOpen)
47
+ CHECK_COMMAND(WindowSize)
48
+ CHECK_COMMAND(WindowMaximize)
49
+ CHECK_COMMAND(GoBack)
50
+ CHECK_COMMAND(GoForward)
data/src/main.cpp CHANGED
@@ -1,5 +1,6 @@
1
1
  #include "Server.h"
2
2
  #include "IgnoreDebugOutput.h"
3
+ #include "StdinNotifier.h"
3
4
  #include <QApplication>
4
5
  #include <iostream>
5
6
  #ifdef Q_OS_UNIX
@@ -19,6 +20,9 @@ int main(int argc, char **argv) {
19
20
  app.setOrganizationName("thoughtbot, inc");
20
21
  app.setOrganizationDomain("thoughtbot.com");
21
22
 
23
+ StdinNotifier notifier;
24
+ QObject::connect(&notifier, SIGNAL(eof()), &app, SLOT(quit()));
25
+
22
26
  ignoreDebugOutput();
23
27
  Server server(0);
24
28
 
@@ -1,7 +1,19 @@
1
1
  TEMPLATE = app
2
2
  TARGET = webkit_server
3
3
  DESTDIR = .
4
+ PROJECT_DIR = $$_PRO_FILE_PWD_
5
+ BUILD_DIR = $${PROJECT_DIR}/build
6
+ PRECOMPILED_DIR = $${BUILD_DIR}
7
+ OBJECTS_DIR = $${BUILD_DIR}
8
+ MOC_DIR = $${BUILD_DIR}
4
9
  HEADERS = \
10
+ GoForward.h \
11
+ GoBack.h \
12
+ WindowMaximize.h \
13
+ WindowSize.h \
14
+ WindowCommand.h \
15
+ WindowOpen.h \
16
+ WindowClose.h \
5
17
  Version.h \
6
18
  EnableLogging.h \
7
19
  Authenticate.h \
@@ -13,7 +25,7 @@ HEADERS = \
13
25
  JavascriptConfirmMessages.h \
14
26
  JavascriptPromptMessages.h \
15
27
  IgnoreSslErrors.h \
16
- ResizeWindow.h \
28
+ WindowResize.h \
17
29
  CurrentUrl.h \
18
30
  ConsoleMessages.h \
19
31
  WebPage.h \
@@ -63,9 +75,17 @@ HEADERS = \
63
75
  JavascriptCommand.h \
64
76
  FindXpath.h \
65
77
  NetworkReplyProxy.h \
66
- IgnoreDebugOutput.h
78
+ IgnoreDebugOutput.h \
79
+ StdinNotifier.h
67
80
 
68
81
  SOURCES = \
82
+ GoForward.cpp \
83
+ GoBack.cpp \
84
+ WindowMaximize.cpp \
85
+ WindowSize.cpp \
86
+ WindowCommand.cpp \
87
+ WindowOpen.cpp \
88
+ WindowClose.cpp \
69
89
  Version.cpp \
70
90
  EnableLogging.cpp \
71
91
  Authenticate.cpp \
@@ -77,7 +97,7 @@ SOURCES = \
77
97
  JavascriptConfirmMessages.cpp \
78
98
  JavascriptPromptMessages.cpp \
79
99
  IgnoreSslErrors.cpp \
80
- ResizeWindow.cpp \
100
+ WindowResize.cpp \
81
101
  CurrentUrl.cpp \
82
102
  ConsoleMessages.cpp \
83
103
  main.cpp \
@@ -128,7 +148,8 @@ SOURCES = \
128
148
  JavascriptCommand.cpp \
129
149
  FindXpath.cpp \
130
150
  NetworkReplyProxy.cpp \
131
- IgnoreDebugOutput.cpp
151
+ IgnoreDebugOutput.cpp \
152
+ StdinNotifier.cpp
132
153
 
133
154
  RESOURCES = webkit_server.qrc
134
155
  QT += network
@@ -1,5 +1,7 @@
1
1
  #include "NAME.h"
2
+ #include "SocketCommand.h"
2
3
  #include "WebPage.h"
4
+ #include "WebPageManager.h"
3
5
 
4
6
  NAME::NAME(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
5
7
  }
data/templates/Command.h CHANGED
@@ -1,6 +1,4 @@
1
- #include "Command.h"
2
-
3
- class WebPage;
1
+ #include "SocketCommand.h"
4
2
 
5
3
  class NAME : public SocketCommand {
6
4
  Q_OBJECT