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 <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 7868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7879 EXPECT_EQ(1u, frame.render_passes_by_id.size()); | 7879 EXPECT_EQ(1u, frame.render_passes_by_id.size()); |
7880 EXPECT_TRUE(frame.render_passes_by_id[RenderPassId(1, 0)]); | 7880 EXPECT_TRUE(frame.render_passes_by_id[RenderPassId(1, 0)]); |
7881 EXPECT_FALSE(frame.render_passes_by_id[RenderPassId(2, 0)]); | 7881 EXPECT_FALSE(frame.render_passes_by_id[RenderPassId(2, 0)]); |
7882 EXPECT_FALSE(frame.render_passes_by_id[RenderPassId(3, 0)]); | 7882 EXPECT_FALSE(frame.render_passes_by_id[RenderPassId(3, 0)]); |
7883 EXPECT_EQ(1u, frame.render_passes.size()); | 7883 EXPECT_EQ(1u, frame.render_passes.size()); |
7884 EXPECT_EQ(RenderPassId(1, 0), frame.render_passes[0]->id); | 7884 EXPECT_EQ(RenderPassId(1, 0), frame.render_passes[0]->id); |
7885 // The RenderPassDrawQuad should be removed from pass1. | 7885 // The RenderPassDrawQuad should be removed from pass1. |
7886 EXPECT_EQ(0u, pass1->quad_list.size()); | 7886 EXPECT_EQ(0u, pass1->quad_list.size()); |
7887 } | 7887 } |
7888 | 7888 |
| 7889 class FakeVideoFrameController : public VideoFrameController { |
| 7890 public: |
| 7891 void OnBeginFrame(const BeginFrameArgs& args) override { |
| 7892 begin_frame_args_ = args; |
| 7893 } |
| 7894 |
| 7895 const BeginFrameArgs& begin_frame_args() { return begin_frame_args_; } |
| 7896 |
| 7897 private: |
| 7898 BeginFrameArgs begin_frame_args_; |
| 7899 }; |
| 7900 |
| 7901 TEST_F(LayerTreeHostImplTest, AddVideoFrameControllerInsideFrame) { |
| 7902 BeginFrameArgs begin_frame_args = |
| 7903 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
| 7904 FakeVideoFrameController controller; |
| 7905 |
| 7906 host_impl_->WillBeginImplFrame(begin_frame_args); |
| 7907 EXPECT_FALSE(controller.begin_frame_args().IsValid()); |
| 7908 host_impl_->AddVideoFrameController(&controller); |
| 7909 EXPECT_TRUE(controller.begin_frame_args().IsValid()); |
| 7910 host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
| 7911 } |
| 7912 |
| 7913 TEST_F(LayerTreeHostImplTest, AddVideoFrameControllerOutsideFrame) { |
| 7914 BeginFrameArgs begin_frame_args = |
| 7915 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
| 7916 FakeVideoFrameController controller; |
| 7917 |
| 7918 host_impl_->WillBeginImplFrame(begin_frame_args); |
| 7919 host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
| 7920 |
| 7921 EXPECT_FALSE(controller.begin_frame_args().IsValid()); |
| 7922 host_impl_->AddVideoFrameController(&controller); |
| 7923 EXPECT_FALSE(controller.begin_frame_args().IsValid()); |
| 7924 |
| 7925 begin_frame_args = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
| 7926 EXPECT_FALSE(controller.begin_frame_args().IsValid()); |
| 7927 host_impl_->WillBeginImplFrame(begin_frame_args); |
| 7928 EXPECT_TRUE(controller.begin_frame_args().IsValid()); |
| 7929 } |
| 7930 |
7889 } // namespace | 7931 } // namespace |
7890 } // namespace cc | 7932 } // namespace cc |
OLD | NEW |