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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 446973002: LayerTreeHostImpl knows if it has an output surface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't test calling InitializeRenderer twice in a row 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/thread_proxy.h » ('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 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698