| 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 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 context3d_->set_times_bind_texture_succeeds(0); | 1119 context3d_->set_times_bind_texture_succeeds(0); |
| 1120 } | 1120 } |
| 1121 return draw_result; | 1121 return draw_result; |
| 1122 } | 1122 } |
| 1123 | 1123 |
| 1124 virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback) | 1124 virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback) |
| 1125 OVERRIDE { | 1125 OVERRIDE { |
| 1126 // This will get called twice: | 1126 // This will get called twice: |
| 1127 // First when we create the initial output surface... | 1127 // First when we create the initial output surface... |
| 1128 if (layer_tree_host()->source_frame_number() > 0) { | 1128 if (layer_tree_host()->source_frame_number() > 0) { |
| 1129 // ... and then again after we forced the context to be lost on the third | 1129 // ... and then again after we forced the context to be lost. |
| 1130 // frame. Verify this assumption here. | |
| 1131 lost_context_ = true; | 1130 lost_context_ = true; |
| 1132 EXPECT_EQ(layer_tree_host()->source_frame_number(), 3); | |
| 1133 } | 1131 } |
| 1134 return LayerTreeHostContextTest::CreateFakeOutputSurface(fallback); | 1132 return LayerTreeHostContextTest::CreateFakeOutputSurface(fallback); |
| 1135 } | 1133 } |
| 1136 | 1134 |
| 1137 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1135 virtual void DidCommitAndDrawFrame() OVERRIDE { |
| 1138 ASSERT_TRUE(layer_tree_host()->hud_layer()); | 1136 ASSERT_TRUE(layer_tree_host()->hud_layer()); |
| 1139 // End the test once we know the 3nd frame drew. | 1137 // End the test once we know the 3nd frame drew. |
| 1140 if (layer_tree_host()->source_frame_number() < 4) { | 1138 if (layer_tree_host()->source_frame_number() < 5) { |
| 1141 layer_tree_host()->root_layer()->SetNeedsDisplay(); | 1139 layer_tree_host()->root_layer()->SetNeedsDisplay(); |
| 1142 layer_tree_host()->SetNeedsCommit(); | 1140 layer_tree_host()->SetNeedsCommit(); |
| 1143 } else { | 1141 } else { |
| 1144 EndTest(); | 1142 EndTest(); |
| 1145 } | 1143 } |
| 1146 } | 1144 } |
| 1147 | 1145 |
| 1148 virtual void AfterTest() OVERRIDE { EXPECT_TRUE(lost_context_); } | 1146 virtual void AfterTest() OVERRIDE { EXPECT_TRUE(lost_context_); } |
| 1149 | 1147 |
| 1150 private: | 1148 private: |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1978 | 1976 |
| 1979 protected: | 1977 protected: |
| 1980 FakeContentLayerClient client_; | 1978 FakeContentLayerClient client_; |
| 1981 scoped_refptr<FakeContentLayer> layer_; | 1979 scoped_refptr<FakeContentLayer> layer_; |
| 1982 }; | 1980 }; |
| 1983 | 1981 |
| 1984 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); | 1982 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); |
| 1985 | 1983 |
| 1986 } // namespace | 1984 } // namespace |
| 1987 } // namespace cc | 1985 } // namespace cc |
| OLD | NEW |