diff options
author | Artur Signell <artur@vaadin.com> | 2013-04-18 01:08:55 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-04-18 11:36:36 +0300 |
commit | 5efb8f01e79bac95955b189d5999ba4ae544a137 (patch) | |
tree | 35706ba3527bdc0c0094a334e0afcd8ba148f014 /uitest/src/com/vaadin/tests/push/RoundTripTest.java | |
parent | ff03ede4439d992371ddcbc4df510cdf85ad41db (diff) | |
download | vaadin-framework-5efb8f01e79bac95955b189d5999ba4ae544a137.tar.gz vaadin-framework-5efb8f01e79bac95955b189d5999ba4ae544a137.zip |
Simple speed test for testing roundtrips/s in various browsers
Change-Id: Id6e96e8d115b02c79038396dfada5c04e0f451ed
Diffstat (limited to 'uitest/src/com/vaadin/tests/push/RoundTripTest.java')
-rw-r--r-- | uitest/src/com/vaadin/tests/push/RoundTripTest.java | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/push/RoundTripTest.java b/uitest/src/com/vaadin/tests/push/RoundTripTest.java new file mode 100644 index 0000000000..a059a1d275 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/RoundTripTest.java @@ -0,0 +1,67 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.push; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.widgetset.TestingWidgetSet; +import com.vaadin.tests.widgetset.server.RoundTripTester; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.TextField; + +@Widgetset(TestingWidgetSet.NAME) +public class RoundTripTest extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final RoundTripTester roundTripTester = new RoundTripTester(); + final TextField payloadSize = new TextField("Payload size (bytes)"); + payloadSize.setConverter(Integer.class); + payloadSize.setConvertedValue(10000); + addComponent(payloadSize); + final TextField testDuration = new TextField("Test duration (ms)"); + testDuration.setConverter(Integer.class); + testDuration.setConvertedValue(10000); + addComponent(testDuration); + + Button start = new Button("Start test"); + start.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + roundTripTester.start( + (Integer) testDuration.getConvertedValue(), + (Integer) payloadSize.getConvertedValue()); + } + }); + addComponent(roundTripTester); + addComponent(start); + } + + @Override + protected String getTestDescription() { + return "Tests how many roundtrips per second you can get using the given package size"; + } + + @Override + protected Integer getTicketNumber() { + return 11370; + } + +} |