2010-07-11 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Jul 2010 03:41:11 +0000 (03:41 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Jul 2010 03:41:11 +0000 (03:41 +0000)
commita494786bf4d1bf1f396ce5b69389ffb04f7f5e70
tree4c6f38c0dd9f486af53e48323297c2a82cdba1e8
parentfdaf2412849074b208d003a183d8c1a9cade41fa
2010-07-11  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Dan Bernstein.

        Implement waitUntilDone and notifyDone for WebKitTestRunner
        https://bugs.webkit.org/show_bug.cgi?id=42049

        With this fix, most of the DOM tests pass.

        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
        (WTR::InjectedBundle::didCreatePage): Track the main page. Not
        a great way to do it in the future case where we may get multiple
        pages - we really need a way to send it over from the ui process.
        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
        (WTR::InjectedBundle::page): A way to get the main page.
        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::InjectedBundlePage::InjectedBundlePage): Initialize m_isLoading to false.
        (WTR::InjectedBundlePage::didStartProvisionalLoadForFrame): Track that we
        are loading.
        (WTR::InjectedBundlePage::dump): Factor into a method so this can be
        called by the layout test controller. Also, cancel any pending watchdogs.
        (WTR::InjectedBundlePage::didFinishLoadForFrame): Note that we are done loading.
        (WTR::InjectedBundlePage::didFailLoadWithErrorForFrame): Ditto.
        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
        (WTR::InjectedBundlePage::isLoading): A way to track if we are loading.
        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
        (WTR::LayoutTestController::LayoutTestController): Initialize m_waitToDump
        to false.
        (WTR::LayoutTestController::invalidateWaitToDumpWatchdog): Invalidate
        the watchdog.
        (WTR::waitUntilDoneWatchdogFired): Static helper for the watchdog timer.
        (WTR::LayoutTestController::setWaitToDump): Set the flag.
        (WTR::LayoutTestController::waitToDumpWatchdogTimerFired): Handle the case
        where waitUntilDone times out.
        (WTR::LayoutTestController::notifyDone): Dump, if loading is done.
        (WTR::waitUntilDoneCallback): JS glue for waitUntilDone.
        (WTR::notifyDoneCallback): JS glue for notifyDone.
        (WTR::LayoutTestController::staticFunctions): Add waitUntilDone and notifyDone
        to the layoutController.
        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
        (WTR::LayoutTestController::waitToDump): Inline method to get the wait state.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63061 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKitTools/ChangeLog
WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h