Index: cc/trees/layer_tree_host_unittest_copyrequest.cc |
diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc |
index 12fc63128f060cae65b923a4a6ce081728da9a4b..e3eed76e530729cf50a5e0a84485a7bb5cb4f56c 100644 |
--- a/cc/trees/layer_tree_host_unittest_copyrequest.cc |
+++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc |
@@ -586,25 +586,33 @@ class LayerTreeHostCopyRequestTestLostOutputSurface |
base::Unretained(this)))); |
break; |
case 4: |
- // With SingleThreadProxy it takes two commits to finally swap after a |
- // context loss. |
+ if (HasImplThread()) |
+ CheckAndReleaseCopyOutput(); |
+ break; |
case 5: |
- // Now destroy the CopyOutputResult, releasing the texture inside back |
- // to the compositor. |
- EXPECT_TRUE(result_); |
- result_.reset(); |
- |
- // Check that it is released. |
- ImplThreadTaskRunner()->PostTask( |
- FROM_HERE, |
- base::Bind(&LayerTreeHostCopyRequestTestLostOutputSurface:: |
- CheckNumTextures, |
- base::Unretained(this), |
- num_textures_after_loss_ - 1)); |
+ // With SingleThreadProxy it takes two commits to finally swap after a |
+ // context loss. |
+ if (!HasImplThread()) |
+ CheckAndReleaseCopyOutput(); |
break; |
} |
} |
+ void CheckAndReleaseCopyOutput() { |
+ // Now destroy the CopyOutputResult, releasing the texture inside back |
+ // to the compositor. |
+ EXPECT_TRUE(result_); |
+ result_.reset(); |
+ |
+ // Check that it is released. |
+ ImplThreadTaskRunner()->PostTask( |
+ FROM_HERE, |
+ base::Bind( |
+ &LayerTreeHostCopyRequestTestLostOutputSurface::CheckNumTextures, |
+ base::Unretained(this), |
+ num_textures_after_loss_ - 1)); |
+ } |
+ |
virtual void SwapBuffersOnThread(LayerTreeHostImpl* impl, |
bool result) OVERRIDE { |
switch (impl->active_tree()->source_frame_number()) { |
@@ -628,18 +636,26 @@ class LayerTreeHostCopyRequestTestLostOutputSurface |
GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); |
break; |
case 3: |
- // With SingleThreadProxy it takes two commits to finally swap after a |
- // context loss. |
+ if (HasImplThread()) |
+ CheckSecondContextCreated(); |
+ break; |
case 4: |
- // The output surface has been recreated. |
- EXPECT_TRUE(second_context_provider_.get()); |
- |
- num_textures_after_loss_ = |
- first_context_provider_->TestContext3d()->NumTextures(); |
+ // With SingleThreadProxy it takes two commits to finally swap after a |
+ // context loss. |
+ if (!HasImplThread()) |
+ CheckSecondContextCreated(); |
break; |
} |
} |
+ void CheckSecondContextCreated() { |
+ // The output surface has been recreated. |
+ EXPECT_TRUE(second_context_provider_.get()); |
+ |
+ num_textures_after_loss_ = |
+ first_context_provider_->TestContext3d()->NumTextures(); |
+ } |
+ |
void CheckNumTextures(size_t expected_num_textures) { |
EXPECT_EQ(expected_num_textures, |
first_context_provider_->TestContext3d()->NumTextures()); |