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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6797 matching lines...) Expand 10 before | Expand all | Expand 10 after
6808 6808
6809 EXPECT_EQ(2u, raw_pending_layer->did_become_active_call_count()); 6809 EXPECT_EQ(2u, raw_pending_layer->did_become_active_call_count());
6810 EXPECT_EQ(1u, raw_mask_layer->did_become_active_call_count()); 6810 EXPECT_EQ(1u, raw_mask_layer->did_become_active_call_count());
6811 EXPECT_EQ(0u, raw_replica_mask_layer->did_become_active_call_count()); 6811 EXPECT_EQ(0u, raw_replica_mask_layer->did_become_active_call_count());
6812 pending_tree->DidBecomeActive(); 6812 pending_tree->DidBecomeActive();
6813 EXPECT_EQ(3u, raw_pending_layer->did_become_active_call_count()); 6813 EXPECT_EQ(3u, raw_pending_layer->did_become_active_call_count());
6814 EXPECT_EQ(2u, raw_mask_layer->did_become_active_call_count()); 6814 EXPECT_EQ(2u, raw_mask_layer->did_become_active_call_count());
6815 EXPECT_EQ(1u, raw_replica_mask_layer->did_become_active_call_count()); 6815 EXPECT_EQ(1u, raw_replica_mask_layer->did_become_active_call_count());
6816 } 6816 }
6817 6817
6818 class LayerTreeHostImplCountingLostSurfaces : public LayerTreeHostImplTest {
6819 public:
6820 LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {}
6821 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {
6822 num_lost_surfaces_++;
6823 }
6824
6825 protected:
6826 int num_lost_surfaces_;
6827 };
6828
6829 TEST_F(LayerTreeHostImplCountingLostSurfaces, TwiceLostSurface) {
6830 // The medium term, we plan to remove LayerTreeHostImpl::IsContextLost().
6831 // Until then, we need the state variable
6832 // LayerTreeHostImpl::have_valid_output_surface_ and we can
6833 // enforce the following behaviour, where calling DidLoseOutputSurface
6834 // 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
6835 // call to LayerTreeHostImplClient::DidLoseOutputSurfaceOnImplThread().
6836 // Really we just need at least one client notification each time
6837 // we go from having a valid output surface to not having a valid output
6838 // surface.
6839 EXPECT_EQ(0, num_lost_surfaces_);
6840 EXPECT_FALSE(host_impl_->IsContextLost());
6841 host_impl_->DidLoseOutputSurface();
6842 EXPECT_TRUE(host_impl_->IsContextLost());
6843 EXPECT_EQ(1, num_lost_surfaces_);
6844 host_impl_->DidLoseOutputSurface();
6845 EXPECT_TRUE(host_impl_->IsContextLost());
6846 EXPECT_EQ(1, num_lost_surfaces_);
6847 }
6848
6818 } // namespace 6849 } // namespace
6819 } // namespace cc 6850 } // namespace cc
OLDNEW
« 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