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 #include "media/base/pipeline_impl.h" | 5 #include "media/base/pipeline_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // TODO(scherkus): even though some filters are initialized on separate | 70 // TODO(scherkus): even though some filters are initialized on separate |
71 // threads these test aren't flaky... why? It's because filters' Initialize() | 71 // threads these test aren't flaky... why? It's because filters' Initialize() |
72 // is executed on |message_loop_| and the mock filters instantly call | 72 // is executed on |message_loop_| and the mock filters instantly call |
73 // InitializationComplete(), which keeps the pipeline humming along. If | 73 // InitializationComplete(), which keeps the pipeline humming along. If |
74 // either filters don't call InitializationComplete() immediately or filter | 74 // either filters don't call InitializationComplete() immediately or filter |
75 // initialization is moved to a separate thread this test will become flaky. | 75 // initialization is moved to a separate thread this test will become flaky. |
76 class PipelineImplTest : public ::testing::Test { | 76 class PipelineImplTest : public ::testing::Test { |
77 public: | 77 public: |
78 // Used for setting expectations on pipeline callbacks. Using a StrictMock | 78 // Used for setting expectations on pipeline callbacks. Using a StrictMock |
79 // also lets us test for missing callbacks. | 79 // also lets us test for missing callbacks. |
80 class CallbackHelper : public Pipeline::Client { | 80 class CallbackHelper : public MockPipelineClient { |
81 public: | 81 public: |
82 CallbackHelper() {} | 82 CallbackHelper() {} |
83 virtual ~CallbackHelper() {} | 83 virtual ~CallbackHelper() {} |
84 | 84 |
85 MOCK_METHOD1(OnStart, void(PipelineStatus)); | 85 MOCK_METHOD1(OnStart, void(PipelineStatus)); |
86 MOCK_METHOD1(OnSeek, void(PipelineStatus)); | 86 MOCK_METHOD1(OnSeek, void(PipelineStatus)); |
87 MOCK_METHOD1(OnSuspend, void(PipelineStatus)); | 87 MOCK_METHOD1(OnSuspend, void(PipelineStatus)); |
88 MOCK_METHOD1(OnResume, void(PipelineStatus)); | 88 MOCK_METHOD1(OnResume, void(PipelineStatus)); |
89 | 89 |
90 // Pipeline::Client overrides. | |
91 MOCK_METHOD1(OnError, void(PipelineStatus)); | |
92 MOCK_METHOD0(OnEnded, void()); | |
93 MOCK_METHOD1(OnMetadata, void(PipelineMetadata)); | |
94 MOCK_METHOD1(OnBufferingStateChange, void(BufferingState)); | |
95 MOCK_METHOD0(OnDurationChange, void()); | |
96 MOCK_METHOD2(OnAddTextTrack, | |
97 void(const TextTrackConfig&, const AddTextTrackDoneCB&)); | |
98 MOCK_METHOD0(OnWaitingForDecryptionKey, void()); | |
99 | |
100 private: | 90 private: |
101 DISALLOW_COPY_AND_ASSIGN(CallbackHelper); | 91 DISALLOW_COPY_AND_ASSIGN(CallbackHelper); |
102 }; | 92 }; |
103 | 93 |
104 PipelineImplTest() | 94 PipelineImplTest() |
105 : pipeline_( | 95 : pipeline_( |
106 new PipelineImpl(message_loop_.task_runner(), new MediaLog())), | 96 new PipelineImpl(message_loop_.task_runner(), new MediaLog())), |
107 demuxer_(new StrictMock<MockDemuxer>()), | 97 demuxer_(new StrictMock<MockDemuxer>()), |
108 scoped_renderer_(new StrictMock<MockRenderer>()), | 98 scoped_renderer_(new StrictMock<MockRenderer>()), |
109 renderer_(scoped_renderer_.get()), | 99 renderer_(scoped_renderer_.get()), |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); | 1081 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); |
1092 INSTANTIATE_TEARDOWN_TEST(Error, Playing); | 1082 INSTANTIATE_TEARDOWN_TEST(Error, Playing); |
1093 INSTANTIATE_TEARDOWN_TEST(Error, Suspending); | 1083 INSTANTIATE_TEARDOWN_TEST(Error, Suspending); |
1094 INSTANTIATE_TEARDOWN_TEST(Error, Suspended); | 1084 INSTANTIATE_TEARDOWN_TEST(Error, Suspended); |
1095 INSTANTIATE_TEARDOWN_TEST(Error, Resuming); | 1085 INSTANTIATE_TEARDOWN_TEST(Error, Resuming); |
1096 | 1086 |
1097 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); | 1087 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); |
1098 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended); | 1088 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended); |
1099 | 1089 |
1100 } // namespace media | 1090 } // namespace media |
OLD | NEW |