OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/macros.h" | 5 #include "base/macros.h" |
6 #include "cc/layers/video_frame_provider_client_impl.h" | 6 #include "cc/layers/video_frame_provider_client_impl.h" |
7 #include "cc/layers/video_layer_impl.h" | 7 #include "cc/layers/video_layer_impl.h" |
8 #include "cc/output/begin_frame_args.h" | 8 #include "cc/output/begin_frame_args.h" |
9 #include "cc/test/fake_video_frame_provider.h" | 9 #include "cc/test/fake_video_frame_provider.h" |
10 #include "cc/test/layer_test_common.h" | 10 #include "cc/test/layer_test_common.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 private: | 96 private: |
97 DISALLOW_COPY_AND_ASSIGN(VideoFrameProviderClientImplTest); | 97 DISALLOW_COPY_AND_ASSIGN(VideoFrameProviderClientImplTest); |
98 }; | 98 }; |
99 | 99 |
100 TEST_F(VideoFrameProviderClientImplTest, StartStopRendering) { | 100 TEST_F(VideoFrameProviderClientImplTest, StartStopRendering) { |
101 StartRendering(); | 101 StartRendering(); |
102 StopRendering(); | 102 StopRendering(); |
103 } | 103 } |
104 | 104 |
| 105 TEST_F(VideoFrameProviderClientImplTest, StopRenderingUpdateDamage) { |
| 106 CreateActiveVideoLayer(); |
| 107 StartRendering(); |
| 108 EXPECT_EQ(gfx::Rect(), video_layer_impl_->update_rect()); |
| 109 StopRendering(); |
| 110 EXPECT_NE(gfx::Rect(), video_layer_impl_->update_rect()); |
| 111 } |
| 112 |
105 TEST_F(VideoFrameProviderClientImplTest, StopUsingProvider) { | 113 TEST_F(VideoFrameProviderClientImplTest, StopUsingProvider) { |
106 ASSERT_TRUE(client_impl_->get_provider_for_testing()); | 114 ASSERT_TRUE(client_impl_->get_provider_for_testing()); |
107 StartRendering(); | 115 StartRendering(); |
108 EXPECT_CALL(*this, RemoveVideoFrameController(_)); | 116 EXPECT_CALL(*this, RemoveVideoFrameController(_)); |
109 client_impl_->StopUsingProvider(); | 117 client_impl_->StopUsingProvider(); |
110 ASSERT_FALSE(client_impl_->get_provider_for_testing()); | 118 ASSERT_FALSE(client_impl_->get_provider_for_testing()); |
111 } | 119 } |
112 | 120 |
| 121 TEST_F(VideoFrameProviderClientImplTest, StopUsingProviderUpdateDamage) { |
| 122 CreateActiveVideoLayer(); |
| 123 ASSERT_TRUE(client_impl_->get_provider_for_testing()); |
| 124 StartRendering(); |
| 125 EXPECT_CALL(*this, RemoveVideoFrameController(_)); |
| 126 EXPECT_EQ(gfx::Rect(), video_layer_impl_->update_rect()); |
| 127 client_impl_->StopUsingProvider(); |
| 128 EXPECT_NE(gfx::Rect(), video_layer_impl_->update_rect()); |
| 129 ASSERT_FALSE(client_impl_->get_provider_for_testing()); |
| 130 } |
| 131 |
| 132 TEST_F(VideoFrameProviderClientImplTest, StopNotUpdateDamage) { |
| 133 CreateActiveVideoLayer(); |
| 134 ASSERT_TRUE(client_impl_->get_provider_for_testing()); |
| 135 StartRendering(); |
| 136 EXPECT_CALL(*this, RemoveVideoFrameController(_)); |
| 137 EXPECT_EQ(gfx::Rect(), video_layer_impl_->update_rect()); |
| 138 client_impl_->Stop(); |
| 139 EXPECT_EQ(gfx::Rect(), video_layer_impl_->update_rect()); |
| 140 ASSERT_FALSE(client_impl_->get_provider_for_testing()); |
| 141 } |
| 142 |
113 TEST_F(VideoFrameProviderClientImplTest, FrameAcquisition) { | 143 TEST_F(VideoFrameProviderClientImplTest, FrameAcquisition) { |
114 CreateActiveVideoLayer(); | 144 CreateActiveVideoLayer(); |
115 StartRenderingAndRenderFrame(); | 145 StartRenderingAndRenderFrame(); |
116 | 146 |
117 // Verify GetCurrentFrame() and PutCurrentFrame() work correctly. | 147 // Verify GetCurrentFrame() and PutCurrentFrame() work correctly. |
118 EXPECT_EQ(test_frame_, client_impl_->AcquireLockAndCurrentFrame()); | 148 EXPECT_EQ(test_frame_, client_impl_->AcquireLockAndCurrentFrame()); |
119 EXPECT_EQ(0, provider_.put_current_frame_count()); | 149 EXPECT_EQ(0, provider_.put_current_frame_count()); |
120 client_impl_->PutCurrentFrame(); | 150 client_impl_->PutCurrentFrame(); |
121 EXPECT_EQ(1, provider_.put_current_frame_count()); | 151 EXPECT_EQ(1, provider_.put_current_frame_count()); |
122 | 152 |
(...skipping 11 matching lines...) Expand all Loading... |
134 TEST_F(VideoFrameProviderClientImplTest, DidDrawFrameIssuesPutCurrentFrame) { | 164 TEST_F(VideoFrameProviderClientImplTest, DidDrawFrameIssuesPutCurrentFrame) { |
135 CreateActiveVideoLayer(); | 165 CreateActiveVideoLayer(); |
136 StartRenderingAndRenderFrame(); | 166 StartRenderingAndRenderFrame(); |
137 EXPECT_EQ(0, provider_.put_current_frame_count()); | 167 EXPECT_EQ(0, provider_.put_current_frame_count()); |
138 client_impl_->DidDrawFrame(); | 168 client_impl_->DidDrawFrame(); |
139 EXPECT_EQ(1, provider_.put_current_frame_count()); | 169 EXPECT_EQ(1, provider_.put_current_frame_count()); |
140 StopRendering(); | 170 StopRendering(); |
141 } | 171 } |
142 | 172 |
143 } // namespace cc | 173 } // namespace cc |
OLD | NEW |