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 a940e3487625981d71e6fe4e14bca2f2c7701249..79501e45c69091baa1768387293c9b7926f88458 100644 |
--- a/cc/trees/layer_tree_host_impl_unittest.cc |
+++ b/cc/trees/layer_tree_host_impl_unittest.cc |
@@ -6815,5 +6815,36 @@ TEST_F(LayerTreeHostImplTest, DidBecomeActive) { |
EXPECT_EQ(1u, raw_replica_mask_layer->did_become_active_call_count()); |
} |
+class LayerTreeHostImplCountingLostSurfaces : public LayerTreeHostImplTest { |
+ public: |
+ LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {} |
+ virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE { |
+ num_lost_surfaces_++; |
+ } |
+ |
+ protected: |
+ int num_lost_surfaces_; |
+}; |
+ |
+TEST_F(LayerTreeHostImplCountingLostSurfaces, TwiceLostSurface) { |
+ // The medium term, we plan to remove LayerTreeHostImpl::IsContextLost(). |
+ // Until then, we need the state variable |
+ // LayerTreeHostImpl::have_valid_output_surface_ and we can |
+ // enforce the following behaviour, where calling DidLoseOutputSurface |
+ // twice in a row only causes one subsequent |
danakj
2014/08/08 13:48:49
I think it'd be a bug if the OutputSurface called
dneto
2014/08/08 14:09:12
No, I didn't see that occur, and I haven't read an
|
+ // call to LayerTreeHostImplClient::DidLoseOutputSurfaceOnImplThread(). |
+ // Really we just need at least one client notification each time |
+ // we go from having a valid output surface to not having a valid output |
+ // surface. |
+ EXPECT_EQ(0, num_lost_surfaces_); |
+ EXPECT_FALSE(host_impl_->IsContextLost()); |
+ host_impl_->DidLoseOutputSurface(); |
+ EXPECT_TRUE(host_impl_->IsContextLost()); |
+ EXPECT_EQ(1, num_lost_surfaces_); |
+ host_impl_->DidLoseOutputSurface(); |
+ EXPECT_TRUE(host_impl_->IsContextLost()); |
+ EXPECT_EQ(1, num_lost_surfaces_); |
+} |
+ |
} // namespace |
} // namespace cc |