OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/message_loop/message_loop_proxy.h" | 5 #include "base/message_loop/message_loop_proxy.h" |
6 #include "base/threading/simple_thread.h" | 6 #include "base/threading/simple_thread.h" |
7 #include "cc/layers/delegated_frame_provider.h" | 7 #include "cc/layers/delegated_frame_provider.h" |
8 #include "cc/layers/delegated_frame_resource_collection.h" | 8 #include "cc/layers/delegated_frame_resource_collection.h" |
9 #include "cc/layers/delegated_renderer_layer.h" | 9 #include "cc/layers/delegated_renderer_layer.h" |
10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
11 #include "cc/layers/solid_color_layer.h" | 11 #include "cc/layers/solid_color_layer.h" |
12 #include "cc/output/delegated_frame_data.h" | 12 #include "cc/output/delegated_frame_data.h" |
13 #include "cc/output/output_surface.h" | 13 #include "cc/output/output_surface.h" |
14 #include "cc/output/output_surface_client.h" | 14 #include "cc/output/output_surface_client.h" |
15 #include "cc/resources/resource_provider.h" | 15 #include "cc/resources/resource_provider.h" |
| 16 #include "cc/scheduler/begin_frame_source.h" |
16 #include "cc/test/fake_delegated_renderer_layer.h" | 17 #include "cc/test/fake_delegated_renderer_layer.h" |
17 #include "cc/test/test_context_provider.h" | 18 #include "cc/test/test_context_provider.h" |
18 #include "cc/trees/layer_tree_host.h" | 19 #include "cc/trees/layer_tree_host.h" |
19 #include "cc/trees/layer_tree_host_client.h" | 20 #include "cc/trees/layer_tree_host_client.h" |
20 #include "cc/trees/layer_tree_host_single_thread_client.h" | 21 #include "cc/trees/layer_tree_host_single_thread_client.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
22 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
23 #include "ui/gfx/frame_time.h" | 24 #include "ui/gfx/frame_time.h" |
24 | 25 |
25 namespace cc { | 26 namespace cc { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 EXPECT_FALSE(base::MessageLoopProxy::current().get()); | 93 EXPECT_FALSE(base::MessageLoopProxy::current().get()); |
93 } | 94 } |
94 | 95 |
95 protected: | 96 protected: |
96 virtual void RunTestWithoutMessageLoop() = 0; | 97 virtual void RunTestWithoutMessageLoop() = 0; |
97 | 98 |
98 void SetupLayerTreeHost() { | 99 void SetupLayerTreeHost() { |
99 LayerTreeSettings settings; | 100 LayerTreeSettings settings; |
100 settings.single_thread_proxy_scheduler = false; | 101 settings.single_thread_proxy_scheduler = false; |
101 layer_tree_host_ = LayerTreeHost::CreateSingleThreaded( | 102 layer_tree_host_ = LayerTreeHost::CreateSingleThreaded( |
102 this, this, NULL, NULL, settings, NULL); | 103 this, this, nullptr, nullptr, settings, nullptr, nullptr); |
103 layer_tree_host_->SetViewportSize(size_); | 104 layer_tree_host_->SetViewportSize(size_); |
104 layer_tree_host_->SetRootLayer(root_layer_); | 105 layer_tree_host_->SetRootLayer(root_layer_); |
105 } | 106 } |
106 | 107 |
107 void Composite() { | 108 void Composite() { |
108 did_commit_ = false; | 109 did_commit_ = false; |
109 did_commit_and_draw_frame_ = false; | 110 did_commit_and_draw_frame_ = false; |
110 layer_tree_host_->Composite(gfx::FrameTime::Now()); | 111 layer_tree_host_->Composite(gfx::FrameTime::Now()); |
111 EXPECT_TRUE(did_initialize_output_surface_); | 112 EXPECT_TRUE(did_initialize_output_surface_); |
112 EXPECT_TRUE(did_commit_); | 113 EXPECT_TRUE(did_commit_); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 scoped_refptr<DelegatedFrameProvider> frame_provider_; | 230 scoped_refptr<DelegatedFrameProvider> frame_provider_; |
230 scoped_refptr<DelegatedRendererLayer> delegated_layer_; | 231 scoped_refptr<DelegatedRendererLayer> delegated_layer_; |
231 }; | 232 }; |
232 | 233 |
233 TEST_F(LayerTreeHostNoMessageLoopDelegatedLayer, SingleDelegatedLayer) { | 234 TEST_F(LayerTreeHostNoMessageLoopDelegatedLayer, SingleDelegatedLayer) { |
234 RunTest(); | 235 RunTest(); |
235 } | 236 } |
236 | 237 |
237 } // namespace | 238 } // namespace |
238 } // namespace cc | 239 } // namespace cc |
OLD | NEW |