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

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

Issue 505713004: Remove cc:LayerTreeHostImpl::IsContextLost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 6956 matching lines...) Expand 10 before | Expand all | Expand 10 after
6967 LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {} 6967 LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {}
6968 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE { 6968 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {
6969 num_lost_surfaces_++; 6969 num_lost_surfaces_++;
6970 } 6970 }
6971 6971
6972 protected: 6972 protected:
6973 int num_lost_surfaces_; 6973 int num_lost_surfaces_;
6974 }; 6974 };
6975 6975
6976 TEST_F(LayerTreeHostImplCountingLostSurfaces, TwiceLostSurface) { 6976 TEST_F(LayerTreeHostImplCountingLostSurfaces, TwiceLostSurface) {
6977 // The medium term, we plan to remove LayerTreeHostImpl::IsContextLost().
6978 // Until then, we need the state variable
6979 // LayerTreeHostImpl::have_valid_output_surface_ and we can
6980 // enforce the following behaviour, where calling DidLoseOutputSurface
6981 // twice in a row only causes one subsequent
6982 // call to LayerTreeHostImplClient::DidLoseOutputSurfaceOnImplThread().
6983 // Really we just need at least one client notification each time 6977 // Really we just need at least one client notification each time
6984 // we go from having a valid output surface to not having a valid output 6978 // we go from having a valid output surface to not having a valid output
6985 // surface. 6979 // surface.
6986 EXPECT_EQ(0, num_lost_surfaces_); 6980 EXPECT_EQ(0, num_lost_surfaces_);
6987 EXPECT_FALSE(host_impl_->IsContextLost());
6988 host_impl_->DidLoseOutputSurface(); 6981 host_impl_->DidLoseOutputSurface();
6989 EXPECT_TRUE(host_impl_->IsContextLost());
6990 EXPECT_EQ(1, num_lost_surfaces_); 6982 EXPECT_EQ(1, num_lost_surfaces_);
6991 host_impl_->DidLoseOutputSurface(); 6983 host_impl_->DidLoseOutputSurface();
6992 EXPECT_TRUE(host_impl_->IsContextLost()); 6984 EXPECT_LE(1, num_lost_surfaces_);
6993 EXPECT_EQ(1, num_lost_surfaces_);
6994 } 6985 }
6995 6986
6996 } // namespace 6987 } // namespace
6997 } // namespace cc 6988 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698