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

Unified Diff: tools/telemetry/telemetry/core/video_unittest.py

Issue 756553003: [Telemetry] Fix video_unittest so that it actually runs on bots. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments 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/telemetry/telemetry/core/video.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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))
« no previous file with comments | « tools/telemetry/telemetry/core/video.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698