jasmine-headless-webkit/ext/jasmine-webkit-specrunner/Page.cpp

30 lines
780 B
C++
Raw Normal View History

2011-08-01 17:09:08 +00:00
#include <QtGui>
#include <QtWebKit>
2011-08-26 15:18:04 +00:00
#include <iostream>
2011-08-01 17:09:08 +00:00
#include "Page.h"
Page::Page() : QWebPage(), confirmResult(true) {}
void Page::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID) {
emit consoleLog(message, lineNumber, sourceID);
}
2011-08-29 17:35:36 +00:00
bool Page::javaScriptConfirm(QWebFrame*, const QString&) {
2011-08-01 17:09:08 +00:00
if (confirmResult) {
emit internalLog("TODO", "jasmine-headless-webkit can't handle confirm() yet! You should mock window.confirm for now. Returning true.");
return true;
} else {
confirmResult = true;
return false;
}
}
2011-08-29 17:35:36 +00:00
void Page::javaScriptAlert(QWebFrame*, const QString &msg) {
2011-08-01 17:09:08 +00:00
emit internalLog("alert", msg);
}
void Page::oneFalseConfirm() {
confirmResult = false;
}