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

Unified Diff: media/blink/webmediaplayer_impl_unittest.cc

Issue 2198403002: Account for video rotation in OnVideoNaturalSizeChange() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Account for video rotation in OnVideoNaturalSizeChange() Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698