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

Unified Diff: tools/telemetry/telemetry/core/video_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 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
new file mode 100644
index 0000000000000000000000000000000000000000..25ca2b92f808e67923c7dd3d64737510936ff171
--- /dev/null
+++ b/tools/telemetry/telemetry/core/video_unittest.py
@@ -0,0 +1,65 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# 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 test
+from telemetry.core import bitmap
+from telemetry.core import util
+from telemetry.core import video
+from telemetry.core.platform import android_platform_backend
+from telemetry.unittest import system_stub
+
+class MockAdbCommands(object):
+ def CanAccessProtectedFileContents(self):
+ return True
+
+class MockDevice(object):
+ def __init__(self, mock_adb_commands):
+ self.old_interface = mock_adb_commands
+
+class VideoTest(unittest.TestCase) :
+ def setUp(self):
+ self._stubs = system_stub.Override(android_platform_backend,
+ ['perf_control', 'thermal_throttle'])
+
+ def tearDown(self):
+ self._stubs.Restore()
+
+ @test.Disabled
+ def testFramesFromMp4(self):
+ mock_adb = MockDevice(MockAdbCommands())
+ backend = android_platform_backend.AndroidPlatformBackend(mock_adb, False)
+
+ try:
+ backend.InstallApplication('avconv')
+ finally:
+ if not backend.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,
+ 763,
+ 783,
+ 940,
+ 1715,
+ 1732,
+ 1842,
+ 1926,
+ ]
+
+ video_obj = video.Video(backend, 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))
« 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