Skip to content

Commit

Permalink
Add missing fields to WD_SERVER_CONFIG in WebDriver tests
Browse files Browse the repository at this point in the history
Namely, `doc_root` and `domains` (the latter was added in
web-platform-tests/wpt#17141)

Also a drive-by fix to improve test discovery (only run .py files).

Bug: 974877
Change-Id: Idb917ee0dcab9691709e3d99e3f29ceec82edeb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1664042
Reviewed-by: John Chen <johnchen@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#670227}
  • Loading branch information
Hexcles authored and Commit Bot committed Jun 18, 2019
1 parent 02dcd97 commit 003a532
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 936 deletions.
16 changes: 12 additions & 4 deletions chrome/test/chromedriver/test/run_webdriver_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@
sys.path.insert(0, BLINK_TOOLS_ABS_PATH)
from blinkpy.common import exit_codes
from blinkpy.common.host import Host
from blinkpy.common.path_finder import PathFinder
from blinkpy.common.system.log_utils import configure_logging
from blinkpy.w3c.common import CHROMIUM_WPT_DIR
from blinkpy.web_tests.models import test_expectations
from blinkpy.common.path_finder import PathFinder

WD_CLIENT_PATH = 'blinkpy/third_party/wpt/wpt/tools/webdriver'
WEBDRIVER_CLIENT_ABS_PATH = os.path.join(BLINK_TOOLS_ABS_PATH, WD_CLIENT_PATH)
Expand Down Expand Up @@ -127,7 +128,7 @@ def record(self, report, status, message=None):
self.result.append(WebDriverTestResult(
output_name, status, message))

def set_up_config(chromedriver_server):
def set_up_config(path_finder, chromedriver_server):
# These envs are used to create a WebDriver session in the fixture.py file.
os.environ["WD_HOST"] = chromedriver_server.GetHost()
os.environ["WD_PORT"] = str(chromedriver_server.GetPort())
Expand Down Expand Up @@ -155,7 +156,13 @@ def set_up_config(chromedriver_server):
# /blinkpy/web_tests/servers/wptserve.py?l=23&rcl=375b34c6ba64
# 5d00c1413e4c6106c7bb74581c85
os.environ["WD_SERVER_CONFIG"] = json.dumps({
"doc_root": path_finder.path_from_chromium_base(CHROMIUM_WPT_DIR),
"browser_host": "web-platform.test",
"domains": {"": {"": "web-platform.test",
"www": "www.web-platform.test",
"www.www": "www.www.web-platform.test",
"www1": "www1.web-platform.test",
"www2": "www2.web-platform.test"}},
"ports": {"ws": [9001], "wss": [9444], "http": [8001], "https": [8444]}})

def run_test(path, path_finder, port, skipped_tests=[]):
Expand Down Expand Up @@ -193,6 +200,7 @@ def run_test(path, path_finder, port, skipped_tests=[]):
help='JSON perf output file used by swarming, ignored')
parser.add_argument(
'--test-path',
required=True,
help='Path to the WPT WebDriver tests')
parser.add_argument(
'-v', '--verbose', action='store_true',
Expand Down Expand Up @@ -252,7 +260,7 @@ def run_test(path, path_finder, port, skipped_tests=[]):
_log.error('ChromeDriver is not running.')
sys.exit(1)

set_up_config(chromedriver_server)
set_up_config(path_finder, chromedriver_server)

test_path = options.test_path
start_time = time.time()
Expand All @@ -264,7 +272,7 @@ def run_test(path, path_finder, port, skipped_tests=[]):
elif os.path.isdir(test_path):
for root, dirnames, filenames in os.walk(test_path):
for filename in filenames:
if '__init__' in filename:
if '__init__' in filename or not filename.endswith('.py'):
continue

test_file = os.path.join(root, filename)
Expand Down
Loading

0 comments on commit 003a532

Please sign in to comment.