| 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 const base::TimeDelta kDuration = base::TimeDelta::FromSeconds(100); | 470 const base::TimeDelta kDuration = base::TimeDelta::FromSeconds(100); |
| 471 InitializeDemuxer(&streams, kDuration); | 471 InitializeDemuxer(&streams, kDuration); |
| 472 InitializeVideoDecoder(video_stream()); | 472 InitializeVideoDecoder(video_stream()); |
| 473 InitializeVideoRenderer(); | 473 InitializeVideoRenderer(); |
| 474 | 474 |
| 475 InitializePipeline(PIPELINE_OK); | 475 InitializePipeline(PIPELINE_OK); |
| 476 EXPECT_TRUE(pipeline_->IsInitialized()); | 476 EXPECT_TRUE(pipeline_->IsInitialized()); |
| 477 | 477 |
| 478 EXPECT_EQ(0u, pipeline_->GetBufferedTimeRanges().size()); | 478 EXPECT_EQ(0u, pipeline_->GetBufferedTimeRanges().size()); |
| 479 | 479 |
| 480 pipeline_->SetBufferedBytes(kTotalBytes / 8); | 480 pipeline_->AddBufferedByteRange(0, kTotalBytes / 8); |
| 481 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 481 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 482 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0)); | 482 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0)); |
| 483 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0)); | 483 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0)); |
| 484 | 484 |
| 485 base::TimeDelta kSeekTime = kDuration / 2; | 485 base::TimeDelta kSeekTime = kDuration / 2; |
| 486 ExpectSeek(kSeekTime); | 486 ExpectSeek(kSeekTime); |
| 487 DoSeek(kSeekTime); | 487 DoSeek(kSeekTime); |
| 488 | 488 |
| 489 pipeline_->SetBufferedBytes(kTotalBytes / 2 + kTotalBytes / 8); | 489 pipeline_->AddBufferedByteRange(kTotalBytes / 2, |
| 490 kTotalBytes / 2 + kTotalBytes / 8); |
| 490 EXPECT_EQ(2u, pipeline_->GetBufferedTimeRanges().size()); | 491 EXPECT_EQ(2u, pipeline_->GetBufferedTimeRanges().size()); |
| 491 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0)); | 492 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0)); |
| 492 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0)); | 493 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0)); |
| 493 EXPECT_EQ(kDuration / 2, pipeline_->GetBufferedTimeRanges().start(1)); | 494 EXPECT_EQ(kDuration / 2, pipeline_->GetBufferedTimeRanges().start(1)); |
| 494 EXPECT_EQ(kDuration / 2 + kDuration / 8, | 495 EXPECT_EQ(kDuration / 2 + kDuration / 8, |
| 495 pipeline_->GetBufferedTimeRanges().end(1)); | 496 pipeline_->GetBufferedTimeRanges().end(1)); |
| 496 } | 497 } |
| 497 | 498 |
| 498 TEST_F(PipelineTest, DisableAudioRenderer) { | 499 TEST_F(PipelineTest, DisableAudioRenderer) { |
| 499 CreateAudioStream(); | 500 CreateAudioStream(); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(0)); | 842 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(0)); |
| 842 } | 843 } |
| 843 | 844 |
| 844 // Test that different-thread, some-delay callback (the expected common case) | 845 // Test that different-thread, some-delay callback (the expected common case) |
| 845 // works correctly. | 846 // works correctly. |
| 846 TEST(PipelineStatusNotificationTest, DelayedCallback) { | 847 TEST(PipelineStatusNotificationTest, DelayedCallback) { |
| 847 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(20)); | 848 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(20)); |
| 848 } | 849 } |
| 849 | 850 |
| 850 } // namespace media | 851 } // namespace media |
| OLD | NEW |