jasmine-headless-webkit/ext/jasmine-webkit-specrunner/Page.cpp
2011-08-29 13:35:36 -04:00

32 lines
813 B
C++

#include <QtGui>
#include <QtWebKit>
#include <iostream>
#include "Page.h"
namespace HeadlessSpecRunner {
Page::Page() : QWebPage(), confirmResult(true) {}
void Page::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID) {
emit consoleLog(message, lineNumber, sourceID);
}
bool Page::javaScriptConfirm(QWebFrame*, const QString&) {
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;
}
}
void Page::javaScriptAlert(QWebFrame*, const QString &msg) {
emit internalLog("alert", msg);
}
void Page::oneFalseConfirm() {
confirmResult = false;
}
}