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..cad978b9d2670744d7d134a292fd16a45747b990 100644 |
--- a/cc/trees/layer_tree_host_impl_unittest.cc |
+++ b/cc/trees/layer_tree_host_impl_unittest.cc |
@@ -6815,5 +6815,39 @@ 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) { |
+ 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_); |
+} |
+ |
+TEST_F(LayerTreeHostImplCountingLostSurfaces, TwiceInitializeRenderer) { |
+ // We should be able to tolerate a re-initialization of the |
danakj
2014/08/06 18:56:44
I don't think this is true. It should never happen
dneto
2014/08/06 20:20:35
So should I remove this test and add the DCHECK(!r
|
+ // renderer if an output surface has not been able to invoke |
+ // our lost-surface callback in time. |
+ // See crbug.com/392891 |
+ EXPECT_EQ(0, num_lost_surfaces_); |
+ host_impl_->InitializeRenderer(CreateOutputSurface()); |
+ EXPECT_EQ(0, num_lost_surfaces_); |
+ host_impl_->InitializeRenderer(CreateOutputSurface()); |
+ EXPECT_EQ(0, num_lost_surfaces_); |
+} |
+ |
} // namespace |
} // namespace cc |