Index: tools/telemetry/telemetry/core/video_unittest.py |
diff --git a/tools/telemetry/telemetry/core/video_unittest.py b/tools/telemetry/telemetry/core/video_unittest.py |
index e940f0f49e4d4f490dda76deb8126a4227a1e5c4..b49190d106d78006322214b926d1db1ef7b06073 100644 |
--- a/tools/telemetry/telemetry/core/video_unittest.py |
+++ b/tools/telemetry/telemetry/core/video_unittest.py |
@@ -2,30 +2,19 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-import logging |
import os |
import unittest |
-from telemetry import benchmark |
+from telemetry import decorators |
from telemetry.core import bitmap |
-from telemetry.core import platform |
from telemetry.core import util |
from telemetry.core import video |
class VideoTest(unittest.TestCase): |
- @benchmark.Disabled |
+ @decorators.Enabled('linux') |
def testFramesFromMp4(self): |
- host_platform = platform.GetHostPlatform() |
- |
- try: |
- host_platform.InstallApplication('avconv') |
- finally: |
- if not host_platform.CanLaunchApplication('avconv'): |
- logging.warning('Test not supported on this platform') |
- return # pylint: disable=W0150 |
- |
vid = os.path.join(util.GetUnittestDataDir(), 'vid.mp4') |
expected_timestamps = [ |
0, |
@@ -38,13 +27,14 @@ class VideoTest(unittest.TestCase): |
1926, |
] |
- video_obj = video.Video(vid) |
- |
- # Calling _FramesFromMp4 should return all frames. |
- # pylint: disable=W0212 |
- for i, timestamp_bitmap in enumerate(video_obj._FramesFromMp4(vid)): |
- timestamp, bmp = timestamp_bitmap |
- self.assertEquals(timestamp, expected_timestamps[i]) |
- expected_bitmap = bitmap.Bitmap.FromPngFile(os.path.join( |
- util.GetUnittestDataDir(), 'frame%d.png' % i)) |
- self.assertTrue(expected_bitmap.IsEqual(bmp)) |
+ with open(vid) as video_file: |
+ video_obj = video.Video(video_file) |
+ |
+ # Calling _FramesFromMp4 should return all frames. |
+ # pylint: disable=W0212 |
+ for i, timestamp_bitmap in enumerate(video_obj._FramesFromMp4()): |
+ timestamp, bmp = timestamp_bitmap |
+ self.assertEquals(timestamp, expected_timestamps[i]) |
+ expected_bitmap = bitmap.Bitmap.FromPngFile(os.path.join( |
+ util.GetUnittestDataDir(), 'frame%d.png' % i)) |
+ self.assertTrue(expected_bitmap.IsEqual(bmp)) |