OLD | NEW |
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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 5731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5742 DrawFrame(); | 5742 DrawFrame(); |
5743 | 5743 |
5744 EXPECT_EQ(1, software_device->frames_began_); | 5744 EXPECT_EQ(1, software_device->frames_began_); |
5745 EXPECT_EQ(1, software_device->frames_ended_); | 5745 EXPECT_EQ(1, software_device->frames_ended_); |
5746 | 5746 |
5747 // Call other API methods that are likely to hit NULL pointer in this mode. | 5747 // Call other API methods that are likely to hit NULL pointer in this mode. |
5748 EXPECT_TRUE(host_impl_->AsValue()); | 5748 EXPECT_TRUE(host_impl_->AsValue()); |
5749 EXPECT_TRUE(host_impl_->ActivationStateAsValue()); | 5749 EXPECT_TRUE(host_impl_->ActivationStateAsValue()); |
5750 } | 5750 } |
5751 | 5751 |
| 5752 TEST_F(LayerTreeHostImplTest, |
| 5753 ForcedDrawToSoftwareDeviceSkipsUnsupportedLayers) { |
| 5754 FakeOutputSurface* output_surface = FakeOutputSurface::CreateDeferredGL( |
| 5755 scoped_ptr<SoftwareOutputDevice>(new CountingSoftwareDevice())).release(); |
| 5756 host_impl_->InitializeRenderer( |
| 5757 scoped_ptr<OutputSurface>(output_surface)); |
| 5758 |
| 5759 output_surface->set_forced_draw_to_software_device(true); |
| 5760 EXPECT_TRUE(output_surface->ForcedDrawToSoftwareDevice()); |
| 5761 |
| 5762 // SolidColorLayerImpl will be drawn. |
| 5763 scoped_ptr<SolidColorLayerImpl> root_layer = |
| 5764 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); |
| 5765 |
| 5766 // VideoLayerImpl will not be drawn. |
| 5767 FakeVideoFrameProvider provider; |
| 5768 scoped_ptr<VideoLayerImpl> video_layer = |
| 5769 VideoLayerImpl::Create(host_impl_->active_tree(), 2, &provider); |
| 5770 video_layer->SetBounds(gfx::Size(10, 10)); |
| 5771 video_layer->SetContentBounds(gfx::Size(10, 10)); |
| 5772 video_layer->SetDrawsContent(true); |
| 5773 root_layer->AddChild(video_layer.PassAs<LayerImpl>()); |
| 5774 SetupRootLayerImpl(root_layer.PassAs<LayerImpl>()); |
| 5775 |
| 5776 LayerTreeHostImpl::FrameData frame; |
| 5777 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); |
| 5778 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
| 5779 host_impl_->DidDrawAllLayers(frame); |
| 5780 |
| 5781 EXPECT_EQ(1u, frame.will_draw_layers.size()); |
| 5782 EXPECT_EQ(host_impl_->active_tree()->root_layer(), frame.will_draw_layers[0]); |
| 5783 } |
| 5784 |
5752 } // namespace | 5785 } // namespace |
5753 } // namespace cc | 5786 } // namespace cc |
OLD | NEW |