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

Unified Diff: ui/compositor/layer_unittest.cc

Issue 2575503003: Getting rid of frame_size_in_dip in Layer::SetShowSurface (Closed)
Patch Set: x Created 4 years 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 | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_unittest.cc
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index 75f29657e53620cc735248da11207cf9495fdbc8..0649f73bac11262a30798644dc00766a8dc82451 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -1835,7 +1835,7 @@ TEST_F(LayerWithDelegateTest, ExternalContent) {
before = child->cc_layer_for_testing();
child->SetShowSurface(cc::SurfaceId(), base::Bind(&FakeSatisfyCallback),
base::Bind(&FakeRequireCallback), gfx::Size(10, 10),
- 1.0, gfx::Size(10, 10));
+ 1.0);
EXPECT_TRUE(child->cc_layer_for_testing());
EXPECT_NE(before.get(), child->cc_layer_for_testing());
@@ -1856,7 +1856,7 @@ TEST_F(LayerWithDelegateTest, ExternalContentMirroring) {
cc::FrameSinkId(0, 1),
cc::LocalFrameId(2, base::UnguessableToken::Create()));
layer->SetShowSurface(surface_id, satisfy_callback, require_callback,
- gfx::Size(10, 10), 1.0f, gfx::Size(10, 10));
+ gfx::Size(10, 10), 1.0f);
const auto mirror = layer->Mirror();
auto* const cc_layer = mirror->cc_layer_for_testing();
@@ -1873,7 +1873,7 @@ TEST_F(LayerWithDelegateTest, ExternalContentMirroring) {
cc::SurfaceId(cc::FrameSinkId(1, 2),
cc::LocalFrameId(3, base::UnguessableToken::Create()));
layer->SetShowSurface(surface_id, satisfy_callback, require_callback,
- gfx::Size(20, 20), 2.0f, gfx::Size(20, 20));
+ gfx::Size(20, 20), 2.0f);
// A new cc::Layer should be created for the mirror.
EXPECT_NE(cc_layer, mirror->cc_layer_for_testing());
@@ -1885,6 +1885,23 @@ TEST_F(LayerWithDelegateTest, ExternalContentMirroring) {
EXPECT_EQ(2.0f, surface->surface_scale());
}
+// Test if frame size in dip is properly calculated in SetShowSurface
+TEST_F(LayerWithDelegateTest, FrameSizeInDip) {
+ std::unique_ptr<Layer> layer(CreateLayer(LAYER_SOLID_COLOR));
+
+ const auto satisfy_callback = base::Bind(&FakeSatisfyCallback);
+ const auto require_callback = base::Bind(&FakeRequireCallback);
+
+ cc::SurfaceId surface_id(
+ cc::FrameSinkId(0, 1),
+ cc::LocalFrameId(2, base::UnguessableToken::Create()));
+
+ layer->SetShowSurface(surface_id, satisfy_callback, require_callback,
+ gfx::Size(30, 40), 2.0f);
+
+ EXPECT_EQ(layer->frame_size_in_dip_for_testing(), gfx::Size(15, 20));
+}
+
// Verifies that layer filters still attached after changing implementation
// layer.
TEST_F(LayerWithDelegateTest, LayerFiltersSurvival) {
@@ -1901,7 +1918,7 @@ TEST_F(LayerWithDelegateTest, LayerFiltersSurvival) {
scoped_refptr<cc::Layer> before = layer->cc_layer_for_testing();
layer->SetShowSurface(cc::SurfaceId(), base::Bind(&FakeSatisfyCallback),
base::Bind(&FakeRequireCallback), gfx::Size(10, 10),
- 1.0, gfx::Size(10, 10));
+ 1.0);
EXPECT_EQ(layer->layer_grayscale(), 0.5f);
EXPECT_TRUE(layer->cc_layer_for_testing());
EXPECT_NE(before.get(), layer->cc_layer_for_testing());
@@ -2224,7 +2241,7 @@ TEST(LayerDelegateTest, DelegatedFrameDamage) {
layer->set_delegate(&delegate);
layer->SetShowSurface(cc::SurfaceId(), base::Bind(&FakeSatisfyCallback),
base::Bind(&FakeRequireCallback), gfx::Size(10, 10),
- 1.0, gfx::Size(10, 10));
+ 1.0);
EXPECT_FALSE(delegate.delegated_frame_damage_called());
layer->OnDelegatedFrameDamage(damage_rect);
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698