Use Docker Java API to manage container for WebDriver

Previously we had a few customized Gradle build task to manage
the Docker container for provisioning browser and ChromeDriverService
used by WebDriver tests. This CL changed to use a java library
from testcontainers.org to achieve the same purpose. The main
benefit of it is that we can expect to run the WebDriver tests
from IDE going forward.

Also, this CL refactored the structure of WebDriver related classes
to have JUnit rule to manage the lifecycle of WebDriver instance,
this is also compatible with the API from testcontainers library.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=241539861
This commit is contained in:
shicong 2019-04-02 09:07:55 -07:00 committed by jianglai
parent 5470414e48
commit ac74ad3088
29 changed files with 376 additions and 177 deletions

View file

@ -82,16 +82,16 @@ public final class NetworkUtils {
/**
* Returns the externally-facing IPv4 network address of the local host.
*
* <p>This function implements a workaround for an
* <a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4665037">issue</a> in
* {@link InetAddress#getLocalHost}.
* <p>This function implements a workaround for an <a
* href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4665037">issue</a> in {@link
* InetAddress#getLocalHost}.
*
* <p><b>Note:</b> This code was pilfered from {@link "com.google.net.base.LocalHost"} which was
* never made open source.
*
* @throws UnknownHostException if the local host could not be resolved into an address
*/
private static InetAddress getExternalAddressOfLocalSystem() throws UnknownHostException {
public static InetAddress getExternalAddressOfLocalSystem() throws UnknownHostException {
InetAddress localhost = InetAddress.getLocalHost();
// If we have a loopback address, look for an address using the network cards.
if (localhost.isLoopbackAddress()) {