| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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() |
| OLD | NEW |