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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « tools/telemetry/telemetry/core/video.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 import logging
6 import os
7 import unittest
8
9 from telemetry import test
10 from telemetry.core import bitmap
11 from telemetry.core import util
12 from telemetry.core import video
13 from telemetry.core.platform import android_platform_backend
14 from telemetry.unittest import system_stub
15
16 class MockAdbCommands(object):
17 def CanAccessProtectedFileContents(self):
18 return True
19
20 class MockDevice(object):
21 def __init__(self, mock_adb_commands):
22 self.old_interface = mock_adb_commands
23
24 class VideoTest(unittest.TestCase) :
25 def setUp(self):
26 self._stubs = system_stub.Override(android_platform_backend,
27 ['perf_control', 'thermal_throttle'])
28
29 def tearDown(self):
30 self._stubs.Restore()
31
32 @test.Disabled
33 def testFramesFromMp4(self):
34 mock_adb = MockDevice(MockAdbCommands())
35 backend = android_platform_backend.AndroidPlatformBackend(mock_adb, False)
36
37 try:
38 backend.InstallApplication('avconv')
39 finally:
40 if not backend.CanLaunchApplication('avconv'):
41 logging.warning('Test not supported on this platform')
42 return # pylint: disable=W0150
43
44 vid = os.path.join(util.GetUnittestDataDir(), 'vid.mp4')
45 expected_timestamps = [
46 0,
47 763,
48 783,
49 940,
50 1715,
51 1732,
52 1842,
53 1926,
54 ]
55
56 video_obj = video.Video(backend, vid)
57
58 # Calling _FramesFromMp4 should return all frames.
59 # pylint: disable=W0212
60 for i, timestamp_bitmap in enumerate(video_obj._FramesFromMp4(vid)):
61 timestamp, bmp = timestamp_bitmap
62 self.assertEquals(timestamp, expected_timestamps[i])
63 expected_bitmap = bitmap.Bitmap.FromPngFile(os.path.join(
64 util.GetUnittestDataDir(), 'frame%d.png' % i))
65 self.assertTrue(expected_bitmap.IsEqual(bmp))
OLDNEW
« 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