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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp

Issue 2452483002: Move GpuMemoryBufferManager and SharedBitmapManager to CompositorFrameSink (Closed)
Patch Set: rebase Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/graphics/CompositorMutableState.h" 5 #include "platform/graphics/CompositorMutableState.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "cc/test/fake_compositor_frame_sink.h" 8 #include "cc/test/fake_compositor_frame_sink.h"
9 #include "cc/test/fake_impl_task_runner_provider.h" 9 #include "cc/test/fake_impl_task_runner_provider.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 18 matching lines...) Expand all
29 using cc::TestTaskGraphRunner; 29 using cc::TestTaskGraphRunner;
30 using cc::TestSharedBitmapManager; 30 using cc::TestSharedBitmapManager;
31 31
32 class CompositorMutableStateTest : public testing::Test { 32 class CompositorMutableStateTest : public testing::Test {
33 public: 33 public:
34 CompositorMutableStateTest() 34 CompositorMutableStateTest()
35 : m_compositorFrameSink(FakeCompositorFrameSink::Create3d()) { 35 : m_compositorFrameSink(FakeCompositorFrameSink::Create3d()) {
36 LayerTreeSettings settings; 36 LayerTreeSettings settings;
37 settings.layer_transforms_should_scale_layer_contents = true; 37 settings.layer_transforms_should_scale_layer_contents = true;
38 m_hostImpl.reset(new FakeLayerTreeHostImpl(settings, &m_taskRunnerProvider, 38 m_hostImpl.reset(new FakeLayerTreeHostImpl(settings, &m_taskRunnerProvider,
39 &m_sharedBitmapManager,
40 &m_taskGraphRunner)); 39 &m_taskGraphRunner));
41 m_hostImpl->SetVisible(true); 40 m_hostImpl->SetVisible(true);
42 EXPECT_TRUE(m_hostImpl->InitializeRenderer(m_compositorFrameSink.get())); 41 EXPECT_TRUE(m_hostImpl->InitializeRenderer(m_compositorFrameSink.get()));
43 } 42 }
44 43
45 void SetLayerPropertiesForTesting(LayerImpl* layer) { 44 void SetLayerPropertiesForTesting(LayerImpl* layer) {
46 layer->test_properties()->transform = gfx::Transform(); 45 layer->test_properties()->transform = gfx::Transform();
47 layer->SetPosition(gfx::PointF()); 46 layer->SetPosition(gfx::PointF());
48 layer->SetBounds(gfx::Size(100, 100)); 47 layer->SetBounds(gfx::Size(100, 100));
49 layer->Set3dSortingContextId(0); 48 layer->Set3dSortingContextId(0);
50 layer->SetDrawsContent(true); 49 layer->SetDrawsContent(true);
51 } 50 }
52 51
53 FakeLayerTreeHostImpl& hostImpl() { return *m_hostImpl; } 52 FakeLayerTreeHostImpl& hostImpl() { return *m_hostImpl; }
54 53
55 LayerImpl* rootLayer() { 54 LayerImpl* rootLayer() {
56 return m_hostImpl->active_tree()->root_layer_for_testing(); 55 return m_hostImpl->active_tree()->root_layer_for_testing();
57 } 56 }
58 57
59 private: 58 private:
60 // The cc testing machinery has fairly deep dependency on having a main 59 // The cc testing machinery has fairly deep dependency on having a main
61 // message loop (one example is the task runner provider). We construct one 60 // message loop (one example is the task runner provider). We construct one
62 // here so that it's installed in TLA and can be found by other cc classes. 61 // here so that it's installed in TLA and can be found by other cc classes.
63 base::MessageLoop m_messageLoop; 62 base::MessageLoop m_messageLoop;
64 TestSharedBitmapManager m_sharedBitmapManager;
65 TestTaskGraphRunner m_taskGraphRunner; 63 TestTaskGraphRunner m_taskGraphRunner;
66 FakeImplTaskRunnerProvider m_taskRunnerProvider; 64 FakeImplTaskRunnerProvider m_taskRunnerProvider;
67 std::unique_ptr<FakeCompositorFrameSink> m_compositorFrameSink; 65 std::unique_ptr<FakeCompositorFrameSink> m_compositorFrameSink;
68 std::unique_ptr<FakeLayerTreeHostImpl> m_hostImpl; 66 std::unique_ptr<FakeLayerTreeHostImpl> m_hostImpl;
69 }; 67 };
70 68
71 TEST_F(CompositorMutableStateTest, NoMutableState) { 69 TEST_F(CompositorMutableStateTest, NoMutableState) {
72 // In this test, there are no layers with either an element id or mutable 70 // In this test, there are no layers with either an element id or mutable
73 // properties. We should not be able to get any mutable state. 71 // properties. We should not be able to get any mutable state.
74 std::unique_ptr<LayerImpl> root = 72 std::unique_ptr<LayerImpl> root =
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 EXPECT_TRUE(mutation.isScrollLeftMutated()); 147 EXPECT_TRUE(mutation.isScrollLeftMutated());
150 EXPECT_TRUE(mutation.isScrollTopMutated()); 148 EXPECT_TRUE(mutation.isScrollTopMutated());
151 149
152 EXPECT_EQ(0.5, mutation.opacity()); 150 EXPECT_EQ(0.5, mutation.opacity());
153 EXPECT_EQ(zero.ToString(), gfx::Transform(mutation.transform()).ToString()); 151 EXPECT_EQ(zero.ToString(), gfx::Transform(mutation.transform()).ToString());
154 EXPECT_EQ(1.0, mutation.scrollLeft()); 152 EXPECT_EQ(1.0, mutation.scrollLeft());
155 EXPECT_EQ(1.0, mutation.scrollTop()); 153 EXPECT_EQ(1.0, mutation.scrollTop());
156 } 154 }
157 155
158 } // namespace blink 156 } // namespace blink
OLDNEW
« no previous file with comments | « services/ui/public/cpp/window_compositor_frame_sink.cc ('k') | ui/android/context_provider_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698