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

Unified Diff: cc/trees/layer_tree_host_unittest_context.cc

Issue 478703002: Remove cc::LayerTreeHostImpl::IsContextLost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ctx4
Patch Set: Include all changes. Prev patchset was second stage only Created 6 years, 4 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
Index: cc/trees/layer_tree_host_unittest_context.cc
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 8fd9743f6d11a527018c6cab91265180ca68b2e3..92e52a014d55861fc61188db01e6a4f94cf3f783 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -65,6 +65,8 @@ class LayerTreeHostContextTest : public LayerTreeTest {
}
void LoseContext() {
+ if (!context3d_)
dneto 2014/08/15 17:44:31 Case #4 in LayerTreeHostContextTestLostContextSucc
+ return;
context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
GL_INNOCENT_CONTEXT_RESET_ARB);
context3d_ = NULL;
@@ -100,7 +102,8 @@ class LayerTreeHostContextTest : public LayerTreeTest {
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame,
DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DRAW_SUCCESS, draw_result);
+ EXPECT_TRUE((DRAW_SUCCESS == draw_result) ||
+ (DRAW_ABORTED_CONTEXT_LOST == draw_result));
if (!times_to_lose_during_draw_)
return draw_result;
@@ -657,6 +660,12 @@ class LayerTreeHostContextTestLayersNotified : public LayerTreeHostContextTest {
EXPECT_GE(1u, grandchild->lost_output_surface_count());
EndTest();
break;
+ case 3:
dneto 2014/08/15 17:44:31 The remaining changes to this file are a result of
+ // The single thread proxy issues extra commits after context lost.
+ // http://crbug.com/287250
danakj 2014/08/15 17:45:15 FYI enne this will go away with your Scheduler CL
+ if (HasImplThread())
+ NOTREACHED();
+ break;
default:
NOTREACHED();
}
@@ -984,6 +993,7 @@ class ScrollbarLayerLostContext : public LayerTreeHostContextTest {
EndTest();
break;
case 3:
+ case 4:
// Single thread proxy issues extra commits after context lost.
// http://crbug.com/287250
if (HasImplThread())
@@ -1097,7 +1107,7 @@ class UIResourceLostAfterCommit : public UIResourceLostTestSimple {
if (HasImplThread())
NOTREACHED();
break;
- case 6:
+ case 7:
danakj 2014/08/15 17:45:15 where's 6? should it be the same as case 5?
NOTREACHED();
}
}
@@ -1114,16 +1124,27 @@ class UIResourceLostAfterCommit : public UIResourceLostTestSimple {
LoseContext();
break;
case 3:
- // The resources should have been recreated. The bitmap callback should
- // have been called once with the resource_lost flag set to true.
- EXPECT_EQ(1, ui_resource_->lost_resource_count);
- // Resource Id on the impl-side have been recreated as well. Note
- // that the same UIResourceId persists after the context lost.
- EXPECT_NE(0u, impl->ResourceIdForUIResource(ui_resource_->id()));
- PostSetNeedsCommitToMainThread();
+ if (HasImplThread())
+ CheckForLossRecoveryThenContinue(impl);
+ break;
+ case 4:
+ // In the single-threaded case, the layer tree host sees the
+ // loss one step later.
+ if (!HasImplThread())
+ CheckForLossRecoveryThenContinue(impl);
break;
}
}
+
+ void CheckForLossRecoveryThenContinue(LayerTreeHostImpl* impl) {
+ // The resources should have been recreated. The bitmap callback should
+ // have been called once with the resource_lost flag set to true.
+ EXPECT_EQ(1, ui_resource_->lost_resource_count);
+ // The resource id on the impl-side should have been recreated as well.
+ // Note that the same UIResourceId persists after the context is lost.
+ EXPECT_NE(0u, impl->ResourceIdForUIResource(ui_resource_->id()));
+ PostSetNeedsCommitToMainThread();
+ }
};
SINGLE_AND_MULTI_THREAD_TEST_F(UIResourceLostAfterCommit);
@@ -1450,9 +1471,28 @@ class LayerTreeHostContextTestSurfaceCreateCallback
EXPECT_EQ(1u, layer_->output_surface_created_count());
break;
case 4:
- EXPECT_EQ(2u, layer_->output_surface_created_count());
+ // In the single threaded case, the layer tree host finishes committing
+ // before it is notified of surface loss.
+ if (HasImplThread()) {
+ EXPECT_EQ(2u, layer_->output_surface_created_count());
+ } else {
+ EXPECT_EQ(1u, layer_->output_surface_created_count());
+ }
layer_tree_host()->SetNeedsCommit();
break;
+ case 5:
+ if (!HasImplThread()) {
+ EXPECT_EQ(2u, layer_->output_surface_created_count());
+ layer_tree_host()->SetNeedsCommit();
+ }
+ break;
+ case 6:
+ if (HasImplThread())
+ NOTREACHED();
+ break;
+ case 7:
+ NOTREACHED();
+ break;
}
}
@@ -1467,7 +1507,13 @@ class LayerTreeHostContextTestSurfaceCreateCallback
LoseContext();
break;
case 3:
- EndTest();
+ if (HasImplThread())
+ EndTest();
+ case 4:
+ break;
+ case 5:
+ if (!HasImplThread())
+ EndTest();
break;
}
}

Powered by Google App Engine
This is Rietveld 408576698