Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: media/filters/chunk_demuxer_unittest.cc

Issue 11088067: Clear source_id_{audio,video}_ after RemoveId. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 audio->Read(base::Bind(&OnReadDone_EOSExpected, 1544 audio->Read(base::Bind(&OnReadDone_EOSExpected,
1545 &audio_read_done)); 1545 &audio_read_done));
1546 EXPECT_TRUE(audio_read_done); 1546 EXPECT_TRUE(audio_read_done);
1547 1547
1548 // Read() from video should still return normal buffers. 1548 // Read() from video should still return normal buffers.
1549 scoped_refptr<DemuxerStream> video = 1549 scoped_refptr<DemuxerStream> video =
1550 demuxer_->GetStream(DemuxerStream::VIDEO); 1550 demuxer_->GetStream(DemuxerStream::VIDEO);
1551 GenerateSingleStreamExpectedReads(0, 4, video, kVideoBlockDuration); 1551 GenerateSingleStreamExpectedReads(0, 4, video, kVideoBlockDuration);
1552 } 1552 }
1553 1553
1554 // Test that removing an ID immediately after adding it does not interfere with
1555 // quota for new IDs in the future.
1556 TEST_F(ChunkDemuxerTest, TestRemoveAndAddId) {
1557 std::string audio_id_1 = "audio1";
1558 ASSERT_TRUE(AddId(audio_id_1, true, false) == ChunkDemuxer::kOk);
1559 demuxer_->RemoveId(audio_id_1);
1560
1561 std::string audio_id_2 = "audio2";
1562 ASSERT_TRUE(AddId(audio_id_2, true, false) == ChunkDemuxer::kOk);
1563 }
1564
1554 TEST_F(ChunkDemuxerTest, TestSeekCanceled) { 1565 TEST_F(ChunkDemuxerTest, TestSeekCanceled) {
1555 ASSERT_TRUE(InitDemuxer(true, true, false)); 1566 ASSERT_TRUE(InitDemuxer(true, true, false));
1556 1567
1557 scoped_refptr<DemuxerStream> audio = 1568 scoped_refptr<DemuxerStream> audio =
1558 demuxer_->GetStream(DemuxerStream::AUDIO); 1569 demuxer_->GetStream(DemuxerStream::AUDIO);
1559 scoped_refptr<DemuxerStream> video = 1570 scoped_refptr<DemuxerStream> video =
1560 demuxer_->GetStream(DemuxerStream::VIDEO); 1571 demuxer_->GetStream(DemuxerStream::VIDEO);
1561 1572
1562 // Append cluster at the beginning of the stream. 1573 // Append cluster at the beginning of the stream.
1563 scoped_ptr<Cluster> start_cluster(GenerateCluster(0, 4)); 1574 scoped_ptr<Cluster> start_cluster(GenerateCluster(0, 4));
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
2364 2375
2365 scoped_ptr<Cluster> cluster_a(kDefaultFirstCluster()); 2376 scoped_ptr<Cluster> cluster_a(kDefaultFirstCluster());
2366 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size())); 2377 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size()));
2367 2378
2368 EXPECT_CALL(host_, SetDuration( 2379 EXPECT_CALL(host_, SetDuration(
2369 base::TimeDelta::FromMilliseconds(kDefaultFirstClusterEndTimestamp))); 2380 base::TimeDelta::FromMilliseconds(kDefaultFirstClusterEndTimestamp)));
2370 demuxer_->EndOfStream(PIPELINE_OK); 2381 demuxer_->EndOfStream(PIPELINE_OK);
2371 } 2382 }
2372 2383
2373 } // namespace media 2384 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698