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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/threading/simple_thread.h" | 10 #include "base/threading/simple_thread.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 protected: | 130 protected: |
131 // Sets up expectations to allow the demuxer to initialize. | 131 // Sets up expectations to allow the demuxer to initialize. |
132 typedef std::vector<MockDemuxerStream*> MockDemuxerStreamVector; | 132 typedef std::vector<MockDemuxerStream*> MockDemuxerStreamVector; |
133 void InitializeDemuxer(MockDemuxerStreamVector* streams, | 133 void InitializeDemuxer(MockDemuxerStreamVector* streams, |
134 const base::TimeDelta& duration) { | 134 const base::TimeDelta& duration) { |
135 EXPECT_CALL(*mocks_->demuxer(), Initialize(_, _)) | 135 EXPECT_CALL(*mocks_->demuxer(), Initialize(_, _)) |
136 .WillOnce(DoAll(SetDemuxerProperties(duration), | 136 .WillOnce(DoAll(SetDemuxerProperties(duration), |
137 RunPipelineStatusCB1())); | 137 RunPipelineStatusCB1())); |
138 EXPECT_CALL(*mocks_->demuxer(), SetPlaybackRate(0.0f)); | 138 EXPECT_CALL(*mocks_->demuxer(), SetPlaybackRate(0.0f)); |
139 | 139 |
140 // Demuxer properties. | |
141 EXPECT_CALL(*mocks_->demuxer(), GetBitrate()) | |
142 .WillRepeatedly(Return(kBitrate)); | |
143 | |
144 // Configure the demuxer to return the streams. | 140 // Configure the demuxer to return the streams. |
145 for (size_t i = 0; i < streams->size(); ++i) { | 141 for (size_t i = 0; i < streams->size(); ++i) { |
146 scoped_refptr<DemuxerStream> stream((*streams)[i]); | 142 scoped_refptr<DemuxerStream> stream((*streams)[i]); |
147 EXPECT_CALL(*mocks_->demuxer(), GetStream(stream->type())) | 143 EXPECT_CALL(*mocks_->demuxer(), GetStream(stream->type())) |
148 .WillRepeatedly(Return(stream)); | 144 .WillRepeatedly(Return(stream)); |
149 } | 145 } |
150 } | 146 } |
151 | 147 |
152 void InitializeDemuxer(MockDemuxerStreamVector* streams) { | 148 void InitializeDemuxer(MockDemuxerStreamVector* streams) { |
153 // Initialize with a default non-zero duration. | 149 // Initialize with a default non-zero duration. |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(0)); | 951 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(0)); |
956 } | 952 } |
957 | 953 |
958 // Test that different-thread, some-delay callback (the expected common case) | 954 // Test that different-thread, some-delay callback (the expected common case) |
959 // works correctly. | 955 // works correctly. |
960 TEST(PipelineStatusNotificationTest, DelayedCallback) { | 956 TEST(PipelineStatusNotificationTest, DelayedCallback) { |
961 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(20)); | 957 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(20)); |
962 } | 958 } |
963 | 959 |
964 } // namespace media | 960 } // namespace media |
OLD | NEW |