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

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

Issue 1385043002: cc: Remove SetLayerTreeHostClientReady() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@startcomp
Patch Set: sky's offline comment Created 5 years, 2 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
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/delegated_frame_provider.h" 8 #include "cc/layers/delegated_frame_provider.h"
9 #include "cc/layers/delegated_frame_resource_collection.h" 9 #include "cc/layers/delegated_frame_resource_collection.h"
10 #include "cc/layers/heads_up_display_layer.h" 10 #include "cc/layers/heads_up_display_layer.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 protected: 347 protected:
348 size_t test_case_; 348 size_t test_case_;
349 int num_losses_; 349 int num_losses_;
350 int num_losses_last_test_case_; 350 int num_losses_last_test_case_;
351 bool recovered_context_; 351 bool recovered_context_;
352 bool first_initialized_; 352 bool first_initialized_;
353 }; 353 };
354 354
355 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLostContextSucceeds); 355 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLostContextSucceeds);
356 356
357 class LayerTreeHostClientNotReadyDoesNotCreateOutputSurface 357 class LayerTreeHostClientNotVisibleDoesNotCreateOutputSurface
358 : public LayerTreeHostContextTest { 358 : public LayerTreeHostContextTest {
359 public: 359 public:
360 LayerTreeHostClientNotReadyDoesNotCreateOutputSurface() 360 LayerTreeHostClientNotVisibleDoesNotCreateOutputSurface()
361 : LayerTreeHostContextTest() {} 361 : LayerTreeHostContextTest() {}
362 362
363 void WillBeginTest() override { 363 void WillBeginTest() override {
364 // Override and do not signal SetLayerTreeHostClientReady. 364 // Override to not become visible.
365 DCHECK(!layer_tree_host()->visible());
365 } 366 }
366 367
367 void BeginTest() override { 368 void BeginTest() override {
368 PostSetNeedsCommitToMainThread(); 369 PostSetNeedsCommitToMainThread();
369 EndTest(); 370 EndTest();
370 } 371 }
371 372
372 scoped_ptr<OutputSurface> CreateOutputSurface() override { 373 scoped_ptr<OutputSurface> CreateOutputSurface() override {
373 EXPECT_TRUE(false); 374 EXPECT_TRUE(false);
374 return nullptr; 375 return nullptr;
375 } 376 }
376 377
377 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } 378 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); }
378 379
379 void AfterTest() override {} 380 void AfterTest() override {}
380 }; 381 };
381 382
382 SINGLE_AND_MULTI_THREAD_TEST_F( 383 SINGLE_AND_MULTI_THREAD_TEST_F(
383 LayerTreeHostClientNotReadyDoesNotCreateOutputSurface); 384 LayerTreeHostClientNotVisibleDoesNotCreateOutputSurface);
384 385
385 // This tests the OutputSurface release logic in the following sequence. 386 // This tests the OutputSurface release logic in the following sequence.
386 // SetUp LTH and create and init OutputSurface 387 // SetUp LTH and create and init OutputSurface
387 // LTH::SetVisible(false); 388 // LTH::SetVisible(false);
388 // LTH::ReleaseOutputSurface(); 389 // LTH::ReleaseOutputSurface();
389 // ... 390 // ...
390 // LTH::SetVisible(true); 391 // LTH::SetVisible(true);
391 // Create and init new OutputSurface 392 // Create and init new OutputSurface
392 class LayerTreeHostClientTakeAwayOutputSurface 393 class LayerTreeHostClientTakeAwayOutputSurface
393 : public LayerTreeHostContextTest { 394 : public LayerTreeHostContextTest {
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 // Release resource before ending the test. 1519 // Release resource before ending the test.
1519 ui_resource_ = nullptr; 1520 ui_resource_ = nullptr;
1520 EndTest(); 1521 EndTest();
1521 break; 1522 break;
1522 case 4: 1523 case 4:
1523 NOTREACHED(); 1524 NOTREACHED();
1524 } 1525 }
1525 } 1526 }
1526 1527
1527 void DidSetVisibleOnImplTree(LayerTreeHostImpl* impl, bool visible) override { 1528 void DidSetVisibleOnImplTree(LayerTreeHostImpl* impl, bool visible) override {
1528 TestWebGraphicsContext3D* context = TestContext();
1529 if (!visible) { 1529 if (!visible) {
1530 TestWebGraphicsContext3D* context = TestContext();
1530 // All resources should have been evicted. 1531 // All resources should have been evicted.
1531 ASSERT_EQ(0u, context->NumTextures()); 1532 ASSERT_EQ(0u, context->NumTextures());
1532 EXPECT_EQ(0u, impl->ResourceIdForUIResource(ui_resource_->id())); 1533 EXPECT_EQ(0u, impl->ResourceIdForUIResource(ui_resource_->id()));
1533 EXPECT_EQ(2, ui_resource_->resource_create_count); 1534 EXPECT_EQ(2, ui_resource_->resource_create_count);
1534 EXPECT_EQ(1, ui_resource_->lost_resource_count); 1535 EXPECT_EQ(1, ui_resource_->lost_resource_count);
1535 // Drawing is disabled both because of the evicted resources and 1536 // Drawing is disabled both because of the evicted resources and
1536 // because the renderer is not visible. 1537 // because the renderer is not visible.
1537 EXPECT_FALSE(impl->CanDraw()); 1538 EXPECT_FALSE(impl->CanDraw());
1538 // Make the renderer visible again. 1539 // Make the renderer visible again.
1539 PostSetVisibleToMainThread(true); 1540 PostSetVisibleToMainThread(true);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 void AfterTest() override {} 1623 void AfterTest() override {}
1623 1624
1624 bool deferred_; 1625 bool deferred_;
1625 }; 1626 };
1626 1627
1627 SINGLE_AND_MULTI_THREAD_TEST_F( 1628 SINGLE_AND_MULTI_THREAD_TEST_F(
1628 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); 1629 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame);
1629 1630
1630 } // namespace 1631 } // namespace
1631 } // namespace cc 1632 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698