| Index: media/blink/webmediaplayer_impl_unittest.cc
|
| diff --git a/media/blink/webmediaplayer_impl_unittest.cc b/media/blink/webmediaplayer_impl_unittest.cc
|
| index dbebb2868592f082a11219b7fec4da270b549f86..e4574407c850656b35228aae8ef700352506dde9 100644
|
| --- a/media/blink/webmediaplayer_impl_unittest.cc
|
| +++ b/media/blink/webmediaplayer_impl_unittest.cc
|
| @@ -27,6 +27,7 @@
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h"
|
| #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
|
| +#include "third_party/WebKit/public/platform/WebSize.h"
|
| #include "third_party/WebKit/public/web/WebFrameClient.h"
|
| #include "third_party/WebKit/public/web/WebLocalFrame.h"
|
| #include "third_party/WebKit/public/web/WebView.h"
|
| @@ -144,6 +145,12 @@ class WebMediaPlayerImplTest : public testing::Test {
|
| wmpi_->pipeline_metadata_.has_video = has_video;
|
| }
|
|
|
| + void OnMetadata(PipelineMetadata metadata) { wmpi_->OnMetadata(metadata); }
|
| +
|
| + void OnVideoNaturalSizeChange(const gfx::Size& size) {
|
| + wmpi_->OnVideoNaturalSizeChange(size);
|
| + }
|
| +
|
| WebMediaPlayerImpl::PlayState ComputePlayState() {
|
| wmpi_->is_idle_ = false;
|
| wmpi_->must_suspend_ = false;
|
| @@ -468,4 +475,31 @@ TEST_F(WebMediaPlayerImplTest, ComputePlayState_Suspended) {
|
| EXPECT_FALSE(state.is_suspended);
|
| }
|
|
|
| +TEST_F(WebMediaPlayerImplTest, NaturalSizeChange) {
|
| + PipelineMetadata metadata;
|
| + metadata.has_video = true;
|
| + metadata.natural_size = gfx::Size(320, 240);
|
| +
|
| + OnMetadata(metadata);
|
| + ASSERT_EQ(blink::WebSize(320, 240), wmpi_->naturalSize());
|
| +
|
| + // TODO(sandersd): Verify that the client is notified of the size change?
|
| + OnVideoNaturalSizeChange(gfx::Size(1920, 1080));
|
| + ASSERT_EQ(blink::WebSize(1920, 1080), wmpi_->naturalSize());
|
| +}
|
| +
|
| +TEST_F(WebMediaPlayerImplTest, NaturalSizeChange_Rotated) {
|
| + PipelineMetadata metadata;
|
| + metadata.has_video = true;
|
| + metadata.natural_size = gfx::Size(320, 240);
|
| + metadata.video_rotation = VIDEO_ROTATION_90;
|
| +
|
| + // For 90/270deg rotations, the natural size should be transposed.
|
| + OnMetadata(metadata);
|
| + ASSERT_EQ(blink::WebSize(240, 320), wmpi_->naturalSize());
|
| +
|
| + OnVideoNaturalSizeChange(gfx::Size(1920, 1080));
|
| + ASSERT_EQ(blink::WebSize(1080, 1920), wmpi_->naturalSize());
|
| +}
|
| +
|
| } // namespace media
|
|
|