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

Unified Diff: tools/perf/metrics/speedindex_unittest.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 | « tools/perf/metrics/speedindex.py ('k') | tools/telemetry/telemetry/core/_bitmap.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/speedindex_unittest.py
diff --git a/tools/perf/metrics/speedindex_unittest.py b/tools/perf/metrics/speedindex_unittest.py
index 25f3433a20ec5d84b7a6ab86f408c3225cf0ccf3..476a245257952b0424cfd0b4ec8c58bb6e322823 100644
--- a/tools/perf/metrics/speedindex_unittest.py
+++ b/tools/perf/metrics/speedindex_unittest.py
@@ -9,7 +9,8 @@ import json
import os
import unittest
-from telemetry.core import bitmap
+from telemetry.image_processing import histogram
+from telemetry.image_processing import rgba_color
from telemetry.timeline import inspector_timeline_data
from telemetry.timeline import model
from metrics import speedindex
@@ -24,8 +25,12 @@ _SAMPLE_EVENTS = model.TimelineModel(
timeline_data=_SAMPLE_TIMELINE_DATA).GetAllEvents()
-class FakeTimelineModel(object):
+class FakeImageUtil(object):
+ # pylint: disable=W0613
+ def GetColorHistogram(self, image, ignore_color=None, tolerance=None):
+ return image.ColorHistogram()
+class FakeTimelineModel(object):
def __init__(self):
self._events = []
@@ -38,7 +43,6 @@ class FakeTimelineModel(object):
class FakeVideo(object):
-
def __init__(self, frames):
self._frames = frames
@@ -47,9 +51,8 @@ class FakeVideo(object):
yield frame
class FakeBitmap(object):
-
def __init__(self, r, g, b):
- self._histogram = bitmap.ColorHistogram(r, g, b, bitmap.WHITE)
+ self._histogram = histogram.ColorHistogram(r, g, b, rgba_color.WHITE)
# pylint: disable=W0613
def ColorHistogram(self, ignore_color=None, tolerance=None):
@@ -57,7 +60,6 @@ class FakeBitmap(object):
class FakeTab(object):
-
def __init__(self, video_capture_result=None):
self._timeline_model = FakeTimelineModel()
self._javascript_result = None
@@ -123,7 +125,7 @@ class SpeedIndexImplTest(unittest.TestCase):
max_distance = 42.
tab = FakeTab(frames)
- impl = speedindex.VideoSpeedIndexImpl()
+ impl = speedindex.VideoSpeedIndexImpl(FakeImageUtil())
impl.Start(tab)
impl.Stop(tab)
time_completeness = impl.GetTimeCompletenessList(tab)
@@ -147,7 +149,7 @@ class SpeedIndexImplTest(unittest.TestCase):
(0.3, FakeBitmap([0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1])),
]
tab = FakeTab(frames)
- impl = speedindex.VideoSpeedIndexImpl()
+ impl = speedindex.VideoSpeedIndexImpl(FakeImageUtil())
impl.Start(tab)
impl.Stop(tab)
time_completeness = impl.GetTimeCompletenessList(tab)
« no previous file with comments | « tools/perf/metrics/speedindex.py ('k') | tools/telemetry/telemetry/core/_bitmap.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698