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

Side by Side Diff: cc/layers/layer_unittest.cc

Issue 2340143002: cc: Rename LayerTreeHost to LayerTreeHostInProcess. (Closed)
Patch Set: comment fix 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 | « cc/layers/heads_up_display_layer.cc ('k') | cc/layers/picture_image_layer.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/layers/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "cc/animation/animation_host.h" 10 #include "cc/animation/animation_host.h"
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 883
884 TestTaskGraphRunner task_graph_runner_; 884 TestTaskGraphRunner task_graph_runner_;
885 FakeLayerTreeHostClient fake_client_; 885 FakeLayerTreeHostClient fake_client_;
886 std::unique_ptr<FakeLayerTreeHost> layer_tree_host_; 886 std::unique_ptr<FakeLayerTreeHost> layer_tree_host_;
887 }; 887 };
888 888
889 namespace { 889 namespace {
890 890
891 class MockLayerTree : public LayerTree { 891 class MockLayerTree : public LayerTree {
892 public: 892 public:
893 MockLayerTree(LayerTreeHost::InitParams* params, 893 MockLayerTree(LayerTreeHostInProcess::InitParams* params,
894 LayerTreeHost* layer_tree_host) 894 LayerTreeHost* layer_tree_host)
895 : LayerTree(std::move(params->animation_host), layer_tree_host) {} 895 : LayerTree(std::move(params->animation_host), layer_tree_host) {}
896 ~MockLayerTree() override {} 896 ~MockLayerTree() override {}
897 897
898 MOCK_METHOD0(SetNeedsFullTreeSync, void()); 898 MOCK_METHOD0(SetNeedsFullTreeSync, void());
899 }; 899 };
900 900
901 class MockLayerTreeHost : public LayerTreeHost { 901 class MockLayerTreeHost : public LayerTreeHostInProcess {
902 public: 902 public:
903 MockLayerTreeHost(LayerTreeHostSingleThreadClient* single_thread_client, 903 MockLayerTreeHost(LayerTreeHostSingleThreadClient* single_thread_client,
904 LayerTreeHost::InitParams* params) 904 LayerTreeHostInProcess::InitParams* params)
905 : LayerTreeHost( 905 : LayerTreeHostInProcess(
906 params, 906 params,
907 CompositorMode::SINGLE_THREADED, 907 CompositorMode::SINGLE_THREADED,
908 base::MakeUnique<StrictMock<MockLayerTree>>(params, this)) { 908 base::MakeUnique<StrictMock<MockLayerTree>>(params, this)) {
909 InitializeSingleThreaded(single_thread_client, 909 InitializeSingleThreaded(single_thread_client,
910 base::ThreadTaskRunnerHandle::Get(), nullptr); 910 base::ThreadTaskRunnerHandle::Get(), nullptr);
911 } 911 }
912 912
913 MOCK_METHOD0(SetNeedsCommit, void()); 913 MOCK_METHOD0(SetNeedsCommit, void());
914 MOCK_METHOD0(SetNeedsUpdateLayers, void()); 914 MOCK_METHOD0(SetNeedsUpdateLayers, void());
915 }; 915 };
916 916
917 class LayerTest : public testing::Test { 917 class LayerTest : public testing::Test {
918 public: 918 public:
919 LayerTest() 919 LayerTest()
920 : host_impl_(LayerTreeSettings(), 920 : host_impl_(LayerTreeSettings(),
921 &task_runner_provider_, 921 &task_runner_provider_,
922 &shared_bitmap_manager_, 922 &shared_bitmap_manager_,
923 &task_graph_runner_) { 923 &task_graph_runner_) {
924 timeline_impl_ = 924 timeline_impl_ =
925 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 925 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
926 timeline_impl_->set_is_impl_only(true); 926 timeline_impl_->set_is_impl_only(true);
927 host_impl_.animation_host()->AddAnimationTimeline(timeline_impl_); 927 host_impl_.animation_host()->AddAnimationTimeline(timeline_impl_);
928 } 928 }
929 929
930 const LayerTreeSettings& settings() { return settings_; } 930 const LayerTreeSettings& settings() { return settings_; }
931 scoped_refptr<AnimationTimeline> timeline_impl() { return timeline_impl_; } 931 scoped_refptr<AnimationTimeline> timeline_impl() { return timeline_impl_; }
932 932
933 protected: 933 protected:
934 void SetUp() override { 934 void SetUp() override {
935 LayerTreeHost::InitParams params; 935 LayerTreeHostInProcess::InitParams params;
936 params.client = &fake_client_; 936 params.client = &fake_client_;
937 params.settings = &settings_; 937 params.settings = &settings_;
938 params.task_graph_runner = &task_graph_runner_; 938 params.task_graph_runner = &task_graph_runner_;
939 params.animation_host = 939 params.animation_host =
940 AnimationHost::CreateForTesting(ThreadInstance::MAIN); 940 AnimationHost::CreateForTesting(ThreadInstance::MAIN);
941 941
942 layer_tree_host_.reset( 942 layer_tree_host_.reset(
943 new StrictMock<MockLayerTreeHost>(&single_thread_client_, &params)); 943 new StrictMock<MockLayerTreeHost>(&single_thread_client_, &params));
944 layer_tree_ = static_cast<StrictMock<MockLayerTree>*>( 944 layer_tree_ = static_cast<StrictMock<MockLayerTree>*>(
945 layer_tree_host_->GetLayerTree()); 945 layer_tree_host_->GetLayerTree());
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 EXPECT_EQ(replica.get(), replica->mask_layer()->parent()); 1861 EXPECT_EQ(replica.get(), replica->mask_layer()->parent());
1862 } 1862 }
1863 1863
1864 class LayerTreeHostFactory { 1864 class LayerTreeHostFactory {
1865 public: 1865 public:
1866 std::unique_ptr<LayerTreeHost> Create() { 1866 std::unique_ptr<LayerTreeHost> Create() {
1867 return Create(LayerTreeSettings()); 1867 return Create(LayerTreeSettings());
1868 } 1868 }
1869 1869
1870 std::unique_ptr<LayerTreeHost> Create(LayerTreeSettings settings) { 1870 std::unique_ptr<LayerTreeHost> Create(LayerTreeSettings settings) {
1871 LayerTreeHost::InitParams params; 1871 LayerTreeHostInProcess::InitParams params;
1872 params.client = &client_; 1872 params.client = &client_;
1873 params.shared_bitmap_manager = &shared_bitmap_manager_; 1873 params.shared_bitmap_manager = &shared_bitmap_manager_;
1874 params.task_graph_runner = &task_graph_runner_; 1874 params.task_graph_runner = &task_graph_runner_;
1875 params.gpu_memory_buffer_manager = &gpu_memory_buffer_manager_; 1875 params.gpu_memory_buffer_manager = &gpu_memory_buffer_manager_;
1876 params.settings = &settings; 1876 params.settings = &settings;
1877 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); 1877 params.main_task_runner = base::ThreadTaskRunnerHandle::Get();
1878 params.animation_host = 1878 params.animation_host =
1879 AnimationHost::CreateForTesting(ThreadInstance::MAIN); 1879 AnimationHost::CreateForTesting(ThreadInstance::MAIN);
1880 return LayerTreeHost::CreateSingleThreaded(&single_thread_client_, &params); 1880 return LayerTreeHostInProcess::CreateSingleThreaded(&single_thread_client_,
1881 &params);
1881 } 1882 }
1882 1883
1883 private: 1884 private:
1884 FakeLayerTreeHostClient client_; 1885 FakeLayerTreeHostClient client_;
1885 StubLayerTreeHostSingleThreadClient single_thread_client_; 1886 StubLayerTreeHostSingleThreadClient single_thread_client_;
1886 TestSharedBitmapManager shared_bitmap_manager_; 1887 TestSharedBitmapManager shared_bitmap_manager_;
1887 TestTaskGraphRunner task_graph_runner_; 1888 TestTaskGraphRunner task_graph_runner_;
1888 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; 1889 TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
1889 }; 1890 };
1890 1891
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
2553 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); 2554 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties());
2554 2555
2555 test_layer->PushPropertiesTo(impl_layer.get()); 2556 test_layer->PushPropertiesTo(impl_layer.get());
2556 2557
2557 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id()); 2558 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id());
2558 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); 2559 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties());
2559 } 2560 }
2560 2561
2561 } // namespace 2562 } // namespace
2562 } // namespace cc 2563 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/heads_up_display_layer.cc ('k') | cc/layers/picture_image_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698