From 47c199f6fabe17a39c5a97b196f2e347e0eeada6 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Tue, 18 Jun 2013 12:31:12 +0300 Subject: Add 'transport' GET parameter to AbstractTestUI (#12094) * Value can be 'xhr', 'websocket', or 'streaming' * xhr disables push even if already enabled * others set push to automatic if not already set to manual Change-Id: Iaf929bbb78865fa7d832718841e781e76cdf7277 --- .../vaadin/tests/components/AbstractTestUI.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java index ec6cf0c57d..f567106d60 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java @@ -6,11 +6,14 @@ import com.vaadin.annotations.Widgetset; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinServlet; import com.vaadin.server.WebBrowser; +import com.vaadin.shared.communication.PushMode; import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.shared.ui.ui.Transport; import com.vaadin.ui.Component; import com.vaadin.ui.Label; import com.vaadin.ui.Notification; import com.vaadin.ui.Notification.Type; +import com.vaadin.ui.PushConfiguration; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; @@ -35,6 +38,8 @@ public abstract class AbstractTestUI extends UI { warnIfWidgetsetMaybeNotCompiled(); + setTransport(request); + setup(request); } @@ -95,6 +100,26 @@ public abstract class AbstractTestUI extends UI { } } + protected void setTransport(VaadinRequest request) { + String transport = request.getParameter("transport"); + PushConfiguration config = getPushConfiguration(); + PushMode mode = config.getPushMode(); + + if ("xhr".equals(transport)) { + config.setPushMode(PushMode.DISABLED); + } else if ("websocket".equals(transport)) { + if (!mode.isEnabled()) { + config.setPushMode(PushMode.AUTOMATIC); + } + config.setTransport(Transport.WEBSOCKET); + } else if ("streaming".equals(transport)) { + if (!mode.isEnabled()) { + config.setPushMode(PushMode.AUTOMATIC); + } + config.setTransport(Transport.STREAMING); + } + } + private VerticalLayout layout; protected VerticalLayout getLayout() { -- cgit v1.2.3