OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 EXPECT_TRUE(child->cc_layer_for_testing()); | 1845 EXPECT_TRUE(child->cc_layer_for_testing()); |
1846 EXPECT_NE(before.get(), child->cc_layer_for_testing()); | 1846 EXPECT_NE(before.get(), child->cc_layer_for_testing()); |
1847 } | 1847 } |
1848 | 1848 |
1849 TEST_F(LayerWithDelegateTest, ExternalContentMirroring) { | 1849 TEST_F(LayerWithDelegateTest, ExternalContentMirroring) { |
1850 std::unique_ptr<Layer> layer(CreateLayer(LAYER_SOLID_COLOR)); | 1850 std::unique_ptr<Layer> layer(CreateLayer(LAYER_SOLID_COLOR)); |
1851 | 1851 |
1852 const auto satisfy_callback = base::Bind(&FakeSatisfyCallback); | 1852 const auto satisfy_callback = base::Bind(&FakeSatisfyCallback); |
1853 const auto require_callback = base::Bind(&FakeRequireCallback); | 1853 const auto require_callback = base::Bind(&FakeRequireCallback); |
1854 | 1854 |
1855 cc::SurfaceId surface_id(cc::FrameSinkId(0, 1), cc::LocalFrameId(2, 3)); | 1855 cc::SurfaceId surface_id( |
| 1856 cc::FrameSinkId(0, 1), |
| 1857 cc::LocalFrameId(2, base::UnguessableToken::Create())); |
1856 layer->SetShowSurface(surface_id, satisfy_callback, require_callback, | 1858 layer->SetShowSurface(surface_id, satisfy_callback, require_callback, |
1857 gfx::Size(10, 10), 1.0f, gfx::Size(10, 10)); | 1859 gfx::Size(10, 10), 1.0f, gfx::Size(10, 10)); |
1858 | 1860 |
1859 const auto mirror = layer->Mirror(); | 1861 const auto mirror = layer->Mirror(); |
1860 auto* const cc_layer = mirror->cc_layer_for_testing(); | 1862 auto* const cc_layer = mirror->cc_layer_for_testing(); |
1861 const auto* surface = static_cast<cc::SurfaceLayer*>(cc_layer); | 1863 const auto* surface = static_cast<cc::SurfaceLayer*>(cc_layer); |
1862 | 1864 |
1863 // Mirroring preserves surface state. | 1865 // Mirroring preserves surface state. |
1864 EXPECT_EQ(surface_id, surface->surface_id()); | 1866 EXPECT_EQ(surface_id, surface->surface_id()); |
1865 EXPECT_TRUE(satisfy_callback.Equals(surface->satisfy_callback())); | 1867 EXPECT_TRUE(satisfy_callback.Equals(surface->satisfy_callback())); |
1866 EXPECT_TRUE(require_callback.Equals(surface->require_callback())); | 1868 EXPECT_TRUE(require_callback.Equals(surface->require_callback())); |
1867 EXPECT_EQ(gfx::Size(10, 10), surface->surface_size()); | 1869 EXPECT_EQ(gfx::Size(10, 10), surface->surface_size()); |
1868 EXPECT_EQ(1.0f, surface->surface_scale()); | 1870 EXPECT_EQ(1.0f, surface->surface_scale()); |
1869 | 1871 |
1870 surface_id = cc::SurfaceId(cc::FrameSinkId(1, 2), cc::LocalFrameId(3, 4)); | 1872 surface_id = |
| 1873 cc::SurfaceId(cc::FrameSinkId(1, 2), |
| 1874 cc::LocalFrameId(3, base::UnguessableToken::Create())); |
1871 layer->SetShowSurface(surface_id, satisfy_callback, require_callback, | 1875 layer->SetShowSurface(surface_id, satisfy_callback, require_callback, |
1872 gfx::Size(20, 20), 2.0f, gfx::Size(20, 20)); | 1876 gfx::Size(20, 20), 2.0f, gfx::Size(20, 20)); |
1873 | 1877 |
1874 // A new cc::Layer should be created for the mirror. | 1878 // A new cc::Layer should be created for the mirror. |
1875 EXPECT_NE(cc_layer, mirror->cc_layer_for_testing()); | 1879 EXPECT_NE(cc_layer, mirror->cc_layer_for_testing()); |
1876 surface = static_cast<cc::SurfaceLayer*>(mirror->cc_layer_for_testing()); | 1880 surface = static_cast<cc::SurfaceLayer*>(mirror->cc_layer_for_testing()); |
1877 | 1881 |
1878 // Surface updates propagate to the mirror. | 1882 // Surface updates propagate to the mirror. |
1879 EXPECT_EQ(surface_id, surface->surface_id()); | 1883 EXPECT_EQ(surface_id, surface->surface_id()); |
1880 EXPECT_EQ(gfx::Size(20, 20), surface->surface_size()); | 1884 EXPECT_EQ(gfx::Size(20, 20), surface->surface_size()); |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 layer.set_name("foo"); | 2254 layer.set_name("foo"); |
2251 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = | 2255 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = |
2252 layer.TakeDebugInfo(nullptr); | 2256 layer.TakeDebugInfo(nullptr); |
2253 std::string trace_format("bar,"); | 2257 std::string trace_format("bar,"); |
2254 debug_info->AppendAsTraceFormat(&trace_format); | 2258 debug_info->AppendAsTraceFormat(&trace_format); |
2255 std::string expected("bar,{\"layer_name\":\"foo\"}"); | 2259 std::string expected("bar,{\"layer_name\":\"foo\"}"); |
2256 EXPECT_EQ(expected, trace_format); | 2260 EXPECT_EQ(expected, trace_format); |
2257 } | 2261 } |
2258 | 2262 |
2259 } // namespace ui | 2263 } // namespace ui |
OLD | NEW |