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/scheduler/scheduler.h" | 5 #include "cc/scheduler/scheduler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 1745 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
1746 | 1746 |
1747 client_->Reset(); | 1747 client_->Reset(); |
1748 EXPECT_SCOPED(AdvanceFrame()); | 1748 EXPECT_SCOPED(AdvanceFrame()); |
1749 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 1749 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
1750 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 1750 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
1751 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1751 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
1752 | 1752 |
1753 client_->Reset(); | 1753 client_->Reset(); |
1754 scheduler_->DidLoseOutputSurface(); | 1754 scheduler_->DidLoseOutputSurface(); |
1755 // Do nothing when impl frame is in deadine pending state. | 1755 // SetNeedsBeginFrames(false) is not called until the end of the frame. |
1756 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); | 1756 EXPECT_NO_ACTION(client_); |
1757 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); | |
1758 | 1757 |
1759 client_->Reset(); | 1758 client_->Reset(); |
1760 scheduler_->NotifyBeginMainFrameStarted(); | 1759 scheduler_->NotifyBeginMainFrameStarted(); |
1761 scheduler_->NotifyReadyToCommit(); | 1760 scheduler_->NotifyReadyToCommit(); |
1762 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 1); | 1761 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 1); |
1763 | 1762 |
1764 client_->Reset(); | 1763 client_->Reset(); |
1765 task_runner().RunPendingTasks(); // Run posted deadline. | 1764 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1766 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); | 1765 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3); |
| 1766 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 1, 3); |
| 1767 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); |
1767 } | 1768 } |
1768 | 1769 |
1769 void SchedulerTest::DidLoseOutputSurfaceAfterBeginFrameStartedWithHighLatency( | 1770 void SchedulerTest::DidLoseOutputSurfaceAfterBeginFrameStartedWithHighLatency( |
1770 bool impl_side_painting) { | 1771 bool impl_side_painting) { |
1771 scheduler_settings_.impl_side_painting = impl_side_painting; | 1772 scheduler_settings_.impl_side_painting = impl_side_painting; |
1772 scheduler_settings_.use_external_begin_frame_source = true; | 1773 scheduler_settings_.use_external_begin_frame_source = true; |
1773 SetUpScheduler(true); | 1774 SetUpScheduler(true); |
1774 | 1775 |
1775 // SetNeedsCommit should begin the frame. | 1776 // SetNeedsCommit should begin the frame. |
1776 scheduler_->SetNeedsCommit(); | 1777 scheduler_->SetNeedsCommit(); |
1777 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 1778 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
1778 | 1779 |
1779 client_->Reset(); | 1780 client_->Reset(); |
1780 EXPECT_SCOPED(AdvanceFrame()); | 1781 EXPECT_SCOPED(AdvanceFrame()); |
1781 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 1782 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
1782 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 1783 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
1783 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1784 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
1784 | 1785 |
1785 client_->Reset(); | 1786 client_->Reset(); |
1786 scheduler_->DidLoseOutputSurface(); | 1787 scheduler_->DidLoseOutputSurface(); |
1787 // Do nothing when impl frame is in deadine pending state. | 1788 // Do nothing when impl frame is in deadine pending state. |
1788 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); | 1789 EXPECT_NO_ACTION(client_); |
1789 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); | |
1790 | 1790 |
1791 client_->Reset(); | 1791 client_->Reset(); |
1792 // Run posted deadline. | 1792 // Run posted deadline. |
1793 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1793 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
1794 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1794 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1795 // OnBeginImplFrameDeadline didn't schedule any actions because main frame is | 1795 // OnBeginImplFrameDeadline didn't schedule output surface creation because |
1796 // not yet completed. | 1796 // main frame is not yet completed. |
1797 EXPECT_NO_ACTION(client_); | 1797 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); |
| 1798 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); |
1798 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 1799 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
1799 | 1800 |
1800 // BeginImplFrame is not started. | 1801 // BeginImplFrame is not started. |
| 1802 client_->Reset(); |
1801 task_runner().RunUntilTime(now_src()->Now() + | 1803 task_runner().RunUntilTime(now_src()->Now() + |
1802 base::TimeDelta::FromMilliseconds(10)); | 1804 base::TimeDelta::FromMilliseconds(10)); |
1803 EXPECT_NO_ACTION(client_); | 1805 EXPECT_NO_ACTION(client_); |
1804 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 1806 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
1805 | 1807 |
1806 client_->Reset(); | 1808 client_->Reset(); |
1807 scheduler_->NotifyBeginMainFrameStarted(); | 1809 scheduler_->NotifyBeginMainFrameStarted(); |
1808 scheduler_->NotifyReadyToCommit(); | 1810 scheduler_->NotifyReadyToCommit(); |
1809 if (impl_side_painting) { | 1811 if (impl_side_painting) { |
1810 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); | 1812 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 1846 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
1845 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1847 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
1846 | 1848 |
1847 client_->Reset(); | 1849 client_->Reset(); |
1848 scheduler_->NotifyBeginMainFrameStarted(); | 1850 scheduler_->NotifyBeginMainFrameStarted(); |
1849 scheduler_->NotifyReadyToCommit(); | 1851 scheduler_->NotifyReadyToCommit(); |
1850 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 1852 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
1851 | 1853 |
1852 client_->Reset(); | 1854 client_->Reset(); |
1853 scheduler_->DidLoseOutputSurface(); | 1855 scheduler_->DidLoseOutputSurface(); |
| 1856 // SetNeedsBeginFrames(false) is not called until the end of the frame. |
1854 if (impl_side_painting) { | 1857 if (impl_side_painting) { |
1855 // Sync tree should be forced to activate. | 1858 // Sync tree should be forced to activate. |
1856 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 0, 3); | 1859 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
1857 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 1, 3); | |
1858 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); | |
1859 } else { | 1860 } else { |
1860 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); | 1861 EXPECT_NO_ACTION(client_); |
1861 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); | |
1862 } | 1862 } |
1863 | 1863 |
1864 client_->Reset(); | 1864 client_->Reset(); |
1865 task_runner().RunPendingTasks(); // Run posted deadline. | 1865 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1866 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); | 1866 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3); |
| 1867 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 1, 3); |
| 1868 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); |
1867 } | 1869 } |
1868 | 1870 |
1869 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) { | 1871 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) { |
1870 DidLoseOutputSurfaceAfterReadyToCommit(false); | 1872 DidLoseOutputSurfaceAfterReadyToCommit(false); |
1871 } | 1873 } |
1872 | 1874 |
1873 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommitWithImplPainting) { | 1875 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommitWithImplPainting) { |
1874 DidLoseOutputSurfaceAfterReadyToCommit(true); | 1876 DidLoseOutputSurfaceAfterReadyToCommit(true); |
1875 } | 1877 } |
1876 | 1878 |
1877 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsPrepareTiles) { | 1879 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsPrepareTiles) { |
1878 scheduler_settings_.use_external_begin_frame_source = true; | 1880 scheduler_settings_.use_external_begin_frame_source = true; |
1879 SetUpScheduler(true); | 1881 SetUpScheduler(true); |
1880 | 1882 |
1881 scheduler_->SetNeedsPrepareTiles(); | 1883 scheduler_->SetNeedsPrepareTiles(); |
1882 scheduler_->SetNeedsRedraw(); | 1884 scheduler_->SetNeedsRedraw(); |
1883 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 1885 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
1884 | 1886 |
1885 client_->Reset(); | 1887 client_->Reset(); |
1886 EXPECT_SCOPED(AdvanceFrame()); | 1888 EXPECT_SCOPED(AdvanceFrame()); |
1887 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 1889 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
1888 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 2); | 1890 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 2); |
1889 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1891 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
1890 | 1892 |
1891 client_->Reset(); | 1893 client_->Reset(); |
1892 scheduler_->DidLoseOutputSurface(); | 1894 scheduler_->DidLoseOutputSurface(); |
1893 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); | 1895 // SetNeedsBeginFrames(false) is not called until the end of the frame. |
1894 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); | 1896 EXPECT_NO_ACTION(client_); |
1895 | 1897 |
1896 client_->Reset(); | 1898 client_->Reset(); |
1897 task_runner().RunPendingTasks(); // Run posted deadline. | 1899 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1898 EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 0, 2); | 1900 EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 0, 4); |
1899 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 1, 2); | 1901 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 1, 4); |
| 1902 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 2, 4); |
| 1903 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 3, 4); |
1900 } | 1904 } |
1901 | 1905 |
1902 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) { | 1906 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) { |
1903 scheduler_settings_.use_external_begin_frame_source = true; | 1907 scheduler_settings_.use_external_begin_frame_source = true; |
1904 SetUpScheduler(true); | 1908 SetUpScheduler(true); |
1905 | 1909 |
1906 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 1910 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
1907 scheduler_->SetNeedsCommit(); | 1911 scheduler_->SetNeedsCommit(); |
1908 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 1912 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
1909 | 1913 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1997 client_->Reset(); | 2001 client_->Reset(); |
1998 task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. | 2002 task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. |
1999 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2003 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2000 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 2); | 2004 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 2); |
2001 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2005 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2002 EXPECT_TRUE(client_->needs_begin_frames()); | 2006 EXPECT_TRUE(client_->needs_begin_frames()); |
2003 | 2007 |
2004 client_->Reset(); | 2008 client_->Reset(); |
2005 EXPECT_FALSE(scheduler_->IsBeginRetroFrameArgsEmpty()); | 2009 EXPECT_FALSE(scheduler_->IsBeginRetroFrameArgsEmpty()); |
2006 scheduler_->DidLoseOutputSurface(); | 2010 scheduler_->DidLoseOutputSurface(); |
2007 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); | 2011 EXPECT_NO_ACTION(client_); |
2008 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); | |
2009 EXPECT_TRUE(scheduler_->IsBeginRetroFrameArgsEmpty()); | 2012 EXPECT_TRUE(scheduler_->IsBeginRetroFrameArgsEmpty()); |
2010 | 2013 |
2011 // BeginImplFrame deadline should abort drawing. | 2014 // BeginImplFrame deadline should abort drawing. |
2012 client_->Reset(); | 2015 client_->Reset(); |
2013 task_runner().RunPendingTasks(); // Run posted deadline. | 2016 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
2014 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); | 2017 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3); |
| 2018 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 1, 3); |
| 2019 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); |
2015 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2020 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
2016 EXPECT_FALSE(client_->needs_begin_frames()); | 2021 EXPECT_FALSE(client_->needs_begin_frames()); |
2017 | 2022 |
2018 // No more BeginRetroFrame because BeginRetroFrame queue is cleared. | 2023 // No more BeginRetroFrame because BeginRetroFrame queue is cleared. |
2019 client_->Reset(); | 2024 client_->Reset(); |
2020 task_runner().RunPendingTasks(); | 2025 task_runner().RunPendingTasks(); |
2021 EXPECT_NO_ACTION(client_); | 2026 EXPECT_NO_ACTION(client_); |
2022 } | 2027 } |
2023 | 2028 |
2024 TEST_F(SchedulerTest, | 2029 TEST_F(SchedulerTest, DidLoseOutputSurfaceWithSyntheticBeginFrameSource) { |
2025 StopBeginFrameAfterDidLoseOutputSurfaceWithSyntheticBeginFrameSource) { | |
2026 SetUpScheduler(true); | 2030 SetUpScheduler(true); |
2027 | 2031 |
2028 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 2032 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
2029 EXPECT_FALSE(scheduler_->frame_source().NeedsBeginFrames()); | 2033 EXPECT_FALSE(scheduler_->frame_source().NeedsBeginFrames()); |
2030 scheduler_->SetNeedsCommit(); | 2034 scheduler_->SetNeedsCommit(); |
2031 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); | 2035 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); |
2032 | 2036 |
2033 client_->Reset(); | 2037 client_->Reset(); |
2034 task_runner().RunPendingTasks(); // Run posted Tick. | 2038 AdvanceFrame(); |
2035 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2039 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2036 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2040 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
2037 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2041 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2038 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); | 2042 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); |
2039 | 2043 |
2040 // NotifyReadyToCommit should trigger the commit. | 2044 // NotifyReadyToCommit should trigger the commit. |
2041 client_->Reset(); | 2045 client_->Reset(); |
2042 scheduler_->NotifyBeginMainFrameStarted(); | 2046 scheduler_->NotifyBeginMainFrameStarted(); |
2043 scheduler_->NotifyReadyToCommit(); | 2047 scheduler_->NotifyReadyToCommit(); |
2044 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2048 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2045 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); | 2049 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); |
2046 | 2050 |
2047 client_->Reset(); | 2051 client_->Reset(); |
2048 scheduler_->DidLoseOutputSurface(); | 2052 scheduler_->DidLoseOutputSurface(); |
2049 EXPECT_SINGLE_ACTION("SendBeginMainFrameNotExpectedSoon", client_); | 2053 // SetNeedsBeginFrames(false) is not called until the end of the frame. |
2050 EXPECT_FALSE(scheduler_->frame_source().NeedsBeginFrames()); | 2054 EXPECT_NO_ACTION(client_); |
| 2055 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); |
2051 | 2056 |
2052 client_->Reset(); | 2057 client_->Reset(); |
2053 task_runner().RunPendingTasks(); // Run posted deadline. | 2058 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
2054 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); | 2059 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 2); |
| 2060 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); |
2055 EXPECT_FALSE(scheduler_->frame_source().NeedsBeginFrames()); | 2061 EXPECT_FALSE(scheduler_->frame_source().NeedsBeginFrames()); |
2056 } | 2062 } |
2057 | 2063 |
| 2064 TEST_F(SchedulerTest, DidLoseOutputSurfaceWhenIdle) { |
| 2065 scheduler_settings_.use_external_begin_frame_source = true; |
| 2066 SetUpScheduler(true); |
| 2067 |
| 2068 // SetNeedsCommit should begin the frame. |
| 2069 scheduler_->SetNeedsCommit(); |
| 2070 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 2071 |
| 2072 client_->Reset(); |
| 2073 EXPECT_SCOPED(AdvanceFrame()); |
| 2074 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 2075 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 2076 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2077 |
| 2078 client_->Reset(); |
| 2079 scheduler_->NotifyBeginMainFrameStarted(); |
| 2080 scheduler_->NotifyReadyToCommit(); |
| 2081 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 2082 |
| 2083 client_->Reset(); |
| 2084 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 2085 EXPECT_ACTION("ScheduledActionAnimate", client_, 0, 2); |
| 2086 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 1, 2); |
| 2087 |
| 2088 // Idle time between BeginFrames. |
| 2089 client_->Reset(); |
| 2090 scheduler_->DidLoseOutputSurface(); |
| 2091 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3); |
| 2092 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 1, 3); |
| 2093 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); |
| 2094 } |
| 2095 |
2058 TEST_F(SchedulerTest, ScheduledActionActivateAfterBecomingInvisible) { | 2096 TEST_F(SchedulerTest, ScheduledActionActivateAfterBecomingInvisible) { |
2059 scheduler_settings_.impl_side_painting = true; | 2097 scheduler_settings_.impl_side_painting = true; |
2060 scheduler_settings_.use_external_begin_frame_source = true; | 2098 scheduler_settings_.use_external_begin_frame_source = true; |
2061 SetUpScheduler(true); | 2099 SetUpScheduler(true); |
2062 | 2100 |
2063 // SetNeedsCommit should begin the frame. | 2101 // SetNeedsCommit should begin the frame. |
2064 scheduler_->SetNeedsCommit(); | 2102 scheduler_->SetNeedsCommit(); |
2065 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 2103 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
2066 | 2104 |
2067 client_->Reset(); | 2105 client_->Reset(); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 client_->Reset(); | 2267 client_->Reset(); |
2230 | 2268 |
2231 task_runner().RunPendingTasks(); // Run posted deadline. | 2269 task_runner().RunPendingTasks(); // Run posted deadline. |
2232 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); | 2270 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); |
2233 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); | 2271 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); |
2234 client_->Reset(); | 2272 client_->Reset(); |
2235 } | 2273 } |
2236 | 2274 |
2237 } // namespace | 2275 } // namespace |
2238 } // namespace cc | 2276 } // namespace cc |
OLD | NEW |