WebDriver: implement maximize, minimize and fullscreen window commands
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 May 2018 08:54:37 +0000 (08:54 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 May 2018 08:54:37 +0000 (08:54 +0000)
commitfbcd1a2d10a5c441b41ee9897d18317d06a3bd7c
tree206c554835ef9066583e7394dc96501e193eb5eb
parentb3015abde3e3176d62cf5d52655be5946040e3ec
WebDriver: implement maximize, minimize and fullscreen window commands
https://bugs.webkit.org/show_bug.cgi?id=180398

Reviewed by Brian Burg.

Source/WebDriver:

* CMakeLists.txt: Add EnterFullscreen.js to the build.
* Session.cpp:
(WebDriver::Session::maximizeWindow):
(WebDriver::Session::minimizeWindow):
(WebDriver::Session::fullscreenWindow):
* Session.h:
* WebDriverService.cpp:
(WebDriver::WebDriverService::maximizeWindow):
(WebDriver::WebDriverService::minimizeWindow):
(WebDriver::WebDriverService::fullscreenWindow):
* WebDriverService.h:

Source/WebKit:

* UIProcess/API/APIAutomationSessionClient.h:
(API::AutomationSessionClient::requestMaximizeWindowOfPage): Added to allow clients maximize the window.
* UIProcess/API/glib/WebKitAutomationSession.cpp:
* UIProcess/API/glib/WebKitWebViewPrivate.h:
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
(WindowStateEvent::WindowStateEvent): Struct to handle window state events.
(WindowStateEvent::~WindowStateEvent): Complete the event.
(WindowStateEvent::complete): Call the completion handler is not called already.
(windowStateEventCallback): Handle window state event changes.
(webkitWebViewMaximizeWindow): Try to maximize the window and wait for the event.
(webkitWebViewMinimizeWindow): Try to minimize the window and wait for the event.
(webkitWebViewRestoreWindow): Try to unmaximize or unminimize the window and wait for the event.
* UIProcess/API/wpe/WebKitWebViewWPE.cpp:
(webkitWebViewMaximizeWindow):
(webkitWebViewMinimizeWindow):
(webkitWebViewRestoreWindow):
* UIProcess/Automation/Automation.json:
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::maximizeWindowOfBrowsingContext): Exit fullscreen, restore the window and then
maximize it.
(WebKit::WebAutomationSession::maximizeWindowForPage): Ask the client to maximize the window of page.
* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/Automation/atoms/EnterFullscreen.js:
(enterFullscreen): Return early if fullscreen is disabled or if window is already in fullscreen.

Tools:

* Scripts/webkitpy/port/xvfbdriver.py:
(XvfbDriver._setup_environ_for_test): Set UNDER_XVFB environment variable when running under Xvfb.

WebDriverTests:

Remove expectations for tests that are passing now.

* TestExpectations.json:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232150 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
Source/WebDriver/CMakeLists.txt
Source/WebDriver/ChangeLog
Source/WebDriver/Session.cpp
Source/WebDriver/Session.h
Source/WebDriver/WebDriverService.cpp
Source/WebDriver/WebDriverService.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APIAutomationSessionClient.h
Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h
Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp
Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp
Source/WebKit/UIProcess/Automation/Automation.json
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
Source/WebKit/UIProcess/Automation/WebAutomationSession.h
Source/WebKit/UIProcess/Automation/atoms/EnterFullscreen.js
Tools/ChangeLog
Tools/Scripts/webkitpy/port/xvfbdriver.py
WebDriverTests/ChangeLog
WebDriverTests/TestExpectations.json