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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 478703002: Remove cc::LayerTreeHostImpl::IsContextLost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ctx4
Patch Set: DoComposite draws even if context lost (fixed comments) 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 6993 matching lines...) Expand 10 before | Expand all | Expand 10 after
7004 LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {} 7004 LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {}
7005 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE { 7005 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {
7006 num_lost_surfaces_++; 7006 num_lost_surfaces_++;
7007 } 7007 }
7008 7008
7009 protected: 7009 protected:
7010 int num_lost_surfaces_; 7010 int num_lost_surfaces_;
7011 }; 7011 };
7012 7012
7013 TEST_F(LayerTreeHostImplCountingLostSurfaces, TwiceLostSurface) { 7013 TEST_F(LayerTreeHostImplCountingLostSurfaces, TwiceLostSurface) {
7014 // The medium term, we plan to remove LayerTreeHostImpl::IsContextLost().
7015 // Until then, we need the state variable
7016 // LayerTreeHostImpl::have_valid_output_surface_ and we can
7017 // enforce the following behaviour, where calling DidLoseOutputSurface
7018 // twice in a row only causes one subsequent
7019 // call to LayerTreeHostImplClient::DidLoseOutputSurfaceOnImplThread().
7020 // Really we just need at least one client notification each time 7014 // Really we just need at least one client notification each time
7021 // we go from having a valid output surface to not having a valid output 7015 // we go from having a valid output surface to not having a valid output
7022 // surface. 7016 // surface.
7023 EXPECT_EQ(0, num_lost_surfaces_); 7017 EXPECT_EQ(0, num_lost_surfaces_);
7024 EXPECT_FALSE(host_impl_->IsContextLost());
7025 host_impl_->DidLoseOutputSurface(); 7018 host_impl_->DidLoseOutputSurface();
7026 EXPECT_TRUE(host_impl_->IsContextLost());
7027 EXPECT_EQ(1, num_lost_surfaces_); 7019 EXPECT_EQ(1, num_lost_surfaces_);
7028 host_impl_->DidLoseOutputSurface(); 7020 host_impl_->DidLoseOutputSurface();
7029 EXPECT_TRUE(host_impl_->IsContextLost()); 7021 EXPECT_LE(1, num_lost_surfaces_);
7030 EXPECT_EQ(1, num_lost_surfaces_);
7031 } 7022 }
7032 7023
7033 } // namespace 7024 } // namespace
7034 } // namespace cc 7025 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698