mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Rename Command::emitFinished to finish
This commit is contained in:
parent
9f85bb20e4
commit
c74949bd04
42 changed files with 56 additions and 56 deletions
|
@ -13,6 +13,6 @@ void Authenticate::start() {
|
|||
networkAccessManager->setUserName(username);
|
||||
networkAccessManager->setPassword(password);
|
||||
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,5 +9,5 @@ ClearCookies::ClearCookies(WebPageManager *manager, QStringList &arguments, QObj
|
|||
void ClearCookies::start()
|
||||
{
|
||||
manager()->cookieJar()->clearCookies();
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ ClearPromptText::ClearPromptText(WebPageManager *manager, QStringList &arguments
|
|||
void ClearPromptText::start()
|
||||
{
|
||||
page()->setPromptText(QString());
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
|
|
@ -8,18 +8,18 @@ QString Command::toString() const {
|
|||
return metaObject()->className();
|
||||
}
|
||||
|
||||
void Command::emitFinished(bool success) {
|
||||
void Command::finish(bool success) {
|
||||
emit finished(new Response(success, this));
|
||||
}
|
||||
|
||||
void Command::emitFinished(bool success, QString message) {
|
||||
void Command::finish(bool success, QString message) {
|
||||
emit finished(new Response(success, message, this));
|
||||
}
|
||||
|
||||
void Command::emitFinished(bool success, QByteArray message) {
|
||||
void Command::finish(bool success, QByteArray message) {
|
||||
emit finished(new Response(success, message, this));
|
||||
}
|
||||
|
||||
void Command::emitFinished(bool success, ErrorMessage *message) {
|
||||
void Command::finish(bool success, ErrorMessage *message) {
|
||||
emit finished(new Response(success, message, this));
|
||||
}
|
||||
|
|
|
@ -16,10 +16,10 @@ class Command : public QObject {
|
|||
virtual QString toString() const;
|
||||
|
||||
protected:
|
||||
void emitFinished(bool success);
|
||||
void emitFinished(bool success, QString message);
|
||||
void emitFinished(bool success, QByteArray message);
|
||||
void emitFinished(bool success, ErrorMessage *message);
|
||||
void finish(bool success);
|
||||
void finish(bool success, QString message);
|
||||
void finish(bool success, QByteArray message);
|
||||
void finish(bool success, ErrorMessage *message);
|
||||
|
||||
signals:
|
||||
void finished(Response *response);
|
||||
|
|
|
@ -9,6 +9,6 @@ ConsoleMessages::ConsoleMessages(WebPageManager *manager, QStringList &arguments
|
|||
void ConsoleMessages::start() {
|
||||
JsonSerializer serializer;
|
||||
QByteArray json = serializer.serialize(page()->consoleMessages());
|
||||
emitFinished(true, json);
|
||||
finish(true, json);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@ void CurrentUrl::start() {
|
|||
QStringList arguments;
|
||||
QVariant result = page()->currentFrame()->evaluateJavaScript("window.location.toString()");
|
||||
QString url = result.toString();
|
||||
emitFinished(true, url);
|
||||
finish(true, url);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,5 +6,5 @@ EnableLogging::EnableLogging(WebPageManager *manager, QStringList &arguments, QO
|
|||
|
||||
void EnableLogging::start() {
|
||||
manager()->enableLogging();
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
|
|
@ -10,5 +10,5 @@ Evaluate::Evaluate(WebPageManager *manager, QStringList &arguments, QObject *par
|
|||
void Evaluate::start() {
|
||||
QVariant result = page()->currentFrame()->evaluateJavaScript(arguments()[0]);
|
||||
JsonSerializer serializer;
|
||||
emitFinished(true, serializer.serialize(result));
|
||||
finish(true, serializer.serialize(result));
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ void Execute::start() {
|
|||
QString script = arguments()[0] + QString("; 'success'");
|
||||
QVariant result = page()->currentFrame()->evaluateJavaScript(script);
|
||||
if (result.isValid()) {
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
} else {
|
||||
emitFinished(false, new ErrorMessage("Javascript failed to execute"));
|
||||
finish(false, new ErrorMessage("Javascript failed to execute"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ void Find::start() {
|
|||
InvocationResult result = page()->invokeCapybaraFunction("find", arguments());
|
||||
|
||||
if (result.hasError())
|
||||
return emitFinished(false, result.errorMessage());
|
||||
return finish(false, result.errorMessage());
|
||||
|
||||
QString message;
|
||||
message = result.result().toString();
|
||||
emitFinished(true, message);
|
||||
finish(true, message);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ void FrameFocus::focusId(QString name) {
|
|||
|
||||
void FrameFocus::focusParent() {
|
||||
if (page()->currentFrame()->parentFrame() == 0) {
|
||||
emitFinished(false, new ErrorMessage("Already at parent frame."));
|
||||
finish(false, new ErrorMessage("Already at parent frame."));
|
||||
} else {
|
||||
page()->currentFrame()->parentFrame()->setFocus();
|
||||
success();
|
||||
|
@ -60,9 +60,9 @@ void FrameFocus::focusParent() {
|
|||
}
|
||||
|
||||
void FrameFocus::frameNotFound() {
|
||||
emitFinished(false, new ErrorMessage("Unable to locate frame."));
|
||||
finish(false, new ErrorMessage("Unable to locate frame."));
|
||||
}
|
||||
|
||||
void FrameFocus::success() {
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
|
|
@ -15,5 +15,5 @@ void GetCookies::start()
|
|||
m_buffer.append(cookie.toRawForm());
|
||||
m_buffer.append("\n");
|
||||
}
|
||||
emitFinished(true, m_buffer);
|
||||
finish(true, m_buffer);
|
||||
}
|
||||
|
|
|
@ -5,5 +5,5 @@ GetTimeout::GetTimeout(WebPageManager *manager, QStringList &arguments, QObject
|
|||
}
|
||||
|
||||
void GetTimeout::start() {
|
||||
emitFinished(true, QString::number(manager()->getTimeout()));
|
||||
finish(true, QString::number(manager()->getTimeout()));
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ GetWindowHandle::GetWindowHandle(WebPageManager *manager, QStringList &arguments
|
|||
}
|
||||
|
||||
void GetWindowHandle::start() {
|
||||
emitFinished(true, page()->uuid());
|
||||
finish(true, page()->uuid());
|
||||
}
|
||||
|
|
|
@ -17,5 +17,5 @@ void GetWindowHandles::start() {
|
|||
JsonSerializer serializer;
|
||||
QByteArray json = serializer.serialize(handles);
|
||||
|
||||
emitFinished(true, json);
|
||||
finish(true, json);
|
||||
}
|
||||
|
|
|
@ -15,5 +15,5 @@ void Header::start() {
|
|||
} else {
|
||||
networkAccessManager->addHeader(key, value);
|
||||
}
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ void Headers::start() {
|
|||
foreach(QNetworkReply::RawHeaderPair header, page()->pageHeaders())
|
||||
headers << header.first+": "+header.second;
|
||||
|
||||
emitFinished(true, headers.join("\n"));
|
||||
finish(true, headers.join("\n"));
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,6 @@ IgnoreSslErrors::IgnoreSslErrors(WebPageManager *manager, QStringList &arguments
|
|||
|
||||
void IgnoreSslErrors::start() {
|
||||
manager()->setIgnoreSslErrors(true);
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,5 +9,5 @@ void JavascriptAlertMessages::start()
|
|||
{
|
||||
JsonSerializer serializer;
|
||||
QByteArray json = serializer.serialize(page()->alertMessages());
|
||||
emitFinished(true, json);
|
||||
finish(true, json);
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@ void JavascriptConfirmMessages::start()
|
|||
{
|
||||
JsonSerializer serializer;
|
||||
QByteArray json = serializer.serialize(page()->confirmMessages());
|
||||
emitFinished(true, json);
|
||||
finish(true, json);
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@ void JavascriptPromptMessages::start()
|
|||
{
|
||||
JsonSerializer serializer;
|
||||
QByteArray json = serializer.serialize(page()->promptMessages());
|
||||
emitFinished(true, json);
|
||||
finish(true, json);
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ void Node::start() {
|
|||
InvocationResult result = page()->invokeCapybaraFunction(functionName, functionArguments);
|
||||
|
||||
if (result.hasError())
|
||||
return emitFinished(false, result.errorMessage());
|
||||
return finish(false, result.errorMessage());
|
||||
|
||||
QString attributeValue = result.result().toString();
|
||||
emitFinished(true, attributeValue);
|
||||
finish(true, attributeValue);
|
||||
}
|
||||
|
||||
QString Node::toString() const {
|
||||
|
|
|
@ -9,6 +9,6 @@ NullCommand::NullCommand(QString name, QObject *parent) : Command(parent) {
|
|||
|
||||
void NullCommand::start() {
|
||||
QString failure = QString("[Capybara WebKit] Unknown command: ") + m_name + "\n";
|
||||
emitFinished(false, new ErrorMessage(failure));
|
||||
finish(false, new ErrorMessage(failure));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ void PageLoadingCommand::pendingLoadFinished(bool success) {
|
|||
emit finished(m_pendingResponse);
|
||||
} else {
|
||||
QString message = m_manager->currentPage()->failureString();
|
||||
emitFinished(false, new ErrorMessage(message));
|
||||
finish(false, new ErrorMessage(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,5 +14,5 @@ void Render::start() {
|
|||
|
||||
bool result = page()->render( imagePath, size );
|
||||
|
||||
emitFinished(result);
|
||||
finish(result);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,6 @@ void Reset::start() {
|
|||
|
||||
manager()->reset();
|
||||
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,6 @@ void ResizeWindow::start() {
|
|||
QSize size(width, height);
|
||||
page()->setViewportSize(size);
|
||||
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,5 +7,5 @@ SetConfirmAction::SetConfirmAction(WebPageManager *manager, QStringList &argumen
|
|||
void SetConfirmAction::start()
|
||||
{
|
||||
page()->setConfirmAction(arguments()[0]);
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ void SetCookie::start()
|
|||
QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(arguments()[0].toAscii());
|
||||
NetworkCookieJar *jar = manager()->cookieJar();
|
||||
jar->overwriteCookies(cookies);
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ SetPromptAction::SetPromptAction(WebPageManager *manager, QStringList &arguments
|
|||
void SetPromptAction::start()
|
||||
{
|
||||
page()->setPromptAction(arguments()[0]);
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ SetPromptText::SetPromptText(WebPageManager *manager, QStringList &arguments, QO
|
|||
void SetPromptText::start()
|
||||
{
|
||||
page()->setPromptText(arguments()[0]);
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
|
|
@ -19,5 +19,5 @@ void SetProxy::start()
|
|||
arguments()[3]);
|
||||
|
||||
page()->networkAccessManager()->setProxy(proxy);
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ SetSkipImageLoading::SetSkipImageLoading(WebPageManager *manager, QStringList &a
|
|||
|
||||
void SetSkipImageLoading::start() {
|
||||
page()->setSkipImageLoading(arguments().contains("true"));
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ void SetTimeout::start() {
|
|||
|
||||
if (ok) {
|
||||
manager()->setTimeout(timeout);
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
} else {
|
||||
emitFinished(false, new ErrorMessage("Invalid value for timeout"));
|
||||
finish(false, new ErrorMessage("Invalid value for timeout"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,6 @@ SetUrlBlacklist::SetUrlBlacklist(WebPageManager *manager, QStringList &arguments
|
|||
void SetUrlBlacklist::start() {
|
||||
NetworkAccessManager* networkAccessManager = page()->networkAccessManager();
|
||||
networkAccessManager->setUrlBlacklist(arguments());
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,6 @@ Status::Status(WebPageManager *manager, QStringList &arguments, QObject *parent)
|
|||
|
||||
void Status::start() {
|
||||
int status = page()->getLastStatus();
|
||||
emitFinished(true, QString::number(status));
|
||||
finish(true, QString::number(status));
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ void TimeoutCommand::pendingLoadFinished(bool success) {
|
|||
} else {
|
||||
disconnect(m_timer, SIGNAL(timeout()), this, SLOT(commandTimeout()));
|
||||
disconnect(m_manager, SIGNAL(loadStarted()), this, SLOT(pageLoadingFromCommand()));
|
||||
emitFinished(false, new ErrorMessage(m_manager->currentPage()->failureString()));
|
||||
finish(false, new ErrorMessage(m_manager->currentPage()->failureString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ void TimeoutCommand::commandTimeout() {
|
|||
disconnect(m_command, SIGNAL(finished(Response *)), this, SLOT(commandFinished(Response *)));
|
||||
m_manager->currentPage()->triggerAction(QWebPage::Stop);
|
||||
QString message = QString("Request timed out after %1 second(s)").arg(m_manager->getTimeout());
|
||||
emitFinished(false, new ErrorMessage("Capybara::Webkit::TimeoutError", message));
|
||||
finish(false, new ErrorMessage("Capybara::Webkit::TimeoutError", message));
|
||||
}
|
||||
|
||||
void TimeoutCommand::commandFinished(Response *response) {
|
||||
|
|
|
@ -9,5 +9,5 @@ void Version::start() {
|
|||
QString("Qt: ") + QT_VERSION_STR +
|
||||
QString("\nWebKit: ") + qWebKitVersion() +
|
||||
QString("\nQtWebKit: ") + QTWEBKIT_VERSION_STR;
|
||||
emitFinished(true, result);
|
||||
finish(true, result);
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@ Visit::Visit(WebPageManager *manager, QStringList &arguments, QObject *parent) :
|
|||
void Visit::start() {
|
||||
QUrl requestedUrl = QUrl::fromEncoded(arguments()[0].toUtf8(), QUrl::StrictMode);
|
||||
page()->currentFrame()->load(QUrl(requestedUrl));
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
|
|
@ -13,12 +13,12 @@ void WindowFocus::start() {
|
|||
}
|
||||
|
||||
void WindowFocus::windowNotFound() {
|
||||
emitFinished(false, new ErrorMessage("Unable to locate window."));
|
||||
finish(false, new ErrorMessage("Unable to locate window."));
|
||||
}
|
||||
|
||||
void WindowFocus::success(WebPage *page) {
|
||||
page->setFocus();
|
||||
emitFinished(true);
|
||||
finish(true);
|
||||
}
|
||||
|
||||
void WindowFocus::focusWindow(QString selector) {
|
||||
|
|
|
@ -12,5 +12,5 @@ void Body::start() {
|
|||
else
|
||||
result = page()->currentFrame()->toHtml();
|
||||
|
||||
emitFinished(true, result);
|
||||
finish(true, result);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue