Commit 6efe3b75 authored by hausmann@webkit.org's avatar hausmann@webkit.org

2008-11-06 Simon Hausmann <hausmann@webkit.org>

        Reviewed by Tor Arne Vestbø.

        Added a unit tests for QWebFrame::metaData().

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38161 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent cd8b9c31
2008-11-06 Simon Hausmann <hausmann@webkit.org>
Reviewed by Tor Arne Vestbø.
Added a unit tests for QWebFrame::metaData().
* tests/qwebframe/tst_qwebframe.cpp:
2008-11-06 Simon Hausmann <hausmann@webkit.org>
Reviewed by Tor Arne Vestbø.
......
......@@ -565,6 +565,7 @@ private slots:
void domCycles();
void setHtml();
void ipv6HostEncoding();
void metaData();
private:
QString evalJS(const QString&s) {
// Convert an undefined return variant to the string "undefined"
......@@ -2068,5 +2069,42 @@ void tst_QWebFrame::ipv6HostEncoding()
QCOMPARE(networkManager->requestedUrls.at(0), QUrl::fromEncoded("http://[::1]/test.xml"));
}
void tst_QWebFrame::metaData()
{
m_view->setHtml("<html>"
" <head>"
" <meta name=\"description\" content=\"Test description\">"
" <meta name=\"keywords\" content=\"HTML, JavaScript, Css\">"
" </head>"
"</html>");
QMultiMap<QString, QString> metaData = m_view->page()->mainFrame()->metaData();
QCOMPARE(metaData.count(), 2);
QCOMPARE(metaData.value("description"), QString("Test description"));
QCOMPARE(metaData.value("keywords"), QString("HTML, JavaScript, Css"));
QCOMPARE(metaData.value("nonexistant"), QString());
m_view->setHtml("<html>"
" <head>"
" <meta name=\"samekey\" content=\"FirstValue\">"
" <meta name=\"samekey\" content=\"SecondValue\">"
" </head>"
"</html>");
metaData = m_view->page()->mainFrame()->metaData();
QCOMPARE(metaData.count(), 2);
QStringList values = metaData.values("samekey");
QCOMPARE(values.count(), 2);
QVERIFY(values.contains("FirstValue"));
QVERIFY(values.contains("SecondValue"));
QCOMPARE(metaData.value("nonexistant"), QString());
}
QTEST_MAIN(tst_QWebFrame)
#include "tst_qwebframe.moc"
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