OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 ASSERT_EQ(blink::WebSize(1920, 1080), wmpi_->naturalSize()); | 671 ASSERT_EQ(blink::WebSize(1920, 1080), wmpi_->naturalSize()); |
672 } | 672 } |
673 | 673 |
674 TEST_F(WebMediaPlayerImplTest, NaturalSizeChange_Rotated) { | 674 TEST_F(WebMediaPlayerImplTest, NaturalSizeChange_Rotated) { |
675 InitializeWebMediaPlayerImpl(); | 675 InitializeWebMediaPlayerImpl(); |
676 PipelineMetadata metadata; | 676 PipelineMetadata metadata; |
677 metadata.has_video = true; | 677 metadata.has_video = true; |
678 metadata.natural_size = gfx::Size(320, 240); | 678 metadata.natural_size = gfx::Size(320, 240); |
679 metadata.video_rotation = VIDEO_ROTATION_90; | 679 metadata.video_rotation = VIDEO_ROTATION_90; |
680 | 680 |
| 681 OnMetadata(metadata); |
| 682 ASSERT_EQ(blink::WebSize(320, 240), wmpi_->naturalSize()); |
| 683 |
681 // For 90/270deg rotations, the natural size should be transposed. | 684 // For 90/270deg rotations, the natural size should be transposed. |
682 OnMetadata(metadata); | |
683 ASSERT_EQ(blink::WebSize(240, 320), wmpi_->naturalSize()); | |
684 | |
685 OnVideoNaturalSizeChange(gfx::Size(1920, 1080)); | 685 OnVideoNaturalSizeChange(gfx::Size(1920, 1080)); |
686 ASSERT_EQ(blink::WebSize(1080, 1920), wmpi_->naturalSize()); | 686 ASSERT_EQ(blink::WebSize(1080, 1920), wmpi_->naturalSize()); |
687 } | 687 } |
688 | 688 |
689 // Audible backgrounded videos are not suspended if delegate_ allows it. | 689 // Audible backgrounded videos are not suspended if delegate_ allows it. |
690 TEST_F(WebMediaPlayerImplTest, ComputePlayState_BackgroundedVideoPlaying) { | 690 TEST_F(WebMediaPlayerImplTest, ComputePlayState_BackgroundedVideoPlaying) { |
691 InitializeWebMediaPlayerImpl(); | 691 InitializeWebMediaPlayerImpl(); |
692 WebMediaPlayerImpl::PlayState state; | 692 WebMediaPlayerImpl::PlayState state; |
693 SetMetadata(true, true); | 693 SetMetadata(true, true); |
694 SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData); | 694 SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 EXPECT_CALL(delegate_, DidPlay(_, true, false, false, _)); | 749 EXPECT_CALL(delegate_, DidPlay(_, true, false, false, _)); |
750 client_.set_is_autoplaying_muted(true); | 750 client_.set_is_autoplaying_muted(true); |
751 SetDelegateState(WebMediaPlayerImpl::DelegateState::PLAYING); | 751 SetDelegateState(WebMediaPlayerImpl::DelegateState::PLAYING); |
752 | 752 |
753 EXPECT_CALL(delegate_, DidPlay(_, true, true, false, _)); | 753 EXPECT_CALL(delegate_, DidPlay(_, true, true, false, _)); |
754 client_.set_is_autoplaying_muted(false); | 754 client_.set_is_autoplaying_muted(false); |
755 wmpi_->setVolume(1.0); | 755 wmpi_->setVolume(1.0); |
756 } | 756 } |
757 | 757 |
758 } // namespace media | 758 } // namespace media |
OLD | NEW |