OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ | 5 #ifndef MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ |
6 #define MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ | 6 #define MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ |
7 | 7 |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/md5.h" | 9 #include "base/md5.h" |
10 #include "media/audio/null_audio_sink.h" | 10 #include "media/audio/null_audio_sink.h" |
11 #include "media/base/filter_collection.h" | 11 #include "media/base/filter_collection.h" |
12 #include "media/base/pipeline.h" | 12 #include "media/base/pipeline.h" |
13 #include "media/filters/chunk_demuxer.h" | 13 #include "media/filters/chunk_demuxer.h" |
14 #include "media/filters/video_renderer_base.h" | 14 #include "media/filters/video_renderer_base.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 | 16 |
| 17 namespace base { |
17 class FilePath; | 18 class FilePath; |
| 19 } |
18 | 20 |
19 namespace media { | 21 namespace media { |
20 | 22 |
21 class Decryptor; | 23 class Decryptor; |
22 | 24 |
23 // Empty MD5 hash string. Used to verify empty audio or video tracks. | 25 // Empty MD5 hash string. Used to verify empty audio or video tracks. |
24 extern const char kNullHash[]; | 26 extern const char kNullHash[]; |
25 | 27 |
26 // Integration tests for Pipeline. Real demuxers, real decoders, and | 28 // Integration tests for Pipeline. Real demuxers, real decoders, and |
27 // base renderer implementations are used to verify pipeline functionality. The | 29 // base renderer implementations are used to verify pipeline functionality. The |
28 // renderers used in these tests rely heavily on the AudioRendererBase & | 30 // renderers used in these tests rely heavily on the AudioRendererBase & |
29 // VideoRendererBase implementations which contain a majority of the code used | 31 // VideoRendererBase implementations which contain a majority of the code used |
30 // in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in | 32 // in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in |
31 // the browser. The renderers in this test don't actually write data to a | 33 // the browser. The renderers in this test don't actually write data to a |
32 // display or audio device. Both of these devices are simulated since they have | 34 // display or audio device. Both of these devices are simulated since they have |
33 // little effect on verifying pipeline behavior and allow tests to run faster | 35 // little effect on verifying pipeline behavior and allow tests to run faster |
34 // than real-time. | 36 // than real-time. |
35 class PipelineIntegrationTestBase { | 37 class PipelineIntegrationTestBase { |
36 public: | 38 public: |
37 PipelineIntegrationTestBase(); | 39 PipelineIntegrationTestBase(); |
38 virtual ~PipelineIntegrationTestBase(); | 40 virtual ~PipelineIntegrationTestBase(); |
39 | 41 |
40 bool WaitUntilOnEnded(); | 42 bool WaitUntilOnEnded(); |
41 PipelineStatus WaitUntilEndedOrError(); | 43 PipelineStatus WaitUntilEndedOrError(); |
42 bool Start(const FilePath& file_path, PipelineStatus expected_status); | 44 bool Start(const base::FilePath& file_path, PipelineStatus expected_status); |
43 // Enable playback with audio and video hashing enabled. Frame dropping and | 45 // Enable playback with audio and video hashing enabled. Frame dropping and |
44 // audio underflow will be disabled to ensure consistent hashes. | 46 // audio underflow will be disabled to ensure consistent hashes. |
45 bool Start(const FilePath& file_path, PipelineStatus expected_status, | 47 bool Start(const base::FilePath& file_path, PipelineStatus expected_status, |
46 bool hashing_enabled); | 48 bool hashing_enabled); |
47 // Initialize the pipeline and ignore any status updates. Useful for testing | 49 // Initialize the pipeline and ignore any status updates. Useful for testing |
48 // invalid audio/video clips which don't have deterministic results. | 50 // invalid audio/video clips which don't have deterministic results. |
49 bool Start(const FilePath& file_path); | 51 bool Start(const base::FilePath& file_path); |
50 | 52 |
51 void Play(); | 53 void Play(); |
52 void Pause(); | 54 void Pause(); |
53 bool Seek(base::TimeDelta seek_time); | 55 bool Seek(base::TimeDelta seek_time); |
54 void Stop(); | 56 void Stop(); |
55 bool WaitUntilCurrentTimeIsAfter(const base::TimeDelta& wait_time); | 57 bool WaitUntilCurrentTimeIsAfter(const base::TimeDelta& wait_time); |
56 scoped_ptr<FilterCollection> CreateFilterCollection( | 58 scoped_ptr<FilterCollection> CreateFilterCollection( |
57 const FilePath& file_path); | 59 const base::FilePath& file_path); |
58 | 60 |
59 // Returns the MD5 hash of all video frames seen. Should only be called once | 61 // Returns the MD5 hash of all video frames seen. Should only be called once |
60 // after playback completes. First time hashes should be generated with | 62 // after playback completes. First time hashes should be generated with |
61 // --video-threads=1 to ensure correctness. Pipeline must have been started | 63 // --video-threads=1 to ensure correctness. Pipeline must have been started |
62 // with hashing enabled. | 64 // with hashing enabled. |
63 std::string GetVideoHash(); | 65 std::string GetVideoHash(); |
64 | 66 |
65 // Returns the MD5 hash of all audio frames seen. Should only be called once | 67 // Returns the MD5 hash of all audio frames seen. Should only be called once |
66 // after playback completes. Pipeline must have been started with hashing | 68 // after playback completes. Pipeline must have been started with hashing |
67 // enabled. | 69 // enabled. |
(...skipping 22 matching lines...) Expand all Loading... |
90 const DecryptorReadyCB& decryptor_ready_cb); | 92 const DecryptorReadyCB& decryptor_ready_cb); |
91 void OnVideoRendererPaint(); | 93 void OnVideoRendererPaint(); |
92 | 94 |
93 MOCK_METHOD1(OnSetOpaque, void(bool)); | 95 MOCK_METHOD1(OnSetOpaque, void(bool)); |
94 MOCK_METHOD1(OnBufferingState, void(Pipeline::BufferingState)); | 96 MOCK_METHOD1(OnBufferingState, void(Pipeline::BufferingState)); |
95 }; | 97 }; |
96 | 98 |
97 } // namespace media | 99 } // namespace media |
98 | 100 |
99 #endif // MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ | 101 #endif // MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ |
OLD | NEW |