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

Unified Diff: cc/tiles/tile_manager_unittest.cc

Issue 2636323002: cc: Fix missing ready to activate/draw callbacks. (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tiles/tile_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/tile_manager_unittest.cc
diff --git a/cc/tiles/tile_manager_unittest.cc b/cc/tiles/tile_manager_unittest.cc
index bf47cd3d5b6e0466792ae8a55ae38c8d45c4b4dd..ccfc0c06ae85b4b2bb37e5c632c809ac2f690719 100644
--- a/cc/tiles/tile_manager_unittest.cc
+++ b/cc/tiles/tile_manager_unittest.cc
@@ -1480,8 +1480,9 @@ class TileManagerTest : public TestLayerTreeHostBase {
task_runner_provider,
task_graph_runner) {}
- MOCK_METHOD0(NotifyAllTileTasksCompleted, void());
+ MOCK_METHOD0(NotifyReadyToActivate, void());
MOCK_METHOD0(NotifyReadyToDraw, void());
+ MOCK_METHOD0(NotifyAllTileTasksCompleted, void());
};
std::unique_ptr<FakeLayerTreeHostImpl> CreateHostImpl(
@@ -1504,12 +1505,14 @@ class TileManagerTest : public TestLayerTreeHostBase {
// Test to ensure that we call NotifyAllTileTasksCompleted when PrepareTiles is
// called.
-TEST_F(TileManagerTest, AllWorkFinishedTest) {
+TEST_F(TileManagerTest, AllWorkFinished) {
// Check with no tile work enqueued.
{
base::RunLoop run_loop;
EXPECT_FALSE(
host_impl()->tile_manager()->HasScheduledTileTasksForTesting());
+ EXPECT_CALL(MockHostImpl(), NotifyReadyToActivate());
+ EXPECT_CALL(MockHostImpl(), NotifyReadyToDraw());
EXPECT_CALL(MockHostImpl(), NotifyAllTileTasksCompleted())
.WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); }));
host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state());
@@ -1523,6 +1526,8 @@ TEST_F(TileManagerTest, AllWorkFinishedTest) {
base::RunLoop run_loop;
EXPECT_FALSE(
host_impl()->tile_manager()->HasScheduledTileTasksForTesting());
+ EXPECT_CALL(MockHostImpl(), NotifyReadyToActivate());
+ EXPECT_CALL(MockHostImpl(), NotifyReadyToDraw());
EXPECT_CALL(MockHostImpl(), NotifyAllTileTasksCompleted())
.WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); }));
host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state());
@@ -1530,6 +1535,22 @@ TEST_F(TileManagerTest, AllWorkFinishedTest) {
EXPECT_TRUE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting());
run_loop.Run();
}
+
+ // Check that if callbacks are called by CheckIfMoreTilesNeedToBePrepared if
+ // they haven't been called already.
+ {
+ base::RunLoop run_loop;
+ EXPECT_FALSE(
+ host_impl()->tile_manager()->HasScheduledTileTasksForTesting());
+ EXPECT_CALL(MockHostImpl(), NotifyReadyToActivate());
+ EXPECT_CALL(MockHostImpl(), NotifyReadyToDraw());
+ EXPECT_CALL(MockHostImpl(), NotifyAllTileTasksCompleted())
+ .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); }));
+ host_impl()->tile_manager()->ResetSignalsForTesting();
+ host_impl()->tile_manager()->SetMoreTilesNeedToBeRasterizedForTesting();
+ host_impl()->tile_manager()->CheckIfMoreTilesNeedToBePreparedForTesting();
+ run_loop.Run();
+ }
}
TEST_F(TileManagerTest, ActivateAndDrawWhenOOM) {
@@ -1543,6 +1564,8 @@ TEST_F(TileManagerTest, ActivateAndDrawWhenOOM) {
base::RunLoop run_loop;
EXPECT_FALSE(
host_impl()->tile_manager()->HasScheduledTileTasksForTesting());
+ EXPECT_CALL(MockHostImpl(), NotifyReadyToActivate());
+ EXPECT_CALL(MockHostImpl(), NotifyReadyToDraw());
EXPECT_CALL(MockHostImpl(), NotifyAllTileTasksCompleted())
.WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); }));
host_impl()->tile_manager()->PrepareTiles(global_state);
@@ -1559,6 +1582,8 @@ TEST_F(TileManagerTest, ActivateAndDrawWhenOOM) {
{
base::RunLoop run_loop;
host_impl()->set_notify_tile_state_changed_called(false);
+ EXPECT_CALL(MockHostImpl(), NotifyReadyToActivate());
+ EXPECT_CALL(MockHostImpl(), NotifyReadyToDraw());
EXPECT_CALL(MockHostImpl(), NotifyAllTileTasksCompleted())
.WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); }));
host_impl()->tile_manager()->PrepareTiles(global_state);
« no previous file with comments | « cc/tiles/tile_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698