Commit ba1be41c authored by hausmann@webkit.org's avatar hausmann@webkit.org

Added a test that console output works.

Patch by Warwick Allison <warwick.allison@nokia.com> on 2009-09-18
Reviewed by Simon Hausmann.

* tests/qwebpage/tst_qwebpage.cpp:
(ConsolePage::ConsolePage):
(ConsolePage::javaScriptConsoleMessage):
(tst_QWebPage::consoleOutput):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48501 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7c2f4a32
2009-09-18 Warwick Allison <warwick.allison@nokia.com>
Reviewed by Simon Hausmann.
Added a test that console output works.
* tests/qwebpage/tst_qwebpage.cpp:
(ConsolePage::ConsolePage):
(ConsolePage::javaScriptConsoleMessage):
(tst_QWebPage::consoleOutput):
2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
......
......@@ -114,6 +114,8 @@ private slots:
void testOptionalJSObjects();
void testEnablePersistentStorage();
void consoleOutput();
private:
......@@ -241,6 +243,31 @@ void tst_QWebPage::loadFinished()
QCOMPARE(spyLoadFinished.count(), 1);
}
class ConsolePage : public QWebPage
{
public:
ConsolePage(QObject* parent = 0) : QWebPage(parent) {}
virtual void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID)
{
messages.append(message);
lineNumbers.append(lineNumber);
sourceIDs.append(sourceID);
}
QStringList messages;
QList<int> lineNumbers;
QStringList sourceIDs;
};
void tst_QWebPage::consoleOutput()
{
ConsolePage page;
page.mainFrame()->evaluateJavaScript("this is not valid JavaScript");
QCOMPARE(page.messages.count(), 1);
QCOMPARE(page.lineNumbers.at(0), 1);
}
class TestPage : public QWebPage
{
public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment