From 0f75f202d333ac507fb3e5efb8e9bd4d4719e098 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Wed, 17 Apr 2013 11:46:19 +0300 Subject: Added test for testing push with different transports #11494 Change-Id: I0296bdee1925ba93ca7e4e65c68215e025d072f6 --- uitest/src/com/vaadin/tests/push/BasicPush.java | 3 + .../src/com/vaadin/tests/push/StreamingPush.html | 88 ++++++++++++++++++++++ .../tests/widgetset/TestingWidgetSet.gwt.xml | 4 + .../widgetset/client/TestingPushConnection.java | 30 ++++++++ 4 files changed, 125 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/push/StreamingPush.html create mode 100644 uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java (limited to 'uitest/src/com') diff --git a/uitest/src/com/vaadin/tests/push/BasicPush.java b/uitest/src/com/vaadin/tests/push/BasicPush.java index 17d107bb8c..43f8236999 100644 --- a/uitest/src/com/vaadin/tests/push/BasicPush.java +++ b/uitest/src/com/vaadin/tests/push/BasicPush.java @@ -4,14 +4,17 @@ import java.util.Date; import java.util.Timer; import java.util.TimerTask; +import com.vaadin.annotations.Widgetset; import com.vaadin.data.util.ObjectProperty; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.widgetset.TestingWidgetSet; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; +@Widgetset(TestingWidgetSet.NAME) public class BasicPush extends AbstractTestUI { private ObjectProperty counter = new ObjectProperty(0); diff --git a/uitest/src/com/vaadin/tests/push/StreamingPush.html b/uitest/src/com/vaadin/tests/push/StreamingPush.html new file mode 100644 index 0000000000..533f571b9c --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/StreamingPush.html @@ -0,0 +1,88 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run-push/com.vaadin.tests.push.BasicPush?restartApplication&debug&transport=streaming
assertTextid=gwt-uid-50
clickvaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]
assertTextid=gwt-uid-51
clickvaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]
clickvaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]
clickvaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]
assertTextid=gwt-uid-54
clickvaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]
assertTextid=gwt-uid-70
pause3000
assertTextid=gwt-uid-71
pause3000
assertTextid=gwt-uid-72
+ + diff --git a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml index 919a4a5d69..1b47a86113 100644 --- a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml +++ b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml @@ -7,5 +7,9 @@ + + + + diff --git a/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java b/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java new file mode 100644 index 0000000000..8453daabcd --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java @@ -0,0 +1,30 @@ +package com.vaadin.tests.widgetset.client; + +import com.google.gwt.user.client.Window; +import com.vaadin.client.ApplicationConnection; +import com.vaadin.client.communication.PushConnection; + +public class TestingPushConnection extends PushConnection { + + private String transport; + + @Override + public void init(ApplicationConnection connection) { + super.init(connection); + transport = Window.Location.getParameter("transport"); + } + + /* + * Force transport + */ + @Override + protected AtmosphereConfiguration createConfig() { + AtmosphereConfiguration conf = super.createConfig(); + if (transport != null) { + conf.setTransport(transport); + conf.setFallbackTransport(transport); + } + return conf; + } + +} -- cgit v1.2.3