Chromium Code Reviews| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 935 | 935 |
| 936 Play(); | 936 Play(); |
| 937 | 937 |
| 938 ASSERT_TRUE(WaitUntilOnEnded()); | 938 ASSERT_TRUE(WaitUntilOnEnded()); |
| 939 | 939 |
| 940 EXPECT_HASH_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash()); | 940 EXPECT_HASH_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash()); |
| 941 EXPECT_HASH_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash()); | 941 EXPECT_HASH_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash()); |
| 942 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null()); | 942 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null()); |
| 943 } | 943 } |
| 944 | 944 |
| 945 TEST_F(PipelineIntegrationTest, PlaybackWithAudioTrackDisabled) { | |
| 946 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed | kClockless)); | |
| 947 | |
| 948 std::vector<MediaTrack::Id> empty; | |
| 949 pipeline_->OnEnabledAudioTracksChanged(empty); | |
| 950 message_loop_.RunUntilIdle(); | |
| 951 | |
| 952 // Seek to flush the pipeline and ensure there's no prerolled audio data. | |
| 953 ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(0))); | |
| 954 Play(); | |
| 955 | |
| 956 ASSERT_TRUE(WaitUntilOnEnded()); | |
| 957 | |
| 958 // Verify that no audio has been rendered, since we disabled audio tracks. | |
| 959 EXPECT_HASH_EQ(kNullAudioHash, GetAudioHash()); | |
| 960 } | |
| 961 | |
| 962 TEST_F(PipelineIntegrationTest, PlaybackWithVideoTrackDisabled) { | |
| 963 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed | kClockless)); | |
| 964 | |
| 965 std::vector<MediaTrack::Id> empty; | |
| 966 pipeline_->OnSelectedVideoTrackChanged(empty); | |
| 967 message_loop_.RunUntilIdle(); | |
| 968 | |
| 969 // Seek to flush the pipeline and ensure there's no prerolled video data. | |
| 970 ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(0))); | |
| 971 | |
| 972 // Reset the video hash in case some of the prerolled video frames have been | |
| 973 // hashed already. | |
| 974 ResetVideoHash(); | |
| 975 | |
| 976 Play(); | |
| 977 | |
| 978 ASSERT_TRUE(WaitUntilOnEnded()); | |
| 979 | |
| 980 // Verify that no audio has been rendered, since we disabled audio tracks. | |
| 981 EXPECT_HASH_EQ(kNullVideoHash, GetVideoHash()); | |
|
chcunningham
2016/06/29 22:49:13
These are a great start. Can you add some test for
chcunningham
2016/06/29 22:58:29
Ignore me - I see you did this in your latest PS
servolk
2016/06/29 23:40:13
Yep, added more complete tests in latest PS.
| |
| 982 } | |
| 983 | |
| 945 TEST_F(PipelineIntegrationTest, | 984 TEST_F(PipelineIntegrationTest, |
| 946 MAYBE_CLOCKLESS(BasicPlaybackOpusOggTrimmingHashed)) { | 985 MAYBE_CLOCKLESS(BasicPlaybackOpusOggTrimmingHashed)) { |
| 947 ASSERT_EQ(PIPELINE_OK, | 986 ASSERT_EQ(PIPELINE_OK, |
| 948 Start("opus-trimming-test.webm", kHashed | kClockless)); | 987 Start("opus-trimming-test.webm", kHashed | kClockless)); |
| 949 | 988 |
| 950 Play(); | 989 Play(); |
| 951 | 990 |
| 952 ASSERT_TRUE(WaitUntilOnEnded()); | 991 ASSERT_TRUE(WaitUntilOnEnded()); |
| 953 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash()); | 992 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash()); |
| 954 | 993 |
| (...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2303 | 2342 |
| 2304 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 2343 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
| 2305 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); | 2344 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
| 2306 Play(); | 2345 Play(); |
| 2307 ASSERT_TRUE(WaitUntilOnEnded()); | 2346 ASSERT_TRUE(WaitUntilOnEnded()); |
| 2308 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 2347 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
| 2309 demuxer_->GetStartTime()); | 2348 demuxer_->GetStartTime()); |
| 2310 } | 2349 } |
| 2311 | 2350 |
| 2312 } // namespace media | 2351 } // namespace media |
| OLD | NEW |