diff options
author | Jonas Granvik <jonas@granvik.me> | 2015-01-12 12:44:34 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2015-01-12 18:44:36 +0000 |
commit | b412ae97a659919b928fc28a3cb6500d75d514b2 (patch) | |
tree | 3ef1ee17b26a99435a6255f1279cefe37f665735 /uitest | |
parent | e20f6fd54ae4b350ea654807b98fe442e546d1a8 (diff) | |
download | vaadin-framework-b412ae97a659919b928fc28a3cb6500d75d514b2.tar.gz vaadin-framework-b412ae97a659919b928fc28a3cb6500d75d514b2.zip |
Add option to disable sending v-loc parameter in init request (#14460).
Change-Id: Ie17e0621400c3397dc19b386974e231b6f82944c
Diffstat (limited to 'uitest')
3 files changed, 76 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/applicationservlet/DisableSendUrlAsParameters.java b/uitest/src/com/vaadin/tests/applicationservlet/DisableSendUrlAsParameters.java new file mode 100644 index 0000000000..d398ead622 --- /dev/null +++ b/uitest/src/com/vaadin/tests/applicationservlet/DisableSendUrlAsParameters.java @@ -0,0 +1,36 @@ +/* + * 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.applicationservlet; + +import com.vaadin.launcher.CustomDeploymentConfiguration; +import com.vaadin.launcher.CustomDeploymentConfiguration.Conf; +import com.vaadin.server.Constants; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; + +@CustomDeploymentConfiguration({ @Conf(name = Constants.SERVLET_PARAMETER_SENDURLSASPARAMETERS, value = "false") }) +public class DisableSendUrlAsParameters extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + try { + log("Init location: " + getPage().getLocation()); + } catch (IllegalStateException e) { + log("Init location exception: " + e.getMessage()); + } + } + +} diff --git a/uitest/src/com/vaadin/tests/applicationservlet/DisableSendUrlAsParametersTest.java b/uitest/src/com/vaadin/tests/applicationservlet/DisableSendUrlAsParametersTest.java new file mode 100644 index 0000000000..f10f281646 --- /dev/null +++ b/uitest/src/com/vaadin/tests/applicationservlet/DisableSendUrlAsParametersTest.java @@ -0,0 +1,35 @@ +/* + * 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.applicationservlet; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class DisableSendUrlAsParametersTest extends SingleBrowserTest { + + @Test + public void testInitLocation() { + openTestURL(); + + String logRow = getLogRow(0); + + Assert.assertEquals( + "1. Init location exception: Location is not available as the sendUrlsAsParameters parameter is configured as false", + logRow); + } +} diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java index 3a7d42e29c..dba055a65a 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java @@ -46,6 +46,11 @@ public abstract class AbstractTestUI extends UI { } protected void warnIfWidgetsetMaybeNotCompiled() { + // Can't check location if sendUrlAsParameters is disabled + if (!getSession().getConfiguration().isSendUrlsAsParameters()) { + return; + } + // Ignore if using debug mode String query = getPage().getLocation().getQuery(); if (query != null && query.matches(".*[&?]gwt\\.codesvr.*")) { |