WebDriver: Implement page load strategy
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Aug 2017 11:14:34 +0000 (11:14 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Aug 2017 11:14:34 +0000 (11:14 +0000)
commitdbbacec6f2da2252a04c45c148bcb82128273462
tree7fc0831e2a04cb0aa73fdeb12c74404cdab7a7d2
parentcb4c3a2c6033c1b38356e87d8a0a76054158fadc
WebDriver: Implement page load strategy
https://bugs.webkit.org/show_bug.cgi?id=175183

Reviewed by Brian Burg.

Source/WebDriver:

Validate and parse page load strategy when processing capabilities.

* Capabilities.h:
* Session.cpp:
(WebDriver::Session::pageLoadStrategyString const): Helper to get the page load strategy as a String to be
passed to Automation.
(WebDriver::Session::go): Pass page load strategy if present.
(WebDriver::Session::back): Ditto.
(WebDriver::Session::forward): Ditto.
(WebDriver::Session::refresh): Ditto.
(WebDriver::Session::waitForNavigationToComplete): Ditto.
* Session.h:
* WebDriverService.cpp:
(WebDriver::deserializePageLoadStrategy):
(WebDriver::WebDriverService::parseCapabilities const):
(WebDriver::WebDriverService::validatedCapabilities const):
(WebDriver::WebDriverService::newSession):

Source/WebKit:

Split pending navigation maps into normal and eager, and use one or the other depending on the received page
load strategy. We need to keep different maps for every page load strategy because every command could use a
different strategy.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::waitForNavigationToComplete): Extract page load strategy from parameter and pass
it to waitForNavigationToCompleteOnPage() and waitForNavigationToCompleteOnFrame().
(WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage): Return early if page load strategy is
none. Otherwise at the pening callback to the normal or eager map depeding on the page load straegy.
(WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame): Ditto.
(WebKit::respondToPendingNavigationCallbacksWithTimeout): Helper to send pening navigation callback in case of
timeout failure.
(WebKit::WebAutomationSession::loadTimerFired): Call finishPendingNavigationsWithTimeoutFailure() with all the maps.
(WebKit::WebAutomationSession::navigateBrowsingContext): Extract page load strategy from parameter and pass it
to waitForNavigationToCompleteOnPage().
(WebKit::WebAutomationSession::goBackInBrowsingContext): Ditto.
(WebKit::WebAutomationSession::goForwardInBrowsingContext): Ditto.
(WebKit::WebAutomationSession::reloadBrowsingContext): Ditto.
(WebKit::WebAutomationSession::navigationOccurredForFrame): Use the normal maps.
(WebKit::WebAutomationSession::documentLoadedForFrame): Stop timeout timer and dispatch eager pending navigations.
* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didFinishDocumentLoadForFrame): Notify the automation session.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220317 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebDriver/Capabilities.h
Source/WebDriver/ChangeLog
Source/WebDriver/Session.cpp
Source/WebDriver/Session.h
Source/WebDriver/WebDriverService.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
Source/WebKit/UIProcess/Automation/WebAutomationSession.h
Source/WebKit/UIProcess/WebPageProxy.cpp