Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/androidDexCompiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dotnet/test/remote/AssemblyTeardown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using NUnit.Framework;
using OpenQA.Selenium.Environment;
using System.Threading.Tasks;
using System;

namespace OpenQA.Selenium.Remote
{
Expand Down
27 changes: 18 additions & 9 deletions java/src/org/openqa/selenium/concurrent/ExecutorServices.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the Software Freedom Conservancy (SFC) under one
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
Expand Down Expand Up @@ -26,18 +26,27 @@
public class ExecutorServices {

private static final Logger LOG = Logger.getLogger(ExecutorServices.class.getName());
private static final int DEFAULT_SHUTDOWN_TIMEOUT = 5;

public static void shutdownGracefully(String name, ExecutorService service) {
service.shutdown();
if(!awaitTermination(name, service, DEFAULT_SHUTDOWN_TIMEOUT)){
forceShutdown(name, service);
}
}

private static boolean awaitTermination(String name, ExecutorService service, int timeoutSeconds){

try {
if (!service.awaitTermination(5, SECONDS)) {
LOG.warning(String.format("Failed to shutdown %s", name));
service.shutdownNow();
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return service.awaitTermination(timeoutSeconds, SECONDS);
}catch(InterruptedException ex){
Thread.currentThread().interrupt;
LOG.log(WARNING, String.format("Failed to shutdown %s", name), e);
service.shutdownNow();
return false;

private static void forceShutDown(String name, ExecutorService, service){
LOG.warning(String.format("Failed to shutdown %s", name), e);
service.shutdownNow();

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,16 @@ public void builderGeneratesDefaultChromeOptions() {
// This test won't pass if we want to use Chrome in a non-standard location
Assumptions.assumeThat(System.getProperty("webdriver.chrome.binary")).isNull();

localDriver = ChromeDriver.builder().build();
Capabilities capabilities = ((ChromeDriver) localDriver).getCapabilities();
localDriver = initializeChromeDriver();
assertDefaultChromeCapabilities((ChromeDriver) localDriver);
}

private ChromeDriver initializeChromeDriver(){
return ChromeDriver.builder().build();
}

private void assertDefaultChromeCapabilities(ChromeDriver driver){
Capabilities capabilities = driver.getCapabilities();
assertThat(localDriver.manage().timeouts().getImplicitWaitTimeout()).isEqualTo(Duration.ZERO);
assertThat(capabilities.getCapability("browserName")).isEqualTo("chrome");
}
Expand Down
14 changes: 7 additions & 7 deletions java/test/org/openqa/selenium/html5/LocationContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public void hasLocationContext() {
void testShouldSetAndGetLatitude() {
driver.get(pages.html5Page);

((LocationContext) driver).setLocation(new Location(40.714353, -74.005973, 0.056747));
Location location = ((LocationContext) driver).location();
LocationContext locationContext = (LocationContext) driver;
Location location = setAndRetrieveLocation(locationContext, 40.714353, -74.005973, 0.056747);
assertThat(location).isNotNull();
assertThat(location.getLatitude()).isCloseTo(40.714353, byLessThan(0.000001));
}
Expand All @@ -49,8 +49,8 @@ void testShouldSetAndGetLatitude() {
void testShouldSetAndGetLongitude() {
driver.get(pages.html5Page);

((LocationContext) driver).setLocation(new Location(40.714353, -74.005973, 0.056747));
Location location = ((LocationContext) driver).location();
LocationContext locationContext = (LocationContext) driver;
Location location = setAndRetrieveLocation(locationContext, 40.714353, -74.005973, 0.056747);
assertThat(location).isNotNull();
assertThat(location.getLongitude()).isCloseTo(-74.005973, byLessThan(0.000001));
}
Expand All @@ -60,9 +60,9 @@ void testShouldSetAndGetLongitude() {
@NotYetImplemented(EDGE)
public void testShouldSetAndGetAltitude() {
driver.get(pages.html5Page);

((LocationContext) driver).setLocation(new Location(40.714353, -74.005973, 0.056747));
Location location = ((LocationContext) driver).location();
LocationContext locationContext = (LocationContext) driver;
Location location = setAndRetrieveLocation(locationContext, 40.714353, -74.005973, 0.056747);
assertThat(location).isNotNull();
assertThat(location.getAltitude()).isCloseTo(0.056747, byLessThan(0.000001));
}
Expand Down