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

Side by Side Diff: tools/perf/metrics/speedindex_unittest.py

Issue 303043002: Refactor all video related processing to its own class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing speedindex tests and resync Created 6 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « tools/perf/metrics/speedindex.py ('k') | tools/telemetry/telemetry/core/platform/__init__.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # These tests access private methods in the speedindex module. 5 # These tests access private methods in the speedindex module.
6 # pylint: disable=W0212 6 # pylint: disable=W0212
7 7
8 import json 8 import json
9 import os 9 import os
10 import unittest 10 import unittest
(...skipping 18 matching lines...) Expand all
29 def __init__(self): 29 def __init__(self):
30 self._events = [] 30 self._events = []
31 31
32 def SetAllEvents(self, events): 32 def SetAllEvents(self, events):
33 self._events = events 33 self._events = events
34 34
35 def GetAllEvents(self): 35 def GetAllEvents(self):
36 return self._events 36 return self._events
37 37
38 38
39 class FakeVideo(object):
40
41 def __init__(self, frames):
42 self._frames = frames
43
44 def GetVideoFrameIter(self):
45 for frame in self._frames:
46 yield frame
47
39 class FakeBitmap(object): 48 class FakeBitmap(object):
40 49
41 def __init__(self, r, g, b): 50 def __init__(self, r, g, b):
42 self._histogram = bitmap.ColorHistogram(r, g, b, bitmap.WHITE) 51 self._histogram = bitmap.ColorHistogram(r, g, b, bitmap.WHITE)
43 52
44 # pylint: disable=W0613 53 # pylint: disable=W0613
45 def ColorHistogram(self, ignore_color=None, tolerance=None): 54 def ColorHistogram(self, ignore_color=None, tolerance=None):
46 return self._histogram 55 return self._histogram
47 56
48 57
49 class FakeTab(object): 58 class FakeTab(object):
50 59
51 def __init__(self, video_capture_result=None): 60 def __init__(self, video_capture_result=None):
52 self._timeline_model = FakeTimelineModel() 61 self._timeline_model = FakeTimelineModel()
53 self._javascript_result = None 62 self._javascript_result = None
54 self._video_capture_result = video_capture_result 63 self._video_capture_result = FakeVideo(video_capture_result)
55 64
56 @property 65 @property
57 def timeline_model(self): 66 def timeline_model(self):
58 return self._timeline_model 67 return self._timeline_model
59 68
60 @property 69 @property
61 def video_capture_supported(self): 70 def video_capture_supported(self):
62 return self._video_capture_result is not None 71 return self._video_capture_result is not None
63 72
64 def SetEvaluateJavaScriptResult(self, result): 73 def SetEvaluateJavaScriptResult(self, result):
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 224
216 def test2ch(self): 225 def test2ch(self):
217 # Page: http://2ch.net/ 226 # Page: http://2ch.net/
218 # This page has several paint events, including nested paint events. 227 # This page has several paint events, including nested paint events.
219 self._TestJsonTimelineExpectation( 228 self._TestJsonTimelineExpectation(
220 '2ch_repeat_timeline.json', (997, 650), 674.58) 229 '2ch_repeat_timeline.json', (997, 650), 674.58)
221 230
222 231
223 if __name__ == "__main__": 232 if __name__ == "__main__":
224 unittest.main() 233 unittest.main()
OLDNEW
« no previous file with comments | « tools/perf/metrics/speedindex.py ('k') | tools/telemetry/telemetry/core/platform/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698