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

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

Issue 2297413002: Fix LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated test (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 569
570 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostFreeContextResourcesOnDestroy); 570 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostFreeContextResourcesOnDestroy);
571 571
572 // Test if the LTH successfully frees and stops freeing context resources 572 // Test if the LTH successfully frees and stops freeing context resources
573 // when the OutputSurface is lost and recreated. 573 // when the OutputSurface is lost and recreated.
574 class LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated 574 class LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated
575 : public LayerTreeHostContextCacheTest { 575 : public LayerTreeHostContextCacheTest {
576 public: 576 public:
577 void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, 577 void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
578 const BeginFrameArgs& args) override { 578 const BeginFrameArgs& args) override {
579 // This code is run once, to trigger recreation of our OutputSurface.
580 if (has_recreated_)
581 return;
582
579 // Ensure that our initialization expectations have completed. 583 // Ensure that our initialization expectations have completed.
580 Mock::VerifyAndClearExpectations(mock_main_context_support_); 584 Mock::VerifyAndClearExpectations(mock_main_context_support_);
581 Mock::VerifyAndClearExpectations(mock_worker_context_support_); 585 Mock::VerifyAndClearExpectations(mock_worker_context_support_);
582 586
583 if (has_recreated_) {
584 // Destruction exptectations.
585 EXPECT_CALL(*mock_worker_context_support_,
586 SetAggressivelyFreeResources(true));
587 EXPECT_CALL(*mock_main_context_support_,
588 SetAggressivelyFreeResources(true));
589 EndTest();
590 return;
591 }
592 has_recreated_ = true;
593
594 // Output surface lost expectations. 587 // Output surface lost expectations.
595 EXPECT_CALL(*mock_worker_context_support_, 588 EXPECT_CALL(*mock_worker_context_support_,
596 SetAggressivelyFreeResources(true)); 589 SetAggressivelyFreeResources(true));
597 EXPECT_CALL(*mock_main_context_support_, 590 EXPECT_CALL(*mock_main_context_support_,
598 SetAggressivelyFreeResources(true)); 591 SetAggressivelyFreeResources(true));
599 host_impl->DidLoseOutputSurface(); 592 host_impl->DidLoseOutputSurface();
593 has_recreated_ = true;
594 }
595
596 void DidInitializeOutputSurface() override {
597 // This is run after we have recreated our OutputSurface.
598 if (!has_recreated_)
599 return;
600
601 // Ensure that our initialization expectations have completed.
602 Mock::VerifyAndClearExpectations(mock_main_context_support_);
603 Mock::VerifyAndClearExpectations(mock_worker_context_support_);
604
605 // Destruction exptectations.
606 EXPECT_CALL(*mock_worker_context_support_,
607 SetAggressivelyFreeResources(true));
608 EXPECT_CALL(*mock_main_context_support_,
609 SetAggressivelyFreeResources(true));
610 EndTest();
600 } 611 }
601 612
602 private: 613 private:
603 bool has_recreated_ = false; 614 bool has_recreated_ = false;
604 }; 615 };
605 616
606 SINGLE_AND_MULTI_THREAD_TEST_F( 617 SINGLE_AND_MULTI_THREAD_TEST_F(
607 LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated); 618 LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated);
608 619
609 // Two setNeedsCommits in a row should lead to at least 1 commit and at least 1 620 // Two setNeedsCommits in a row should lead to at least 1 commit and at least 1
(...skipping 6415 matching lines...) Expand 10 before | Expand all | Expand 10 after
7025 private: 7036 private:
7026 FakeContentLayerClient client_; 7037 FakeContentLayerClient client_;
7027 const gfx::Size viewport_size_; 7038 const gfx::Size viewport_size_;
7028 const gfx::Size large_image_size_; 7039 const gfx::Size large_image_size_;
7029 }; 7040 };
7030 7041
7031 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); 7042 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage);
7032 7043
7033 } // namespace 7044 } // namespace
7034 } // namespace cc 7045 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698