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

Unified Diff: media/blink/webmediaplayer_impl_unittest.cc

Issue 2205173002: Merge to M53: Account for video rotation in OnVideoNaturalSizeChange() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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 0aee551c1676cd3e339ee3161813202d2fc41d4d..0cb9aa9575537f7f34254d32d122fb9cefada6f5 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"
@@ -141,6 +142,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;
@@ -438,4 +445,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