Index: media/filters/pipeline_integration_test_base.h |
diff --git a/media/filters/pipeline_integration_test_base.h b/media/filters/pipeline_integration_test_base.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dc341312f2c497fee8ba19b991ee3d33ed578afa |
--- /dev/null |
+++ b/media/filters/pipeline_integration_test_base.h |
@@ -0,0 +1,64 @@ |
+// Copyright (c) 2012 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. |
+ |
+#ifndef MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ |
+#define MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ |
+ |
+#include "base/message_loop.h" |
+#include "media/base/filter_collection.h" |
+#include "media/base/message_loop_factory_impl.h" |
+#include "media/base/pipeline.h" |
+#include "media/filters/chunk_demuxer.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
+ |
+namespace media { |
+ |
+// Integration tests for Pipeline. Real demuxers, real decoders, and |
+// base renderer implementations are used to verify pipeline functionality. The |
+// renderers used in these tests rely heavily on the AudioRendererBase & |
+// VideoRendererBase implementations which contain a majority of the code used |
+// in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in |
+// the browser. The renderers in this test don't actually write data to a |
+// display or audio device. Both of these devices are simulated since they have |
+// little effect on verifying pipeline behavior and allow tests to run faster |
+// than real-time. |
+class PipelineIntegrationTestBase : public testing::Test { |
+ public: |
+ PipelineIntegrationTestBase(); |
+ virtual ~PipelineIntegrationTestBase(); |
+ |
+ bool WaitUntilOnEnded(); |
+ void OnError(PipelineStatus status); |
+ bool Start(const std::string& url, PipelineStatus expected_status); |
+ void Play(); |
+ void Pause(); |
+ bool Seek(base::TimeDelta seek_time); |
+ void Stop(); |
+ bool WaitUntilCurrentTimeIsAfter(const base::TimeDelta& wait_time); |
+ scoped_ptr<FilterCollection> CreateFilterCollection(const std::string& url); |
+ scoped_ptr<FilterCollection> CreateFilterCollection( |
+ ChunkDemuxerClient* client); |
+ |
+ protected: |
+ MessageLoop message_loop_; |
+ scoped_ptr<MessageLoopFactory> message_loop_factory_; |
+ scoped_refptr<Pipeline> pipeline_; |
+ bool ended_; |
+ PipelineStatus pipeline_status_; |
+ |
+ void OnStatusCallback(PipelineStatus expected_status, |
+ PipelineStatus status); |
+ PipelineStatusCB QuitOnStatusCB(PipelineStatus expected_status); |
+ void OnEnded(PipelineStatus status); |
+ void QuitAfterCurrentTimeTask(const base::TimeDelta& quit_time); |
+ scoped_ptr<FilterCollection> CreateFilterCollection( |
+ scoped_ptr<DemuxerFactory> demuxer_factory); |
+ |
+ MOCK_METHOD0(OnVideoRendererPaint, void()); |
+ MOCK_METHOD1(OnSetOpaque, void(bool)); |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_FILTERS_PIPELINE_INTEGRATION_TEST_BASE_H_ |