OLD | NEW |
---|---|
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 Loading... | |
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 EXPECT_EQ(0, num_lost_surfaces_); | |
6831 EXPECT_FALSE(host_impl_->IsContextLost()); | |
6832 host_impl_->DidLoseOutputSurface(); | |
6833 EXPECT_TRUE(host_impl_->IsContextLost()); | |
6834 EXPECT_EQ(1, num_lost_surfaces_); | |
6835 host_impl_->DidLoseOutputSurface(); | |
6836 EXPECT_TRUE(host_impl_->IsContextLost()); | |
6837 EXPECT_EQ(1, num_lost_surfaces_); | |
6838 } | |
6839 | |
6840 TEST_F(LayerTreeHostImplCountingLostSurfaces, TwiceInitializeRenderer) { | |
6841 // 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
| |
6842 // renderer if an output surface has not been able to invoke | |
6843 // our lost-surface callback in time. | |
6844 // See crbug.com/392891 | |
6845 EXPECT_EQ(0, num_lost_surfaces_); | |
6846 host_impl_->InitializeRenderer(CreateOutputSurface()); | |
6847 EXPECT_EQ(0, num_lost_surfaces_); | |
6848 host_impl_->InitializeRenderer(CreateOutputSurface()); | |
6849 EXPECT_EQ(0, num_lost_surfaces_); | |
6850 } | |
6851 | |
6818 } // namespace | 6852 } // namespace |
6819 } // namespace cc | 6853 } // namespace cc |
OLD | NEW |