1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00
capybara-webkit/src/WebPage.h
Andrew Wason f57b3a3d15 Make ignoring SSL errors an option.
webkit_server takes an --ignore-ssl-errors argument.
2011-10-14 16:38:07 -04:00

54 lines
1.9 KiB
C++

#include <QtWebKit>
class WebPage : public QWebPage {
Q_OBJECT
public:
WebPage(QObject *parent = 0);
QVariant invokeCapybaraFunction(const char *name, QStringList &arguments);
QVariant invokeCapybaraFunction(QString &name, QStringList &arguments);
QString failureString();
QString userAgentForUrl(const QUrl &url ) const;
void setUserAgent(QString userAgent);
int getLastStatus();
void resetResponseHeaders();
void setCustomNetworkAccessManager();
bool render(const QString &fileName);
virtual bool extension (Extension extension, const ExtensionOption *option=0, ExtensionReturn *output=0);
void setIgnoreSslErrors(bool ignore);
bool ignoreSslErrors();
public slots:
bool shouldInterruptJavaScript();
void injectJavascriptHelpers();
void loadStarted();
void loadFinished(bool);
bool isLoading() const;
QString pageHeaders();
void frameCreated(QWebFrame *);
void replyFinished(QNetworkReply *reply);
void ignoreSslErrors(QNetworkReply *reply, const QList<QSslError> &);
void handleUnsupportedContent(QNetworkReply *reply);
signals:
void pageFinished(bool);
protected:
virtual void javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID);
virtual void javaScriptAlert(QWebFrame *frame, const QString &message);
virtual bool javaScriptConfirm(QWebFrame *frame, const QString &message);
virtual bool javaScriptPrompt(QWebFrame *frame, const QString &message, const QString &defaultValue, QString *result);
virtual QString chooseFile(QWebFrame * parentFrame, const QString &suggestedFile);
private:
QString m_capybaraJavascript;
QString m_userAgent;
bool m_loading;
QString getLastAttachedFileName();
void loadJavascript();
void setUserStylesheet();
int m_lastStatus;
QString m_pageHeaders;
bool m_ignoreSslErrors;
};