summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java3
-rw-r--r--uitest/src/com/vaadin/tests/application/TimingInfoReported.java71
-rw-r--r--uitest/src/com/vaadin/tests/application/TimingInfoReportedTest.java33
3 files changed, 105 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 6830f21bcd..97ddd14764 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -42,7 +42,6 @@ import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.ApplicationConfiguration.ErrorMessage;
-import com.vaadin.client.ApplicationConnection.ApplicationStoppedEvent;
import com.vaadin.client.ResourceLoader.ResourceLoadEvent;
import com.vaadin.client.ResourceLoader.ResourceLoadListener;
import com.vaadin.client.communication.ConnectionStateHandler;
@@ -486,7 +485,7 @@ public class ApplicationConnection implements HasHandlers {
}
client.getProfilingData = $entry(function() {
- var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler();
+ var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler()();
var pd = [
smh.@com.vaadin.client.communication.MessageHandler::lastProcessingTime,
smh.@com.vaadin.client.communication.MessageHandler::totalProcessingTime
diff --git a/uitest/src/com/vaadin/tests/application/TimingInfoReported.java b/uitest/src/com/vaadin/tests/application/TimingInfoReported.java
new file mode 100644
index 0000000000..83d31b184e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/application/TimingInfoReported.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2000-2014 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.application;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.JavaScriptFunction;
+
+import elemental.json.JsonArray;
+
+public class TimingInfoReported extends AbstractTestUIWithLog {
+
+ private String reportTimings = "setTimeout(function() {"
+ + "report(window.vaadin.clients[Object.keys(window.vaadin.clients)].getProfilingData());"
+ + "},0);";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ getPage().getJavaScript().addFunction("report",
+ new JavaScriptFunction() {
+
+ @Override
+ public void call(JsonArray arguments) {
+ log("Got: " + arguments.toJson());
+ JsonArray values = arguments.getArray(0);
+
+ if (values.length() != 5) {
+ log("ERROR: expected 5 values, got "
+ + values.length());
+ return;
+ }
+
+ for (int i = 0; i < values.length(); i++) {
+ if (i < 0 || i > 10000) {
+ log("ERROR: expected value " + i
+ + " to be between 0 and 10000, was "
+ + values.getNumber(i));
+ return;
+ }
+ }
+ log("Timings ok");
+ }
+ });
+ getPage().getJavaScript().execute(reportTimings);
+ Button b = new Button("test request", new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ getPage().getJavaScript().execute(reportTimings);
+
+ }
+ });
+ addComponent(b);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/application/TimingInfoReportedTest.java b/uitest/src/com/vaadin/tests/application/TimingInfoReportedTest.java
new file mode 100644
index 0000000000..0b9ab77d81
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/application/TimingInfoReportedTest.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2014 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.application;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.SingleBrowserTestPhantomJS2;
+
+public class TimingInfoReportedTest extends SingleBrowserTestPhantomJS2 {
+
+ @Test
+ public void ensureTimingsAvailable() {
+ openTestURL();
+ Assert.assertEquals("2. Timings ok", getLogRow(0));
+ $(ButtonElement.class).first().click();
+ Assert.assertEquals("4. Timings ok", getLogRow(0));
+ }
+}