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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 591473003: (Reland) cc:Use impl-side painting in LTH context lost test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment addressed. Created 6 years, 3 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/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 9e63fad82d87448da4d85c965d6da37f423cab13..92087fe361ddf662e5bc02633670f28f1c9c8c2e 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -1927,6 +1927,12 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) {
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+ LayerTreeHostImpl::FrameData frame;
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
+ host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame);
+ host_impl_->SwapBuffers(frame);
+
bool tile_missing = true;
bool had_incomplete_tile = false;
bool is_animating = false;
@@ -1937,10 +1943,10 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) {
had_incomplete_tile,
is_animating,
host_impl_->resource_provider()));
- LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
- host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
- host_impl_->DidDrawAllLayers(frame);
+ LayerTreeHostImpl::FrameData frame2;
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2));
+ host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame2);
}
TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) {
@@ -1949,6 +1955,12 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) {
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+ LayerTreeHostImpl::FrameData frame;
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
+ host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame);
+ host_impl_->SwapBuffers(frame);
+
bool tile_missing = false;
bool had_incomplete_tile = true;
bool is_animating = false;
@@ -1959,10 +1971,10 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) {
had_incomplete_tile,
is_animating,
host_impl_->resource_provider()));
- LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
- host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
- host_impl_->DidDrawAllLayers(frame);
+ LayerTreeHostImpl::FrameData frame2;
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2));
+ host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame2);
}
TEST_F(LayerTreeHostImplTest,
@@ -1971,6 +1983,13 @@ TEST_F(LayerTreeHostImplTest,
DidDrawCheckLayer::Create(host_impl_->active_tree(), 5));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+
+ LayerTreeHostImpl::FrameData frame;
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
+ host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame);
+ host_impl_->SwapBuffers(frame);
+
bool tile_missing = true;
bool had_incomplete_tile = false;
bool is_animating = true;
@@ -1981,11 +2000,11 @@ TEST_F(LayerTreeHostImplTest,
had_incomplete_tile,
is_animating,
host_impl_->resource_provider()));
- LayerTreeHostImpl::FrameData frame;
+ LayerTreeHostImpl::FrameData frame2;
EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS,
- host_impl_->PrepareToDraw(&frame));
- host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
- host_impl_->DidDrawAllLayers(frame);
+ host_impl_->PrepareToDraw(&frame2));
+ host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame2);
}
TEST_F(LayerTreeHostImplTest,
@@ -1994,6 +2013,13 @@ TEST_F(LayerTreeHostImplTest,
DidDrawCheckLayer::Create(host_impl_->active_tree(), 5));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+
+ LayerTreeHostImpl::FrameData frame;
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
+ host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame);
+ host_impl_->SwapBuffers(frame);
+
bool tile_missing = false;
bool had_incomplete_tile = true;
bool is_animating = true;
@@ -2004,10 +2030,10 @@ TEST_F(LayerTreeHostImplTest,
had_incomplete_tile,
is_animating,
host_impl_->resource_provider()));
- LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
- host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
- host_impl_->DidDrawAllLayers(frame);
+ LayerTreeHostImpl::FrameData frame2;
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2));
+ host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame2);
}
TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) {
@@ -2015,6 +2041,13 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) {
DidDrawCheckLayer::Create(host_impl_->active_tree(), 7));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+
+ LayerTreeHostImpl::FrameData frame;
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
+ host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame);
+ host_impl_->SwapBuffers(frame);
+
bool tile_missing = false;
bool had_incomplete_tile = false;
bool is_animating = false;
@@ -2026,10 +2059,10 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) {
is_animating,
host_impl_->resource_provider()));
host_impl_->active_tree()->SetRequiresHighResToDraw();
- LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
- host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
- host_impl_->DidDrawAllLayers(frame);
+ LayerTreeHostImpl::FrameData frame2;
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2));
+ host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame2);
}
TEST_F(LayerTreeHostImplTest,
@@ -2038,6 +2071,13 @@ TEST_F(LayerTreeHostImplTest,
DidDrawCheckLayer::Create(host_impl_->active_tree(), 7));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+
+ LayerTreeHostImpl::FrameData frame;
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
+ host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame);
+ host_impl_->SwapBuffers(frame);
+
bool tile_missing = false;
bool had_incomplete_tile = true;
bool is_animating = false;
@@ -2049,11 +2089,11 @@ TEST_F(LayerTreeHostImplTest,
is_animating,
host_impl_->resource_provider()));
host_impl_->active_tree()->SetRequiresHighResToDraw();
- LayerTreeHostImpl::FrameData frame;
+ LayerTreeHostImpl::FrameData frame2;
EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT,
- host_impl_->PrepareToDraw(&frame));
- host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
- host_impl_->DidDrawAllLayers(frame);
+ host_impl_->PrepareToDraw(&frame2));
+ host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame2);
}
TEST_F(LayerTreeHostImplTest,
@@ -2062,6 +2102,13 @@ TEST_F(LayerTreeHostImplTest,
DidDrawCheckLayer::Create(host_impl_->active_tree(), 7));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+
+ LayerTreeHostImpl::FrameData frame;
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
+ host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame);
+ host_impl_->SwapBuffers(frame);
+
bool tile_missing = true;
bool had_incomplete_tile = false;
bool is_animating = false;
@@ -2073,11 +2120,11 @@ TEST_F(LayerTreeHostImplTest,
is_animating,
host_impl_->resource_provider()));
host_impl_->active_tree()->SetRequiresHighResToDraw();
- LayerTreeHostImpl::FrameData frame;
+ LayerTreeHostImpl::FrameData frame2;
EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT,
- host_impl_->PrepareToDraw(&frame));
- host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
- host_impl_->DidDrawAllLayers(frame);
+ host_impl_->PrepareToDraw(&frame2));
+ host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now());
+ host_impl_->DidDrawAllLayers(frame2);
}
TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) {
@@ -5895,7 +5942,11 @@ TEST_F(LayerTreeHostImplTest, MemoryPolicy) {
TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) {
ASSERT_TRUE(host_impl_->active_tree());
- EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
+ // RequiresHighResToDraw is set when new output surface is used.
+ EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
+
+ host_impl_->active_tree()->ResetRequiresHighResToDraw();
+
host_impl_->SetVisible(false);
EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
host_impl_->SetVisible(true);
@@ -5903,8 +5954,7 @@ TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) {
host_impl_->SetVisible(false);
EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
- host_impl_->CreatePendingTree();
- host_impl_->ActivateSyncTree();
+ host_impl_->active_tree()->ResetRequiresHighResToDraw();
EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
host_impl_->SetVisible(true);
@@ -5915,7 +5965,11 @@ TEST_F(LayerTreeHostImplTest, RequireHighResAfterGpuRasterizationToggles) {
ASSERT_TRUE(host_impl_->active_tree());
EXPECT_FALSE(host_impl_->use_gpu_rasterization());
- EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
+ // RequiresHighResToDraw is set when new output surface is used.
+ EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
+
+ host_impl_->active_tree()->ResetRequiresHighResToDraw();
+
host_impl_->SetUseGpuRasterization(false);
EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
host_impl_->SetUseGpuRasterization(true);
@@ -5923,8 +5977,7 @@ TEST_F(LayerTreeHostImplTest, RequireHighResAfterGpuRasterizationToggles) {
host_impl_->SetUseGpuRasterization(false);
EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
- host_impl_->CreatePendingTree();
- host_impl_->ActivateSyncTree();
+ host_impl_->active_tree()->ResetRequiresHighResToDraw();
EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
host_impl_->SetUseGpuRasterization(true);
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698