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

Side by Side Diff: ui/compositor/layer_unittest.cc

Issue 2661543002: Rename LocalFrameId to LocalSurfaceId (Closed)
Patch Set: c Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/android/delegated_frame_host_android.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 child->SetShowSolidColorContent(); 1817 child->SetShowSolidColorContent();
1818 EXPECT_TRUE(child->cc_layer_for_testing()); 1818 EXPECT_TRUE(child->cc_layer_for_testing());
1819 EXPECT_NE(before.get(), child->cc_layer_for_testing()); 1819 EXPECT_NE(before.get(), child->cc_layer_for_testing());
1820 } 1820 }
1821 1821
1822 TEST_F(LayerWithDelegateTest, ExternalContentMirroring) { 1822 TEST_F(LayerWithDelegateTest, ExternalContentMirroring) {
1823 std::unique_ptr<Layer> layer(CreateLayer(LAYER_SOLID_COLOR)); 1823 std::unique_ptr<Layer> layer(CreateLayer(LAYER_SOLID_COLOR));
1824 1824
1825 cc::SurfaceId surface_id( 1825 cc::SurfaceId surface_id(
1826 cc::FrameSinkId(0, 1), 1826 cc::FrameSinkId(0, 1),
1827 cc::LocalFrameId(2, base::UnguessableToken::Create())); 1827 cc::LocalSurfaceId(2, base::UnguessableToken::Create()));
1828 cc::SurfaceInfo surface_info(surface_id, 1.0f, gfx::Size(10, 10)); 1828 cc::SurfaceInfo surface_info(surface_id, 1.0f, gfx::Size(10, 10));
1829 layer->SetShowSurface(surface_info, new TestSurfaceReferenceFactory()); 1829 layer->SetShowSurface(surface_info, new TestSurfaceReferenceFactory());
1830 1830
1831 const auto mirror = layer->Mirror(); 1831 const auto mirror = layer->Mirror();
1832 auto* const cc_layer = mirror->cc_layer_for_testing(); 1832 auto* const cc_layer = mirror->cc_layer_for_testing();
1833 const auto* surface = static_cast<cc::SurfaceLayer*>(cc_layer); 1833 const auto* surface = static_cast<cc::SurfaceLayer*>(cc_layer);
1834 1834
1835 // Mirroring preserves surface state. 1835 // Mirroring preserves surface state.
1836 EXPECT_EQ(surface_info, surface->surface_info()); 1836 EXPECT_EQ(surface_info, surface->surface_info());
1837 1837
1838 surface_id = 1838 surface_id =
1839 cc::SurfaceId(cc::FrameSinkId(1, 2), 1839 cc::SurfaceId(cc::FrameSinkId(1, 2),
1840 cc::LocalFrameId(3, base::UnguessableToken::Create())); 1840 cc::LocalSurfaceId(3, base::UnguessableToken::Create()));
1841 cc::SurfaceInfo surface_info_2(surface_id, 2.0f, gfx::Size(20, 20)); 1841 cc::SurfaceInfo surface_info_2(surface_id, 2.0f, gfx::Size(20, 20));
1842 layer->SetShowSurface(surface_info_2, new TestSurfaceReferenceFactory()); 1842 layer->SetShowSurface(surface_info_2, new TestSurfaceReferenceFactory());
1843 1843
1844 // A new cc::Layer should be created for the mirror. 1844 // A new cc::Layer should be created for the mirror.
1845 EXPECT_NE(cc_layer, mirror->cc_layer_for_testing()); 1845 EXPECT_NE(cc_layer, mirror->cc_layer_for_testing());
1846 surface = static_cast<cc::SurfaceLayer*>(mirror->cc_layer_for_testing()); 1846 surface = static_cast<cc::SurfaceLayer*>(mirror->cc_layer_for_testing());
1847 1847
1848 // Surface updates propagate to the mirror. 1848 // Surface updates propagate to the mirror.
1849 EXPECT_EQ(surface_info_2, surface->surface_info()); 1849 EXPECT_EQ(surface_info_2, surface->surface_info());
1850 } 1850 }
1851 1851
1852 // Test if frame size in dip is properly calculated in SetShowSurface 1852 // Test if frame size in dip is properly calculated in SetShowSurface
1853 TEST_F(LayerWithDelegateTest, FrameSizeInDip) { 1853 TEST_F(LayerWithDelegateTest, FrameSizeInDip) {
1854 std::unique_ptr<Layer> layer(CreateLayer(LAYER_SOLID_COLOR)); 1854 std::unique_ptr<Layer> layer(CreateLayer(LAYER_SOLID_COLOR));
1855 1855
1856 cc::SurfaceId surface_id( 1856 cc::SurfaceId surface_id(
1857 cc::FrameSinkId(0, 1), 1857 cc::FrameSinkId(0, 1),
1858 cc::LocalFrameId(2, base::UnguessableToken::Create())); 1858 cc::LocalSurfaceId(2, base::UnguessableToken::Create()));
1859 1859
1860 layer->SetShowSurface(cc::SurfaceInfo(surface_id, 2.0f, gfx::Size(30, 40)), 1860 layer->SetShowSurface(cc::SurfaceInfo(surface_id, 2.0f, gfx::Size(30, 40)),
1861 new TestSurfaceReferenceFactory()); 1861 new TestSurfaceReferenceFactory());
1862 1862
1863 EXPECT_EQ(layer->frame_size_in_dip_for_testing(), gfx::Size(15, 20)); 1863 EXPECT_EQ(layer->frame_size_in_dip_for_testing(), gfx::Size(15, 20));
1864 } 1864 }
1865 1865
1866 // Verifies that layer filters still attached after changing implementation 1866 // Verifies that layer filters still attached after changing implementation
1867 // layer. 1867 // layer.
1868 TEST_F(LayerWithDelegateTest, LayerFiltersSurvival) { 1868 TEST_F(LayerWithDelegateTest, LayerFiltersSurvival) {
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
2279 layer.set_name("foo"); 2279 layer.set_name("foo");
2280 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = 2280 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info =
2281 layer.TakeDebugInfo(nullptr); 2281 layer.TakeDebugInfo(nullptr);
2282 std::string trace_format("bar,"); 2282 std::string trace_format("bar,");
2283 debug_info->AppendAsTraceFormat(&trace_format); 2283 debug_info->AppendAsTraceFormat(&trace_format);
2284 std::string expected("bar,{\"layer_name\":\"foo\"}"); 2284 std::string expected("bar,{\"layer_name\":\"foo\"}");
2285 EXPECT_EQ(expected, trace_format); 2285 EXPECT_EQ(expected, trace_format);
2286 } 2286 }
2287 2287
2288 } // namespace ui 2288 } // namespace ui
OLDNEW
« no previous file with comments | « ui/android/delegated_frame_host_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698