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

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

Issue 10908180: Reset 'can_update_offset' on call to ChunkDemuxer::Abort() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fix comment Created 8 years, 3 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 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 TEST_F(ChunkDemuxerTest, TestTimestampOffsetMidParse) { 2253 TEST_F(ChunkDemuxerTest, TestTimestampOffsetMidParse) {
2254 ASSERT_TRUE(InitDemuxer(true, true, false)); 2254 ASSERT_TRUE(InitDemuxer(true, true, false));
2255 2255
2256 scoped_ptr<Cluster> cluster = GenerateCluster(0, 2); 2256 scoped_ptr<Cluster> cluster = GenerateCluster(0, 2);
2257 // Append only part of the cluster data. 2257 // Append only part of the cluster data.
2258 ASSERT_TRUE(AppendData(cluster->data(), cluster->size() - 13)); 2258 ASSERT_TRUE(AppendData(cluster->data(), cluster->size() - 13));
2259 2259
2260 // Setting a timestamp should fail because we're in the middle of a cluster. 2260 // Setting a timestamp should fail because we're in the middle of a cluster.
2261 ASSERT_FALSE(demuxer_->SetTimestampOffset( 2261 ASSERT_FALSE(demuxer_->SetTimestampOffset(
2262 kSourceId, base::TimeDelta::FromSeconds(25))); 2262 kSourceId, base::TimeDelta::FromSeconds(25)));
2263
2264 demuxer_->Abort(kSourceId);
2265 // After Abort(), setting a timestamp should succeed since we're no longer
2266 // in the middle of a cluster
2267 ASSERT_TRUE(demuxer_->SetTimestampOffset(
2268 kSourceId, base::TimeDelta::FromSeconds(25)));
2263 } 2269 }
2264 2270
2265 TEST_F(ChunkDemuxerTest, TestDurationChange) { 2271 TEST_F(ChunkDemuxerTest, TestDurationChange) {
2266 ASSERT_TRUE(InitDemuxer(true, true, false)); 2272 ASSERT_TRUE(InitDemuxer(true, true, false));
2267 static const int kStreamDuration = kDefaultDuration().InMilliseconds(); 2273 static const int kStreamDuration = kDefaultDuration().InMilliseconds();
2268 2274
2269 // Add data leading up to the currently set duration. 2275 // Add data leading up to the currently set duration.
2270 scoped_ptr<Cluster> first_cluster = GenerateCluster( 2276 scoped_ptr<Cluster> first_cluster = GenerateCluster(
2271 kStreamDuration - kAudioBlockDuration, 2277 kStreamDuration - kAudioBlockDuration,
2272 kStreamDuration - kVideoBlockDuration, 2); 2278 kStreamDuration - kVideoBlockDuration, 2);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 2319
2314 scoped_ptr<Cluster> cluster_a(kDefaultFirstCluster()); 2320 scoped_ptr<Cluster> cluster_a(kDefaultFirstCluster());
2315 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size())); 2321 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size()));
2316 2322
2317 EXPECT_CALL(host_, SetDuration( 2323 EXPECT_CALL(host_, SetDuration(
2318 base::TimeDelta::FromMilliseconds(kDefaultFirstClusterEndTimestamp))); 2324 base::TimeDelta::FromMilliseconds(kDefaultFirstClusterEndTimestamp)));
2319 demuxer_->EndOfStream(PIPELINE_OK); 2325 demuxer_->EndOfStream(PIPELINE_OK);
2320 } 2326 }
2321 2327
2322 } // namespace media 2328 } // 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