Commit 6fc1d5f0 authored by John Chen's avatar John Chen Committed by Commit Bot

[ChromeDriver] Fix screenshot tests on Mac

The default color profile on Mac causes some adjusts to displayed
colors, so that screenshots have different colors from expected.
This caused some screenshot tests to fail. Fix by forcing srgb
color profile.

Bug: chromedriver:1857
Change-Id: I65aa784836e527fe8d1fa5ee3f45e50f19cdc9d3
Reviewed-on: https://chromium-review.googlesource.com/1058985Reviewed-by: default avatarJonathon Kereliuk <kereliuk@chromium.org>
Commit-Queue: John Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558702}
parent a618ff62
......@@ -111,6 +111,16 @@ def _Run(java_tests_src_dir, test_filter,
os.path.abspath(chrome_path))
st = os.stat(chrome_wrapper_path)
os.chmod(chrome_wrapper_path, st.st_mode | stat.S_IEXEC)
elif util.IsMac():
# Use srgb color profile, otherwise the default color profile on Mac
# causes some color adjustments, so screenshots have unexpected colors.
chrome_wrapper_path = os.path.join(test_dir, 'chrome-wrapper')
with open(chrome_wrapper_path, 'w') as f:
f.write('#!/bin/sh\n')
f.write('exec %s --force-color-profile=srgb "$@"\n' %
os.path.abspath(chrome_path))
st = os.stat(chrome_wrapper_path)
os.chmod(chrome_wrapper_path, st.st_mode | stat.S_IEXEC)
else:
chrome_wrapper_path = os.path.abspath(chrome_path)
sys_props += ['webdriver.chrome.binary=' + chrome_wrapper_path]
......
......@@ -114,12 +114,6 @@ _OS_NEGATIVE_FILTER['win'] = [
_OS_NEGATIVE_FILTER['linux'] = [
]
_OS_NEGATIVE_FILTER['mac'] = [
# Flaky: https://bugs.chromium.org/p/chromedriver/issues/detail?id=416
'TakesScreenshotTest.testShouldCaptureScreenshotAtFramePage',
# https://bugs.chromium.org/p/chromedriver/issues/detail?id=1857
'TakesScreenshotTest.testShouldCaptureScreenshot',
'TakesScreenshotTest.testShouldCaptureScreenshotAtFramePageAfterSwitching',
'TakesScreenshotTest.testShouldCaptureScreenshotAtIFramePageAfterSwitching',
]
_SPECIFIC_OS_REVISION_NEGATIVE_FILTER = {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment