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

Side by Side Diff: cc/trees/layer_tree_host_unittest_delegated.cc

Issue 16871016: cc: Use BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@bfargs2
Patch Set: Fix tests Created 7 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
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/layers/delegated_renderer_layer.h" 8 #include "cc/layers/delegated_renderer_layer.h"
9 #include "cc/layers/delegated_renderer_layer_client.h" 9 #include "cc/layers/delegated_renderer_layer_client.h"
10 #include "cc/layers/delegated_renderer_layer_impl.h" 10 #include "cc/layers/delegated_renderer_layer_impl.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 244 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
245 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); 245 LayerImpl* root_impl = host_impl->active_tree()->root_layer();
246 FakeDelegatedRendererLayerImpl* delegated_impl = 246 FakeDelegatedRendererLayerImpl* delegated_impl =
247 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); 247 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
248 248
249 WebKit::WebGraphicsContext3D* context = 249 WebKit::WebGraphicsContext3D* context =
250 host_impl->resource_provider()->GraphicsContext3D(); 250 host_impl->resource_provider()->GraphicsContext3D();
251 251
252 ++num_activates_; 252 ++num_activates_;
253 switch (num_activates_) { 253 if (num_activates_ == 2) {
254 case 2: 254 EXPECT_TRUE(delegated_impl->ChildId());
255 EXPECT_TRUE(delegated_impl->ChildId()); 255 EXPECT_FALSE(did_reset_child_id_);
256 EXPECT_FALSE(did_reset_child_id_);
257 256
258 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, 257 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
259 GL_INNOCENT_CONTEXT_RESET_ARB); 258 GL_INNOCENT_CONTEXT_RESET_ARB);
260 break; 259 } else if (did_reset_child_id_) {
261 case 3: 260 EXPECT_TRUE(delegated_impl->ChildId());
262 EXPECT_TRUE(delegated_impl->ChildId()); 261 EndTest();
263 EXPECT_TRUE(did_reset_child_id_);
264 EndTest();
265 break;
266 } 262 }
267 } 263 }
268 264
269 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, 265 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl,
270 bool success) OVERRIDE { 266 bool success) OVERRIDE {
271 EXPECT_TRUE(success); 267 EXPECT_TRUE(success);
272 268
273 if (num_activates_ < 2) 269 if (num_activates_ < 2)
274 return; 270 return;
275 271
276 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); 272 LayerImpl* root_impl = host_impl->active_tree()->root_layer();
277 FakeDelegatedRendererLayerImpl* delegated_impl = 273 FakeDelegatedRendererLayerImpl* delegated_impl =
278 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); 274 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
279 275
280 EXPECT_EQ(2, num_activates_); 276 EXPECT_LE(2, num_activates_);
281 EXPECT_FALSE(delegated_impl->ChildId()); 277 EXPECT_FALSE(delegated_impl->ChildId());
282 did_reset_child_id_ = true; 278 did_reset_child_id_ = true;
283 } 279 }
284 280
285 virtual void AfterTest() OVERRIDE {} 281 virtual void AfterTest() OVERRIDE {}
286 282
287 protected: 283 protected:
288 int num_activates_; 284 int num_activates_;
289 bool did_reset_child_id_; 285 bool did_reset_child_id_;
290 }; 286 };
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 } 1462 }
1467 } 1463 }
1468 1464
1469 virtual void AfterTest() OVERRIDE {} 1465 virtual void AfterTest() OVERRIDE {}
1470 }; 1466 };
1471 1467
1472 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake); 1468 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake);
1473 1469
1474 } // namespace 1470 } // namespace
1475 } // namespace cc 1471 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698