Commit 7bd3c532 authored by Brian Sheedy's avatar Brian Sheedy Committed by Commit Bot

Switch remaining GPU expected color tests

Switches all remaining uses of expected colors in the GPU pixel tests to
regular pixel tests. Initially, these are set to use the very permissive
Sobel algorithm so that images are auto-triaged until enough data is
collected to calculate suitable less permissive parameters. The tests
have grace periods defined until June 22nd, so any flakes that are not
caught by the permissive algorithm will not affect the bots.

Bug: 1078914
Change-Id: Ia59bba2d5117b66a537b4be3894cc9b2725ead56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2219585
Auto-Submit: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: default avatarYuly Novikov <ynovikov@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773911}
parent d429ec69
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import json import datetime
import os import os
import sys import sys
...@@ -20,7 +20,7 @@ _MAPS_PERF_TEST_PATH = os.path.join(path_util.GetChromiumSrcDir(), 'tools', ...@@ -20,7 +20,7 @@ _MAPS_PERF_TEST_PATH = os.path.join(path_util.GetChromiumSrcDir(), 'tools',
_DATA_PATH = os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', _DATA_PATH = os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test',
'gpu', 'gpu_tests') 'gpu', 'gpu_tests')
_TOLERANCE = 6 _TEST_NAME = 'Maps_maps'
class MapsIntegrationTest( class MapsIntegrationTest(
...@@ -68,12 +68,10 @@ class MapsIntegrationTest( ...@@ -68,12 +68,10 @@ class MapsIntegrationTest(
# artifact of the failure to help with debugging. There are no accepted # artifact of the failure to help with debugging. There are no accepted
# positive baselines recorded in Skia Gold, so its diff will not be # positive baselines recorded in Skia Gold, so its diff will not be
# sufficient to debugging the failure. # sufficient to debugging the failure.
yield ('Maps_maps', 'file://performance.html', yield ('Maps_maps', 'file://performance.html', ())
('maps_pixel_expectations.json'))
def RunActualGpuTest(self, url, *args): def RunActualGpuTest(self, url, *_):
tab = self.tab tab = self.tab
pixel_expectations_file = args[0]
action_runner = tab.action_runner action_runner = tab.action_runner
action_runner.Navigate(url) action_runner.Navigate(url)
action_runner.WaitForJavaScriptCondition('window.startTest != undefined') action_runner.WaitForJavaScriptCondition('window.startTest != undefined')
...@@ -94,18 +92,9 @@ class MapsIntegrationTest( ...@@ -94,18 +92,9 @@ class MapsIntegrationTest(
dpr = tab.EvaluateJavaScript('window.devicePixelRatio') dpr = tab.EvaluateJavaScript('window.devicePixelRatio')
print 'Maps\' devicePixelRatio is ' + str(dpr) print 'Maps\' devicePixelRatio is ' + str(dpr)
# Even though the Maps test uses a fixed devicePixelRatio so that page = _GetMapsPageForUrl(url)
# it fetches all of the map tiles at the same resolution, on two self._UploadTestResultToSkiaGold(_TEST_NAME, screenshot, page,
# different devices with the same devicePixelRatio (a Retina self._GetBuildIdArgs())
# MacBook Pro and a Nexus 9), different scale factors of the final
# screenshot are observed. Hack around this by specifying a scale
# factor for these bots in the test expectations. This relies on
# the test-machine-name argument being specified on the command
# line.
expected = _ReadPixelExpectations(pixel_expectations_file)
page = _MapsExpectationToPixelExpectation(url, expected, _TOLERANCE)
self._ValidateScreenshotSamplesWithSkiaGold(tab, page, screenshot, dpr,
self._GetBuildIdArgs())
@classmethod @classmethod
def ExpectationsFiles(cls): def ExpectationsFiles(cls):
...@@ -116,22 +105,15 @@ class MapsIntegrationTest( ...@@ -116,22 +105,15 @@ class MapsIntegrationTest(
] ]
def _ReadPixelExpectations(expectations_file): def _GetMapsPageForUrl(url):
expectations_path = os.path.join(_DATA_PATH, expectations_file)
with open(expectations_path, 'r') as f:
json_contents = json.load(f)
return json_contents
def _MapsExpectationToPixelExpectation(url, expected_colors, tolerance):
page = pixel_test_pages.PixelTestPage( page = pixel_test_pages.PixelTestPage(
url=url, url=url,
name=('Maps_maps'), name=_TEST_NAME,
# Exact test_rect is arbitrary, just needs to encapsulate all pixels # Exact test_rect is arbitrary, just needs to encapsulate all pixels
# that are tested. # that are tested.
test_rect=[0, 0, 600, 400], test_rect=[0, 0, 600, 400],
tolerance=tolerance, grace_period_end=datetime.date(2020, 6, 22),
expected_colors=expected_colors) matching_algorithm=pixel_test_pages.VERY_PERMISSIVE_SOBEL_ALGO)
return page return page
......
[
{
"comment": "scale factor overrides",
"scale_factor_overrides": [
{
"device_type": "Nexus 5",
"scale_factor": 1.105
},
{
"device_type": "Nexus 5X",
"scale_factor": 1.105
},
{
"device_type": "Nexus 6",
"scale_factor": 1.47436
},
{
"device_type": "Nexus 6P",
"scale_factor": 1.472
},
{
"device_type": "Nexus 9",
"scale_factor": 1.566
},
{
"comment": "NVIDIA Shield",
"device_type": "sb_na_wf",
"scale_factor": 1.226
}
]
},
{
"comment": "light green",
"location": [ 43, 247 ],
"size": [ 1, 1 ],
"color": [ 214, 232, 186 ]
},
{
"comment": "darker green",
"location": [ 326, 111 ],
"size": [ 1, 1 ],
"color": [ 203, 230, 163 ]
},
{
"comment": "blue lake",
"location": [ 593, 393 ],
"size": [ 1, 1 ],
"color": [ 163, 205, 255 ]
},
{
"comment": "gray",
"location": [ 95, 117 ],
"size": [ 1, 1 ],
"color": [ 232, 232, 232 ]
},
{
"comment": "tan",
"location": [ 344, 263 ],
"size": [ 1, 1 ],
"color": [ 240, 237, 230 ]
}
]
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