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