| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/layers/delegated_renderer_layer.h" | 7 #include "cc/layers/delegated_renderer_layer.h" |
| 8 #include "cc/layers/delegated_renderer_layer_client.h" | 8 #include "cc/layers/delegated_renderer_layer_client.h" |
| 9 #include "cc/layers/delegated_renderer_layer_impl.h" | 9 #include "cc/layers/delegated_renderer_layer_impl.h" |
| 10 #include "cc/output/delegated_frame_data.h" | 10 #include "cc/output/delegated_frame_data.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 149 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 150 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); | 150 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); |
| 151 FakeDelegatedRendererLayerImpl* delegated_impl = | 151 FakeDelegatedRendererLayerImpl* delegated_impl = |
| 152 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); | 152 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); |
| 153 | 153 |
| 154 WebKit::WebGraphicsContext3D* context = | 154 WebKit::WebGraphicsContext3D* context = |
| 155 host_impl->resource_provider()->GraphicsContext3D(); | 155 host_impl->resource_provider()->GraphicsContext3D(); |
| 156 | 156 |
| 157 ++num_activates_; | 157 ++num_activates_; |
| 158 switch (num_activates_) { | 158 if (num_activates_ == 2) { |
| 159 case 2: | |
| 160 EXPECT_TRUE(delegated_impl->ChildId()); | 159 EXPECT_TRUE(delegated_impl->ChildId()); |
| 161 EXPECT_FALSE(did_reset_child_id_); | 160 EXPECT_FALSE(did_reset_child_id_); |
| 162 | 161 |
| 163 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 162 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 164 GL_INNOCENT_CONTEXT_RESET_ARB); | 163 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 165 break; | 164 } else if (did_reset_child_id_) { |
| 166 case 3: | |
| 167 EXPECT_TRUE(delegated_impl->ChildId()); | 165 EXPECT_TRUE(delegated_impl->ChildId()); |
| 168 EXPECT_TRUE(did_reset_child_id_); | |
| 169 EndTest(); | 166 EndTest(); |
| 170 break; | |
| 171 } | 167 } |
| 172 } | 168 } |
| 173 | 169 |
| 174 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 170 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
| 175 bool success) OVERRIDE { | 171 bool success) OVERRIDE { |
| 176 EXPECT_TRUE(success); | 172 EXPECT_TRUE(success); |
| 177 | 173 |
| 178 if (num_activates_ < 2) | 174 if (num_activates_ < 2) |
| 179 return; | 175 return; |
| 180 | 176 |
| 181 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); | 177 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); |
| 182 FakeDelegatedRendererLayerImpl* delegated_impl = | 178 FakeDelegatedRendererLayerImpl* delegated_impl = |
| 183 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); | 179 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); |
| 184 | 180 |
| 185 EXPECT_EQ(2, num_activates_); | 181 EXPECT_LE(2, num_activates_); |
| 186 EXPECT_FALSE(delegated_impl->ChildId()); | 182 EXPECT_FALSE(delegated_impl->ChildId()); |
| 187 did_reset_child_id_ = true; | 183 did_reset_child_id_ = true; |
| 188 } | 184 } |
| 189 | 185 |
| 190 virtual void AfterTest() OVERRIDE {} | 186 virtual void AfterTest() OVERRIDE {} |
| 191 | 187 |
| 192 protected: | 188 protected: |
| 193 int num_activates_; | 189 int num_activates_; |
| 194 bool did_reset_child_id_; | 190 bool did_reset_child_id_; |
| 195 }; | 191 }; |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 } | 1284 } |
| 1289 } | 1285 } |
| 1290 | 1286 |
| 1291 virtual void AfterTest() OVERRIDE {} | 1287 virtual void AfterTest() OVERRIDE {} |
| 1292 }; | 1288 }; |
| 1293 | 1289 |
| 1294 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake); | 1290 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake); |
| 1295 | 1291 |
| 1296 } // namespace | 1292 } // namespace |
| 1297 } // namespace cc | 1293 } // namespace cc |
| OLD | NEW |