RESOLVED FIXED 31583
[Qt] better test coverage for ErrorPageExtension
https://bugs.webkit.org/show_bug.cgi?id=31583
Summary [Qt] better test coverage for ErrorPageExtension
Antonio Gomes
Reported 2009-11-17 05:44:25 PST
load errors in iframes and framesets are currently not covered by qwebpage's autotests ... patch coming...
Attachments
patch 0.1 (4.66 KB, patch)
2009-11-17 05:49 PST, Antonio Gomes
kenneth: review-
patch 0.2 (4.59 KB, patch)
2009-11-17 06:04 PST, Antonio Gomes
kenneth: review-
(committed r51076) patch 0.3 (4.92 KB, patch)
2009-11-17 07:43 PST, Antonio Gomes
no flags
Antonio Gomes
Comment 1 2009-11-17 05:49:16 PST
Created attachment 43357 [details] patch 0.1
Kenneth Rohde Christiansen
Comment 2 2009-11-17 05:52:59 PST
Comment on attachment 43357 [details] patch 0.1 > + (tst_QWebPage::errorPageExtension_withIFrames): > + (tst_QWebPage::errorPageExtension_withFrameset): Strange function naming > void tst_QWebPage::infiniteLoopJS() > { > + return; Doesn't seem right > - page->mainFrame()->load(QUrl("qrc:///frametest/index.html")); > + m_view->setUrl(QUrl("data:text/html,foo")); > + QTest::qWait(2000); Can these waits be avoided?
Antonio Gomes
Comment 3 2009-11-17 06:04:22 PST
Created attachment 43359 [details] patch 0.2 thx for reviewing. > + (tst_QWebPage::errorPageExtension_withIFrames): > + (tst_QWebPage::errorPageExtension_withFrameset): > Strange function naming fixed. > void tst_QWebPage::infiniteLoopJS() > { > + return; > Doesn't seem right typo, removed. > - page->mainFrame()->load(QUrl("qrc:///frametest/index.html")); > + m_view->setUrl(QUrl("data:text/html,foo")); > + QTest::qWait(2000); > Can these waits be avoided? removed.
Kenneth Rohde Christiansen
Comment 4 2009-11-17 06:22:28 PST
> > void tst_QWebPage::infiniteLoopJS() > > { > > + return; > > Doesn't seem right > > typo, removed. If that is a typo, I will need to look very careful at your patches. Please be more careful. > > > - page->mainFrame()->load(QUrl("qrc:///frametest/index.html")); > > + m_view->setUrl(QUrl("data:text/html,foo")); > > + QTest::qWait(2000); > > Can these waits be avoided? > > removed. Why was it there in the first place?
Kenneth Rohde Christiansen
Comment 5 2009-11-17 06:26:29 PST
Comment on attachment 43359 [details] patch 0.2 Please respond these questions: > @@ -1629,12 +1631,8 @@ public: > const ErrorPageExtensionOption* info = static_cast<const ErrorPageExtensionOption*>(option); > ErrorPageExtensionReturn* errorPage = static_cast<ErrorPageExtensionReturn*>(output); > > - if (info->frame == mainFrame()) { > - errorPage->content = "data:text/html,error"; > - return true; > - } > - > - return false; > + errorPage->content = "data:text/html,error"; > + return true; > } This above doesn't seem to have to do with your new change. If not, please explain that in the changelog. > }; > > @@ -1645,11 +1643,10 @@ void tst_QWebPage::errorPageExtension() > > QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); > > - page->mainFrame()->load(QUrl("qrc:///frametest/index.html")); > + m_view->setUrl(QUrl("data:text/html,foo")); Is the frametest/index.html not needed anymore now? > - QCOMPARE(page->history()->currentItem().url(), QUrl("qrc:///frametest/index.html")); > + QCOMPARE(page->history()->currentItem().url(), QUrl("data:text/html,foo")); > + > + m_view->setPage(0); Why is this needed. Is it part of the test? Add a comment
Antonio Gomes
Comment 6 2009-11-17 06:45:35 PST
> > typo, removed. > If that is a typo, I will need to look very careful at your patches. Please be > more careful. well, it is really a typo. see 'infiniteLoop()' test (where i added the 'return') takes ~15 seconds running in my box. I added a 'return' there just to speed up my own test execution. so it was a small typo to forget to remove the 'return' and hapelly you catch it and it is fixed, so thank you again. > > > - page->mainFrame()->load(QUrl("qrc:///frametest/index.html")); > > > + m_view->setUrl(QUrl("data:text/html,foo")); > > > + QTest::qWait(2000); > > > Can these waits be avoided? > > removed. > Why was it there in the first place? there were not needed. removed. > > const ErrorPageExtensionOption* info = static_cast<const ErrorPageExtensionOption*>(option); > > ErrorPageExtensionReturn* errorPage = static_cast<ErrorPageExtensionReturn*>(output); > > > > - if (info->frame == mainFrame()) { > > - errorPage->content = "data:text/html,error"; > > - return true; > > - } > > - > > - return false; > > + errorPage->content = "data:text/html,error"; > > + return true; > > } > > This above doesn't seem to have to do with your new change. If not, please > explain that in the changelog. It is related, yes. We were firstly handling error pages for the mainFrame only. See "if (info->frame == mainFrame())". Now the "if" got removed, and we are handling it for all frames (which purpose of the patch). > > @@ -1645,11 +1643,10 @@ void tst_QWebPage::errorPageExtension() > > > > QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); > > > > - page->mainFrame()->load(QUrl("qrc:///frametest/index.html")); > > + m_view->setUrl(QUrl("data:text/html,foo")); > > Is the frametest/index.html not needed anymore now? it is not needed for the test "errorPageExtension" then I replaced it for a simpler URL. It is needed for the newly added "errorPageExtensionForFrameset" test, which specifically tests 'framesets'. > Why is this needed. Is it part of the test? Add a comment > > - QCOMPARE(page->history()->currentItem().url(), QUrl("qrc:///frametest/index.html")); > > + QCOMPARE(page->history()->currentItem().url(), QUrl("data:text/html,foo")); since i changed the url (see my answer to the question above ) it is needed. > > + m_view->setPage(0); it resets the page for the next test.
Kenneth Rohde Christiansen
Comment 7 2009-11-17 07:14:46 PST
Comment on attachment 43359 [details] patch 0.2 ChangeLog was not updated!
Antonio Gomes
Comment 8 2009-11-17 07:43:30 PST
Created attachment 43364 [details] (committed r51076) patch 0.3 Update changelog, sorry about that.
Antonio Gomes
Comment 9 2009-11-17 09:58:46 PST
Comment on attachment 43364 [details] (committed r51076) patch 0.3 thx for reviewing.
Antonio Gomes
Comment 10 2009-11-17 09:59:04 PST
landed r51076
Note You need to log in before you can comment on or make changes to this bug.