Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2755)

Unified Diff: content/test/gpu/gpu_tests/pixel.py

Issue 668753002: [Telemetry] Migrate bitmap.py from bitmaptools.cc to numpy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/gpu/gpu_tests/maps.py ('k') | tools/perf/measurements/screenshot.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/gpu/gpu_tests/pixel.py
diff --git a/content/test/gpu/gpu_tests/pixel.py b/content/test/gpu/gpu_tests/pixel.py
index e5bd7ae1f15c7615750499ed5c2de77520ef81d2..6613daeaf1e56d5fd6bb9a4a7de99c519e44f984 100644
--- a/content/test/gpu/gpu_tests/pixel.py
+++ b/content/test/gpu/gpu_tests/pixel.py
@@ -12,7 +12,7 @@ import page_sets
import pixel_expectations
from telemetry import benchmark
-from telemetry.core import bitmap
+from telemetry.image_processing import image_util
from telemetry.page import page_test
from telemetry.util import cloud_storage
@@ -62,12 +62,12 @@ class _PixelValidator(cloud_storage_test_base.ValidatorBase):
screenshot = tab.Screenshot(5)
- if not screenshot:
+ if screenshot is None:
raise page_test.Failure('Could not capture screenshot')
if hasattr(page, 'test_rect'):
- screenshot = screenshot.Crop(
- page.test_rect[0], page.test_rect[1],
+ screenshot = image_util.Crop(
+ screenshot, page.test_rect[0], page.test_rect[1],
page.test_rect[2], page.test_rect[3])
image_name = self._UrlToImageName(page.display_name)
@@ -104,7 +104,7 @@ class _PixelValidator(cloud_storage_test_base.ValidatorBase):
image_name, page.revision, screenshot)
# Test new snapshot against existing reference image
- if not ref_png.IsEqual(screenshot, tolerance=2):
+ if not image_util.AreEqual(ref_png, screenshot, tolerance=2):
if self.options.test_machine_name:
self._UploadErrorImagesToCloudStorage(image_name, screenshot, ref_png)
else:
@@ -134,11 +134,11 @@ class _PixelValidator(cloud_storage_test_base.ValidatorBase):
image_path = image_path + '_' + str(cur_revision) + '.png'
try:
- ref_png = bitmap.Bitmap.FromPngFile(image_path)
+ ref_png = image_util.FromPngFile(image_path)
except IOError:
ref_png = None
- if ref_png:
+ if ref_png is not None:
return ref_png
print 'Reference image not found. Writing tab contents as reference.'
« no previous file with comments | « content/test/gpu/gpu_tests/maps.py ('k') | tools/perf/measurements/screenshot.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698