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

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

Issue 2171143002: cc: Get rid of non-delegated rendering in most cc unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@killdirecttests
Patch Set: fakeoutputsurface: no-constructor Created 4 years, 5 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_host_unittest_copyrequest.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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "cc/layers/heads_up_display_layer.h" 9 #include "cc/layers/heads_up_display_layer.h"
10 #include "cc/layers/layer_impl.h" 10 #include "cc/layers/layer_impl.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 std::unique_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d(); 90 std::unique_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d();
91 base::AutoLock lock(context3d_lock_); 91 base::AutoLock lock(context3d_lock_);
92 context3d_ = context3d.get(); 92 context3d_ = context3d.get();
93 93
94 if (context_should_support_io_surface_) { 94 if (context_should_support_io_surface_) {
95 context3d_->set_have_extension_io_surface(true); 95 context3d_->set_have_extension_io_surface(true);
96 context3d_->set_have_extension_egl_image(true); 96 context3d_->set_have_extension_egl_image(true);
97 } 97 }
98 98
99 if (delegating_renderer()) 99 DCHECK(delegating_renderer());
100 return FakeOutputSurface::CreateDelegating3d(std::move(context3d)); 100 return FakeOutputSurface::CreateDelegating3d(std::move(context3d));
101 else
102 return FakeOutputSurface::Create3d(std::move(context3d));
103 } 101 }
104 102
105 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 103 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
106 LayerTreeHostImpl::FrameData* frame, 104 LayerTreeHostImpl::FrameData* frame,
107 DrawResult draw_result) override { 105 DrawResult draw_result) override {
108 if (draw_result == DRAW_ABORTED_MISSING_HIGH_RES_CONTENT) { 106 if (draw_result == DRAW_ABORTED_MISSING_HIGH_RES_CONTENT) {
109 // Only valid for single-threaded compositing, which activates 107 // Only valid for single-threaded compositing, which activates
110 // immediately and will try to draw again when content has finished. 108 // immediately and will try to draw again when content has finished.
111 DCHECK(!host_impl->task_runner_provider()->HasImplThread()); 109 DCHECK(!host_impl->task_runner_provider()->HasImplThread());
112 return draw_result; 110 return draw_result;
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 771
774 protected: 772 protected:
775 bool lose_after_evict_; 773 bool lose_after_evict_;
776 FakeContentLayerClient client_; 774 FakeContentLayerClient client_;
777 LayerTreeHostImpl* impl_host_; 775 LayerTreeHostImpl* impl_host_;
778 int num_commits_; 776 int num_commits_;
779 bool lost_context_; 777 bool lost_context_;
780 }; 778 };
781 779
782 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures, 780 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures,
783 LoseAfterEvict_SingleThread_DirectRenderer) {
784 lose_after_evict_ = true;
785 RunTest(CompositorMode::SINGLE_THREADED, false);
786 }
787
788 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures,
789 LoseAfterEvict_SingleThread_DelegatingRenderer) { 781 LoseAfterEvict_SingleThread_DelegatingRenderer) {
790 lose_after_evict_ = true; 782 lose_after_evict_ = true;
791 RunTest(CompositorMode::SINGLE_THREADED, true); 783 RunTest(CompositorMode::SINGLE_THREADED, true);
792 } 784 }
793 785
794 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures, 786 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures,
795 LoseAfterEvict_MultiThread_DirectRenderer) {
796 lose_after_evict_ = true;
797 RunTest(CompositorMode::THREADED, false);
798 }
799
800 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures,
801 LoseAfterEvict_MultiThread_DelegatingRenderer) { 787 LoseAfterEvict_MultiThread_DelegatingRenderer) {
802 lose_after_evict_ = true; 788 lose_after_evict_ = true;
803 RunTest(CompositorMode::THREADED, true); 789 RunTest(CompositorMode::THREADED, true);
804 } 790 }
805 791
806 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures, 792 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures,
807 LoseBeforeEvict_SingleThread_DirectRenderer) {
808 lose_after_evict_ = false;
809 RunTest(CompositorMode::SINGLE_THREADED, false);
810 }
811
812 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures,
813 LoseBeforeEvict_SingleThread_DelegatingRenderer) { 793 LoseBeforeEvict_SingleThread_DelegatingRenderer) {
814 lose_after_evict_ = false; 794 lose_after_evict_ = false;
815 RunTest(CompositorMode::SINGLE_THREADED, true); 795 RunTest(CompositorMode::SINGLE_THREADED, true);
816 } 796 }
817 797
818 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures, 798 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures,
819 LoseBeforeEvict_MultiThread_DirectRenderer) {
820 lose_after_evict_ = false;
821 RunTest(CompositorMode::THREADED, false);
822 }
823
824 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures,
825 LoseBeforeEvict_MultiThread_DelegatingRenderer) { 799 LoseBeforeEvict_MultiThread_DelegatingRenderer) {
826 lose_after_evict_ = false; 800 lose_after_evict_ = false;
827 RunTest(CompositorMode::THREADED, true); 801 RunTest(CompositorMode::THREADED, true);
828 } 802 }
829 803
830 class LayerTreeHostContextTestLayersNotified : public LayerTreeHostContextTest { 804 class LayerTreeHostContextTestLayersNotified : public LayerTreeHostContextTest {
831 public: 805 public:
832 LayerTreeHostContextTestLayersNotified() 806 LayerTreeHostContextTestLayersNotified()
833 : LayerTreeHostContextTest(), num_commits_(0) {} 807 : LayerTreeHostContextTest(), num_commits_(0) {}
834 808
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 }; 870 };
897 871
898 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLayersNotified); 872 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLayersNotified);
899 873
900 class LayerTreeHostContextTestDontUseLostResources 874 class LayerTreeHostContextTestDontUseLostResources
901 : public LayerTreeHostContextTest { 875 : public LayerTreeHostContextTest {
902 public: 876 public:
903 LayerTreeHostContextTestDontUseLostResources() : lost_context_(false) { 877 LayerTreeHostContextTestDontUseLostResources() : lost_context_(false) {
904 context_should_support_io_surface_ = true; 878 context_should_support_io_surface_ = true;
905 879
906 child_output_surface_ = FakeOutputSurface::Create3d(); 880 child_output_surface_ = FakeOutputSurface::CreateDelegating3d();
907 child_output_surface_->BindToClient(&output_surface_client_); 881 child_output_surface_->BindToClient(&output_surface_client_);
908 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); 882 shared_bitmap_manager_.reset(new TestSharedBitmapManager());
909 child_resource_provider_ = FakeResourceProvider::Create( 883 child_resource_provider_ = FakeResourceProvider::Create(
910 child_output_surface_.get(), shared_bitmap_manager_.get()); 884 child_output_surface_.get(), shared_bitmap_manager_.get());
911 } 885 }
912 886
913 static void EmptyReleaseCallback(const gpu::SyncToken& sync_token, 887 static void EmptyReleaseCallback(const gpu::SyncToken& sync_token,
914 bool lost) {} 888 bool lost) {}
915 889
916 void SetupTree() override { 890 void SetupTree() override {
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 void AfterTest() override {} 1573 void AfterTest() override {}
1600 1574
1601 bool deferred_; 1575 bool deferred_;
1602 }; 1576 };
1603 1577
1604 SINGLE_AND_MULTI_THREAD_TEST_F( 1578 SINGLE_AND_MULTI_THREAD_TEST_F(
1605 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); 1579 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame);
1606 1580
1607 } // namespace 1581 } // namespace
1608 } // namespace cc 1582 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_copyrequest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698