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

Side by Side Diff: media/base/pipeline_unittest.cc

Issue 376013003: Rename media::Clock to media::TimeDeltaInterpolator and update API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: SetBounds Created 6 years, 5 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/base/pipeline.cc ('k') | media/base/time_delta_interpolator.h » ('j') | 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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
11 #include "base/threading/simple_thread.h" 11 #include "base/threading/simple_thread.h"
12 #include "base/time/clock.h" 12 #include "base/time/clock.h"
13 #include "media/base/clock.h"
14 #include "media/base/fake_text_track_stream.h" 13 #include "media/base/fake_text_track_stream.h"
15 #include "media/base/gmock_callback_support.h" 14 #include "media/base/gmock_callback_support.h"
16 #include "media/base/media_log.h" 15 #include "media/base/media_log.h"
17 #include "media/base/mock_filters.h" 16 #include "media/base/mock_filters.h"
18 #include "media/base/pipeline.h" 17 #include "media/base/pipeline.h"
19 #include "media/base/test_helpers.h" 18 #include "media/base/test_helpers.h"
20 #include "media/base/text_renderer.h" 19 #include "media/base/text_renderer.h"
21 #include "media/base/text_track_config.h" 20 #include "media/base/text_track_config.h"
21 #include "media/base/time_delta_interpolator.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 #include "ui/gfx/size.h" 23 #include "ui/gfx/size.h"
24 24
25 using ::testing::_; 25 using ::testing::_;
26 using ::testing::AnyNumber; 26 using ::testing::AnyNumber;
27 using ::testing::DeleteArg; 27 using ::testing::DeleteArg;
28 using ::testing::DoAll; 28 using ::testing::DoAll;
29 // TODO(scherkus): Remove InSequence after refactoring Pipeline. 29 // TODO(scherkus): Remove InSequence after refactoring Pipeline.
30 using ::testing::InSequence; 30 using ::testing::InSequence;
31 using ::testing::Invoke; 31 using ::testing::Invoke;
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 612
613 TEST_F(PipelineTest, AudioStreamShorterThanVideo) { 613 TEST_F(PipelineTest, AudioStreamShorterThanVideo) {
614 base::TimeDelta duration = base::TimeDelta::FromSeconds(10); 614 base::TimeDelta duration = base::TimeDelta::FromSeconds(10);
615 615
616 CreateAudioStream(); 616 CreateAudioStream();
617 CreateVideoStream(); 617 CreateVideoStream();
618 MockDemuxerStreamVector streams; 618 MockDemuxerStreamVector streams;
619 streams.push_back(audio_stream()); 619 streams.push_back(audio_stream());
620 streams.push_back(video_stream()); 620 streams.push_back(video_stream());
621 621
622 // Replace the clock so we can simulate wall clock time advancing w/o using 622 // Replace what's used for interpolating to simulate wall clock time.
623 // Sleep(). 623 pipeline_->SetTimeDeltaInterpolatorForTesting(
624 pipeline_->SetClockForTesting(new Clock(&test_tick_clock_)); 624 new TimeDeltaInterpolator(&test_tick_clock_));
625 625
626 InitializeDemuxer(&streams, duration); 626 InitializeDemuxer(&streams, duration);
627 InitializeAudioRenderer(audio_stream()); 627 InitializeAudioRenderer(audio_stream());
628 InitializeVideoRenderer(video_stream()); 628 InitializeVideoRenderer(video_stream());
629 InitializePipeline(PIPELINE_OK); 629 InitializePipeline(PIPELINE_OK);
630 630
631 EXPECT_EQ(0, pipeline_->GetMediaTime().ToInternalValue()); 631 EXPECT_EQ(0, pipeline_->GetMediaTime().ToInternalValue());
632 632
633 float playback_rate = 1.0f; 633 float playback_rate = 1.0f;
634 EXPECT_CALL(*video_renderer_, SetPlaybackRate(playback_rate)); 634 EXPECT_CALL(*video_renderer_, SetPlaybackRate(playback_rate));
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 INSTANTIATE_TEARDOWN_TEST(Error, InitDemuxer); 1130 INSTANTIATE_TEARDOWN_TEST(Error, InitDemuxer);
1131 INSTANTIATE_TEARDOWN_TEST(Error, InitAudioRenderer); 1131 INSTANTIATE_TEARDOWN_TEST(Error, InitAudioRenderer);
1132 INSTANTIATE_TEARDOWN_TEST(Error, InitVideoRenderer); 1132 INSTANTIATE_TEARDOWN_TEST(Error, InitVideoRenderer);
1133 INSTANTIATE_TEARDOWN_TEST(Error, Flushing); 1133 INSTANTIATE_TEARDOWN_TEST(Error, Flushing);
1134 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); 1134 INSTANTIATE_TEARDOWN_TEST(Error, Seeking);
1135 INSTANTIATE_TEARDOWN_TEST(Error, Playing); 1135 INSTANTIATE_TEARDOWN_TEST(Error, Playing);
1136 1136
1137 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); 1137 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing);
1138 1138
1139 } // namespace media 1139 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline.cc ('k') | media/base/time_delta_interpolator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698