OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "cc/layers/content_layer.h" | 8 #include "cc/layers/content_layer.h" |
9 #include "cc/layers/delegated_frame_provider.h" | 9 #include "cc/layers/delegated_frame_provider.h" |
10 #include "cc/layers/delegated_frame_resource_collection.h" | 10 #include "cc/layers/delegated_frame_resource_collection.h" |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 context3d_->set_times_bind_texture_succeeds(0); | 1123 context3d_->set_times_bind_texture_succeeds(0); |
1124 } | 1124 } |
1125 return true; | 1125 return true; |
1126 } | 1126 } |
1127 | 1127 |
1128 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) | 1128 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) |
1129 OVERRIDE { | 1129 OVERRIDE { |
1130 // This will get called twice: | 1130 // This will get called twice: |
1131 // First when we create the initial output surface... | 1131 // First when we create the initial output surface... |
1132 if (layer_tree_host()->source_frame_number() > 0) { | 1132 if (layer_tree_host()->source_frame_number() > 0) { |
1133 // ... and then again after we forced the context to be lost on the third | 1133 // ... and then again after we forced the context to be lost. |
1134 // frame. Verify this assumption here. | |
1135 lost_context_ = true; | 1134 lost_context_ = true; |
1136 EXPECT_EQ(layer_tree_host()->source_frame_number(), 3); | |
1137 } | 1135 } |
1138 return LayerTreeHostContextTest::CreateOutputSurface(fallback); | 1136 return LayerTreeHostContextTest::CreateOutputSurface(fallback); |
1139 } | 1137 } |
1140 | 1138 |
1141 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1139 virtual void DidCommitAndDrawFrame() OVERRIDE { |
1142 ASSERT_TRUE(layer_tree_host()->hud_layer()); | 1140 ASSERT_TRUE(layer_tree_host()->hud_layer()); |
1143 // End the test once we know the 3nd frame drew. | 1141 // End the test once we know the 3nd frame drew. |
1144 if (layer_tree_host()->source_frame_number() < 4) { | 1142 if (layer_tree_host()->source_frame_number() < 5) { |
1145 layer_tree_host()->root_layer()->SetNeedsDisplay(); | 1143 layer_tree_host()->root_layer()->SetNeedsDisplay(); |
1146 layer_tree_host()->SetNeedsCommit(); | 1144 layer_tree_host()->SetNeedsCommit(); |
1147 } else { | 1145 } else { |
1148 EndTest(); | 1146 EndTest(); |
1149 } | 1147 } |
1150 } | 1148 } |
1151 | 1149 |
1152 virtual void AfterTest() OVERRIDE { EXPECT_TRUE(lost_context_); } | 1150 virtual void AfterTest() OVERRIDE { EXPECT_TRUE(lost_context_); } |
1153 | 1151 |
1154 private: | 1152 private: |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 protected: | 1980 protected: |
1983 FakeContentLayerClient client_; | 1981 FakeContentLayerClient client_; |
1984 scoped_refptr<FakeContentLayer> layer_; | 1982 scoped_refptr<FakeContentLayer> layer_; |
1985 int num_commits_; | 1983 int num_commits_; |
1986 }; | 1984 }; |
1987 | 1985 |
1988 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); | 1986 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); |
1989 | 1987 |
1990 } // namespace | 1988 } // namespace |
1991 } // namespace cc | 1989 } // namespace cc |
OLD | NEW |