Skip to content

Commit

Permalink
Merge branch 'trunk' of https://github.com/SeleniumHQ/selenium into t…
Browse files Browse the repository at this point in the history
…runk
  • Loading branch information
harsha509 committed Nov 11, 2020
2 parents 74a012b + 9899fc0 commit 9ca44d6
Show file tree
Hide file tree
Showing 84 changed files with 1,837 additions and 630 deletions.
2 changes: 2 additions & 0 deletions .idea/libraries/libcdp.xml

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

9 changes: 7 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,13 @@ task '//java/client/test/org/openqa/selenium/environment/webserver:webserver:ube
JAVA_RELEASE_TARGETS = %w[
//java/client/src/org/openqa/selenium/chrome:chrome-maven-artifacts
//java/client/src/org/openqa/selenium/chromium:chromium-maven-artifacts
//java/client/src/org/openqa/selenium/devtools/v84:v84-maven-artifacts
//java/client/src/org/openqa/selenium/devtools/v85:v85-maven-artifacts
//java/client/src/org/openqa/selenium/devtools/v86:v86-maven-artifacts
//java/client/src/org/openqa/selenium/devtools/v87:v87-maven-artifacts
//java/client/src/org/openqa/selenium/devtools:devtools-maven-artifacts
//java/client/src/org/openqa/selenium/edge/edgehtml:edgehtml-maven-artifacts
//java/client/src/org/openqa/selenium/edge:edgeium-maven-artifacts
//java/client/src/org/openqa/selenium/edge:edge-maven-artifacts
//java/client/src/org/openqa/selenium/edgehtml:edgehtml-maven-artifacts
//java/client/src/org/openqa/selenium/firefox/xpi:xpi-maven-artifacts
//java/client/src/org/openqa/selenium/firefox:firefox-maven-artifacts
//java/client/src/org/openqa/selenium/ie:ie-maven-artifacts
Expand All @@ -120,6 +124,7 @@ JAVA_RELEASE_TARGETS = %w[
//java/client/src/org/openqa/selenium:client-combined-maven-artifacts
//java/client/src/org/openqa/selenium:core-maven-artifacts
//java/server/src/com/thoughtworks/selenium/webdriven:webdriven-maven-artifacts
//java/server/src/org/openqa/selenium/grid/sessionmap/jdbc:jdbc-maven-artifacts
//java/server/src/org/openqa/selenium/grid/sessionmap/redis:redis-maven-artifacts
//java/server/src/org/openqa/selenium/grid:grid-maven-artifacts
]
Expand Down
86 changes: 52 additions & 34 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ lint_setup({

http_archive(
name = "platforms",
sha256 = "ae95e4bfcd9f66e9dc73a92cee0107fede74163f788e3deefe00f3aaae75c431",
strip_prefix = "platforms-681f1ee032566aa2d443cf0335d012925d9c58d4",
sha256 = "0fc19efca1dfc5c1448c98f050639e3a48beb0031701d55bea5eb546507970f2",
strip_prefix = "platforms-0.0.1",
urls = [
"https://github.com/bazelbuild/platforms/archive/681f1ee032566aa2d443cf0335d012925d9c58d4.zip",
"https://github.com/bazelbuild/platforms/archive/0.0.1.tar.gz",
],
)

http_archive(
name = "bazel_skylib",
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
],
)

Expand All @@ -63,6 +63,43 @@ load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")

rbe_autoconfig(name = "rbe_default")

http_archive(
name = "rules_python",
patches = ["//py:rules_python_wheel_directory_check.patch"],
sha256 = "4d8ed66d5f57a0b6b90e495ca8e29e5c5fa353b93f093e7c31c595a4631ff293",
strip_prefix = "rules_python-5c948dcfd4ca79c2ed3a87636c46abba9f5836e9",
url = "https://github.com/bazelbuild/rules_python/archive/5c948dcfd4ca79c2ed3a87636c46abba9f5836e9.zip",
)

# This call should always be present.
load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

# This one is only needed if you're using the packaging rules.
load("@rules_python//python:pip.bzl", "pip_install", "pip_repositories")

pip_install(
name = "dev_requirements",
requirements = "//py:requirements.txt",
)

http_archive(
name = "rules_proto",
sha256 = "8e7d59a5b12b233be5652e3d29f42fba01c7cbab09f6b3a8d0a57ed6d1e9a0da",
strip_prefix = "rules_proto-7e4afce6fe62dbff0a4a03450143146f9f2d7488",
urls = [
"https://github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
],
)

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")

rules_proto_dependencies()

rules_proto_toolchains()

http_archive(
name = "rules_jvm_external",
sha256 = "d85951a92c0908c80bd8551002d66cb23c3434409c814179c0ff026b53544dab",
Expand All @@ -78,19 +115,6 @@ load("@maven//:defs.bzl", "pinned_maven_install")

pinned_maven_install()

http_archive(
name = "io_bazel_rules_closure",
sha256 = "2e95ba060acd74f3662547a38814ffff60317be047b7168d25498aea52f3e732",
strip_prefix = "rules_closure-b3d4ec3879620edcadd3422b161cebb37c59b6c5",
urls = [
"https://github.com/bazelbuild/rules_closure/archive/b3d4ec3879620edcadd3422b161cebb37c59b6c5.tar.gz",
],
)

load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")

closure_repositories()

http_archive(
name = "d2l_rules_csharp",
sha256 = "4e8e9a93a5436d81c0a410148bef9e3e44860cd7dc567dd4732ab5b269a5e1f8",
Expand Down Expand Up @@ -119,25 +143,19 @@ npm_install(
)

http_archive(
name = "rules_python",
patches = ["//py:rules_python_wheel_directory_check.patch"],
sha256 = "4d8ed66d5f57a0b6b90e495ca8e29e5c5fa353b93f093e7c31c595a4631ff293",
strip_prefix = "rules_python-5c948dcfd4ca79c2ed3a87636c46abba9f5836e9",
url = "https://github.com/bazelbuild/rules_python/archive/5c948dcfd4ca79c2ed3a87636c46abba9f5836e9.zip",
name = "io_bazel_rules_closure",
sha256 = "d66deed38a0bb20581c15664f0ab62270af5940786855c7adc3087b27168b529",
strip_prefix = "rules_closure-0.11.0",
urls = [
"https://github.com/bazelbuild/rules_closure/archive/0.11.0.tar.gz",
],
)

# This call should always be present.
load("@rules_python//python:repositories.bzl", "py_repositories")
load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies", "rules_closure_toolchains")

py_repositories()
rules_closure_dependencies()

# This one is only needed if you're using the packaging rules.
load("@rules_python//python:pip.bzl", "pip_install", "pip_repositories")

pip_install(
name = "dev_requirements",
requirements = "//py:requirements.txt",
)
rules_closure_toolchains()

http_archive(
name = "rules_pkg",
Expand Down
89 changes: 0 additions & 89 deletions dotnet/merge-assemblies.bzl

This file was deleted.

4 changes: 4 additions & 0 deletions dotnet/src/webdriver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ generated_assembly_info(
"//dotnet/src/webdriver/cdp:generate-v84",
"//dotnet/src/webdriver/cdp:generate-v85",
"//dotnet/src/webdriver/cdp:generate-v86",
"//dotnet/src/webdriver/cdp:generate-v87",
],
out = "WebDriver",
resources = [
Expand Down Expand Up @@ -99,6 +100,7 @@ generated_assembly_info(
"//dotnet/src/webdriver/cdp:generate-v84",
"//dotnet/src/webdriver/cdp:generate-v85",
"//dotnet/src/webdriver/cdp:generate-v86",
"//dotnet/src/webdriver/cdp:generate-v87",
],
out = "WebDriver",
resources = [
Expand Down Expand Up @@ -138,6 +140,7 @@ generated_assembly_info(
"//dotnet/src/webdriver/cdp:generate-v84",
"//dotnet/src/webdriver/cdp:generate-v85",
"//dotnet/src/webdriver/cdp:generate-v86",
"//dotnet/src/webdriver/cdp:generate-v87",
],
out = "strongnamed/WebDriver",
keyfile = "//dotnet:WebDriver.snk",
Expand Down Expand Up @@ -187,6 +190,7 @@ generated_assembly_info(
"//dotnet/src/webdriver/cdp:generate-v84",
"//dotnet/src/webdriver/cdp:generate-v85",
"//dotnet/src/webdriver/cdp:generate-v86",
"//dotnet/src/webdriver/cdp:generate-v87",
],
out = "strongnamed/WebDriver",
keyfile = "//dotnet:WebDriver.snk",
Expand Down
45 changes: 24 additions & 21 deletions dotnet/src/webdriver/DevTools/DevToolsDomains.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;

namespace OpenQA.Selenium.DevTools
Expand All @@ -32,14 +33,14 @@ public abstract class DevToolsDomains
private static readonly int DefaultVersionRange = 5;

// This is the list of known supported DevTools version implementation.
// Note carefully that it is sorted in reverse order, most recent
// version first, as that is more likely to match. When new versions
// are implemented for support,
private static readonly List<Type> SupportedDevToolsVersions = new List<Type>()
// When new versions are implemented for support, new types must be
// added to this dictionary.
private static readonly Dictionary<int, Type> SupportedDevToolsVersions = new Dictionary<int, Type>()
{
typeof(V86.V86Domains),
typeof(V85.V85Domains),
typeof(V84.V84Domains)
{ 87, typeof(V87.V87Domains) },
{ 86, typeof(V86.V86Domains) },
{ 85, typeof(V85.V85Domains) },
{ 84, typeof(V84.V84Domains) }
};

/// <summary>
Expand Down Expand Up @@ -110,22 +111,24 @@ public static DevToolsDomains InitializeDomains(DevToolsVersionInfo versionInfo,

private static Type MatchDomainsVersion(int desiredVersion, int versionRange)
{
// Use reflection to look for a DevToolsVersion static field on every known domain implementation type
foreach (Type candidateType in SupportedDevToolsVersions)
// Return fast on an exact match
if (SupportedDevToolsVersions.ContainsKey(desiredVersion))
{
PropertyInfo info = candidateType.GetProperty("DevToolsVersion", BindingFlags.Static | BindingFlags.Public);
if (info != null)
return SupportedDevToolsVersions[desiredVersion];
}

// Get the list of supported versions and sort descending
List<int> supportedVersions = new List<int>(SupportedDevToolsVersions.Keys);
supportedVersions.Sort((first, second) => second.CompareTo(first));

foreach (int supportedVersion in supportedVersions)
{
// Match the version with the desired version within the
// version range, using "The Price Is Right" style matching
// (that is, closest without going over).
if (desiredVersion >= supportedVersion && desiredVersion - supportedVersion < versionRange)
{
object propertyValue = info.GetValue(null);
if (propertyValue != null)
{
// Match the version with the desired version within the version range
int candidateVersion = (int)propertyValue;
if (desiredVersion - candidateVersion < versionRange)
{
return candidateType;
}
}
return SupportedDevToolsVersions[supportedVersion];
}
}

Expand Down
4 changes: 3 additions & 1 deletion dotnet/src/webdriver/DevTools/DevToolsSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public T GetVersionSpecificDomains<T>() where T: DevToolsSessionDomains
T versionSpecificDomains = this.domains.VersionSpecificDomains as T;
if (versionSpecificDomains == null)
{
throw new InvalidOperationException("Type is invalid for conversion");
string errorTemplate = "The type is invalid for conversion. You requested domains of type '{0}', but the version-specific domains for this session are '{1}'";
string exceptionMessage = string.Format(CultureInfo.InvariantCulture, errorTemplate, typeof(T).ToString(), this.domains.GetType().ToString());
throw new InvalidOperationException(exceptionMessage);
}

return versionSpecificDomains;
Expand Down
Loading

0 comments on commit 9ca44d6

Please sign in to comment.