summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-02-28 13:10:09 +0200
committerLeif Åstrand <leif@vaadin.com>2013-03-01 16:45:52 +0200
commitd6cf871c7d3cd7e48db3450b02361e24fe652670 (patch)
tree51f466aba61b28ba1e250df33e2548dadffc4aa4 /uitest
parent7f9e51e0e31c5c0a699c7ca486aaf993d5aec347 (diff)
downloadvaadin-framework-d6cf871c7d3cd7e48db3450b02361e24fe652670.tar.gz
vaadin-framework-d6cf871c7d3cd7e48db3450b02361e24fe652670.zip
Add bootstrap performance measuring support (#11188)
svn changeset:25664/svn branch:6.8 Conflicts: client/src/com/vaadin/client/ApplicationConnection.java uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java uitest/src/com/vaadin/tests/util/TestUtils.java Change-Id: I699e7b47ad5a62b67dbdf1004da5e5daf009ba25
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java5
-rw-r--r--uitest/src/com/vaadin/tests/util/TestUtils.java11
2 files changed, 11 insertions, 5 deletions
diff --git a/uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java b/uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java
index b0047d6b62..04fe18fc08 100644
--- a/uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java
+++ b/uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java
@@ -22,13 +22,14 @@ public class BasicPerformanceTest extends UI {
private int clientLimit;
private int serverLimit;
+ private boolean reportBootstap = true;
private String performanceTopic;
private final Button reportPerformanceButton = new Button(
"Report some performance", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
TestUtils.reportPerformance(performanceTopic, serverLimit,
- clientLimit);
+ clientLimit, reportBootstap);
event.getButton().setEnabled(false);
}
});
@@ -37,6 +38,7 @@ public class BasicPerformanceTest extends UI {
public void init(VaadinRequest request) {
setContent(buildMainLayout());
updatePerformanceReporting("first load", 100, 100);
+ reportBootstap = true;
}
private void updatePerformanceReporting(String performanceTopic,
@@ -47,6 +49,7 @@ public class BasicPerformanceTest extends UI {
reportPerformanceButton.setCaption("Report performance for "
+ performanceTopic);
reportPerformanceButton.setEnabled(true);
+ reportBootstap = false;
}
private ComponentContainer buildMainLayout() {
diff --git a/uitest/src/com/vaadin/tests/util/TestUtils.java b/uitest/src/com/vaadin/tests/util/TestUtils.java
index 6cb6e79c1c..5c6315a23a 100644
--- a/uitest/src/com/vaadin/tests/util/TestUtils.java
+++ b/uitest/src/com/vaadin/tests/util/TestUtils.java
@@ -120,20 +120,23 @@ public class TestUtils {
public static void installPerformanceReporting(TextArea targetTextArea) {
targetTextArea.setId("performanceTestTarget");
JavaScript
- .eval("window.reportVaadinPerformance = function(topic, serverLimit, clientLimit) {"
+ .eval("window.reportVaadinPerformance = function(topic, serverLimit, clientLimit, bootstrapTime) {"
+ "var element = document.getElementById('performanceTestTarget');"
+ "var text = topic + ': \\n';"
+ "for(var k in window.vaadin.clients) {"
+ "var p = window.vaadin.clients[k].getProfilingData();"
+ "text += ' Server time: ' + (p[3] > serverLimit?'FAIL':'OK') + ' (' + p[3] +')\\n';"
+ "text += ' Client time: ' + (p[0] > clientLimit?'FAIL':'OK') + ' (' + p[0] +')\\n';"
+ + "if (bootstrapTime) text += ' Bootstrap time: ' + (p[4] > clientLimit?'FAIL':'OK') + ' (' + p[4] +')\\n';"
+ "}" + "element.value = text;" + "}");
}
public static void reportPerformance(String topic, int serverLimit,
- int totalLimit) {
- JavaScript.eval("window.reportVaadinPerformance(\"" + topic + "\", "
- + serverLimit + ", " + totalLimit + ");");
+ int clientLimit, boolean bootstrapTime) {
+ JavaScript
+ .eval("window.reportVaadinPerformance(\"" + topic + "\", "
+ + serverLimit + ", " + clientLimit + ","
+ + bootstrapTime + ");");
}
public static IndexedContainer getISO3166Container() {