aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBuild Agent <build@vaadin.com>2014-03-21 10:29:58 +0200
committerBuild Agent <build@vaadin.com>2014-03-21 10:29:59 +0200
commit1f149be0e8c49e8d7a69853f758f2a01356202e5 (patch)
tree17bd83f8579ca996a3382c27b186a6a866fdd9b5
parentd90416ce1bf53b18e14b951e27f36d7323b3f3d3 (diff)
parente45294f717f920a6dfbcf36aff68d25d9b00cca3 (diff)
downloadvaadin-framework-1f149be0e8c49e8d7a69853f758f2a01356202e5.tar.gz
vaadin-framework-1f149be0e8c49e8d7a69853f758f2a01356202e5.zip
Merge changes from origin/7.1
7112abe Preventing premature start of drag due to Chrome move event #13381 7e7b623 reduce frequency of session locking and StreamingProgressEvents (#13155) 7cab7fd Improve error message when reusing UI instance (#13457) 3e53fa6 Fixed "EEE" in DateField's date pattern (#13443) 1881ea8 Fix for width issue of TabSheet (#12805) 396820e Test for streaming reconnect issue (#13435) 2f93186 Eliminate .v-caption memory leak (#13346) 0c7cbc7 Fixes a memory leak on IE8 in LayoutManagerIE8 (#12688) 5441ef0 Merged IntegrationTestRunner into TB3Runner 3545db2 Added User-Agent and Screen Width + Height labels to portlet test. c5aaf93 Refactored JSR286 portlet test. 52dcbaa Pressing ESC now closes the DateField popup when using month or year resolutions. (#12317) e45294f Revert "Preventing premature start of drag due to Chrome move event #13381" Change-Id: I35e119a6e8e68e226487906af35eaa220f3af16f
-rw-r--r--client/src/com/vaadin/client/DateTimeService.java2
-rw-r--r--client/src/com/vaadin/client/LayoutManager.java9
-rw-r--r--client/src/com/vaadin/client/LayoutManagerIE8.java15
-rw-r--r--client/src/com/vaadin/client/ui/VCalendarPanel.java2
-rw-r--r--client/src/com/vaadin/client/ui/VTabsheet.java4
-rw-r--r--client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java3
-rw-r--r--server/src/com/vaadin/server/communication/FileUploadHandler.java49
-rw-r--r--server/src/com/vaadin/ui/UI.java13
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java59
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEETest.java36
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java57
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEscTest.java67
-rw-r--r--uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeak.java62
-rw-r--r--uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java68
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidth.java105
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidthTest.java41
-rw-r--r--uitest/src/com/vaadin/tests/extensions/LayoutMemoryUsageIE8Extension.java36
-rw-r--r--uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java17
-rw-r--r--uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java54
-rw-r--r--uitest/src/com/vaadin/tests/integration/JSR286Portlet.java18
-rw-r--r--uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeak.java111
-rw-r--r--uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeakTest.java54
-rw-r--r--uitest/src/com/vaadin/tests/push/StreamingReconnectWhilePushing.java75
-rw-r--r--uitest/src/com/vaadin/tests/tb3/TB3Runner.java44
-rw-r--r--uitest/src/com/vaadin/tests/tb3/TestNameSuffix.java29
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/LayoutMemoryUsageIE8ExtensionConnector.java45
26 files changed, 981 insertions, 94 deletions
diff --git a/client/src/com/vaadin/client/DateTimeService.java b/client/src/com/vaadin/client/DateTimeService.java
index 5fd0574d3e..2388bd38fb 100644
--- a/client/src/com/vaadin/client/DateTimeService.java
+++ b/client/src/com/vaadin/client/DateTimeService.java
@@ -344,7 +344,7 @@ public class DateTimeService {
if (formatStr.contains("EEE")) {
- String dayName = getShortDay(date.getMonth());
+ String dayName = getShortDay(date.getDay());
if (dayName != null) {
/*
diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java
index 4fb656b16d..fbf540273f 100644
--- a/client/src/com/vaadin/client/LayoutManager.java
+++ b/client/src/com/vaadin/client/LayoutManager.java
@@ -75,6 +75,15 @@ public class LayoutManager {
}
/**
+ * Returns the application connection for this layout manager.
+ *
+ * @return connection
+ */
+ protected ApplicationConnection getConnection() {
+ return connection;
+ }
+
+ /**
* Gets the layout manager associated with the given
* {@link ApplicationConnection}.
*
diff --git a/client/src/com/vaadin/client/LayoutManagerIE8.java b/client/src/com/vaadin/client/LayoutManagerIE8.java
index a692f126a2..97e3059a22 100644
--- a/client/src/com/vaadin/client/LayoutManagerIE8.java
+++ b/client/src/com/vaadin/client/LayoutManagerIE8.java
@@ -21,6 +21,7 @@ import java.util.Map;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Node;
import com.google.gwt.user.client.ui.RootPanel;
/**
@@ -39,6 +40,12 @@ public class LayoutManagerIE8 extends LayoutManager {
private Map<Element, MeasuredSize> measuredSizes = new HashMap<Element, MeasuredSize>();
+ // this method is needed to test for memory leaks (see
+ // LayoutMemoryUsageIE8ExtensionConnector) but can be private
+ private int getMeasuredSizesMapSize() {
+ return measuredSizes.size();
+ }
+
@Override
protected void setMeasuredSize(Element element, MeasuredSize measuredSize) {
if (measuredSize != null) {
@@ -62,12 +69,16 @@ public class LayoutManagerIE8 extends LayoutManager {
@Override
protected void cleanMeasuredSizes() {
Profiler.enter("LayoutManager.cleanMeasuredSizes");
- Document document = RootPanel.get().getElement().getOwnerDocument();
+
+ // #12688: IE8 was leaking memory when adding&removing components.
+ // Uses IE specific logic to figure if an element has been removed from
+ // DOM or not. For removed elements the measured size is discarded.
+ Node rootNode = Document.get().getBody();
Iterator<Element> i = measuredSizes.keySet().iterator();
while (i.hasNext()) {
Element e = i.next();
- if (e.getOwnerDocument() != document) {
+ if (!rootNode.isOrHasChild(e)) {
i.remove();
}
}
diff --git a/client/src/com/vaadin/client/ui/VCalendarPanel.java b/client/src/com/vaadin/client/ui/VCalendarPanel.java
index 5fbd3ec15c..5d22dfdee1 100644
--- a/client/src/com/vaadin/client/ui/VCalendarPanel.java
+++ b/client/src/com/vaadin/client/ui/VCalendarPanel.java
@@ -1189,6 +1189,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
} else if (keycode == getCloseKey()) {
// TODO fire listener, on users responsibility??
+ onCancel();
return true;
}
return false;
@@ -1240,6 +1241,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
return true;
} else if (keycode == getCloseKey() || keycode == KeyCodes.KEY_TAB) {
+ onCancel();
// TODO fire close event
diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java
index 82eb9e7694..db140834bc 100644
--- a/client/src/com/vaadin/client/ui/VTabsheet.java
+++ b/client/src/com/vaadin/client/ui/VTabsheet.java
@@ -1062,9 +1062,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
*/
private void updateTabScroller() {
if (!isDynamicWidth()) {
- ComponentConnector paintable = ConnectorMap.get(client)
- .getConnector(this);
- DOM.setStyleAttribute(tabs, "width", paintable.getState().width);
+ DOM.setStyleAttribute(tabs, "width", "100%");
}
// Make sure scrollerIndex is valid
diff --git a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
index 92cf83d038..fa0dec873d 100644
--- a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
+++ b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
@@ -270,8 +270,7 @@ public abstract class AbstractOrderedLayoutConnector extends
if (slot.hasCaption()) {
CaptionPosition pos = slot.getCaptionPosition();
- getLayoutManager().addElementResizeListener(
- slot.getCaptionElement(), slotCaptionResizeListener);
+ slot.setCaptionResizeListener(slotCaptionResizeListener);
if (child.isRelativeHeight()
&& (pos == CaptionPosition.TOP || pos == CaptionPosition.BOTTOM)) {
getWidget().updateCaptionOffset(slot.getCaptionElement());
diff --git a/server/src/com/vaadin/server/communication/FileUploadHandler.java b/server/src/com/vaadin/server/communication/FileUploadHandler.java
index 41a16601fe..dc397eadcd 100644
--- a/server/src/com/vaadin/server/communication/FileUploadHandler.java
+++ b/server/src/com/vaadin/server/communication/FileUploadHandler.java
@@ -227,6 +227,9 @@ public class FileUploadHandler implements RequestHandler {
/* Same as in apache commons file upload library that was previously used. */
private static final int MAX_UPLOAD_BUFFER_SIZE = 4 * 1024;
+ /* Minimum interval which will be used for streaming progress events. */
+ public static final int DEFAULT_STREAMING_PROGRESS_EVENT_INTERVAL_MS = 500;
+
@Override
public boolean handleRequest(VaadinSession session, VaadinRequest request,
VaadinResponse response) throws IOException {
@@ -550,26 +553,35 @@ public class FileUploadHandler implements RequestHandler {
}
final byte buffer[] = new byte[MAX_UPLOAD_BUFFER_SIZE];
+ long lastStreamingEvent = 0;
int bytesReadToBuffer = 0;
- while ((bytesReadToBuffer = in.read(buffer)) > 0) {
- out.write(buffer, 0, bytesReadToBuffer);
- totalBytes += bytesReadToBuffer;
+ do {
+ bytesReadToBuffer = in.read(buffer);
+ if (bytesReadToBuffer > 0) {
+ out.write(buffer, 0, bytesReadToBuffer);
+ totalBytes += bytesReadToBuffer;
+ }
if (listenProgress) {
- // update progress if listener set and contentLength
- // received
- session.lock();
- try {
- StreamingProgressEventImpl progressEvent = new StreamingProgressEventImpl(
- filename, type, contentLength, totalBytes);
- streamVariable.onProgress(progressEvent);
- } finally {
- session.unlock();
+ long now = System.currentTimeMillis();
+ // to avoid excessive session locking and event storms,
+ // events are sent in intervals, or at the end of the file.
+ if (lastStreamingEvent + getProgressEventInterval() <= now
+ || bytesReadToBuffer <= 0) {
+ lastStreamingEvent = now;
+ session.lock();
+ try {
+ StreamingProgressEventImpl progressEvent = new StreamingProgressEventImpl(
+ filename, type, contentLength, totalBytes);
+ streamVariable.onProgress(progressEvent);
+ } finally {
+ session.unlock();
+ }
}
}
if (streamVariable.isInterrupted()) {
throw new UploadInterruptedException();
}
- }
+ } while (bytesReadToBuffer > 0);
// upload successful
out.close();
@@ -612,6 +624,17 @@ public class FileUploadHandler implements RequestHandler {
return startedEvent.isDisposed();
}
+ /**
+ * To prevent event storming, streaming progress events are sent in this
+ * interval rather than every time the buffer is filled. This fixes #13155.
+ * To adjust this value override the method, and register your own handler
+ * in VaadinService.createRequestHandlers(). The default is 500ms, and
+ * setting it to 0 effectively restores the old behavior.
+ */
+ protected int getProgressEventInterval() {
+ return DEFAULT_STREAMING_PROGRESS_EVENT_INTERVAL_MS;
+ }
+
static void tryToCloseStream(OutputStream out) {
try {
// try to close output stream (e.g. file handle)
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index e688c06061..b3004e9ad2 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -613,7 +613,18 @@ public abstract class UI extends AbstractSingleComponentContainer implements
*/
public void doInit(VaadinRequest request, int uiId, String embedId) {
if (this.uiId != -1) {
- throw new IllegalStateException("UI id has already been defined");
+ String message = "This UI instance is already initialized (as UI id "
+ + this.uiId
+ + ") and can therefore not be initialized again (as UI id "
+ + uiId + "). ";
+
+ if (getSession() != null
+ && !getSession().equals(VaadinSession.getCurrent())) {
+ message += "Furthermore, it is already attached to another VaadinSession. ";
+ }
+ message += "Please make sure you are not accidentally reusing an old UI instance.";
+
+ throw new IllegalStateException(message);
}
this.uiId = uiId;
this.embedId = embedId;
diff --git a/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java b/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java
new file mode 100644
index 0000000000..ce9d021c79
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java
@@ -0,0 +1,59 @@
+/*
+ * 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.components.datefield;
+
+import java.util.Calendar;
+import java.util.Locale;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.VerticalLayout;
+
+public class CustomDateFormatEEE extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Calendar cal = Calendar.getInstance();
+ cal.set(2014, 2, 14); // Friday
+
+ DateField df = new DateField("Should display 14/03/2014 Fri");
+ df.setResolution(Resolution.DAY);
+ df.setLocale(new Locale("en", "US"));
+
+ String pattern = "dd/MM/yyyy EEE";
+ df.setDateFormat(pattern);
+ df.setValue(cal.getTime());
+ df.setWidth("200px");
+
+ VerticalLayout layout = new VerticalLayout();
+ layout.addComponent(df);
+ layout.setMargin(true);
+ setContent(layout);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Verifies that \"EEE\" works as a part of custom date pattern";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 13443;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEETest.java b/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEETest.java
new file mode 100644
index 0000000000..286da85f06
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEETest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.components.datefield;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class CustomDateFormatEEETest extends MultiBrowserTest {
+
+ @Test
+ public void verifyDatePattern() {
+ openTestURL();
+
+ String dateValue = driver.findElement(
+ By.className("v-datefield-textfield")).getAttribute("value");
+ assertEquals("14/03/2014 Fri", dateValue);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java b/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java
new file mode 100644
index 0000000000..af43f143c1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java
@@ -0,0 +1,57 @@
+/*
+ * 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.components.datefield;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.VerticalLayout;
+
+public class PopupClosingWithEsc extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ DateField df1 = new DateField("Day");
+ df1.setId("day");
+ df1.setResolution(Resolution.DAY);
+
+ DateField df2 = new DateField("Month");
+ df2.setId("month");
+ df2.setResolution(Resolution.MONTH);
+
+ DateField df3 = new DateField("Year");
+ df3.setId("year");
+ df3.setResolution(Resolution.YEAR);
+
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ layout.setSpacing(true);
+ layout.addComponents(df1, df2, df3);
+ setContent(layout);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Testing that the DateField popup can be closed with ESC key.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12317;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEscTest.java b/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEscTest.java
new file mode 100644
index 0000000000..4c4b894b2b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEscTest.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.components.datefield;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class PopupClosingWithEscTest extends MultiBrowserTest {
+
+ @Test
+ public void testPopupClosingDayResolution() {
+ testPopupClosing("day");
+ }
+
+ @Test
+ public void testPopupClosingMonthResolution() {
+ testPopupClosing("month");
+ }
+
+ @Test
+ public void testPopupClosingYearResolution() {
+ testPopupClosing("year");
+ }
+
+ private void testPopupClosing(String dateFieldId) {
+ openTestURL();
+
+ driver.findElement(
+ vaadinLocator("PID_S" + dateFieldId + "#popupButton")).click();
+ assertTrue(isPopupVisible());
+ sendEsc();
+ assertFalse(isPopupVisible());
+ }
+
+ private boolean isPopupVisible() {
+ return !(driver.findElements(By.cssSelector(".v-datefield-popup"))
+ .isEmpty());
+ }
+
+ private void sendEsc() {
+ WebElement elem = driver.findElement(By
+ .cssSelector(".v-datefield-calendarpanel"));
+ new Actions(driver).sendKeys(elem, Keys.ESCAPE).perform();
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeak.java b/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeak.java
new file mode 100644
index 0000000000..7d347d6180
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeak.java
@@ -0,0 +1,62 @@
+package com.vaadin.tests.components.orderedlayout;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * HorizontalLayout and VerticalLayout should not leak caption elements via
+ * listeners when removing components from a layout.
+ *
+ * @since 7.1.13
+ * @author Vaadin Ltd
+ */
+public class CaptionLeak extends UI {
+
+ public static final String USAGE = "Open this UI with ?debug and count"
+ + " measured non-connector elements after setting leaky and non leaky"
+ + " content.";
+
+ @Override
+ public void init(VaadinRequest req) {
+ final VerticalLayout root = new VerticalLayout();
+ setContent(root);
+ Label usage = new Label(USAGE);
+ Panel parent = new Panel();
+ Button setLeakyContent = makeButton("Set leaky content", parent,
+ VerticalLayout.class);
+ Button setNonLeakyContent = makeButton("Set non leaky content", parent,
+ CssLayout.class);
+ root.addComponents(usage, setLeakyContent, setNonLeakyContent, parent);
+ }
+
+ private Button makeButton(String caption, final Panel parent,
+ final Class<? extends ComponentContainer> targetClass) {
+ Button btn = new Button(caption);
+ btn.setId(caption);
+ btn.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ try {
+ ComponentContainer target = targetClass.newInstance();
+ for (int i = 0; i < 61; i++) {
+ target.addComponent(new TextField("Test"));
+ }
+ parent.setContent(target);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ return btn;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java
new file mode 100644
index 0000000000..142ca00ba7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.components.orderedlayout;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class CaptionLeakTest extends MultiBrowserTest {
+
+ @Test
+ public void testCaptionLeak() throws Exception {
+ setDebug(true);
+ openTestURL();
+
+ // this should be present
+ // 3 general non-connector elements, none accumulated on click
+ getDriver()
+ .findElement(
+ By.xpath("//span[text() = 'Measured 3 non connector elements']"));
+
+ getDriver().findElement(By.xpath("//button[@title = 'Clear log']"))
+ .click();
+ getDriver().findElement(By.id("Set leaky content")).click();
+
+ getDriver()
+ .findElement(
+ By.xpath("//span[text() = 'Measured 3 non connector elements']"));
+
+ // nothing accumulates over clicks
+ getDriver().findElement(By.xpath("//button[@title = 'Clear log']"))
+ .click();
+ getDriver().findElement(By.id("Set leaky content")).click();
+ getDriver()
+ .findElement(
+ By.xpath("//span[text() = 'Measured 3 non connector elements']"));
+ }
+
+ @Test
+ public void testNoCaptionLeak() throws Exception {
+ setDebug(true);
+ openTestURL();
+
+ getDriver().findElement(By.xpath("//button[@title = 'Clear log']"))
+ .click();
+ getDriver().findElement(By.id("Set non leaky content")).click();
+
+ // this should be present
+ // 3 general non-connector elements, none accumulated on click
+ getDriver()
+ .findElement(
+ By.xpath("//span[text() = 'Measured 3 non connector elements']"));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidth.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidth.java
new file mode 100644
index 0000000000..01bce334db
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidth.java
@@ -0,0 +1,105 @@
+/*
+ * 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.components.tabsheet;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * Tests the width of the tab bar, especially when using relative width for the
+ * {@link TabSheet}.
+ *
+ * Created for ticket <a href="http://dev.vaadin.com/ticket/12805">#12805</a>.
+ */
+public class TabBarWidth extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ layout.setSpacing(true);
+ layout.setWidth("500px");
+ setContent(layout);
+
+ // Add a Button to toggle between the widths and undefined.
+ Button toggle = new Button("Toggle widths", new Button.ClickListener() {
+
+ private boolean removeWidths = true;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ restoreOrRemoveWidths(layout, removeWidths);
+ removeWidths = !removeWidths;
+ }
+ });
+ toggle.setId("toggleWidths");
+ layout.addComponent(toggle);
+
+ // Add TabSheets with different widths specified.
+ layout.addComponent(newTabSheet(null));
+ layout.addComponent(newTabSheet("100%"));
+ layout.addComponent(newTabSheet("75%"));
+ layout.addComponent(newTabSheet("50%"));
+ layout.addComponent(newTabSheet("150px"));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Tests the width of the tab bar.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12805;
+ }
+
+ private void restoreOrRemoveWidths(VerticalLayout layout,
+ boolean removeWidths) {
+ for (Component component : layout) {
+ if (component instanceof TabSheet) {
+ if (removeWidths) {
+ component.setWidth(null);
+ component.setCaption("Width: undefined");
+ } else {
+ String originalWidth = (String) ((TabSheet) component)
+ .getData();
+ component.setWidth(originalWidth);
+ component.setCaption("Width: "
+ + (originalWidth == null ? "undefined"
+ : originalWidth));
+ }
+ }
+ }
+ }
+
+ private TabSheet newTabSheet(String width) {
+ TabSheet tabSheet = new TabSheet();
+ tabSheet.setCaption("Width: " + (width == null ? "undefined" : width));
+ tabSheet.setWidth(width);
+ tabSheet.setData(width);
+
+ // Add dummy components to fill the TabSheet.
+ for (int i = 1; i <= 10; i++) {
+ tabSheet.addComponent(new Button(i + ". tab"));
+ }
+ return tabSheet;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidthTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidthTest.java
new file mode 100644
index 0000000000..f09a68d576
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidthTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.components.tabsheet;
+
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TabBarWidthTest extends MultiBrowserTest {
+
+ @Test
+ public void testWidths() throws Exception {
+ openTestURL();
+
+ // Initial rendering.
+ compareScreen("tab-bar-width-init");
+
+ // Remove all widths.
+ vaadinElementById("toggleWidths").click();
+ compareScreen("tab-bar-width-undefined");
+
+ // Restore all widths. This should restore the rendering to the same
+ // point as the initial rendering.
+ vaadinElementById("toggleWidths").click();
+ compareScreen("tab-bar-width-restored");
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/extensions/LayoutMemoryUsageIE8Extension.java b/uitest/src/com/vaadin/tests/extensions/LayoutMemoryUsageIE8Extension.java
new file mode 100644
index 0000000000..c69c2b4d30
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/extensions/LayoutMemoryUsageIE8Extension.java
@@ -0,0 +1,36 @@
+/*
+ * 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.extensions;
+
+import com.vaadin.server.AbstractExtension;
+import com.vaadin.ui.UI;
+
+/**
+ * Test extension for finding out the size of the measuredSizes map of
+ * LayoutManagerIE8.
+ *
+ * This UI extension uses JSNI to register a JavaScript method
+ * window.vaadin.getMeasuredSizesCount() that can be used to query the size of
+ * the internal map of the layout manager. It should only be used on IE8.
+ *
+ * @since 7.1.13
+ * @author Vaadin Ltd
+ */
+public class LayoutMemoryUsageIE8Extension extends AbstractExtension {
+ public void extend(UI target) {
+ super.extend(target);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java b/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java
index cbb3a8b8e4..0266a9d892 100644
--- a/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java
+++ b/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java
@@ -15,15 +15,8 @@
*/
package com.vaadin.tests.integration;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized.Parameters;
-import org.openqa.selenium.remote.DesiredCapabilities;
-
-import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
import com.vaadin.tests.tb3.PrivateTB3Configuration;
+import com.vaadin.tests.tb3.TestNameSuffix;
/**
* Base class for integration tests. Integration tests use the
@@ -32,7 +25,7 @@ import com.vaadin.tests.tb3.PrivateTB3Configuration;
*
* @author Vaadin Ltd
*/
-@RunWith(IntegrationTestRunner.class)
+@TestNameSuffix(property = "server-name")
public abstract class AbstractIntegrationTest extends PrivateTB3Configuration {
@Override
protected String getBaseURL() {
@@ -41,13 +34,7 @@ public abstract class AbstractIntegrationTest extends PrivateTB3Configuration {
throw new RuntimeException(
"Deployment url must be given as deployment.url");
}
-
return deploymentUrl;
}
- @Parameters
- public static Collection<DesiredCapabilities> getBrowsersForTest() {
- return Collections.singleton(Browser.FIREFOX.getDesiredCapabilities());
- }
-
}
diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java
deleted file mode 100644
index f5042b54b6..0000000000
--- a/uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.integration;
-
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-
-import com.vaadin.tests.tb3.TB3Runner;
-
-/**
- * JUnit runner for integration tests. Replaces the actual method name with the
- * server-name property when generating the test name.
- *
- * @author Vaadin Ltd
- */
-public class IntegrationTestRunner extends TB3Runner {
-
- private Class<?> testClass;
-
- public IntegrationTestRunner(Class<?> klass) throws InitializationError {
- super(klass);
- testClass = klass;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.junit.runners.BlockJUnit4ClassRunner#testName(org.junit.runners.model
- * .FrameworkMethod)
- */
- @Override
- protected String testName(FrameworkMethod method) {
- if (AbstractIntegrationTest.class.isAssignableFrom(testClass)) {
- return System.getProperty("server-name");
- } else {
- return super.testName(method);
- }
- }
-}
diff --git a/uitest/src/com/vaadin/tests/integration/JSR286Portlet.java b/uitest/src/com/vaadin/tests/integration/JSR286Portlet.java
index 859175394d..37f8e21c50 100644
--- a/uitest/src/com/vaadin/tests/integration/JSR286Portlet.java
+++ b/uitest/src/com/vaadin/tests/integration/JSR286Portlet.java
@@ -50,6 +50,9 @@ public class JSR286Portlet extends UI {
Link portletEdit = new Link();
Link portletMax = new Link();
Link someAction = null;
+ Label userAgent = new Label();
+ Label screenWidth = new Label();
+ Label screenHeight = new Label();
private VerticalLayout main = new VerticalLayout();
@Override
@@ -88,6 +91,16 @@ public class JSR286Portlet extends UI {
main.addComponent(upload);
possiblyChangedModeOrState();
+
+ userAgent.setCaption("User Agent");
+ main.addComponent(userAgent);
+
+ screenWidth.setCaption("Screen width");
+ main.addComponent(screenWidth);
+
+ screenHeight.setCaption("Screen height");
+ main.addComponent(screenHeight);
+
getSession().addPortletListener(new DemoPortletListener());
}
@@ -100,6 +113,11 @@ public class JSR286Portlet extends UI {
VaadinPortletRequest request = (VaadinPortletRequest) VaadinPortletService
.getCurrentRequest();
+ userAgent.setValue(getPage().getWebBrowser().getBrowserApplication());
+ screenWidth.setValue(String.valueOf(getPage().getBrowserWindowWidth()));
+ screenHeight.setValue(String
+ .valueOf(getPage().getBrowserWindowHeight()));
+
boolean inViewMode = (request.getPortletMode() == PortletMode.VIEW);
boolean inNormalState = (request.getWindowState() == WindowState.NORMAL);
// Portlet up-and-running, enable stuff
diff --git a/uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeak.java b/uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeak.java
new file mode 100644
index 0000000000..7da9e46653
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeak.java
@@ -0,0 +1,111 @@
+/*
+ * 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.layouts;
+
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.extensions.LayoutMemoryUsageIE8Extension;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.HasComponents;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
+
+@Widgetset("com.vaadin.tests.widgetset.TestingWidgetSet")
+public class IE8MeasuredSizeMemoryLeak extends AbstractTestUI {
+
+ private boolean state = false;
+
+ private HasComponents component1 = new VerticalLayout() {
+ {
+ for (int i = 1; i <= 200; i++) {
+ String idText = "ID:" + i;
+ Label c = new Label(idText);
+ c.setId(idText);
+ addComponent(c);
+ }
+ }
+ };
+
+ private HasComponents component2 = new VerticalLayout() {
+ {
+ for (int i = 201; i <= 400; i++) {
+ String idText = "ID:" + i;
+ Label c = new Label(idText);
+ c.setId(idText);
+ addComponent(c);
+ }
+ }
+ };
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ new LayoutMemoryUsageIE8Extension().extend(this);
+
+ VerticalLayout layout = new VerticalLayout();
+ setContent(layout);
+
+ final VerticalLayout contentLayout = new VerticalLayout();
+
+ Button button = new Button("Toggle");
+ button.setId("toggle");
+ button.addClickListener(new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ contentLayout.removeAllComponents();
+ if (state) {
+ contentLayout.addComponent(component1);
+ } else {
+ contentLayout.addComponent(component2);
+ }
+ state = !state;
+ }
+
+ });
+
+ layout.addComponent(button);
+ layout.addComponent(contentLayout);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "IE8 leaks memory when components are added and removed";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 12688;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeakTest.java b/uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeakTest.java
new file mode 100644
index 0000000000..c9bd64c881
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeakTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.layouts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class IE8MeasuredSizeMemoryLeakTest extends MultiBrowserTest {
+
+ @Test
+ public void testMeasuredSizesMapCleaned() {
+ openTestURL();
+ Assert.assertEquals("No extra measured sizes in the beginning", 3,
+ getMeasuredSizesMapSize());
+ vaadinElementById("toggle").click();
+ Assert.assertEquals("Measured sizes after single toggle", 204,
+ getMeasuredSizesMapSize());
+ vaadinElementById("toggle").click();
+ Assert.assertEquals("Measured sizes cleaned on toggle", 204,
+ getMeasuredSizesMapSize());
+ }
+
+ private int getMeasuredSizesMapSize() {
+ JavascriptExecutor jsExec = (JavascriptExecutor) getDriver();
+ Number result = (Number) jsExec
+ .executeScript("return window.vaadin.getMeasuredSizesCount();");
+ return result.intValue();
+ }
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ return Collections.singletonList(Browser.IE8.getDesiredCapabilities());
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/push/StreamingReconnectWhilePushing.java b/uitest/src/com/vaadin/tests/push/StreamingReconnectWhilePushing.java
new file mode 100644
index 0000000000..5a3460a290
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/StreamingReconnectWhilePushing.java
@@ -0,0 +1,75 @@
+/*
+ * 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.Push;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.ui.Transport;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+
+@Push(transport = Transport.STREAMING)
+public class StreamingReconnectWhilePushing extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+
+ Button button = new Button("Click Me");
+ button.addClickListener(new Button.ClickListener() {
+ private Label label;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (label == null) {
+ label = new Label();
+ label.setValue(getString(1000000));
+ addComponent(label);
+ } else {
+ label.setValue("." + label.getValue());
+ }
+
+ }
+ });
+ addComponent(button);
+
+ }
+
+ protected String getString(int len) {
+ StringBuilder b = new StringBuilder();
+ for (int i = 0; i < len; i++) {
+ if (i % 100 == 0) {
+ b.append("\n");
+ } else {
+ b.append('A');
+ }
+
+ }
+ return b.toString();
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Each push of the button sends about 1MB to the client. Press it a couple of times and a spinner will appear forever if reconnecting does not work.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 13435;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/tb3/TB3Runner.java b/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
index eaffa80d09..54bb2d86a5 100644
--- a/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
+++ b/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
@@ -16,6 +16,7 @@
package com.vaadin.tests.tb3;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
@@ -83,12 +84,21 @@ public class TB3Runner extends BlockJUnit4ClassRunner {
.getAnnotation(RunLocally.class).value()
.getDesiredCapabilities());
}
- for (DesiredCapabilities capabilities : desiredCapabilites) {
+ TestNameSuffix testNameSuffixProperty = findAnnotation(
+ testClassInstance.getClass(), TestNameSuffix.class);
+ for (DesiredCapabilities capabilities : desiredCapabilites) {
// Find any methods marked with @Test.
for (FrameworkMethod m : getTestClass().getAnnotatedMethods(
Test.class)) {
- tests.add(new TB3Method(m.getMethod(), capabilities));
+ TB3Method method = new TB3Method(m.getMethod(),
+ capabilities);
+ if (testNameSuffixProperty != null) {
+ method.setTestNameSuffix("-"
+ + System.getProperty(testNameSuffixProperty
+ .property()));
+ }
+ tests.add(method);
}
}
} catch (Exception e) {
@@ -98,6 +108,27 @@ public class TB3Runner extends BlockJUnit4ClassRunner {
return tests;
}
+ /**
+ * Finds the given annotation in the given class or one of its super
+ * classes. Return the first found annotation
+ *
+ * @param searchClass
+ * @param annotationClass
+ * @return
+ */
+ private <T extends Annotation> T findAnnotation(Class<?> searchClass,
+ Class<T> annotationClass) {
+ if (searchClass == Object.class) {
+ return null;
+ }
+
+ if (searchClass.getAnnotation(annotationClass) != null) {
+ return searchClass.getAnnotation(annotationClass);
+ }
+
+ return findAnnotation(searchClass.getSuperclass(), annotationClass);
+ }
+
/*
* (non-Javadoc)
*
@@ -141,12 +172,17 @@ public class TB3Runner extends BlockJUnit4ClassRunner {
private static class TB3Method extends FrameworkMethod {
private DesiredCapabilities capabilities;
+ private String testNameSuffix = "";
public TB3Method(Method method, DesiredCapabilities capabilities) {
super(method);
this.capabilities = capabilities;
}
+ public void setTestNameSuffix(String testNameSuffix) {
+ this.testNameSuffix = testNameSuffix;
+ }
+
@Override
public Object invokeExplosively(final Object target, Object... params)
throws Throwable {
@@ -156,9 +192,11 @@ public class TB3Runner extends BlockJUnit4ClassRunner {
@Override
public String getName() {
- return String.format("%s[%s]", getMethod().getName(),
+ return String.format("%s[%s]", getMethod().getName()
+ + testNameSuffix,
BrowserUtil.getUniqueIdentifier(capabilities));
}
}
+
}
diff --git a/uitest/src/com/vaadin/tests/tb3/TestNameSuffix.java b/uitest/src/com/vaadin/tests/tb3/TestNameSuffix.java
new file mode 100644
index 0000000000..9f9bb07a13
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tb3/TestNameSuffix.java
@@ -0,0 +1,29 @@
+/*
+ * 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.tb3;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Defines a system property to be used as part of the test name
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface TestNameSuffix {
+
+ String property();
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/LayoutMemoryUsageIE8ExtensionConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/LayoutMemoryUsageIE8ExtensionConnector.java
new file mode 100644
index 0000000000..c92e688520
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/LayoutMemoryUsageIE8ExtensionConnector.java
@@ -0,0 +1,45 @@
+/*
+ * 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.widgetset.client;
+
+import com.vaadin.client.BrowserInfo;
+import com.vaadin.client.LayoutManager;
+import com.vaadin.client.LayoutManagerIE8;
+import com.vaadin.client.ServerConnector;
+import com.vaadin.client.extensions.AbstractExtensionConnector;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.tests.extensions.LayoutMemoryUsageIE8Extension;
+
+@Connect(LayoutMemoryUsageIE8Extension.class)
+public class LayoutMemoryUsageIE8ExtensionConnector extends
+ AbstractExtensionConnector {
+
+ @Override
+ protected void extend(ServerConnector target) {
+ if (BrowserInfo.get().isIE8()) {
+ LayoutManagerIE8 manager = (LayoutManagerIE8) LayoutManager
+ .get(getConnection());
+ configureGetMapSizeJS(manager);
+ }
+ }
+
+ private native void configureGetMapSizeJS(LayoutManagerIE8 manager)
+ /*-{
+ $wnd.vaadin.getMeasuredSizesCount = function() {
+ return manager.@com.vaadin.client.LayoutManagerIE8::getMeasuredSizesMapSize()();
+ };
+ }-*/;
+}
ckport/52121/stable31'>backport/52121/stable31 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/core/Controller/SetupController.php
blob: 69c3b2f2a23941af089f928935442bfe238e9c1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135