Changeset 232150 in webkit
- Timestamp:
- May 24, 2018 1:54:37 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebDriver/CMakeLists.txt
r227845 r232150 23 23 ${WEBKIT_DIR}/UIProcess/Automation/atoms/ElementAttribute.js 24 24 ${WEBKIT_DIR}/UIProcess/Automation/atoms/ElementDisplayed.js 25 ${WEBKIT_DIR}/UIProcess/Automation/atoms/EnterFullscreen.js 25 26 ${WEBKIT_DIR}/UIProcess/Automation/atoms/FindNodes.js 26 27 ${WEBKIT_DIR}/UIProcess/Automation/atoms/FormElementClear.js -
trunk/Source/WebDriver/ChangeLog
r232111 r232150 1 2018-05-24 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 WebDriver: implement maximize, minimize and fullscreen window commands 4 https://bugs.webkit.org/show_bug.cgi?id=180398 5 6 Reviewed by Brian Burg. 7 8 * CMakeLists.txt: Add EnterFullscreen.js to the build. 9 * Session.cpp: 10 (WebDriver::Session::maximizeWindow): 11 (WebDriver::Session::minimizeWindow): 12 (WebDriver::Session::fullscreenWindow): 13 * Session.h: 14 * WebDriverService.cpp: 15 (WebDriver::WebDriverService::maximizeWindow): 16 (WebDriver::WebDriverService::minimizeWindow): 17 (WebDriver::WebDriverService::fullscreenWindow): 18 * WebDriverService.h: 19 1 20 2018-05-23 Carlos Garcia Campos <cgarcia@igalia.com> 2 21 -
trunk/Source/WebDriver/Session.cpp
r231632 r232150 770 770 return; 771 771 } 772 getToplevelBrowsingContextRect(WTFMove(completionHandler)); 773 }); 774 }); 775 } 776 777 void Session::maximizeWindow(Function<void (CommandResult&&)>&& completionHandler) 778 { 779 if (!m_toplevelBrowsingContext) { 780 completionHandler(CommandResult::fail(CommandResult::ErrorCode::NoSuchWindow)); 781 return; 782 } 783 784 handleUserPrompts([this, completionHandler = WTFMove(completionHandler)](CommandResult&& result) mutable { 785 if (result.isError()) { 786 completionHandler(WTFMove(result)); 787 return; 788 } 789 790 RefPtr<JSON::Object> parameters = JSON::Object::create(); 791 parameters->setString(ASCIILiteral("handle"), m_toplevelBrowsingContext.value()); 792 m_host->sendCommandToBackend(ASCIILiteral("maximizeWindowOfBrowsingContext"), WTFMove(parameters), [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (SessionHost::CommandResponse&& response) mutable { 793 if (response.isError) { 794 completionHandler(CommandResult::fail(WTFMove(response.responseObject))); 795 return; 796 } 797 getToplevelBrowsingContextRect(WTFMove(completionHandler)); 798 }); 799 }); 800 } 801 802 void Session::minimizeWindow(Function<void (CommandResult&&)>&& completionHandler) 803 { 804 if (!m_toplevelBrowsingContext) { 805 completionHandler(CommandResult::fail(CommandResult::ErrorCode::NoSuchWindow)); 806 return; 807 } 808 809 handleUserPrompts([this, completionHandler = WTFMove(completionHandler)](CommandResult&& result) mutable { 810 if (result.isError()) { 811 completionHandler(WTFMove(result)); 812 return; 813 } 814 815 RefPtr<JSON::Object> parameters = JSON::Object::create(); 816 parameters->setString(ASCIILiteral("handle"), m_toplevelBrowsingContext.value()); 817 m_host->sendCommandToBackend(ASCIILiteral("hideWindowOfBrowsingContext"), WTFMove(parameters), [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (SessionHost::CommandResponse&& response) mutable { 818 if (response.isError) { 819 completionHandler(CommandResult::fail(WTFMove(response.responseObject))); 820 return; 821 } 822 getToplevelBrowsingContextRect(WTFMove(completionHandler)); 823 }); 824 }); 825 } 826 827 void Session::fullscreenWindow(Function<void (CommandResult&&)>&& completionHandler) 828 { 829 if (!m_toplevelBrowsingContext) { 830 completionHandler(CommandResult::fail(CommandResult::ErrorCode::NoSuchWindow)); 831 return; 832 } 833 834 handleUserPrompts([this, completionHandler = WTFMove(completionHandler)](CommandResult&& result) mutable { 835 if (result.isError()) { 836 completionHandler(WTFMove(result)); 837 return; 838 } 839 840 RefPtr<JSON::Object> parameters = JSON::Object::create(); 841 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 842 parameters->setString(ASCIILiteral("function"), EnterFullscreenJavaScript); 843 parameters->setArray(ASCIILiteral("arguments"), JSON::Array::create()); 844 parameters->setBoolean(ASCIILiteral("expectsImplicitCallbackArgument"), true); 845 m_host->sendCommandToBackend(ASCIILiteral("evaluateJavaScriptFunction"), WTFMove(parameters), [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) mutable { 846 if (response.isError || !response.responseObject) { 847 completionHandler(CommandResult::fail(WTFMove(response.responseObject))); 848 return; 849 } 850 851 String valueString; 852 if (!response.responseObject->getString(ASCIILiteral("result"), valueString)) { 853 completionHandler(CommandResult::fail(CommandResult::ErrorCode::UnknownError)); 854 return; 855 } 856 RefPtr<JSON::Value> resultValue; 857 if (!JSON::Value::parseJSON(valueString, resultValue)) { 858 completionHandler(CommandResult::fail(CommandResult::ErrorCode::UnknownError)); 859 return; 860 } 861 772 862 getToplevelBrowsingContextRect(WTFMove(completionHandler)); 773 863 }); -
trunk/Source/WebDriver/Session.h
r231632 r232150 91 91 void getWindowRect(Function<void (CommandResult&&)>&&); 92 92 void setWindowRect(std::optional<double> x, std::optional<double> y, std::optional<double> width, std::optional<double> height, Function<void (CommandResult&&)>&&); 93 void maximizeWindow(Function<void (CommandResult&&)>&&); 94 void minimizeWindow(Function<void (CommandResult&&)>&&); 95 void fullscreenWindow(Function<void (CommandResult&&)>&&); 93 96 void findElements(const String& strategy, const String& selector, FindElementsMode, const String& rootElementID, Function<void (CommandResult&&)>&&); 94 97 void getActiveElement(Function<void (CommandResult&&)>&&); -
trunk/Source/WebDriver/WebDriverService.cpp
r231632 r232150 123 123 { HTTPMethod::Get, "/session/$sessionId/window/rect", &WebDriverService::getWindowRect }, 124 124 { HTTPMethod::Post, "/session/$sessionId/window/rect", &WebDriverService::setWindowRect }, 125 { HTTPMethod::Post, "/session/$sessionId/window/maximize", &WebDriverService::maximizeWindow }, 126 { HTTPMethod::Post, "/session/$sessionId/window/minimize", &WebDriverService::minimizeWindow }, 127 { HTTPMethod::Post, "/session/$sessionId/window/fullscreen", &WebDriverService::fullscreenWindow }, 125 128 126 129 { HTTPMethod::Post, "/session/$sessionId/element", &WebDriverService::findElement }, … … 969 972 } 970 973 974 void WebDriverService::maximizeWindow(RefPtr<JSON::Object>&& parameters, Function<void (CommandResult&&)>&& completionHandler) 975 { 976 // §10.7.3 Maximize Window 977 // https://w3c.github.io/webdriver/#maximize-window 978 if (findSessionOrCompleteWithError(*parameters, completionHandler)) 979 m_session->maximizeWindow(WTFMove(completionHandler)); 980 } 981 982 void WebDriverService::minimizeWindow(RefPtr<JSON::Object>&& parameters, Function<void (CommandResult&&)>&& completionHandler) 983 { 984 // §10.7.4 Minimize Window 985 // https://w3c.github.io/webdriver/#minimize-window 986 if (findSessionOrCompleteWithError(*parameters, completionHandler)) 987 m_session->minimizeWindow(WTFMove(completionHandler)); 988 } 989 990 void WebDriverService::fullscreenWindow(RefPtr<JSON::Object>&& parameters, Function<void (CommandResult&&)>&& completionHandler) 991 { 992 // §10.7.5 Fullscreen Window 993 // https://w3c.github.io/webdriver/#fullscreen-window 994 if (findSessionOrCompleteWithError(*parameters, completionHandler)) 995 m_session->fullscreenWindow(WTFMove(completionHandler)); 996 } 997 971 998 void WebDriverService::closeWindow(RefPtr<JSON::Object>&& parameters, Function<void (CommandResult&&)>&& completionHandler) 972 999 { -
trunk/Source/WebDriver/WebDriverService.h
r231632 r232150 80 80 void getWindowRect(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&); 81 81 void setWindowRect(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&); 82 void maximizeWindow(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&); 83 void minimizeWindow(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&); 84 void fullscreenWindow(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&); 82 85 void findElement(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&); 83 86 void findElements(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&); -
trunk/Source/WebKit/ChangeLog
r232136 r232150 1 2018-05-24 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 WebDriver: implement maximize, minimize and fullscreen window commands 4 https://bugs.webkit.org/show_bug.cgi?id=180398 5 6 Reviewed by Brian Burg. 7 8 * UIProcess/API/APIAutomationSessionClient.h: 9 (API::AutomationSessionClient::requestMaximizeWindowOfPage): Added to allow clients maximize the window. 10 * UIProcess/API/glib/WebKitAutomationSession.cpp: 11 * UIProcess/API/glib/WebKitWebViewPrivate.h: 12 * UIProcess/API/gtk/WebKitWebViewGtk.cpp: 13 (WindowStateEvent::WindowStateEvent): Struct to handle window state events. 14 (WindowStateEvent::~WindowStateEvent): Complete the event. 15 (WindowStateEvent::complete): Call the completion handler is not called already. 16 (windowStateEventCallback): Handle window state event changes. 17 (webkitWebViewMaximizeWindow): Try to maximize the window and wait for the event. 18 (webkitWebViewMinimizeWindow): Try to minimize the window and wait for the event. 19 (webkitWebViewRestoreWindow): Try to unmaximize or unminimize the window and wait for the event. 20 * UIProcess/API/wpe/WebKitWebViewWPE.cpp: 21 (webkitWebViewMaximizeWindow): 22 (webkitWebViewMinimizeWindow): 23 (webkitWebViewRestoreWindow): 24 * UIProcess/Automation/Automation.json: 25 * UIProcess/Automation/WebAutomationSession.cpp: 26 (WebKit::WebAutomationSession::maximizeWindowOfBrowsingContext): Exit fullscreen, restore the window and then 27 maximize it. 28 (WebKit::WebAutomationSession::maximizeWindowForPage): Ask the client to maximize the window of page. 29 * UIProcess/Automation/WebAutomationSession.h: 30 * UIProcess/Automation/atoms/EnterFullscreen.js: 31 (enterFullscreen): Return early if fullscreen is disabled or if window is already in fullscreen. 32 1 33 2018-05-23 Eric Carlson <eric.carlson@apple.com> 2 34 -
trunk/Source/WebKit/UIProcess/API/APIAutomationSessionClient.h
r229998 r232150 55 55 virtual void didDisconnectFromRemote(WebKit::WebAutomationSession&) { } 56 56 virtual void requestNewPageWithOptions(WebKit::WebAutomationSession&, AutomationSessionBrowsingContextOptions, CompletionHandler<void(WebKit::WebPageProxy*)>&& completionHandler) { completionHandler(nullptr); } 57 virtual void requestMaximizeWindowOfPage(WebKit::WebAutomationSession&, WebKit::WebPageProxy&, CompletionHandler<void()>&& completionHandler) { completionHandler(); } 57 58 virtual void requestHideWindowOfPage(WebKit::WebAutomationSession&, WebKit::WebPageProxy&, CompletionHandler<void()>&& completionHandler) { completionHandler(); } 58 59 virtual void requestRestoreWindowOfPage(WebKit::WebAutomationSession&, WebKit::WebPageProxy&, CompletionHandler<void()>&& completionHandler) { completionHandler(); } -
trunk/Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp
r232111 r232150 96 96 else 97 97 completionHandler(&webkitWebViewGetPage(webView)); 98 } 99 100 void requestMaximizeWindowOfPage(WebAutomationSession&, WebPageProxy& page, CompletionHandler<void()>&& completionHandler) override 101 { 102 if (auto* webView = webkitWebContextGetWebViewForPage(m_session->priv->webContext, &page)) 103 webkitWebViewMaximizeWindow(webView, WTFMove(completionHandler)); 104 else 105 completionHandler(); 106 } 107 108 void requestHideWindowOfPage(WebAutomationSession&, WebPageProxy& page, CompletionHandler<void()>&& completionHandler) override 109 { 110 if (auto* webView = webkitWebContextGetWebViewForPage(m_session->priv->webContext, &page)) 111 webkitWebViewMinimizeWindow(webView, WTFMove(completionHandler)); 112 else 113 completionHandler(); 114 } 115 116 void requestRestoreWindowOfPage(WebAutomationSession&, WebPageProxy& page, CompletionHandler<void()>&& completionHandler) override 117 { 118 if (auto* webView = webkitWebContextGetWebViewForPage(m_session->priv->webContext, &page)) 119 webkitWebViewRestoreWindow(webView, WTFMove(completionHandler)); 120 else 121 completionHandler(); 98 122 } 99 123 -
trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h
r226019 r232150 37 37 #include <WebCore/IntRect.h> 38 38 #include <WebCore/LinkIcon.h> 39 #include <wtf/CompletionHandler.h> 39 40 #include <wtf/text/CString.h> 40 41 … … 75 76 #endif 76 77 void webkitWebViewRemoveLoadingWebResource(WebKitWebView*, uint64_t resourceIdentifier); 78 void webkitWebViewMaximizeWindow(WebKitWebView*, CompletionHandler<void()>&&); 79 void webkitWebViewMinimizeWindow(WebKitWebView*, CompletionHandler<void()>&&); 80 void webkitWebViewRestoreWindow(WebKitWebView*, CompletionHandler<void()>&&); 77 81 void webkitWebViewEnterFullScreen(WebKitWebView*); 78 82 void webkitWebViewExitFullScreen(WebKitWebView*); -
trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp
r220387 r232150 26 26 #include "WebKitWebViewPrivate.h" 27 27 #include <WebCore/GtkUtilities.h> 28 #include <WebCore/PlatformDisplay.h> 29 #include <WebCore/PlatformScreen.h> 28 30 #include <glib/gi18n-lib.h> 29 31 #include <gtk/gtk.h> … … 105 107 } 106 108 109 struct WindowStateEvent { 110 enum class Type { Maximize, Minimize, Restore }; 111 112 WindowStateEvent(Type type, CompletionHandler<void()>&& completionHandler) 113 : type(type) 114 , completionHandler(WTFMove(completionHandler)) 115 , completeTimer(RunLoop::main(), this, &WindowStateEvent::complete) 116 { 117 // Complete the event if not done after one second. 118 completeTimer.startOneShot(1_s); 119 } 120 121 ~WindowStateEvent() 122 { 123 complete(); 124 } 125 126 void complete() 127 { 128 if (auto handler = std::exchange(completionHandler, nullptr)) 129 handler(); 130 } 131 132 Type type; 133 CompletionHandler<void()> completionHandler; 134 RunLoop::Timer<WindowStateEvent> completeTimer; 135 }; 136 137 static const char* gWindowStateEventID = "wk-window-state-event"; 138 139 static gboolean windowStateEventCallback(GtkWidget* window, GdkEventWindowState* event, WebKitWebView* view) 140 { 141 auto* state = static_cast<WindowStateEvent*>(g_object_get_data(G_OBJECT(view), gWindowStateEventID)); 142 if (!state) { 143 g_signal_handlers_disconnect_by_func(window, reinterpret_cast<gpointer>(windowStateEventCallback), view); 144 return FALSE; 145 } 146 147 bool eventCompleted = false; 148 switch (state->type) { 149 case WindowStateEvent::Type::Maximize: 150 if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) 151 eventCompleted = true; 152 break; 153 case WindowStateEvent::Type::Minimize: 154 if ((event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) || !gtk_widget_get_mapped(window)) 155 eventCompleted = true; 156 break; 157 case WindowStateEvent::Type::Restore: 158 if (!(event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) && !(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED)) 159 eventCompleted = true; 160 break; 161 } 162 163 if (eventCompleted) { 164 g_signal_handlers_disconnect_by_func(window, reinterpret_cast<gpointer>(windowStateEventCallback), view); 165 g_object_set_data(G_OBJECT(view), gWindowStateEventID, nullptr); 166 } 167 168 return FALSE; 169 } 170 171 void webkitWebViewMaximizeWindow(WebKitWebView* view, CompletionHandler<void()>&& completionHandler) 172 { 173 auto* topLevel = gtk_widget_get_toplevel(GTK_WIDGET(view)); 174 if (!gtk_widget_is_toplevel(topLevel)) { 175 completionHandler(); 176 return; 177 } 178 179 auto* window = GTK_WINDOW(topLevel); 180 if (gtk_window_is_maximized(window)) { 181 completionHandler(); 182 return; 183 } 184 185 g_object_set_data_full(G_OBJECT(view), gWindowStateEventID, new WindowStateEvent(WindowStateEvent::Type::Maximize, WTFMove(completionHandler)), [](gpointer userData) { 186 delete static_cast<WindowStateEvent*>(userData); 187 }); 188 g_signal_connect_object(window, "window-state-event", G_CALLBACK(windowStateEventCallback), view, G_CONNECT_AFTER); 189 gtk_window_maximize(window); 190 #if ENABLE(DEVELOPER_MODE) 191 // Xvfb doesn't support maximize, so we resize the window to the screen size. 192 if (WebCore::PlatformDisplay::sharedDisplay().type() == WebCore::PlatformDisplay::Type::X11) { 193 const char* underXvfb = g_getenv("UNDER_XVFB"); 194 if (!g_strcmp0(underXvfb, "yes")) { 195 auto screenRect = WebCore::screenAvailableRect(nullptr); 196 gtk_window_move(window, screenRect.x(), screenRect.y()); 197 gtk_window_resize(window, screenRect.width(), screenRect.height()); 198 } 199 } 200 #endif 201 gtk_widget_show(topLevel); 202 } 203 204 void webkitWebViewMinimizeWindow(WebKitWebView* view, CompletionHandler<void()>&& completionHandler) 205 { 206 auto* topLevel = gtk_widget_get_toplevel(GTK_WIDGET(view)); 207 if (!gtk_widget_is_toplevel(topLevel)) { 208 completionHandler(); 209 return; 210 } 211 212 auto* window = GTK_WINDOW(topLevel); 213 g_object_set_data_full(G_OBJECT(view), gWindowStateEventID, new WindowStateEvent(WindowStateEvent::Type::Minimize, WTFMove(completionHandler)), [](gpointer userData) { 214 delete static_cast<WindowStateEvent*>(userData); 215 }); 216 g_signal_connect_object(window, "window-state-event", G_CALLBACK(windowStateEventCallback), view, G_CONNECT_AFTER); 217 gtk_window_iconify(window); 218 gtk_widget_hide(topLevel); 219 } 220 221 void webkitWebViewRestoreWindow(WebKitWebView* view, CompletionHandler<void()>&& completionHandler) 222 { 223 auto* topLevel = gtk_widget_get_toplevel(GTK_WIDGET(view)); 224 if (!gtk_widget_is_toplevel(topLevel)) { 225 completionHandler(); 226 return; 227 } 228 229 auto* window = GTK_WINDOW(topLevel); 230 if (gtk_widget_get_mapped(topLevel) && !gtk_window_is_maximized(window)) { 231 completionHandler(); 232 return; 233 } 234 235 g_object_set_data_full(G_OBJECT(view), gWindowStateEventID, new WindowStateEvent(WindowStateEvent::Type::Restore, WTFMove(completionHandler)), [](gpointer userData) { 236 delete static_cast<WindowStateEvent*>(userData); 237 }); 238 g_signal_connect_object(window, "window-state-event", G_CALLBACK(windowStateEventCallback), view, G_CONNECT_AFTER); 239 if (gtk_window_is_maximized(window)) 240 gtk_window_unmaximize(window); 241 if (!gtk_widget_get_mapped(topLevel)) 242 gtk_window_deiconify(window); 243 #if ENABLE(DEVELOPER_MODE) 244 // Xvfb doesn't support maximize, so we resize the window to the default size. 245 if (WebCore::PlatformDisplay::sharedDisplay().type() == WebCore::PlatformDisplay::Type::X11) { 246 const char* underXvfb = g_getenv("UNDER_XVFB"); 247 if (!g_strcmp0(underXvfb, "yes")) { 248 int x, y; 249 gtk_window_get_default_size(window, &x, &y); 250 gtk_window_resize(window, x, y); 251 } 252 } 253 #endif 254 gtk_widget_show(topLevel); 255 } 256 107 257 /** 108 258 * webkit_web_view_new: -
trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp
r230557 r232150 36 36 { 37 37 return FALSE; 38 } 39 40 void webkitWebViewMaximizeWindow(WebKitWebView*, CompletionHandler<void()>&& completionHandler) 41 { 42 completionHandler(); 43 } 44 45 void webkitWebViewMinimizeWindow(WebKitWebView*, CompletionHandler<void()>&& completionHandler) 46 { 47 completionHandler(); 48 } 49 50 void webkitWebViewRestoreWindow(WebKitWebView*, CompletionHandler<void()>&& completionHandler) 51 { 52 completionHandler(); 38 53 } 39 54 -
trunk/Source/WebKit/UIProcess/Automation/Automation.json
r231632 r232150 358 358 }, 359 359 { 360 "name": "maximizeWindowOfBrowsingContext", 361 "description": "Causes the window of the specified browsing context to be maximized. This command implicitly exits fullscreen mode.", 362 "parameters": [ 363 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context whose window should be maximized." } 364 ], 365 "async": true 366 }, 367 { 360 368 "name": "hideWindowOfBrowsingContext", 361 369 "description": "Causes the window of the specified browsing context to be hidden/minimized/iconified. This command implicitly exits fullscreen mode.", -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
r231767 r232150 526 526 } 527 527 528 void WebAutomationSession::maximizeWindowOfBrowsingContext(const String& browsingContextHandle, Ref<MaximizeWindowOfBrowsingContextCallback>&& callback) 529 { 530 auto* page = webPageProxyForHandle(browsingContextHandle); 531 if (!page) 532 ASYNC_FAIL_WITH_PREDEFINED_ERROR(WindowNotFound); 533 534 exitFullscreenWindowForPage(*page, [this, protectedThis = makeRef(*this), callback = WTFMove(callback), page = makeRefPtr(page)]() mutable { 535 auto& webPage = *page; 536 restoreWindowForPage(webPage, [this, callback = WTFMove(callback), page = WTFMove(page)]() mutable { 537 maximizeWindowForPage(*page, [callback = WTFMove(callback)]() { 538 callback->sendSuccess(); 539 }); 540 }); 541 }); 542 } 543 528 544 void WebAutomationSession::hideWindowOfBrowsingContext(const String& browsingContextHandle, Ref<HideWindowOfBrowsingContextCallback>&& callback) 529 545 { … … 567 583 { 568 584 m_client->requestRestoreWindowOfPage(*this, page, WTFMove(completionHandler)); 585 } 586 587 void WebAutomationSession::maximizeWindowForPage(WebPageProxy& page, WTF::CompletionHandler<void()>&& completionHandler) 588 { 589 m_client->requestMaximizeWindowOfPage(*this, page, WTFMove(completionHandler)); 569 590 } 570 591 -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h
r231767 r232150 152 152 void switchToBrowsingContext(const String& browsingContextHandle, const String* optionalFrameHandle, Ref<SwitchToBrowsingContextCallback>&&) final; 153 153 void setWindowFrameOfBrowsingContext(const String& handle, const JSON::Object* origin, const JSON::Object* size, Ref<SetWindowFrameOfBrowsingContextCallback>&&) final; 154 void maximizeWindowOfBrowsingContext(const String& handle, Ref<MaximizeWindowOfBrowsingContextCallback>&&) final; 154 155 void hideWindowOfBrowsingContext(const String& handle, Ref<HideWindowOfBrowsingContextCallback>&&) final; 155 156 void navigateBrowsingContext(const String& handle, const String& url, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<NavigateBrowsingContextCallback>&&) override; … … 214 215 void exitFullscreenWindowForPage(WebPageProxy&, WTF::CompletionHandler<void()>&&); 215 216 void restoreWindowForPage(WebPageProxy&, WTF::CompletionHandler<void()>&&); 217 void maximizeWindowForPage(WebPageProxy&, WTF::CompletionHandler<void()>&&); 216 218 void hideWindowForPage(WebPageProxy&, WTF::CompletionHandler<void()>&&); 217 219 -
trunk/Source/WebKit/UIProcess/Automation/atoms/EnterFullscreen.js
r229998 r232150 27 27 28 28 let callback = arguments[0]; 29 if (!document.webkitFullscreenEnabled) 29 if (!document.webkitFullscreenEnabled) { 30 30 callback(false); 31 return; 32 } 33 34 if (document.webkitIsFullScreen) { 35 callback(true); 36 return; 37 } 31 38 32 39 let fullscreenChangeListener, fullscreenErrorListener; -
trunk/Tools/ChangeLog
r232149 r232150 1 2018-05-24 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 WebDriver: implement maximize, minimize and fullscreen window commands 4 https://bugs.webkit.org/show_bug.cgi?id=180398 5 6 Reviewed by Brian Burg. 7 8 * Scripts/webkitpy/port/xvfbdriver.py: 9 (XvfbDriver._setup_environ_for_test): Set UNDER_XVFB environment variable when running under Xvfb. 10 1 11 2018-05-24 Xabier Rodriguez Calvar <calvaris@igalia.com> 2 12 -
trunk/Tools/Scripts/webkitpy/port/xvfbdriver.py
r225740 r232150 99 99 # We must do this here because the DISPLAY number depends on _worker_number 100 100 environment['DISPLAY'] = ":%d" % display_id 101 environment['UNDER_XVFB'] = 'yes' 101 102 environment['GDK_BACKEND'] = 'x11' 102 103 environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir() -
trunk/WebDriverTests/ChangeLog
r232013 r232150 1 2018-05-24 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 WebDriver: implement maximize, minimize and fullscreen window commands 4 https://bugs.webkit.org/show_bug.cgi?id=180398 5 6 Reviewed by Brian Burg. 7 8 Remove expectations for tests that are passing now. 9 10 * TestExpectations.json: 11 1 12 2018-05-21 Carlos Garcia Campos <cgarcia@igalia.com> 2 13 -
trunk/WebDriverTests/TestExpectations.json
r232013 r232150 204 204 } 205 205 }, 206 "imported/selenium/py/test/selenium/webdriver/common/window_tests.py": {207 "subtests": {208 "testShouldMaximizeTheWindow": {209 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}210 },211 "test_should_fullscreen_the_current_window": {212 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}213 },214 "test_should_minimize_the_current_window": {215 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}216 }217 }218 },219 206 "imported/w3c/webdriver/tests/actions/key.py": { 220 207 "subtests": { … … 514 501 } 515 502 }, 516 "imported/w3c/webdriver/tests/maximize_window/maximize.py": {517 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}518 },519 "imported/w3c/webdriver/tests/maximize_window/user_prompts.py": {520 "subtests": {521 "test_handle_prompt_accept": {522 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}523 },524 "test_handle_prompt_missing_value": {525 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}526 }527 }528 },529 503 "imported/w3c/webdriver/tests/execute_script/json_serialize_windowproxy.py": { 530 504 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180397"}} … … 1004 978 } 1005 979 }, 1006 "imported/w3c/webdriver/tests/fullscreen_window/fullscreen.py": {1007 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}1008 },1009 "imported/w3c/webdriver/tests/fullscreen_window/user_prompts.py": {1010 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}},1011 "subtests": {1012 "test_handle_prompt_dismiss_and_notify": {1013 "expected": {"all": {"status": ["PASS"]}}1014 },1015 "test_handle_prompt_accept_and_notify": {1016 "expected": {"all": {"status": ["PASS"]}}1017 },1018 "test_handle_prompt_ignore": {1019 "expected": {"all": {"status": ["PASS"]}}1020 }1021 }1022 },1023 "imported/w3c/webdriver/tests/minimize_window/minimize.py": {1024 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}1025 },1026 "imported/w3c/webdriver/tests/minimize_window/user_prompts.py": {1027 "subtests": {1028 "test_handle_prompt_accept": {1029 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}1030 },1031 "test_handle_prompt_missing_value": {1032 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}1033 }1034 }1035 },1036 980 "imported/w3c/webdriver/tests/set_window_rect/set.py": { 1037 981 "subtests": { 1038 "test_fully_exit_fullscreen": {1039 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}1040 },1041 "test_restore_from_minimized": {1042 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}1043 },1044 "test_restore_from_maximized": {1045 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180398"}}1046 },1047 982 "test_negative_x_y": { 1048 983 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180418"}}
Note: See TracChangeset
for help on using the changeset viewer.