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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "media/base/audio_decoder_config.h" | 7 #include "media/base/audio_decoder_config.h" |
8 #include "media/base/decoder_buffer.h" | 8 #include "media/base/decoder_buffer.h" |
9 #include "media/base/mock_callback.h" | 9 #include "media/base/mock_callback.h" |
10 #include "media/base/mock_demuxer_host.h" | 10 #include "media/base/mock_demuxer_host.h" |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 audio->Read(base::Bind(&OnReadDone_EOSExpected, | 1469 audio->Read(base::Bind(&OnReadDone_EOSExpected, |
1470 &audio_read_done)); | 1470 &audio_read_done)); |
1471 EXPECT_TRUE(audio_read_done); | 1471 EXPECT_TRUE(audio_read_done); |
1472 | 1472 |
1473 // Read() from video should still return normal buffers. | 1473 // Read() from video should still return normal buffers. |
1474 scoped_refptr<DemuxerStream> video = | 1474 scoped_refptr<DemuxerStream> video = |
1475 demuxer_->GetStream(DemuxerStream::VIDEO); | 1475 demuxer_->GetStream(DemuxerStream::VIDEO); |
1476 GenerateSingleStreamExpectedReads(0, 4, video, kVideoBlockDuration); | 1476 GenerateSingleStreamExpectedReads(0, 4, video, kVideoBlockDuration); |
1477 } | 1477 } |
1478 | 1478 |
| 1479 // Test that removing an ID immediately after adding it does not interfere with |
| 1480 // quota for new IDs in the future. |
| 1481 TEST_F(ChunkDemuxerTest, TestRemoveAndAddId) { |
| 1482 std::string audio_id_1 = "audio1"; |
| 1483 ASSERT_TRUE(AddId(audio_id_1, true, false) == ChunkDemuxer::kOk); |
| 1484 demuxer_->RemoveId(audio_id_1); |
| 1485 |
| 1486 std::string audio_id_2 = "audio2"; |
| 1487 ASSERT_TRUE(AddId(audio_id_2, true, false) == ChunkDemuxer::kOk); |
| 1488 } |
| 1489 |
1479 TEST_F(ChunkDemuxerTest, TestSeekCanceled) { | 1490 TEST_F(ChunkDemuxerTest, TestSeekCanceled) { |
1480 ASSERT_TRUE(InitDemuxer(true, true, false)); | 1491 ASSERT_TRUE(InitDemuxer(true, true, false)); |
1481 | 1492 |
1482 scoped_refptr<DemuxerStream> audio = | 1493 scoped_refptr<DemuxerStream> audio = |
1483 demuxer_->GetStream(DemuxerStream::AUDIO); | 1494 demuxer_->GetStream(DemuxerStream::AUDIO); |
1484 scoped_refptr<DemuxerStream> video = | 1495 scoped_refptr<DemuxerStream> video = |
1485 demuxer_->GetStream(DemuxerStream::VIDEO); | 1496 demuxer_->GetStream(DemuxerStream::VIDEO); |
1486 | 1497 |
1487 // Append cluster at the beginning of the stream. | 1498 // Append cluster at the beginning of the stream. |
1488 scoped_ptr<Cluster> start_cluster(GenerateCluster(0, 4)); | 1499 scoped_ptr<Cluster> start_cluster(GenerateCluster(0, 4)); |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 | 2323 |
2313 scoped_ptr<Cluster> cluster_a(kDefaultFirstCluster()); | 2324 scoped_ptr<Cluster> cluster_a(kDefaultFirstCluster()); |
2314 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size())); | 2325 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size())); |
2315 | 2326 |
2316 EXPECT_CALL(host_, SetDuration( | 2327 EXPECT_CALL(host_, SetDuration( |
2317 base::TimeDelta::FromMilliseconds(kDefaultFirstClusterEndTimestamp))); | 2328 base::TimeDelta::FromMilliseconds(kDefaultFirstClusterEndTimestamp))); |
2318 demuxer_->EndOfStream(PIPELINE_OK); | 2329 demuxer_->EndOfStream(PIPELINE_OK); |
2319 } | 2330 } |
2320 | 2331 |
2321 } // namespace media | 2332 } // namespace media |
OLD | NEW |