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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 years, 9 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 | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_pixeltest_filters.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 } 1551 }
1552 1552
1553 void SetCurrentPhysicalTimeTicksForTest(base::TimeTicks fake_now) { 1553 void SetCurrentPhysicalTimeTicksForTest(base::TimeTicks fake_now) {
1554 fake_current_physical_time_ = fake_now; 1554 fake_current_physical_time_ = fake_now;
1555 } 1555 }
1556 1556
1557 private: 1557 private:
1558 base::TimeTicks fake_current_physical_time_; 1558 base::TimeTicks fake_current_physical_time_;
1559 }; 1559 };
1560 1560
1561 #define SETUP_LAYERS_FOR_SCROLLBAR_ANIMATION_TEST() \ 1561 class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
1562 gfx::Size viewport_size(10, 10); \ 1562 protected:
1563 gfx::Size content_size(100, 100); \ 1563 void SetupLayers(LayerTreeSettings settings) {
1564 \ 1564 gfx::Size viewport_size(10, 10);
1565 LayerTreeHostImplOverridePhysicalTime* host_impl_override_time = \ 1565 gfx::Size content_size(100, 100);
1566 new LayerTreeHostImplOverridePhysicalTime(settings, this, &proxy_, \
1567 shared_bitmap_manager_.get(), \
1568 &stats_instrumentation_); \
1569 host_impl_ = make_scoped_ptr(host_impl_override_time); \
1570 host_impl_->InitializeRenderer(CreateOutputSurface()); \
1571 host_impl_->SetViewportSize(viewport_size); \
1572 \
1573 scoped_ptr<LayerImpl> root = \
1574 LayerImpl::Create(host_impl_->active_tree(), 1); \
1575 root->SetBounds(viewport_size); \
1576 \
1577 scoped_ptr<LayerImpl> scroll = \
1578 LayerImpl::Create(host_impl_->active_tree(), 2); \
1579 scroll->SetScrollClipLayer(root->id()); \
1580 scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); \
1581 root->SetBounds(viewport_size); \
1582 scroll->SetBounds(content_size); \
1583 scroll->SetContentBounds(content_size); \
1584 scroll->SetIsContainerForFixedPositionLayers(true); \
1585 \
1586 scoped_ptr<LayerImpl> contents = \
1587 LayerImpl::Create(host_impl_->active_tree(), 3); \
1588 contents->SetDrawsContent(true); \
1589 contents->SetBounds(content_size); \
1590 contents->SetContentBounds(content_size); \
1591 \
1592 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar = \
1593 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 4, \
1594 VERTICAL, 10, 0, false, true); \
1595 EXPECT_FLOAT_EQ(0.f, scrollbar->opacity()); \
1596 \
1597 scroll->AddChild(contents.Pass()); \
1598 root->AddChild(scroll.Pass()); \
1599 root->SetHasRenderSurface(true); \
1600 scrollbar->SetScrollLayerAndClipLayerByIds(2, 1); \
1601 root->AddChild(scrollbar.Pass()); \
1602 \
1603 host_impl_->active_tree()->SetRootLayer(root.Pass()); \
1604 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 2, \
1605 Layer::INVALID_ID); \
1606 host_impl_->active_tree()->DidBecomeActive(); \
1607 DrawFrame();
1608 1566
1609 TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) { 1567 LayerTreeHostImplOverridePhysicalTime* host_impl_override_time =
1610 LayerTreeSettings settings; 1568 new LayerTreeHostImplOverridePhysicalTime(settings, this, &proxy_,
1611 settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE; 1569 shared_bitmap_manager_.get(),
1612 settings.scrollbar_fade_delay_ms = 20; 1570 &stats_instrumentation_);
1613 settings.scrollbar_fade_duration_ms = 20; 1571 host_impl_ = make_scoped_ptr(host_impl_override_time);
1572 host_impl_->InitializeRenderer(CreateOutputSurface());
1573 host_impl_->SetViewportSize(viewport_size);
1614 1574
1615 SETUP_LAYERS_FOR_SCROLLBAR_ANIMATION_TEST(); 1575 scoped_ptr<LayerImpl> root =
1576 LayerImpl::Create(host_impl_->active_tree(), 1);
1577 root->SetBounds(viewport_size);
1616 1578
1617 base::TimeTicks fake_now = gfx::FrameTime::Now(); 1579 scoped_ptr<LayerImpl> scroll =
1580 LayerImpl::Create(host_impl_->active_tree(), 2);
1581 scroll->SetScrollClipLayer(root->id());
1582 scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset());
1583 root->SetBounds(viewport_size);
1584 scroll->SetBounds(content_size);
1585 scroll->SetContentBounds(content_size);
1586 scroll->SetIsContainerForFixedPositionLayers(true);
1618 1587
1619 EXPECT_FALSE(did_request_animate_); 1588 scoped_ptr<LayerImpl> contents =
1620 EXPECT_FALSE(did_request_redraw_); 1589 LayerImpl::Create(host_impl_->active_tree(), 3);
1621 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); 1590 contents->SetDrawsContent(true);
1622 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 1591 contents->SetBounds(content_size);
1592 contents->SetContentBounds(content_size);
1623 1593
1624 // If no scroll happened during a scroll gesture, it should have no effect. 1594 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar =
1625 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); 1595 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 4,
1626 host_impl_->ScrollEnd(); 1596 VERTICAL, 10, 0, false, true);
1627 EXPECT_FALSE(did_request_animate_); 1597 EXPECT_FLOAT_EQ(0.f, scrollbar->opacity());
1628 EXPECT_FALSE(did_request_redraw_);
1629 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1630 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
1631 1598
1632 // After a scroll, a fade animation should be scheduled about 20ms from now. 1599 scroll->AddChild(contents.Pass());
1633 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); 1600 root->AddChild(scroll.Pass());
1634 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 5)); 1601 root->SetHasRenderSurface(true);
1635 EXPECT_FALSE(did_request_animate_); 1602 scrollbar->SetScrollLayerAndClipLayerByIds(2, 1);
1636 EXPECT_TRUE(did_request_redraw_); 1603 root->AddChild(scrollbar.Pass());
1637 did_request_redraw_ = false;
1638 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1639 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
1640 1604
1641 host_impl_->ScrollEnd(); 1605 host_impl_->active_tree()->SetRootLayer(root.Pass());
1642 EXPECT_FALSE(did_request_animate_); 1606 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 2,
1643 EXPECT_FALSE(did_request_redraw_); 1607 Layer::INVALID_ID);
1644 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20), requested_animation_delay_); 1608 host_impl_->active_tree()->DidBecomeActive();
1645 EXPECT_FALSE(animation_task_.Equals(base::Closure())); 1609 DrawFrame();
1610 }
1646 1611
1647 fake_now += requested_animation_delay_; 1612 void RunTest(LayerTreeSettings::ScrollbarAnimator animator) {
1648 requested_animation_delay_ = base::TimeDelta(); 1613 LayerTreeSettings settings;
1649 animation_task_.Run(); 1614 settings.scrollbar_animator = animator;
1650 animation_task_ = base::Closure(); 1615 settings.scrollbar_fade_delay_ms = 20;
1651 EXPECT_TRUE(did_request_animate_); 1616 settings.scrollbar_fade_duration_ms = 20;
1652 did_request_animate_ = false;
1653 EXPECT_FALSE(did_request_redraw_);
1654 1617
1655 // After the fade begins, we should start getting redraws instead of a 1618 SetupLayers(settings);
1656 // scheduled animation.
1657 host_impl_->Animate(fake_now);
1658 EXPECT_TRUE(did_request_animate_);
1659 did_request_animate_ = false;
1660 EXPECT_TRUE(did_request_redraw_);
1661 did_request_redraw_ = false;
1662 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1663 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
1664 1619
1665 // Setting the scroll offset outside a scroll should also cause the scrollbar 1620 base::TimeTicks fake_now = gfx::FrameTime::Now();
1666 // to appear and to schedule a fade.
1667 host_impl_->InnerViewportScrollLayer()->PushScrollOffsetFromMainThread(
1668 gfx::ScrollOffset(5, 5));
1669 EXPECT_FALSE(did_request_animate_);
1670 EXPECT_FALSE(did_request_redraw_);
1671 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20), requested_animation_delay_);
1672 EXPECT_FALSE(animation_task_.Equals(base::Closure()));
1673 requested_animation_delay_ = base::TimeDelta();
1674 animation_task_ = base::Closure();
1675 1621
1676 // Unnecessarily Fade animation of solid color scrollbar is not triggered. 1622 EXPECT_FALSE(did_request_animate_);
1677 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); 1623 EXPECT_FALSE(did_request_redraw_);
1678 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0)); 1624 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1679 EXPECT_FALSE(did_request_animate_); 1625 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
1680 EXPECT_TRUE(did_request_redraw_);
1681 did_request_redraw_ = false;
1682 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1683 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
1684 1626
1685 host_impl_->ScrollEnd(); 1627 // If no scroll happened during a scroll gesture, it should have no effect.
1686 EXPECT_FALSE(did_request_animate_); 1628 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
1687 EXPECT_FALSE(did_request_redraw_); 1629 host_impl_->ScrollEnd();
1688 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); 1630 EXPECT_FALSE(did_request_animate_);
1689 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 1631 EXPECT_FALSE(did_request_redraw_);
1632 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1633 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
1634
1635 // After a scroll, a scrollbar animation should be scheduled about 20ms from
1636 // now.
1637 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
1638 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 5));
1639 EXPECT_FALSE(did_request_animate_);
1640 EXPECT_TRUE(did_request_redraw_);
1641 did_request_redraw_ = false;
1642 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1643 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
1644
1645 host_impl_->ScrollEnd();
1646 EXPECT_FALSE(did_request_animate_);
1647 EXPECT_FALSE(did_request_redraw_);
1648 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20),
1649 requested_animation_delay_);
1650 EXPECT_FALSE(animation_task_.Equals(base::Closure()));
1651
1652 fake_now += requested_animation_delay_;
1653 requested_animation_delay_ = base::TimeDelta();
1654 animation_task_.Run();
1655 animation_task_ = base::Closure();
1656 EXPECT_TRUE(did_request_animate_);
1657 did_request_animate_ = false;
1658 EXPECT_FALSE(did_request_redraw_);
1659
1660 // After the scrollbar animation begins, we should start getting redraws.
1661 host_impl_->Animate(fake_now);
1662 EXPECT_TRUE(did_request_animate_);
1663 did_request_animate_ = false;
1664 EXPECT_TRUE(did_request_redraw_);
1665 did_request_redraw_ = false;
1666 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1667 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
1668
1669 // Setting the scroll offset outside a scroll should also cause the
1670 // scrollbar to appear and to schedule a scrollbar animation.
1671 host_impl_->InnerViewportScrollLayer()->PushScrollOffsetFromMainThread(
1672 gfx::ScrollOffset(5, 5));
1673 EXPECT_FALSE(did_request_animate_);
1674 EXPECT_FALSE(did_request_redraw_);
1675 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20),
1676 requested_animation_delay_);
1677 EXPECT_FALSE(animation_task_.Equals(base::Closure()));
1678 requested_animation_delay_ = base::TimeDelta();
1679 animation_task_ = base::Closure();
1680
1681 // Scrollbar animation is not triggered unnecessarily.
1682 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
1683 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0));
1684 EXPECT_FALSE(did_request_animate_);
1685 EXPECT_TRUE(did_request_redraw_);
1686 did_request_redraw_ = false;
1687 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1688 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
1689
1690 host_impl_->ScrollEnd();
1691 EXPECT_FALSE(did_request_animate_);
1692 EXPECT_FALSE(did_request_redraw_);
1693 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1694 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
1695
1696 // Changing page scale triggers scrollbar animation.
1697 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f);
1698 host_impl_->SetPageScaleOnActiveTree(1.1f);
1699 EXPECT_FALSE(did_request_animate_);
1700 EXPECT_FALSE(did_request_redraw_);
1701 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20),
1702 requested_animation_delay_);
1703 EXPECT_FALSE(animation_task_.Equals(base::Closure()));
1704 requested_animation_delay_ = base::TimeDelta();
1705 animation_task_ = base::Closure();
1706 }
1707 };
1708
1709 TEST_F(LayerTreeHostImplTestScrollbarAnimation, LinearFade) {
1710 RunTest(LayerTreeSettings::LINEAR_FADE);
1690 } 1711 }
1691 1712
1692 TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) { 1713 TEST_F(LayerTreeHostImplTestScrollbarAnimation, Thinning) {
1693 LayerTreeSettings settings; 1714 RunTest(LayerTreeSettings::THINNING);
1694 settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE;
1695 settings.scrollbar_fade_delay_ms = 20;
1696 settings.scrollbar_fade_duration_ms = 20;
1697 settings.use_pinch_zoom_scrollbars = true;
1698
1699 SETUP_LAYERS_FOR_SCROLLBAR_ANIMATION_TEST();
1700
1701 base::TimeTicks fake_now = gfx::FrameTime::Now();
1702
1703 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f);
1704
1705 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1706 EXPECT_FALSE(did_request_animate_);
1707
1708 // If no scroll happened during a scroll gesture, it should have no effect.
1709 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
1710 host_impl_->ScrollEnd();
1711 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1712 EXPECT_FALSE(did_request_animate_);
1713 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
1714
1715 // After a scroll, no fade animation should be scheduled.
1716 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
1717 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0));
1718 host_impl_->ScrollEnd();
1719 did_request_redraw_ = false;
1720 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1721 EXPECT_FALSE(did_request_animate_);
1722 requested_animation_delay_ = base::TimeDelta();
1723
1724 // We should not see any draw requests.
1725 fake_now += base::TimeDelta::FromMilliseconds(25);
1726 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
1727 EXPECT_FALSE(did_request_animate_);
1728
1729 // Make page scale > min so that subsequent scrolls will trigger fades.
1730 host_impl_->SetPageScaleOnActiveTree(1.1f);
1731
1732 // After a scroll, a fade animation should be scheduled about 20ms from now.
1733 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
1734 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0));
1735 host_impl_->ScrollEnd();
1736 did_request_redraw_ = false;
1737 EXPECT_LT(base::TimeDelta::FromMilliseconds(19), requested_animation_delay_);
1738 EXPECT_FALSE(did_request_animate_);
1739 requested_animation_delay_ = base::TimeDelta();
1740 animation_task_.Run();
1741
1742 // After the fade begins, we should start getting redraws instead of a
1743 // scheduled animation.
1744 fake_now += base::TimeDelta::FromMilliseconds(25);
1745 host_impl_->Animate(fake_now);
1746 EXPECT_TRUE(did_request_animate_);
1747 } 1715 }
1748 1716
1749 void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale( 1717 void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale(
1750 float device_scale_factor) { 1718 float device_scale_factor) {
1751 LayerTreeSettings settings; 1719 LayerTreeSettings settings;
1752 settings.scrollbar_fade_delay_ms = 500; 1720 settings.scrollbar_fade_delay_ms = 500;
1753 settings.scrollbar_fade_duration_ms = 300; 1721 settings.scrollbar_fade_duration_ms = 300;
1754 settings.scrollbar_animator = LayerTreeSettings::THINNING; 1722 settings.scrollbar_animator = LayerTreeSettings::THINNING;
1755 1723
1756 gfx::Size viewport_size(300, 200); 1724 gfx::Size viewport_size(300, 200);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 bool did_draw_called() const { return did_draw_called_; } 1921 bool did_draw_called() const { return did_draw_called_; }
1954 1922
1955 void set_will_draw_returns_false() { will_draw_returns_false_ = true; } 1923 void set_will_draw_returns_false() { will_draw_returns_false_ = true; }
1956 1924
1957 void ClearDidDrawCheck() { 1925 void ClearDidDrawCheck() {
1958 will_draw_called_ = false; 1926 will_draw_called_ = false;
1959 append_quads_called_ = false; 1927 append_quads_called_ = false;
1960 did_draw_called_ = false; 1928 did_draw_called_ = false;
1961 } 1929 }
1962 1930
1931 static void IgnoreResult(scoped_ptr<CopyOutputResult> result) {}
1932
1933 void AddCopyRequest() {
1934 ScopedPtrVector<CopyOutputRequest> requests;
1935 requests.push_back(
1936 CopyOutputRequest::CreateRequest(base::Bind(&IgnoreResult)));
1937 SetHasRenderSurface(true);
1938 PassCopyRequests(&requests);
1939 }
1940
1963 protected: 1941 protected:
1964 DidDrawCheckLayer(LayerTreeImpl* tree_impl, int id) 1942 DidDrawCheckLayer(LayerTreeImpl* tree_impl, int id)
1965 : LayerImpl(tree_impl, id), 1943 : LayerImpl(tree_impl, id),
1966 will_draw_returns_false_(false), 1944 will_draw_returns_false_(false),
1967 will_draw_called_(false), 1945 will_draw_called_(false),
1968 append_quads_called_(false), 1946 append_quads_called_(false),
1969 did_draw_called_(false) { 1947 did_draw_called_(false) {
1970 SetBounds(gfx::Size(10, 10)); 1948 SetBounds(gfx::Size(10, 10));
1971 SetContentBounds(gfx::Size(10, 10)); 1949 SetContentBounds(gfx::Size(10, 10));
1972 SetDrawsContent(true); 1950 SetDrawsContent(true);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 tile_missing_(tile_missing), 2160 tile_missing_(tile_missing),
2183 had_incomplete_tile_(had_incomplete_tile) { 2161 had_incomplete_tile_(had_incomplete_tile) {
2184 if (animating) 2162 if (animating)
2185 AddAnimatedTransformToLayer(this, 10.0, 3, 0); 2163 AddAnimatedTransformToLayer(this, 10.0, 3, 0);
2186 } 2164 }
2187 2165
2188 bool tile_missing_; 2166 bool tile_missing_;
2189 bool had_incomplete_tile_; 2167 bool had_incomplete_tile_;
2190 }; 2168 };
2191 2169
2192 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsOnDefault) { 2170 struct PrepareToDrawSuccessTestCase {
2171 struct State {
2172 bool has_missing_tile = false;
2173 bool has_incomplete_tile = false;
2174 bool is_animating = false;
2175 bool has_copy_request = false;
2176 };
2177 bool high_res_required = false;
2178 State layer_before;
2179 State layer_between;
2180 State layer_after;
2181 DrawResult expected_result;
2182
2183 explicit PrepareToDrawSuccessTestCase(DrawResult result)
2184 : expected_result(result) {}
2185 };
2186
2187 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsAndFails) {
2188 std::vector<PrepareToDrawSuccessTestCase> cases;
2189
2190 // 0. Default case.
2191 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2192 // 1. Animated layer first.
2193 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2194 cases.back().layer_before.is_animating = true;
2195 // 2. Animated layer between.
2196 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2197 cases.back().layer_between.is_animating = true;
2198 // 3. Animated layer last.
2199 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2200 cases.back().layer_after.is_animating = true;
2201 // 4. Missing tile first.
2202 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2203 cases.back().layer_before.has_missing_tile = true;
2204 // 5. Missing tile between.
2205 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2206 cases.back().layer_between.has_missing_tile = true;
2207 // 6. Missing tile last.
2208 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2209 cases.back().layer_after.has_missing_tile = true;
2210 // 7. Incomplete tile first.
2211 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2212 cases.back().layer_before.has_incomplete_tile = true;
2213 // 8. Incomplete tile between.
2214 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2215 cases.back().layer_between.has_incomplete_tile = true;
2216 // 9. Incomplete tile last.
2217 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2218 cases.back().layer_after.has_incomplete_tile = true;
2219 // 10. Animation with missing tile.
2220 cases.push_back(
2221 PrepareToDrawSuccessTestCase(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS));
2222 cases.back().layer_between.has_missing_tile = true;
2223 cases.back().layer_between.is_animating = true;
2224 // 11. Animation with missing tile and copy request after. Must succeed
2225 // because the animation checkerboard means we'll get a new frame and the copy
2226 // request's layer may be destroyed.
2227 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2228 cases.back().layer_between.has_missing_tile = true;
2229 cases.back().layer_between.is_animating = true;
2230 cases.back().layer_after.has_copy_request = true;
2231 // 12. Animation with missing tile and copy request before. Must succeed
2232 // because the animation checkerboard means we'll get a new frame and the copy
2233 // request's layer may be destroyed.
2234 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2235 cases.back().layer_between.has_missing_tile = true;
2236 cases.back().layer_between.is_animating = true;
2237 cases.back().layer_before.has_copy_request = true;
2238 // 13. Animation with incomplete tile.
2239 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2240 cases.back().layer_between.has_incomplete_tile = true;
2241 cases.back().layer_between.is_animating = true;
2242
2243 // 14. High res required.
2244 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2245 cases.back().high_res_required = true;
2246 // 15. High res required with incomplete tile.
2247 cases.push_back(
2248 PrepareToDrawSuccessTestCase(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT));
2249 cases.back().high_res_required = true;
2250 cases.back().layer_between.has_incomplete_tile = true;
2251 // 16. High res required with missing tile.
2252 cases.push_back(
2253 PrepareToDrawSuccessTestCase(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT));
2254 cases.back().high_res_required = true;
2255 cases.back().layer_between.has_missing_tile = true;
2256
2257 // 17. High res required is higher priority than animating missing tiles.
2258 cases.push_back(
2259 PrepareToDrawSuccessTestCase(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT));
2260 cases.back().high_res_required = true;
2261 cases.back().layer_between.has_missing_tile = true;
2262 cases.back().layer_after.has_missing_tile = true;
2263 cases.back().layer_after.is_animating = true;
2264 // 18. High res required is higher priority than animating missing tiles.
2265 cases.push_back(
2266 PrepareToDrawSuccessTestCase(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT));
2267 cases.back().high_res_required = true;
2268 cases.back().layer_between.has_missing_tile = true;
2269 cases.back().layer_before.has_missing_tile = true;
2270 cases.back().layer_before.is_animating = true;
2271
2272 // 19. High res required is higher priority than copy requests.
2273 cases.push_back(
2274 PrepareToDrawSuccessTestCase(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT));
2275 cases.back().high_res_required = true;
2276 cases.back().layer_between.has_missing_tile = true;
2277 cases.back().layer_after.has_copy_request = true;
2278 // 20. High res required is higher priority than copy requests.
2279 cases.push_back(
2280 PrepareToDrawSuccessTestCase(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT));
2281 cases.back().high_res_required = true;
2282 cases.back().layer_between.has_missing_tile = true;
2283 cases.back().layer_before.has_copy_request = true;
2284 // 21. High res required is higher priority than copy requests.
2285 cases.push_back(
2286 PrepareToDrawSuccessTestCase(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT));
2287 cases.back().high_res_required = true;
2288 cases.back().layer_between.has_missing_tile = true;
2289 cases.back().layer_between.has_copy_request = true;
2290
2193 host_impl_->active_tree()->SetRootLayer( 2291 host_impl_->active_tree()->SetRootLayer(
2194 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); 2292 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1));
2195 DidDrawCheckLayer* root = 2293 DidDrawCheckLayer* root =
2196 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); 2294 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2197 root->SetHasRenderSurface(true); 2295 root->SetHasRenderSurface(true);
2198 bool tile_missing = false;
2199 bool had_incomplete_tile = false;
2200 bool is_animating = false;
2201 root->AddChild(
2202 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
2203 2,
2204 tile_missing,
2205 had_incomplete_tile,
2206 is_animating,
2207 host_impl_->resource_provider()));
2208
2209 LayerTreeHostImpl::FrameData frame;
2210
2211 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
2212 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
2213 host_impl_->DidDrawAllLayers(frame);
2214 }
2215
2216 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithAnimatedLayer) {
2217 host_impl_->active_tree()->SetRootLayer(
2218 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1));
2219 DidDrawCheckLayer* root =
2220 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2221 root->SetHasRenderSurface(true);
2222 bool tile_missing = false;
2223 bool had_incomplete_tile = false;
2224 bool is_animating = true;
2225 root->AddChild(
2226 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
2227 2,
2228 tile_missing,
2229 had_incomplete_tile,
2230 is_animating,
2231 host_impl_->resource_provider()));
2232
2233 LayerTreeHostImpl::FrameData frame;
2234
2235 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
2236 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
2237 host_impl_->DidDrawAllLayers(frame);
2238 }
2239
2240 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) {
2241 host_impl_->active_tree()->SetRootLayer(
2242 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3));
2243 DidDrawCheckLayer* root =
2244 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2245 root->SetHasRenderSurface(true);
2246 2296
2247 LayerTreeHostImpl::FrameData frame; 2297 LayerTreeHostImpl::FrameData frame;
2248 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 2298 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
2249 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
2250 host_impl_->DidDrawAllLayers(frame);
2251 host_impl_->SwapBuffers(frame);
2252
2253 bool tile_missing = true;
2254 bool had_incomplete_tile = false;
2255 bool is_animating = false;
2256 root->AddChild(
2257 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
2258 4,
2259 tile_missing,
2260 had_incomplete_tile,
2261 is_animating,
2262 host_impl_->resource_provider()));
2263 LayerTreeHostImpl::FrameData frame2;
2264 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2));
2265 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now());
2266 host_impl_->DidDrawAllLayers(frame2);
2267 }
2268
2269 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) {
2270 host_impl_->active_tree()->SetRootLayer(
2271 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3));
2272 DidDrawCheckLayer* root =
2273 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2274 root->SetHasRenderSurface(true);
2275
2276 LayerTreeHostImpl::FrameData frame;
2277 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
2278 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 2299 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
2279 host_impl_->DidDrawAllLayers(frame); 2300 host_impl_->DidDrawAllLayers(frame);
2280 host_impl_->SwapBuffers(frame); 2301 host_impl_->SwapBuffers(frame);
2281 2302
2282 bool tile_missing = false; 2303 for (size_t i = 0; i < cases.size(); ++i) {
2283 bool had_incomplete_tile = true; 2304 const auto& testcase = cases[i];
2284 bool is_animating = false; 2305 std::vector<LayerImpl*> to_remove;
2285 root->AddChild( 2306 for (auto* child : root->children())
2286 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), 2307 to_remove.push_back(child);
2287 4, 2308 for (auto* child : to_remove)
2288 tile_missing, 2309 root->RemoveChild(child);
2289 had_incomplete_tile, 2310
2290 is_animating, 2311 std::ostringstream scope;
2291 host_impl_->resource_provider())); 2312 scope << "Test case: " << i;
2292 LayerTreeHostImpl::FrameData frame2; 2313 SCOPED_TRACE(scope.str());
2293 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2)); 2314
2294 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); 2315 root->AddChild(MissingTextureAnimatingLayer::Create(
2295 host_impl_->DidDrawAllLayers(frame2); 2316 host_impl_->active_tree(), 2, testcase.layer_before.has_missing_tile,
2317 testcase.layer_before.has_incomplete_tile,
2318 testcase.layer_before.is_animating, host_impl_->resource_provider()));
2319 DidDrawCheckLayer* before =
2320 static_cast<DidDrawCheckLayer*>(root->children().back());
2321 if (testcase.layer_before.has_copy_request)
2322 before->AddCopyRequest();
2323
2324 root->AddChild(MissingTextureAnimatingLayer::Create(
2325 host_impl_->active_tree(), 3, testcase.layer_between.has_missing_tile,
2326 testcase.layer_between.has_incomplete_tile,
2327 testcase.layer_between.is_animating, host_impl_->resource_provider()));
2328 DidDrawCheckLayer* between =
2329 static_cast<DidDrawCheckLayer*>(root->children().back());
2330 if (testcase.layer_between.has_copy_request)
2331 between->AddCopyRequest();
2332
2333 root->AddChild(MissingTextureAnimatingLayer::Create(
2334 host_impl_->active_tree(), 4, testcase.layer_after.has_missing_tile,
2335 testcase.layer_after.has_incomplete_tile,
2336 testcase.layer_after.is_animating, host_impl_->resource_provider()));
2337 DidDrawCheckLayer* after =
2338 static_cast<DidDrawCheckLayer*>(root->children().back());
2339 if (testcase.layer_after.has_copy_request)
2340 after->AddCopyRequest();
2341
2342 if (testcase.high_res_required)
2343 host_impl_->SetRequiresHighResToDraw();
2344
2345 LayerTreeHostImpl::FrameData frame;
2346 EXPECT_EQ(testcase.expected_result, host_impl_->PrepareToDraw(&frame));
2347 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
2348 host_impl_->DidDrawAllLayers(frame);
2349 host_impl_->SwapBuffers(frame);
2350 }
2296 } 2351 }
2297 2352
2298 TEST_F(LayerTreeHostImplTest, 2353 TEST_F(LayerTreeHostImplTest,
2299 PrepareToDrawFailsWithAnimationAndMissingTilesUsesCheckerboard) { 2354 PrepareToDrawWhenDrawAndSwapFullViewportEveryFrame) {
2355 CreateHostImpl(DefaultSettings(),
2356 FakeOutputSurface::CreateAlwaysDrawAndSwap3d());
2357 EXPECT_TRUE(host_impl_->output_surface()
2358 ->capabilities()
2359 .draw_and_swap_full_viewport_every_frame);
2360
2361 std::vector<PrepareToDrawSuccessTestCase> cases;
2362
2363 // 0. Default case.
2364 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2365 // 1. Animation with missing tile.
2366 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2367 cases.back().layer_between.has_missing_tile = true;
2368 cases.back().layer_between.is_animating = true;
2369 // 2. High res required with incomplete tile.
2370 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2371 cases.back().high_res_required = true;
2372 cases.back().layer_between.has_incomplete_tile = true;
2373 // 3. High res required with missing tile.
2374 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS));
2375 cases.back().high_res_required = true;
2376 cases.back().layer_between.has_missing_tile = true;
2377
2300 host_impl_->active_tree()->SetRootLayer( 2378 host_impl_->active_tree()->SetRootLayer(
2301 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); 2379 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1));
2302 DidDrawCheckLayer* root = 2380 DidDrawCheckLayer* root =
2303 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); 2381 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2304 root->SetHasRenderSurface(true); 2382 root->SetHasRenderSurface(true);
2305
2306 LayerTreeHostImpl::FrameData frame;
2307 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
2308 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
2309 host_impl_->DidDrawAllLayers(frame);
2310 host_impl_->SwapBuffers(frame);
2311
2312 bool tile_missing = true;
2313 bool had_incomplete_tile = false;
2314 bool is_animating = true;
2315 root->AddChild(
2316 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
2317 6,
2318 tile_missing,
2319 had_incomplete_tile,
2320 is_animating,
2321 host_impl_->resource_provider()));
2322 LayerTreeHostImpl::FrameData frame2;
2323 EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS,
2324 host_impl_->PrepareToDraw(&frame2));
2325 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now());
2326 host_impl_->DidDrawAllLayers(frame2);
2327 }
2328
2329 TEST_F(LayerTreeHostImplTest,
2330 PrepareToDrawSucceedsWithAnimationAndIncompleteTiles) {
2331 host_impl_->active_tree()->SetRootLayer(
2332 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5));
2333 DidDrawCheckLayer* root =
2334 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2335 root->SetHasRenderSurface(true);
2336
2337 LayerTreeHostImpl::FrameData frame;
2338 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
2339 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
2340 host_impl_->DidDrawAllLayers(frame);
2341 host_impl_->SwapBuffers(frame);
2342
2343 bool tile_missing = false;
2344 bool had_incomplete_tile = true;
2345 bool is_animating = true;
2346 root->AddChild(
2347 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
2348 6,
2349 tile_missing,
2350 had_incomplete_tile,
2351 is_animating,
2352 host_impl_->resource_provider()));
2353 LayerTreeHostImpl::FrameData frame2;
2354 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2));
2355 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now());
2356 host_impl_->DidDrawAllLayers(frame2);
2357 }
2358
2359 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) {
2360 host_impl_->active_tree()->SetRootLayer(
2361 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7));
2362 DidDrawCheckLayer* root =
2363 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2364 root->SetHasRenderSurface(true);
2365
2366 LayerTreeHostImpl::FrameData frame;
2367 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
2368 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
2369 host_impl_->DidDrawAllLayers(frame);
2370 host_impl_->SwapBuffers(frame);
2371
2372 bool tile_missing = false;
2373 bool had_incomplete_tile = false;
2374 bool is_animating = false;
2375 root->AddChild(
2376 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
2377 8,
2378 tile_missing,
2379 had_incomplete_tile,
2380 is_animating,
2381 host_impl_->resource_provider()));
2382 host_impl_->SetRequiresHighResToDraw();
2383 LayerTreeHostImpl::FrameData frame2;
2384 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2));
2385 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now());
2386 host_impl_->DidDrawAllLayers(frame2);
2387 }
2388
2389 TEST_F(LayerTreeHostImplTest,
2390 PrepareToDrawFailsWhenHighResRequiredAndIncompleteTiles) {
2391 host_impl_->active_tree()->SetRootLayer(
2392 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7));
2393 DidDrawCheckLayer* root =
2394 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2395 root->SetHasRenderSurface(true);
2396 2383
2397 LayerTreeHostImpl::FrameData frame; 2384 LayerTreeHostImpl::FrameData frame;
2398 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 2385 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
2399 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 2386 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
2400 host_impl_->DidDrawAllLayers(frame); 2387 host_impl_->DidDrawAllLayers(frame);
2401 host_impl_->SwapBuffers(frame); 2388 host_impl_->SwapBuffers(frame);
2402 2389
2403 bool tile_missing = false; 2390 for (size_t i = 0; i < cases.size(); ++i) {
2404 bool had_incomplete_tile = true; 2391 const auto& testcase = cases[i];
2405 bool is_animating = false; 2392 std::vector<LayerImpl*> to_remove;
2406 root->AddChild( 2393 for (auto* child : root->children())
2407 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), 2394 to_remove.push_back(child);
2408 8, 2395 for (auto* child : to_remove)
2409 tile_missing, 2396 root->RemoveChild(child);
2410 had_incomplete_tile,
2411 is_animating,
2412 host_impl_->resource_provider()));
2413 host_impl_->SetRequiresHighResToDraw();
2414 LayerTreeHostImpl::FrameData frame2;
2415 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT,
2416 host_impl_->PrepareToDraw(&frame2));
2417 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now());
2418 host_impl_->DidDrawAllLayers(frame2);
2419 }
2420 2397
2421 TEST_F(LayerTreeHostImplTest, 2398 std::ostringstream scope;
2422 PrepareToDrawFailsWhenHighResRequiredAndMissingTile) { 2399 scope << "Test case: " << i;
2423 host_impl_->active_tree()->SetRootLayer( 2400 SCOPED_TRACE(scope.str());
2424 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7));
2425 DidDrawCheckLayer* root =
2426 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2427 root->SetHasRenderSurface(true);
2428 2401
2429 LayerTreeHostImpl::FrameData frame; 2402 root->AddChild(MissingTextureAnimatingLayer::Create(
2430 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 2403 host_impl_->active_tree(), 2, testcase.layer_before.has_missing_tile,
2431 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 2404 testcase.layer_before.has_incomplete_tile,
2432 host_impl_->DidDrawAllLayers(frame); 2405 testcase.layer_before.is_animating, host_impl_->resource_provider()));
2433 host_impl_->SwapBuffers(frame); 2406 DidDrawCheckLayer* before =
2407 static_cast<DidDrawCheckLayer*>(root->children().back());
2408 if (testcase.layer_before.has_copy_request)
2409 before->AddCopyRequest();
2434 2410
2435 bool tile_missing = true; 2411 root->AddChild(MissingTextureAnimatingLayer::Create(
2436 bool had_incomplete_tile = false; 2412 host_impl_->active_tree(), 3, testcase.layer_between.has_missing_tile,
2437 bool is_animating = false; 2413 testcase.layer_between.has_incomplete_tile,
2438 root->AddChild( 2414 testcase.layer_between.is_animating, host_impl_->resource_provider()));
2439 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), 2415 DidDrawCheckLayer* between =
2440 8, 2416 static_cast<DidDrawCheckLayer*>(root->children().back());
2441 tile_missing, 2417 if (testcase.layer_between.has_copy_request)
2442 had_incomplete_tile, 2418 between->AddCopyRequest();
2443 is_animating, 2419
2444 host_impl_->resource_provider())); 2420 root->AddChild(MissingTextureAnimatingLayer::Create(
2445 host_impl_->SetRequiresHighResToDraw(); 2421 host_impl_->active_tree(), 4, testcase.layer_after.has_missing_tile,
2446 LayerTreeHostImpl::FrameData frame2; 2422 testcase.layer_after.has_incomplete_tile,
2447 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, 2423 testcase.layer_after.is_animating, host_impl_->resource_provider()));
2448 host_impl_->PrepareToDraw(&frame2)); 2424 DidDrawCheckLayer* after =
2449 host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); 2425 static_cast<DidDrawCheckLayer*>(root->children().back());
2450 host_impl_->DidDrawAllLayers(frame2); 2426 if (testcase.layer_after.has_copy_request)
2427 after->AddCopyRequest();
2428
2429 if (testcase.high_res_required)
2430 host_impl_->SetRequiresHighResToDraw();
2431
2432 LayerTreeHostImpl::FrameData frame;
2433 EXPECT_EQ(testcase.expected_result, host_impl_->PrepareToDraw(&frame));
2434 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
2435 host_impl_->DidDrawAllLayers(frame);
2436 host_impl_->SwapBuffers(frame);
2437 }
2451 } 2438 }
2452 2439
2453 TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) { 2440 TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) {
2454 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); 2441 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1);
2455 root->SetScrollClipLayer(Layer::INVALID_ID); 2442 root->SetScrollClipLayer(Layer::INVALID_ID);
2456 root->SetHasRenderSurface(true); 2443 root->SetHasRenderSurface(true);
2457 host_impl_->active_tree()->SetRootLayer(root.Pass()); 2444 host_impl_->active_tree()->SetRootLayer(root.Pass());
2458 DrawFrame(); 2445 DrawFrame();
2459 2446
2460 // Scroll event is ignored because layer is not scrollable. 2447 // Scroll event is ignored because layer is not scrollable.
(...skipping 4062 matching lines...) Expand 10 before | Expand all | Expand 10 after
6523 resourceless_software_draw); 6510 resourceless_software_draw);
6524 6511
6525 EXPECT_EQ(0, software_device->frames_began_); 6512 EXPECT_EQ(0, software_device->frames_began_);
6526 EXPECT_EQ(0, software_device->frames_ended_); 6513 EXPECT_EQ(0, software_device->frames_ended_);
6527 6514
6528 DrawFrame(); 6515 DrawFrame();
6529 6516
6530 EXPECT_EQ(1, software_device->frames_began_); 6517 EXPECT_EQ(1, software_device->frames_began_);
6531 EXPECT_EQ(1, software_device->frames_ended_); 6518 EXPECT_EQ(1, software_device->frames_ended_);
6532 6519
6533 // Call other API methods that are likely to hit NULL pointer in this mode. 6520 // Call another API method that is likely to hit nullptr in this mode.
6534 EXPECT_TRUE(host_impl_->AsValue().get()); 6521 scoped_refptr<base::trace_event::TracedValue> state =
6535 EXPECT_TRUE(host_impl_->ActivationStateAsValue().get()); 6522 make_scoped_refptr(new base::trace_event::TracedValue());
6523 host_impl_->ActivationStateAsValueInto(state.get());
6536 } 6524 }
6537 6525
6538 TEST_F(LayerTreeHostImplTest, 6526 TEST_F(LayerTreeHostImplTest,
6539 ForcedDrawToSoftwareDeviceSkipsUnsupportedLayers) { 6527 ForcedDrawToSoftwareDeviceSkipsUnsupportedLayers) {
6540 set_reduce_memory_result(false); 6528 set_reduce_memory_result(false);
6541 bool delegated_rendering = false; 6529 bool delegated_rendering = false;
6542 FakeOutputSurface* output_surface = 6530 FakeOutputSurface* output_surface =
6543 FakeOutputSurface::CreateDeferredGL( 6531 FakeOutputSurface::CreateDeferredGL(
6544 scoped_ptr<SoftwareOutputDevice>(new CountingSoftwareDevice()), 6532 scoped_ptr<SoftwareOutputDevice>(new CountingSoftwareDevice()),
6545 delegated_rendering).release(); 6533 delegated_rendering).release();
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
7110 7098
7111 child_scroll->AddChild(occluder_layer.Pass()); 7099 child_scroll->AddChild(occluder_layer.Pass());
7112 scroll_layer->AddChild(child_scroll.Pass()); 7100 scroll_layer->AddChild(child_scroll.Pass());
7113 7101
7114 DrawFrame(); 7102 DrawFrame();
7115 7103
7116 EXPECT_EQ(InputHandler::SCROLL_UNKNOWN, 7104 EXPECT_EQ(InputHandler::SCROLL_UNKNOWN,
7117 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL)); 7105 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
7118 } 7106 }
7119 7107
7120 TEST_F(LayerTreeHostImplTest, ScrollInvisibleScroller) { 7108 TEST_F(LayerTreeHostImplTest, NotScrollInvisibleScroller) {
7121 gfx::Size content_size(100, 100); 7109 gfx::Size content_size(100, 100);
7122 SetupScrollAndContentsLayers(content_size); 7110 SetupScrollAndContentsLayers(content_size);
7123 7111
7124 LayerImpl* root = host_impl_->active_tree()->LayerById(1); 7112 LayerImpl* root = host_impl_->active_tree()->LayerById(1);
7125 7113
7126 int scroll_layer_id = 2; 7114 int scroll_layer_id = 2;
7127 LayerImpl* scroll_layer = 7115 LayerImpl* scroll_layer =
7128 host_impl_->active_tree()->LayerById(scroll_layer_id); 7116 host_impl_->active_tree()->LayerById(scroll_layer_id);
7129 7117
7130 int child_scroll_layer_id = 7; 7118 int child_scroll_layer_id = 7;
7131 scoped_ptr<LayerImpl> child_scroll = 7119 scoped_ptr<LayerImpl> child_scroll =
7132 CreateScrollableLayer(child_scroll_layer_id, content_size, root); 7120 CreateScrollableLayer(child_scroll_layer_id, content_size, root);
7133 child_scroll->SetDrawsContent(false); 7121 child_scroll->SetDrawsContent(false);
7134 7122
7135 scroll_layer->AddChild(child_scroll.Pass()); 7123 scroll_layer->AddChild(child_scroll.Pass());
7136 7124
7137 DrawFrame(); 7125 DrawFrame();
7138 7126
7139 // We should not have scrolled |child_scroll| even though we technically "hit" 7127 // We should not have scrolled |child_scroll| even though we technically "hit"
7140 // it. The reason for this is that if the scrolling the scroll would not move 7128 // it. The reason for this is that if the scrolling the scroll would not move
7141 // any layer that is a drawn RSLL member, then we can ignore the hit. 7129 // any layer that is a drawn RSLL member, then we can ignore the hit.
7142 // 7130 //
7143 // Why SCROLL_STARTED? In this case, it's because we've bubbled out and 7131 // Why SCROLL_STARTED? In this case, it's because we've bubbled out and
7144 // started overscrolling the inner viewport. 7132 // started scrolling the inner viewport.
7145 EXPECT_EQ(InputHandler::SCROLL_STARTED, 7133 EXPECT_EQ(InputHandler::SCROLL_STARTED,
7146 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL)); 7134 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
7147 7135
7148 EXPECT_EQ(2, host_impl_->CurrentlyScrollingLayer()->id()); 7136 EXPECT_EQ(2, host_impl_->CurrentlyScrollingLayer()->id());
7149 } 7137 }
7150 7138
7139 TEST_F(LayerTreeHostImplTest, ScrollInvisibleScrollerWithVisibleDescendent) {
7140 gfx::Size content_size(100, 100);
7141 SetupScrollAndContentsLayers(content_size);
7142
7143 LayerImpl* root = host_impl_->active_tree()->LayerById(1);
7144 LayerImpl* root_scroll_layer = host_impl_->active_tree()->LayerById(2);
7145
7146 scoped_ptr<LayerImpl> invisible_scroll_layer =
7147 CreateScrollableLayer(7, content_size, root);
7148 invisible_scroll_layer->SetDrawsContent(false);
7149
7150 scoped_ptr<LayerImpl> child_layer =
7151 LayerImpl::Create(host_impl_->active_tree(), 8);
7152 child_layer->SetDrawsContent(false);
7153
7154 scoped_ptr<LayerImpl> grand_child_layer =
7155 LayerImpl::Create(host_impl_->active_tree(), 9);
7156 grand_child_layer->SetDrawsContent(true);
7157 grand_child_layer->SetBounds(content_size);
7158 grand_child_layer->SetContentBounds(content_size);
7159 // Move the grand child so it's not hit by our test point.
7160 grand_child_layer->SetPosition(gfx::PointF(10.f, 10.f));
7161
7162 child_layer->AddChild(grand_child_layer.Pass());
7163 invisible_scroll_layer->AddChild(child_layer.Pass());
7164 root_scroll_layer->AddChild(invisible_scroll_layer.Pass());
7165
7166 DrawFrame();
7167
7168 // We should have scrolled |invisible_scroll_layer| as it was hit and it has
7169 // a descendant which is a drawn RSLL member.
7170 EXPECT_EQ(InputHandler::SCROLL_STARTED,
7171 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
7172
7173 EXPECT_EQ(7, host_impl_->CurrentlyScrollingLayer()->id());
7174 }
7175
7151 TEST_F(LayerTreeHostImplTest, ScrollInvisibleScrollerWithVisibleScrollChild) { 7176 TEST_F(LayerTreeHostImplTest, ScrollInvisibleScrollerWithVisibleScrollChild) {
7152 // This test case is very similar to the one above with one key difference: 7177 // This test case is very similar to the one above with one key difference:
7153 // the invisible scroller has a scroll child that is indeed draw contents. 7178 // the invisible scroller has a scroll child that is indeed draw contents.
7154 // If we attempt to initiate a gesture scroll off of the visible scroll child 7179 // If we attempt to initiate a gesture scroll off of the visible scroll child
7155 // we should still start the scroll child. 7180 // we should still start the scroll child.
7156 gfx::Size content_size(100, 100); 7181 gfx::Size content_size(100, 100);
7157 SetupScrollAndContentsLayers(content_size); 7182 SetupScrollAndContentsLayers(content_size);
7158 7183
7159 LayerImpl* root = host_impl_->active_tree()->LayerById(1); 7184 LayerImpl* root = host_impl_->active_tree()->LayerById(1);
7160 7185
(...skipping 25 matching lines...) Expand all
7186 7211
7187 scroll_child->SetScrollParent(invisible_scroll.get()); 7212 scroll_child->SetScrollParent(invisible_scroll.get());
7188 7213
7189 container->AddChild(invisible_scroll.Pass()); 7214 container->AddChild(invisible_scroll.Pass());
7190 container->AddChild(scroll_child.Pass()); 7215 container->AddChild(scroll_child.Pass());
7191 7216
7192 scroll_layer->AddChild(container.Pass()); 7217 scroll_layer->AddChild(container.Pass());
7193 7218
7194 DrawFrame(); 7219 DrawFrame();
7195 7220
7196 // We should not have scrolled |child_scroll| even though we technically "hit" 7221 // We should have scrolled |child_scroll| even though it is invisible.
7197 // it. The reason for this is that if the scrolling the scroll would not move 7222 // The reason for this is that if the scrolling the scroll would move a layer
7198 // any layer that is a drawn RSLL member, then we can ignore the hit. 7223 // that is a drawn RSLL member, then we should accept this hit.
7199 //
7200 // Why SCROLL_STARTED? In this case, it's because we've bubbled out and
7201 // started overscrolling the inner viewport.
7202 EXPECT_EQ(InputHandler::SCROLL_STARTED, 7224 EXPECT_EQ(InputHandler::SCROLL_STARTED,
7203 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL)); 7225 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
7204 7226
7205 EXPECT_EQ(7, host_impl_->CurrentlyScrollingLayer()->id()); 7227 EXPECT_EQ(7, host_impl_->CurrentlyScrollingLayer()->id());
7206 } 7228 }
7207 7229
7208 // Make sure LatencyInfo carried by LatencyInfoSwapPromise are passed 7230 // Make sure LatencyInfo carried by LatencyInfoSwapPromise are passed
7209 // to CompositorFrameMetadata after SwapBuffers(); 7231 // to CompositorFrameMetadata after SwapBuffers();
7210 TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) { 7232 TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) {
7211 scoped_ptr<SolidColorLayerImpl> root = 7233 scoped_ptr<SolidColorLayerImpl> root =
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
7488 host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE)); 7510 host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
7489 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); 7511 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
7490 EXPECT_EQ(gfx::Vector2dF().ToString(), 7512 EXPECT_EQ(gfx::Vector2dF().ToString(),
7491 scroll_layer->CurrentScrollOffset().ToString()); 7513 scroll_layer->CurrentScrollOffset().ToString());
7492 7514
7493 // Scroll just the top controls and verify that the scroll succeeds. 7515 // Scroll just the top controls and verify that the scroll succeeds.
7494 const float residue = 10; 7516 const float residue = 10;
7495 float offset = top_controls_height_ - residue; 7517 float offset = top_controls_height_ - residue;
7496 EXPECT_TRUE( 7518 EXPECT_TRUE(
7497 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); 7519 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
7498 EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset()); 7520 EXPECT_FLOAT_EQ(-offset,
7521 host_impl_->top_controls_manager()->ControlsTopOffset());
7499 EXPECT_EQ(gfx::Vector2dF().ToString(), 7522 EXPECT_EQ(gfx::Vector2dF().ToString(),
7500 scroll_layer->CurrentScrollOffset().ToString()); 7523 scroll_layer->CurrentScrollOffset().ToString());
7501 7524
7502 // Scroll across the boundary 7525 // Scroll across the boundary
7503 const float content_scroll = 20; 7526 const float content_scroll = 20;
7504 offset = residue + content_scroll; 7527 offset = residue + content_scroll;
7505 EXPECT_TRUE( 7528 EXPECT_TRUE(
7506 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); 7529 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
7507 EXPECT_EQ(-top_controls_height_, 7530 EXPECT_EQ(-top_controls_height_,
7508 host_impl_->top_controls_manager()->ControlsTopOffset()); 7531 host_impl_->top_controls_manager()->ControlsTopOffset());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
7547 host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE)); 7570 host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
7548 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); 7571 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
7549 EXPECT_EQ(gfx::Vector2dF().ToString(), 7572 EXPECT_EQ(gfx::Vector2dF().ToString(),
7550 scroll_layer->CurrentScrollOffset().ToString()); 7573 scroll_layer->CurrentScrollOffset().ToString());
7551 7574
7552 // Scroll the top controls partially. 7575 // Scroll the top controls partially.
7553 const float residue = 35; 7576 const float residue = 35;
7554 float offset = top_controls_height_ - residue; 7577 float offset = top_controls_height_ - residue;
7555 EXPECT_TRUE( 7578 EXPECT_TRUE(
7556 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); 7579 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
7557 EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset()); 7580 EXPECT_FLOAT_EQ(-offset,
7581 host_impl_->top_controls_manager()->ControlsTopOffset());
7558 EXPECT_EQ(gfx::Vector2dF().ToString(), 7582 EXPECT_EQ(gfx::Vector2dF().ToString(),
7559 scroll_layer->CurrentScrollOffset().ToString()); 7583 scroll_layer->CurrentScrollOffset().ToString());
7560 7584
7561 did_request_redraw_ = false; 7585 did_request_redraw_ = false;
7562 did_request_animate_ = false; 7586 did_request_animate_ = false;
7563 did_request_commit_ = false; 7587 did_request_commit_ = false;
7564 7588
7565 // End the scroll while the controls are still offset from their limit. 7589 // End the scroll while the controls are still offset from their limit.
7566 host_impl_->ScrollEnd(); 7590 host_impl_->ScrollEnd();
7567 ASSERT_TRUE(host_impl_->top_controls_manager()->animation()); 7591 ASSERT_TRUE(host_impl_->top_controls_manager()->animation());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
7617 host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE)); 7641 host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
7618 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); 7642 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
7619 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(), 7643 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
7620 scroll_layer->CurrentScrollOffset().ToString()); 7644 scroll_layer->CurrentScrollOffset().ToString());
7621 7645
7622 // Scroll the top controls partially. 7646 // Scroll the top controls partially.
7623 const float residue = 15; 7647 const float residue = 15;
7624 float offset = top_controls_height_ - residue; 7648 float offset = top_controls_height_ - residue;
7625 EXPECT_TRUE( 7649 EXPECT_TRUE(
7626 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); 7650 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
7627 EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset()); 7651 EXPECT_FLOAT_EQ(-offset,
7652 host_impl_->top_controls_manager()->ControlsTopOffset());
7628 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(), 7653 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
7629 scroll_layer->CurrentScrollOffset().ToString()); 7654 scroll_layer->CurrentScrollOffset().ToString());
7630 7655
7631 did_request_redraw_ = false; 7656 did_request_redraw_ = false;
7632 did_request_animate_ = false; 7657 did_request_animate_ = false;
7633 did_request_commit_ = false; 7658 did_request_commit_ = false;
7634 7659
7635 // End the scroll while the controls are still offset from the limit. 7660 // End the scroll while the controls are still offset from the limit.
7636 host_impl_->ScrollEnd(); 7661 host_impl_->ScrollEnd();
7637 ASSERT_TRUE(host_impl_->top_controls_manager()->animation()); 7662 ASSERT_TRUE(host_impl_->top_controls_manager()->animation());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
7680 host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE)); 7705 host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
7681 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); 7706 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
7682 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(), 7707 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
7683 scroll_layer->CurrentScrollOffset().ToString()); 7708 scroll_layer->CurrentScrollOffset().ToString());
7684 7709
7685 // Scroll the top controls partially. 7710 // Scroll the top controls partially.
7686 const float residue = 15; 7711 const float residue = 15;
7687 float offset = top_controls_height_ - residue; 7712 float offset = top_controls_height_ - residue;
7688 EXPECT_TRUE( 7713 EXPECT_TRUE(
7689 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); 7714 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
7690 EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset()); 7715 EXPECT_FLOAT_EQ(-offset,
7716 host_impl_->top_controls_manager()->ControlsTopOffset());
7691 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(), 7717 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
7692 scroll_layer->CurrentScrollOffset().ToString()); 7718 scroll_layer->CurrentScrollOffset().ToString());
7693 7719
7694 did_request_redraw_ = false; 7720 did_request_redraw_ = false;
7695 did_request_animate_ = false; 7721 did_request_animate_ = false;
7696 did_request_commit_ = false; 7722 did_request_commit_ = false;
7697 7723
7698 // End the fling while the controls are still offset from the limit. 7724 // End the fling while the controls are still offset from the limit.
7699 host_impl_->MainThreadHasStoppedFlinging(); 7725 host_impl_->MainThreadHasStoppedFlinging();
7700 ASSERT_TRUE(host_impl_->top_controls_manager()->animation()); 7726 ASSERT_TRUE(host_impl_->top_controls_manager()->animation());
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
8446 // surface. 8472 // surface.
8447 EXPECT_EQ(0, num_lost_surfaces_); 8473 EXPECT_EQ(0, num_lost_surfaces_);
8448 host_impl_->DidLoseOutputSurface(); 8474 host_impl_->DidLoseOutputSurface();
8449 EXPECT_EQ(1, num_lost_surfaces_); 8475 EXPECT_EQ(1, num_lost_surfaces_);
8450 host_impl_->DidLoseOutputSurface(); 8476 host_impl_->DidLoseOutputSurface();
8451 EXPECT_LE(1, num_lost_surfaces_); 8477 EXPECT_LE(1, num_lost_surfaces_);
8452 } 8478 }
8453 8479
8454 } // namespace 8480 } // namespace
8455 } // namespace cc 8481 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_pixeltest_filters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698