OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 1914 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
1915 host_impl_->DidDrawAllLayers(frame); | 1915 host_impl_->DidDrawAllLayers(frame); |
1916 } | 1916 } |
1917 | 1917 |
1918 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) { | 1918 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) { |
1919 host_impl_->active_tree()->SetRootLayer( | 1919 host_impl_->active_tree()->SetRootLayer( |
1920 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); | 1920 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); |
1921 DidDrawCheckLayer* root = | 1921 DidDrawCheckLayer* root = |
1922 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 1922 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
1923 | 1923 |
1924 LayerTreeHostImpl::FrameData frame; | |
1925 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | |
1926 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | |
1927 host_impl_->DidDrawAllLayers(frame); | |
1928 host_impl_->SwapBuffers(frame); | |
1929 | |
1930 bool tile_missing = true; | 1924 bool tile_missing = true; |
1931 bool had_incomplete_tile = false; | 1925 bool had_incomplete_tile = false; |
1932 bool is_animating = false; | 1926 bool is_animating = false; |
1933 root->AddChild( | 1927 root->AddChild( |
1934 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 1928 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
1935 4, | 1929 4, |
1936 tile_missing, | 1930 tile_missing, |
1937 had_incomplete_tile, | 1931 had_incomplete_tile, |
1938 is_animating, | 1932 is_animating, |
1939 host_impl_->resource_provider())); | 1933 host_impl_->resource_provider())); |
1940 LayerTreeHostImpl::FrameData frame2; | 1934 LayerTreeHostImpl::FrameData frame; |
1941 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2)); | 1935 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
1942 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); | 1936 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
1943 host_impl_->DidDrawAllLayers(frame2); | 1937 host_impl_->DidDrawAllLayers(frame); |
1944 } | 1938 } |
1945 | 1939 |
1946 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) { | 1940 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) { |
1947 host_impl_->active_tree()->SetRootLayer( | 1941 host_impl_->active_tree()->SetRootLayer( |
1948 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); | 1942 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); |
1949 DidDrawCheckLayer* root = | 1943 DidDrawCheckLayer* root = |
1950 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 1944 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
1951 | 1945 |
1952 LayerTreeHostImpl::FrameData frame; | |
1953 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | |
1954 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | |
1955 host_impl_->DidDrawAllLayers(frame); | |
1956 host_impl_->SwapBuffers(frame); | |
1957 | |
1958 bool tile_missing = false; | 1946 bool tile_missing = false; |
1959 bool had_incomplete_tile = true; | 1947 bool had_incomplete_tile = true; |
1960 bool is_animating = false; | 1948 bool is_animating = false; |
1961 root->AddChild( | 1949 root->AddChild( |
1962 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 1950 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
1963 4, | 1951 4, |
1964 tile_missing, | 1952 tile_missing, |
1965 had_incomplete_tile, | 1953 had_incomplete_tile, |
1966 is_animating, | 1954 is_animating, |
1967 host_impl_->resource_provider())); | 1955 host_impl_->resource_provider())); |
1968 LayerTreeHostImpl::FrameData frame2; | 1956 LayerTreeHostImpl::FrameData frame; |
1969 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2)); | 1957 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
1970 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); | 1958 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
1971 host_impl_->DidDrawAllLayers(frame2); | 1959 host_impl_->DidDrawAllLayers(frame); |
1972 } | 1960 } |
1973 | 1961 |
1974 TEST_F(LayerTreeHostImplTest, | 1962 TEST_F(LayerTreeHostImplTest, |
1975 PrepareToDrawFailsWithAnimationAndMissingTilesUsesCheckerboard) { | 1963 PrepareToDrawFailsWithAnimationAndMissingTilesUsesCheckerboard) { |
1976 host_impl_->active_tree()->SetRootLayer( | 1964 host_impl_->active_tree()->SetRootLayer( |
1977 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); | 1965 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); |
1978 DidDrawCheckLayer* root = | 1966 DidDrawCheckLayer* root = |
1979 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 1967 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
1980 | |
1981 LayerTreeHostImpl::FrameData frame; | |
1982 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | |
1983 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | |
1984 host_impl_->DidDrawAllLayers(frame); | |
1985 host_impl_->SwapBuffers(frame); | |
1986 | |
1987 bool tile_missing = true; | 1968 bool tile_missing = true; |
1988 bool had_incomplete_tile = false; | 1969 bool had_incomplete_tile = false; |
1989 bool is_animating = true; | 1970 bool is_animating = true; |
1990 root->AddChild( | 1971 root->AddChild( |
1991 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 1972 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
1992 6, | 1973 6, |
1993 tile_missing, | 1974 tile_missing, |
1994 had_incomplete_tile, | 1975 had_incomplete_tile, |
1995 is_animating, | 1976 is_animating, |
1996 host_impl_->resource_provider())); | 1977 host_impl_->resource_provider())); |
1997 LayerTreeHostImpl::FrameData frame2; | 1978 LayerTreeHostImpl::FrameData frame; |
1998 EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS, | 1979 EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS, |
1999 host_impl_->PrepareToDraw(&frame2)); | 1980 host_impl_->PrepareToDraw(&frame)); |
2000 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); | 1981 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
2001 host_impl_->DidDrawAllLayers(frame2); | 1982 host_impl_->DidDrawAllLayers(frame); |
2002 } | 1983 } |
2003 | 1984 |
2004 TEST_F(LayerTreeHostImplTest, | 1985 TEST_F(LayerTreeHostImplTest, |
2005 PrepareToDrawSucceedsWithAnimationAndIncompleteTiles) { | 1986 PrepareToDrawSucceedsWithAnimationAndIncompleteTiles) { |
2006 host_impl_->active_tree()->SetRootLayer( | 1987 host_impl_->active_tree()->SetRootLayer( |
2007 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); | 1988 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); |
2008 DidDrawCheckLayer* root = | 1989 DidDrawCheckLayer* root = |
2009 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 1990 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
2010 | |
2011 LayerTreeHostImpl::FrameData frame; | |
2012 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | |
2013 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | |
2014 host_impl_->DidDrawAllLayers(frame); | |
2015 host_impl_->SwapBuffers(frame); | |
2016 | |
2017 bool tile_missing = false; | 1991 bool tile_missing = false; |
2018 bool had_incomplete_tile = true; | 1992 bool had_incomplete_tile = true; |
2019 bool is_animating = true; | 1993 bool is_animating = true; |
2020 root->AddChild( | 1994 root->AddChild( |
2021 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 1995 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
2022 6, | 1996 6, |
2023 tile_missing, | 1997 tile_missing, |
2024 had_incomplete_tile, | 1998 had_incomplete_tile, |
2025 is_animating, | 1999 is_animating, |
2026 host_impl_->resource_provider())); | 2000 host_impl_->resource_provider())); |
2027 LayerTreeHostImpl::FrameData frame2; | 2001 LayerTreeHostImpl::FrameData frame; |
2028 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2)); | 2002 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
2029 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); | 2003 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
2030 host_impl_->DidDrawAllLayers(frame2); | 2004 host_impl_->DidDrawAllLayers(frame); |
2031 } | 2005 } |
2032 | 2006 |
2033 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) { | 2007 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) { |
2034 host_impl_->active_tree()->SetRootLayer( | 2008 host_impl_->active_tree()->SetRootLayer( |
2035 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); | 2009 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); |
2036 DidDrawCheckLayer* root = | 2010 DidDrawCheckLayer* root = |
2037 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 2011 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
2038 | |
2039 LayerTreeHostImpl::FrameData frame; | |
2040 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | |
2041 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | |
2042 host_impl_->DidDrawAllLayers(frame); | |
2043 host_impl_->SwapBuffers(frame); | |
2044 | |
2045 bool tile_missing = false; | 2012 bool tile_missing = false; |
2046 bool had_incomplete_tile = false; | 2013 bool had_incomplete_tile = false; |
2047 bool is_animating = false; | 2014 bool is_animating = false; |
2048 root->AddChild( | 2015 root->AddChild( |
2049 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 2016 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
2050 8, | 2017 8, |
2051 tile_missing, | 2018 tile_missing, |
2052 had_incomplete_tile, | 2019 had_incomplete_tile, |
2053 is_animating, | 2020 is_animating, |
2054 host_impl_->resource_provider())); | 2021 host_impl_->resource_provider())); |
2055 host_impl_->active_tree()->SetRequiresHighResToDraw(); | 2022 host_impl_->active_tree()->SetRequiresHighResToDraw(); |
2056 LayerTreeHostImpl::FrameData frame2; | 2023 LayerTreeHostImpl::FrameData frame; |
2057 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2)); | 2024 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
2058 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); | 2025 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
2059 host_impl_->DidDrawAllLayers(frame2); | 2026 host_impl_->DidDrawAllLayers(frame); |
2060 } | 2027 } |
2061 | 2028 |
2062 TEST_F(LayerTreeHostImplTest, | 2029 TEST_F(LayerTreeHostImplTest, |
2063 PrepareToDrawFailsWhenHighResRequiredAndIncompleteTiles) { | 2030 PrepareToDrawFailsWhenHighResRequiredAndIncompleteTiles) { |
2064 host_impl_->active_tree()->SetRootLayer( | 2031 host_impl_->active_tree()->SetRootLayer( |
2065 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); | 2032 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); |
2066 DidDrawCheckLayer* root = | 2033 DidDrawCheckLayer* root = |
2067 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 2034 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
2068 | |
2069 LayerTreeHostImpl::FrameData frame; | |
2070 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | |
2071 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | |
2072 host_impl_->DidDrawAllLayers(frame); | |
2073 host_impl_->SwapBuffers(frame); | |
2074 | |
2075 bool tile_missing = false; | 2035 bool tile_missing = false; |
2076 bool had_incomplete_tile = true; | 2036 bool had_incomplete_tile = true; |
2077 bool is_animating = false; | 2037 bool is_animating = false; |
2078 root->AddChild( | 2038 root->AddChild( |
2079 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 2039 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
2080 8, | 2040 8, |
2081 tile_missing, | 2041 tile_missing, |
2082 had_incomplete_tile, | 2042 had_incomplete_tile, |
2083 is_animating, | 2043 is_animating, |
2084 host_impl_->resource_provider())); | 2044 host_impl_->resource_provider())); |
2085 host_impl_->active_tree()->SetRequiresHighResToDraw(); | 2045 host_impl_->active_tree()->SetRequiresHighResToDraw(); |
2086 LayerTreeHostImpl::FrameData frame2; | 2046 LayerTreeHostImpl::FrameData frame; |
2087 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, | 2047 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, |
2088 host_impl_->PrepareToDraw(&frame2)); | 2048 host_impl_->PrepareToDraw(&frame)); |
2089 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); | 2049 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
2090 host_impl_->DidDrawAllLayers(frame2); | 2050 host_impl_->DidDrawAllLayers(frame); |
2091 } | 2051 } |
2092 | 2052 |
2093 TEST_F(LayerTreeHostImplTest, | 2053 TEST_F(LayerTreeHostImplTest, |
2094 PrepareToDrawFailsWhenHighResRequiredAndMissingTile) { | 2054 PrepareToDrawFailsWhenHighResRequiredAndMissingTile) { |
2095 host_impl_->active_tree()->SetRootLayer( | 2055 host_impl_->active_tree()->SetRootLayer( |
2096 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); | 2056 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); |
2097 DidDrawCheckLayer* root = | 2057 DidDrawCheckLayer* root = |
2098 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 2058 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
2099 | |
2100 LayerTreeHostImpl::FrameData frame; | |
2101 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | |
2102 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | |
2103 host_impl_->DidDrawAllLayers(frame); | |
2104 host_impl_->SwapBuffers(frame); | |
2105 | |
2106 bool tile_missing = true; | 2059 bool tile_missing = true; |
2107 bool had_incomplete_tile = false; | 2060 bool had_incomplete_tile = false; |
2108 bool is_animating = false; | 2061 bool is_animating = false; |
2109 root->AddChild( | 2062 root->AddChild( |
2110 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 2063 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
2111 8, | 2064 8, |
2112 tile_missing, | 2065 tile_missing, |
2113 had_incomplete_tile, | 2066 had_incomplete_tile, |
2114 is_animating, | 2067 is_animating, |
2115 host_impl_->resource_provider())); | 2068 host_impl_->resource_provider())); |
2116 host_impl_->active_tree()->SetRequiresHighResToDraw(); | 2069 host_impl_->active_tree()->SetRequiresHighResToDraw(); |
2117 LayerTreeHostImpl::FrameData frame2; | 2070 LayerTreeHostImpl::FrameData frame; |
2118 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, | 2071 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, |
2119 host_impl_->PrepareToDraw(&frame2)); | 2072 host_impl_->PrepareToDraw(&frame)); |
2120 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); | 2073 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
2121 host_impl_->DidDrawAllLayers(frame2); | 2074 host_impl_->DidDrawAllLayers(frame); |
2122 } | 2075 } |
2123 | 2076 |
2124 TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) { | 2077 TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) { |
2125 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 2078 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
2126 root->SetScrollClipLayer(Layer::INVALID_ID); | 2079 root->SetScrollClipLayer(Layer::INVALID_ID); |
2127 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 2080 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
2128 DrawFrame(); | 2081 DrawFrame(); |
2129 | 2082 |
2130 // Scroll event is ignored because layer is not scrollable. | 2083 // Scroll event is ignored because layer is not scrollable. |
2131 EXPECT_EQ(InputHandler::ScrollIgnored, | 2084 EXPECT_EQ(InputHandler::ScrollIgnored, |
(...skipping 3797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5929 EXPECT_EQ(allow_nice_to_have_cutoff_value, current_priority_cutoff_value_); | 5882 EXPECT_EQ(allow_nice_to_have_cutoff_value, current_priority_cutoff_value_); |
5930 | 5883 |
5931 host_impl_->SetVisible(false); | 5884 host_impl_->SetVisible(false); |
5932 EXPECT_EQ(0u, current_limit_bytes_); | 5885 EXPECT_EQ(0u, current_limit_bytes_); |
5933 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_); | 5886 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_); |
5934 } | 5887 } |
5935 | 5888 |
5936 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { | 5889 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { |
5937 ASSERT_TRUE(host_impl_->active_tree()); | 5890 ASSERT_TRUE(host_impl_->active_tree()); |
5938 | 5891 |
5939 // RequiresHighResToDraw is set when new output surface is used. | 5892 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); |
5940 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); | |
5941 | |
5942 host_impl_->active_tree()->ResetRequiresHighResToDraw(); | |
5943 | |
5944 host_impl_->SetVisible(false); | 5893 host_impl_->SetVisible(false); |
5945 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); | 5894 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); |
5946 host_impl_->SetVisible(true); | 5895 host_impl_->SetVisible(true); |
5947 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); | 5896 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); |
5948 host_impl_->SetVisible(false); | 5897 host_impl_->SetVisible(false); |
5949 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); | 5898 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); |
5950 | 5899 |
5951 host_impl_->active_tree()->ResetRequiresHighResToDraw(); | 5900 host_impl_->CreatePendingTree(); |
| 5901 host_impl_->ActivateSyncTree(); |
5952 | 5902 |
5953 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); | 5903 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); |
5954 host_impl_->SetVisible(true); | 5904 host_impl_->SetVisible(true); |
5955 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); | 5905 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); |
5956 } | 5906 } |
5957 | 5907 |
5958 TEST_F(LayerTreeHostImplTest, RequireHighResAfterGpuRasterizationToggles) { | 5908 TEST_F(LayerTreeHostImplTest, RequireHighResAfterGpuRasterizationToggles) { |
5959 ASSERT_TRUE(host_impl_->active_tree()); | 5909 ASSERT_TRUE(host_impl_->active_tree()); |
5960 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); | 5910 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); |
5961 | 5911 |
5962 // RequiresHighResToDraw is set when new output surface is used. | 5912 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); |
5963 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); | |
5964 | |
5965 host_impl_->active_tree()->ResetRequiresHighResToDraw(); | |
5966 | |
5967 host_impl_->SetUseGpuRasterization(false); | 5913 host_impl_->SetUseGpuRasterization(false); |
5968 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); | 5914 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); |
5969 host_impl_->SetUseGpuRasterization(true); | 5915 host_impl_->SetUseGpuRasterization(true); |
5970 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); | 5916 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); |
5971 host_impl_->SetUseGpuRasterization(false); | 5917 host_impl_->SetUseGpuRasterization(false); |
5972 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); | 5918 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); |
5973 | 5919 |
5974 host_impl_->active_tree()->ResetRequiresHighResToDraw(); | 5920 host_impl_->CreatePendingTree(); |
| 5921 host_impl_->ActivateSyncTree(); |
5975 | 5922 |
5976 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); | 5923 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); |
5977 host_impl_->SetUseGpuRasterization(true); | 5924 host_impl_->SetUseGpuRasterization(true); |
5978 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); | 5925 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); |
5979 } | 5926 } |
5980 | 5927 |
5981 class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest { | 5928 class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest { |
5982 public: | 5929 public: |
5983 virtual void SetUp() OVERRIDE { | 5930 virtual void SetUp() OVERRIDE { |
5984 LayerTreeSettings settings; | 5931 LayerTreeSettings settings; |
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7165 // surface. | 7112 // surface. |
7166 EXPECT_EQ(0, num_lost_surfaces_); | 7113 EXPECT_EQ(0, num_lost_surfaces_); |
7167 host_impl_->DidLoseOutputSurface(); | 7114 host_impl_->DidLoseOutputSurface(); |
7168 EXPECT_EQ(1, num_lost_surfaces_); | 7115 EXPECT_EQ(1, num_lost_surfaces_); |
7169 host_impl_->DidLoseOutputSurface(); | 7116 host_impl_->DidLoseOutputSurface(); |
7170 EXPECT_LE(1, num_lost_surfaces_); | 7117 EXPECT_LE(1, num_lost_surfaces_); |
7171 } | 7118 } |
7172 | 7119 |
7173 } // namespace | 7120 } // namespace |
7174 } // namespace cc | 7121 } // namespace cc |
OLD | NEW |