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