Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 9 files changed
  • 0 commit comments
  • 1 contributor
Showing with 47 additions and 10 deletions.
  1. +1 −1 capybara-webkit.gemspec
  2. +3 −6 spec/integration/driver_spec.rb
  3. +1 −0 src/Connection.cpp
  4. +10 −0 src/Headers.cpp
  5. +12 −0 src/Headers.h
  6. +16 −1 src/WebPage.cpp
  7. +1 −0 src/WebPage.h
  8. +1 −0 src/find_command.h
  9. +2 −2 src/webkit_server.pro
View
2 capybara-webkit.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "capybara-webkit"
- s.version = "0.5.0"
+ s.version = "0.6.0"
s.authors = ["thoughtbot", "Joe Ferris", "Jason Morrison", "Tristan Dunn",
"Joshua Clayton", "Yuichi Tateno", "Aaron Gibralter",
"Vasily Reys", "petrushka", "John Bintz", "Chad Pytel",
View
9 spec/integration/driver_spec.rb
@@ -6,18 +6,15 @@
@driver = Capybara::Driver::Webkit.new(TestApp, :browser => $webkit_browser)
end
- # TODO: select options
- # it_should_behave_like "driver"
-
+ it_should_behave_like "driver"
it_should_behave_like "driver with javascript support"
it_should_behave_like "driver with cookies support"
-
+
it "returns the rack server port" do
@driver.server_port.should eq(@driver.instance_variable_get(:@rack_server).port)
end
- # Can't support:
- # it_should_behave_like "driver with header support"
+ it_should_behave_like "driver with header support"
# it_should_behave_like "driver with status code support"
# it_should_behave_like "driver with frame support"
end
View
1 src/Connection.cpp
@@ -13,6 +13,7 @@
#include "Header.h"
#include "Render.h"
#include "Body.h"
+#include "Headers.h"
#include <QTcpSocket>
#include <iostream>
View
10 src/Headers.cpp
@@ -0,0 +1,10 @@
+#include "Headers.h"
+#include "WebPage.h"
+
+Headers::Headers(WebPage *page, QObject *parent) : Command(page, parent) {
+}
+
+void Headers::start(QStringList &arguments) {
+ Q_UNUSED(arguments);
+}
+
View
12 src/Headers.h
@@ -0,0 +1,12 @@
+#include "Command.h"
+
+class WebPage;
+
+class Headers : public Command {
+ Q_OBJECT
+
+ public:
+ Headers(WebPage *page, QObject *parent = 0);
+ virtual void start(QStringList &arguments);
+};
+
View
17 src/WebPage.cpp
@@ -10,7 +10,9 @@ WebPage::WebPage(QObject *parent) : QWebPage(parent) {
m_loading = false;
- this->setNetworkAccessManager(new NetworkAccessManager());
+ NetworkAccessManager *manager = new NetworkAccessManager();
+ this->setNetworkAccessManager(manager);
+ connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(replyFinished(QNetworkReply *)));
connect(this, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
@@ -164,3 +166,16 @@ bool WebPage::extension(Extension extension, const ExtensionOption *option, Exte
QString WebPage::getLastAttachedFileName() {
return currentFrame()->evaluateJavaScript(QString("Capybara.lastAttachedFile")).toString();
}
+
+void WebPage::replyFinished(QNetworkReply *reply) {
+ QList<QByteArray> headers = reply->rawHeaderList();
+ for (int i = 0; i < headers.size(); i++) {
+ QByteArray header = headers.at(i);
+ std::cerr << qPrintable(QString(header)) << std::endl;
+ QByteArray value = reply->rawHeader(header);
+ std::cerr << qPrintable(QString(value)) << std::endl;
+ }
+ std::cerr << "Body:" << std::endl;
+ std::cerr << "Open? " << (reply->isOpen() ? "true" : "false") << std::endl;
+ std::cerr << "Pos " << (reply->pos()) << std::endl;
+}
View
1 src/WebPage.h
@@ -20,6 +20,7 @@ class WebPage : public QWebPage {
void loadFinished(bool);
bool isLoading() const;
void frameCreated(QWebFrame *);
+ void replyFinished(QNetworkReply *reply);
protected:
virtual void javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID);
View
1 src/find_command.h
@@ -15,3 +15,4 @@ CHECK_COMMAND(FrameFocus)
CHECK_COMMAND(Header)
CHECK_COMMAND(Render)
CHECK_COMMAND(Body)
+CHECK_COMMAND(Headers)
View
4 src/webkit_server.pro
@@ -1,8 +1,8 @@
TEMPLATE = app
TARGET = webkit_server
DESTDIR = .
-HEADERS = WebPage.h Server.h Connection.h Command.h Visit.h Find.h Reset.h Node.h JavascriptInvocation.h Url.h Source.h Evaluate.h Execute.h FrameFocus.h Response.h NetworkAccessManager.h Header.h Render.h body.h
-SOURCES = main.cpp WebPage.cpp Server.cpp Connection.cpp Command.cpp Visit.cpp Find.cpp Reset.cpp Node.cpp JavascriptInvocation.cpp Url.cpp Source.cpp Evaluate.cpp Execute.cpp FrameFocus.cpp Response.cpp NetworkAccessManager.cpp Header.cpp Render.cpp body.cpp
+HEADERS = WebPage.h Server.h Connection.h Command.h Visit.h Find.h Reset.h Node.h JavascriptInvocation.h Url.h Source.h Evaluate.h Execute.h FrameFocus.h Response.h NetworkAccessManager.h Header.h Render.h body.h Headers.h
+SOURCES = main.cpp WebPage.cpp Server.cpp Connection.cpp Command.cpp Visit.cpp Find.cpp Reset.cpp Node.cpp JavascriptInvocation.cpp Url.cpp Source.cpp Evaluate.cpp Execute.cpp FrameFocus.cpp Response.cpp NetworkAccessManager.cpp Header.cpp Render.cpp body.cpp Headers.cpp
RESOURCES = webkit_server.qrc
QT += network webkit
CONFIG += console

No commit comments for this range

Something went wrong with that request. Please try again.