| 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/test/pipeline_integration_test_base.h" | 5 #include "media/test/pipeline_integration_test_base.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 hashing_enabled_ = test_type & kHashed; | 137 hashing_enabled_ = test_type & kHashed; |
| 138 clockless_playback_ = test_type & kClockless; | 138 clockless_playback_ = test_type & kClockless; |
| 139 | 139 |
| 140 EXPECT_CALL(*this, OnMetadata(_)) | 140 EXPECT_CALL(*this, OnMetadata(_)) |
| 141 .Times(AtMost(1)) | 141 .Times(AtMost(1)) |
| 142 .WillRepeatedly(SaveArg<0>(&metadata_)); | 142 .WillRepeatedly(SaveArg<0>(&metadata_)); |
| 143 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) | 143 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
| 144 .Times(AnyNumber()); | 144 .Times(AnyNumber()); |
| 145 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_NOTHING)) | 145 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_NOTHING)) |
| 146 .Times(AnyNumber()); | 146 .Times(AnyNumber()); |
| 147 // Permit at most two calls to OnDurationChange. CheckDuration will make sure | 147 // If the test is expected to have reliable duration information, permit at |
| 148 // that no more than one of them is a finite duration. This allows the | 148 // most two calls to OnDurationChange. CheckDuration will make sure that no |
| 149 // pipeline to call back at the end of the media with the known duration. | 149 // more than one of them is a finite duration. This allows the pipeline to |
| 150 EXPECT_CALL(*this, OnDurationChange()) | 150 // call back at the end of the media with the known duration. |
| 151 .Times(AtMost(2)) | 151 // |
| 152 .WillRepeatedly( | 152 // In the event of unreliable duration information, just set the expectation |
| 153 Invoke(this, &PipelineIntegrationTestBase::CheckDuration)); | 153 // that it's called at least once. Such streams may repeatedly update their |
| 154 // duration as new packets are demuxed. |
| 155 if (test_type & kUnreliableDuration) { |
| 156 EXPECT_CALL(*this, OnDurationChange()).Times(AtLeast(1)); |
| 157 } else { |
| 158 EXPECT_CALL(*this, OnDurationChange()) |
| 159 .Times(AtMost(2)) |
| 160 .WillRepeatedly( |
| 161 Invoke(this, &PipelineIntegrationTestBase::CheckDuration)); |
| 162 } |
| 154 EXPECT_CALL(*this, OnVideoNaturalSizeChange(_)).Times(AtMost(1)); | 163 EXPECT_CALL(*this, OnVideoNaturalSizeChange(_)).Times(AtMost(1)); |
| 155 EXPECT_CALL(*this, OnVideoOpacityChange(_)).WillRepeatedly(Return()); | 164 EXPECT_CALL(*this, OnVideoOpacityChange(_)).WillRepeatedly(Return()); |
| 156 CreateDemuxer(std::move(data_source)); | 165 CreateDemuxer(std::move(data_source)); |
| 157 | 166 |
| 158 if (cdm_context) { | 167 if (cdm_context) { |
| 159 EXPECT_CALL(*this, DecryptorAttached(true)); | 168 EXPECT_CALL(*this, DecryptorAttached(true)); |
| 160 pipeline_->SetCdm( | 169 pipeline_->SetCdm( |
| 161 cdm_context, base::Bind(&PipelineIntegrationTestBase::DecryptorAttached, | 170 cdm_context, base::Bind(&PipelineIntegrationTestBase::DecryptorAttached, |
| 162 base::Unretained(this))); | 171 base::Unretained(this))); |
| 163 } | 172 } |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 DCHECK(clockless_playback_); | 442 DCHECK(clockless_playback_); |
| 434 return clockless_audio_sink_->render_time(); | 443 return clockless_audio_sink_->render_time(); |
| 435 } | 444 } |
| 436 | 445 |
| 437 base::TimeTicks DummyTickClock::NowTicks() { | 446 base::TimeTicks DummyTickClock::NowTicks() { |
| 438 now_ += base::TimeDelta::FromSeconds(60); | 447 now_ += base::TimeDelta::FromSeconds(60); |
| 439 return now_; | 448 return now_; |
| 440 } | 449 } |
| 441 | 450 |
| 442 } // namespace media | 451 } // namespace media |
| OLD | NEW |