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

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: Add an --enable-deadline-scheduler commandline flag. 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "cc/layers/delegated_renderer_layer.h" 10 #include "cc/layers/delegated_renderer_layer.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 287 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
288 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); 288 LayerImpl* root_impl = host_impl->active_tree()->root_layer();
289 FakeDelegatedRendererLayerImpl* delegated_impl = 289 FakeDelegatedRendererLayerImpl* delegated_impl =
290 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); 290 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
291 291
292 ContextProvider* context_provider = 292 ContextProvider* context_provider =
293 host_impl->output_surface()->context_provider(); 293 host_impl->output_surface()->context_provider();
294 294
295 ++num_activates_; 295 ++num_activates_;
296 switch (num_activates_) { 296 if (num_activates_ == 2) {
297 case 2: 297 EXPECT_TRUE(delegated_impl->ChildId());
298 EXPECT_TRUE(delegated_impl->ChildId()); 298 EXPECT_FALSE(did_reset_child_id_);
299 EXPECT_FALSE(did_reset_child_id_); 299 context_provider->Context3d()->loseContextCHROMIUM(
300 300 GL_GUILTY_CONTEXT_RESET_ARB,
301 context_provider->Context3d()->loseContextCHROMIUM( 301 GL_INNOCENT_CONTEXT_RESET_ARB);
302 GL_GUILTY_CONTEXT_RESET_ARB, 302 } else if (did_reset_child_id_) {
303 GL_INNOCENT_CONTEXT_RESET_ARB); 303 EXPECT_TRUE(delegated_impl->ChildId());
304 break; 304 EndTest();
305 case 3:
306 EXPECT_TRUE(delegated_impl->ChildId());
307 EXPECT_TRUE(did_reset_child_id_);
308 EndTest();
309 break;
310 } 305 }
311 } 306 }
312 307
313 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, 308 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl,
314 bool success) OVERRIDE { 309 bool success) OVERRIDE {
315 EXPECT_TRUE(success); 310 EXPECT_TRUE(success);
316 311
317 if (num_activates_ < 2) 312 if (num_activates_ < 2)
318 return; 313 return;
319 314
320 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); 315 LayerImpl* root_impl = host_impl->active_tree()->root_layer();
321 FakeDelegatedRendererLayerImpl* delegated_impl = 316 FakeDelegatedRendererLayerImpl* delegated_impl =
322 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); 317 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
323 318
324 EXPECT_EQ(2, num_activates_); 319 EXPECT_LE(2, num_activates_);
325 EXPECT_FALSE(delegated_impl->ChildId()); 320 EXPECT_FALSE(delegated_impl->ChildId());
326 did_reset_child_id_ = true; 321 did_reset_child_id_ = true;
327 } 322 }
328 323
329 virtual void AfterTest() OVERRIDE {} 324 virtual void AfterTest() OVERRIDE {}
330 325
331 protected: 326 protected:
332 int num_activates_; 327 int num_activates_;
333 bool did_reset_child_id_; 328 bool did_reset_child_id_;
334 }; 329 };
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 } 1572 }
1578 } 1573 }
1579 1574
1580 virtual void AfterTest() OVERRIDE {} 1575 virtual void AfterTest() OVERRIDE {}
1581 }; 1576 };
1582 1577
1583 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake); 1578 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake);
1584 1579
1585 } // namespace 1580 } // namespace
1586 } // namespace cc 1581 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698