Skip to content

Commit

Permalink
Removing tests that browsers have rendered obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Sep 28, 2021
1 parent b398f8f commit 25d1037
Showing 1 changed file with 0 additions and 146 deletions.
146 changes: 0 additions & 146 deletions java/test/org/openqa/selenium/ReferrerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.openqa.selenium;

import com.google.common.base.Joiner;
import com.google.common.net.HostAndPort;
import org.junit.After;
import org.junit.Before;
Expand All @@ -32,7 +31,6 @@
import org.openqa.selenium.remote.http.HttpRequest;
import org.openqa.selenium.remote.http.HttpResponse;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.testing.Ignore;
import org.openqa.selenium.testing.SeleniumTestRule;
import org.openqa.selenium.testing.SeleniumTestRunner;

Expand All @@ -57,10 +55,6 @@
import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
import static org.openqa.selenium.testing.Safely.safelyCall;
import static org.openqa.selenium.testing.drivers.Browser.CHROME;
import static org.openqa.selenium.testing.drivers.Browser.LEGACY_FIREFOX_XPI;
import static org.openqa.selenium.testing.drivers.Browser.IE;
import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;

/**
* Tests that "Referer" headers are generated as expected under various conditions.
Expand Down Expand Up @@ -149,26 +143,6 @@ public void basicHistoryNavigationWithoutAProxy() {
new ExpectedRequest(PAGE_3, page2Url));
}

/**
* Tests navigation across multiple domains when the browser does not have a proxy configured.
*/
@Test
@Ignore(value = CHROME, reason = "https://developers.google.com/web/updates/2020/07/referrer-policy-new-chrome-default")
@Ignore(value = FIREFOX, reason = "https://developers.google.com/web/updates/2020/07/referrer-policy-new-chrome-default")
public void crossDomainHistoryNavigationWithoutAProxy() {
String page1Url = server1.whereIs(PAGE_1) + "?next=" + encode(server2.whereIs(PAGE_2));
String page2Url = server2.whereIs(PAGE_2) + "?next=" + encode(server1.whereIs(PAGE_3));

performNavigation(seleniumTestRule.getDriver(), page1Url);

assertThat(server1.getRequests()).containsExactly(
new ExpectedRequest(PAGE_1, null),
new ExpectedRequest(PAGE_3, page2Url));

assertThat(server2.getRequests()).containsExactly(
new ExpectedRequest(PAGE_2, page1Url));
}

/**
* Tests navigation when all of the files are hosted on the same domain and the browser is
* configured to use a proxy that permits direct access to that domain.
Expand All @@ -190,126 +164,6 @@ public void basicHistoryNavigationWithADirectProxy() {
new ExpectedRequest(PAGE_3, page2Url));
}

/**
* Tests navigation across multiple domains when the browser is configured to use a proxy that
* permits direct access to those domains.
*/
@Test
@Ignore(value = CHROME, reason = "https://developers.google.com/web/updates/2020/07/referrer-policy-new-chrome-default")
@Ignore(value = FIREFOX, reason = "https://developers.google.com/web/updates/2020/07/referrer-policy-new-chrome-default")
public void crossDomainHistoryNavigationWithADirectProxy() {
proxyServer.setPacFileContents("function FindProxyForURL(url, host) { return 'DIRECT'; }");
WebDriver driver = createDriver(proxyServer.whereIs("/pac.js"));

String page1Url = server1.whereIs(PAGE_1) + "?next=" + encode(server2.whereIs(PAGE_2));
String page2Url = server2.whereIs(PAGE_2) + "?next=" + encode(server1.whereIs(PAGE_3));

performNavigation(driver, page1Url);

assertThat(server1.getRequests()).containsExactly(
new ExpectedRequest(PAGE_1, null),
new ExpectedRequest(PAGE_3, page2Url));

assertThat(server2.getRequests()).containsExactly(
new ExpectedRequest(PAGE_2, page1Url));
}

/**
* Tests navigation across multiple domains when the browser is configured to use a proxy that
* redirects the second domain to another host.
*/
@Test
@Ignore(value = CHROME, reason = "https://developers.google.com/web/updates/2020/07/referrer-policy-new-chrome-default")
@Ignore(value = FIREFOX, reason = "https://developers.google.com/web/updates/2020/07/referrer-policy-new-chrome-default")
public void crossDomainHistoryNavigationWithAProxiedHost() {
proxyServer.setPacFileContents(Joiner.on('\n').join(
"function FindProxyForURL(url, host) {",
" if (host.indexOf('example') != -1) {",
" return 'PROXY " + server2.getHostAndPort() + "';",
" }",
" return 'DIRECT';",
" }"));
WebDriver driver = createDriver(proxyServer.whereIs("/pac.js"));

String page1Url = server1.whereIs(PAGE_1) + "?next=" + encode("http://www.example.com" + PAGE_2);
String page2Url = "http://www.example.com" + PAGE_2 + "?next=" + encode(server1.whereIs(PAGE_3));

performNavigation(driver, page1Url);

assertThat(server1.getRequests()).containsExactly(
new ExpectedRequest(PAGE_1, null),
new ExpectedRequest(PAGE_3, page2Url));

assertThat(server2.getRequests()).containsExactly(
new ExpectedRequest("http://www.example.com" + PAGE_2, page1Url));
}

/**
* Tests navigation across multiple domains when the browser is configured to use a proxy that
* intercepts requests to a specific host (www.example.com) - all other requests are permitted
* to connect directly to the target server.
*/
@Test
@Ignore(value = CHROME, reason = "https://developers.google.com/web/updates/2020/07/referrer-policy-new-chrome-default")
@Ignore(value = FIREFOX, reason = "https://developers.google.com/web/updates/2020/07/referrer-policy-new-chrome-default")
public void crossDomainHistoryNavigationWhenProxyInterceptsHostRequests() {
proxyServer.setPacFileContents(Joiner.on('\n').join(
"function FindProxyForURL(url, host) {",
" if (host.indexOf('example') != -1) {",
" return 'PROXY " + proxyServer.getHostAndPort() + "';",
" }",
" return 'DIRECT';",
" }"));
WebDriver driver = createDriver(proxyServer.whereIs("/pac.js"));

String page1Url = server1.whereIs(PAGE_1) + "?next=" + encode("http://www.example.com" + PAGE_2);
String page2Url = "http://www.example.com" + PAGE_2 + "?next=" + encode(server1.whereIs(PAGE_3));

performNavigation(driver, page1Url);

assertThat(server1.getRequests()).containsExactly(
new ExpectedRequest(PAGE_1, null),
new ExpectedRequest(PAGE_3, page2Url));

assertThat(proxyServer.getRequests()).containsExactly(
new ExpectedRequest("http://www.example.com" + PAGE_2, page1Url));
}

/**
* Tests navigation on a single domain where the browser is configured to use a proxy that
* intercepts requests for page 2.
*/
@Test
@Ignore(value = IE,
reason = "IEDriver does not disable automatic proxy caching, causing this test to fail, issue 6629")
@Ignore(FIREFOX)
@Ignore(value = LEGACY_FIREFOX_XPI, travis = true)
@Ignore(value = CHROME, reason = "Flaky")
public void navigationWhenProxyInterceptsASpecificUrl() {
// Have our proxy intercept requests for page 2.
proxyServer.setPacFileContents(Joiner.on('\n').join(
"function FindProxyForURL(url, host) {",
" if (url.indexOf('/page2.html?next') != -1) {",
" return 'PROXY " + proxyServer.getHostAndPort() + "';",
" }",
" return 'DIRECT';",
" }"));
WebDriver driver = createDriver(proxyServer.whereIs("/pac.js"));


String page1Url = server1.whereIs(PAGE_1) + "?next=" + encode(server1.whereIs(PAGE_2));
String page2Url = server1.whereIs(PAGE_2 + "?next=" + encode(server1.whereIs(PAGE_3)));

performNavigation(driver, page1Url);

assertThat(server1.getRequests()).containsExactly(
new ExpectedRequest(PAGE_1, null),
new ExpectedRequest(PAGE_3, page2Url));

assertThat(proxyServer.getRequests()).containsExactly(
new ExpectedRequest(PAGE_2, page1Url));
}

private static String encode(String url) {
try {
return URLEncoder.encode(url, UTF_8.name());
Expand Down

0 comments on commit 25d1037

Please sign in to comment.