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

Side by Side Diff: cc/test/layer_tree_test.cc

Issue 2140383005: cc: Decouple LayerTreeTests from FakeOutputSurface expectations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@novirtualswapbuffers
Patch Set: layertreetest-outputsurface: more-more-more-android 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/test/layer_tree_test.h ('k') | cc/trees/layer_tree_host_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 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/test/layer_tree_test.h" 5 #include "cc/test/layer_tree_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 CompositorMode mode) 493 CompositorMode mode)
494 : LayerTreeHost(params, mode), 494 : LayerTreeHost(params, mode),
495 test_hooks_(test_hooks), 495 test_hooks_(test_hooks),
496 test_started_(false) {} 496 test_started_(false) {}
497 497
498 TestHooks* test_hooks_; 498 TestHooks* test_hooks_;
499 bool test_started_; 499 bool test_started_;
500 }; 500 };
501 501
502 LayerTreeTest::LayerTreeTest() 502 LayerTreeTest::LayerTreeTest()
503 : output_surface_(nullptr), 503 : external_begin_frame_source_(nullptr),
504 external_begin_frame_source_(nullptr),
505 remote_proto_channel_bridge_(this), 504 remote_proto_channel_bridge_(this),
506 image_serialization_processor_( 505 image_serialization_processor_(
507 base::WrapUnique(new FakeImageSerializationProcessor)), 506 base::WrapUnique(new FakeImageSerializationProcessor)),
508 beginning_(false), 507 beginning_(false),
509 end_when_begin_returns_(false), 508 end_when_begin_returns_(false),
510 timed_out_(false), 509 timed_out_(false),
511 scheduled_(false), 510 scheduled_(false),
512 started_(false), 511 started_(false),
513 ended_(false), 512 ended_(false),
514 delegating_renderer_(false), 513 delegating_renderer_(false),
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 ASSERT_FALSE(layer_tree_host_.get()); 897 ASSERT_FALSE(layer_tree_host_.get());
899 client_ = nullptr; 898 client_ = nullptr;
900 if (timed_out_) { 899 if (timed_out_) {
901 FAIL() << "Test timed out"; 900 FAIL() << "Test timed out";
902 return; 901 return;
903 } 902 }
904 AfterTest(); 903 AfterTest();
905 } 904 }
906 905
907 void LayerTreeTest::RequestNewOutputSurface() { 906 void LayerTreeTest::RequestNewOutputSurface() {
907 if (settings_.use_external_begin_frame_source &&
908 settings_.wait_for_beginframe_interval) {
909 DCHECK(external_begin_frame_source_);
910 }
908 SetOutputSurfaceOnLayerTreeHost(CreateOutputSurface()); 911 SetOutputSurfaceOnLayerTreeHost(CreateOutputSurface());
909 } 912 }
910 913
911 std::unique_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() { 914 std::unique_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() {
912 std::unique_ptr<FakeOutputSurface> output_surface = CreateFakeOutputSurface(); 915 return delegating_renderer_ ? FakeOutputSurface::CreateDelegating3d()
913 DCHECK_EQ(delegating_renderer_, 916 : FakeOutputSurface::Create3d();
914 output_surface->capabilities().delegated_rendering);
915 output_surface_ = output_surface.get();
916
917 if (settings_.use_external_begin_frame_source &&
918 settings_.wait_for_beginframe_interval) {
919 DCHECK(external_begin_frame_source_);
920 }
921 return std::move(output_surface);
922 }
923
924 std::unique_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface() {
925 if (delegating_renderer_)
926 return FakeOutputSurface::CreateDelegating3d();
927 else
928 return FakeOutputSurface::Create3d();
929 }
930
931 TestWebGraphicsContext3D* LayerTreeTest::TestContext() {
932 return static_cast<TestContextProvider*>(output_surface_->context_provider())
933 ->TestContext3d();
934 } 917 }
935 918
936 void LayerTreeTest::DestroyLayerTreeHost() { 919 void LayerTreeTest::DestroyLayerTreeHost() {
937 if (layer_tree_host_ && layer_tree_host_->root_layer()) 920 if (layer_tree_host_ && layer_tree_host_->root_layer())
938 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); 921 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL);
939 layer_tree_host_ = nullptr; 922 layer_tree_host_ = nullptr;
940 923
941 DCHECK(!remote_proto_channel_bridge_.channel_main.HasReceiver()); 924 DCHECK(!remote_proto_channel_bridge_.channel_main.HasReceiver());
942 925
943 // Destroying the LayerTreeHost should destroy the remote client 926 // Destroying the LayerTreeHost should destroy the remote client
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1022
1040 RemoteChannelImplForTest* LayerTreeTest::GetRemoteChannelImplForTest() const { 1023 RemoteChannelImplForTest* LayerTreeTest::GetRemoteChannelImplForTest() const {
1041 DCHECK(IsRemoteTest()); 1024 DCHECK(IsRemoteTest());
1042 DCHECK(remote_client_layer_tree_host_); 1025 DCHECK(remote_client_layer_tree_host_);
1043 1026
1044 return static_cast<RemoteChannelImplForTest*>( 1027 return static_cast<RemoteChannelImplForTest*>(
1045 remote_client_layer_tree_host_->proxy()); 1028 remote_client_layer_tree_host_->proxy());
1046 } 1029 }
1047 1030
1048 } // namespace cc 1031 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698