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

Side by Side Diff: cc/layers/video_frame_provider_client_impl_unittest.cc

Issue 2667383009: Revert of Mark Layer Damaged When The Client Is Gone (Closed)
Patch Set: Created 3 years, 10 months 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
« no previous file with comments | « cc/layers/video_frame_provider_client_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
113 TEST_F(VideoFrameProviderClientImplTest, StopUsingProvider) { 105 TEST_F(VideoFrameProviderClientImplTest, StopUsingProvider) {
114 ASSERT_TRUE(client_impl_->get_provider_for_testing()); 106 ASSERT_TRUE(client_impl_->get_provider_for_testing());
115 StartRendering(); 107 StartRendering();
116 EXPECT_CALL(*this, RemoveVideoFrameController(_)); 108 EXPECT_CALL(*this, RemoveVideoFrameController(_));
117 client_impl_->StopUsingProvider(); 109 client_impl_->StopUsingProvider();
118 ASSERT_FALSE(client_impl_->get_provider_for_testing()); 110 ASSERT_FALSE(client_impl_->get_provider_for_testing());
119 } 111 }
120 112
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, FrameAcquisition) { 113 TEST_F(VideoFrameProviderClientImplTest, FrameAcquisition) {
133 CreateActiveVideoLayer(); 114 CreateActiveVideoLayer();
134 StartRenderingAndRenderFrame(); 115 StartRenderingAndRenderFrame();
135 116
136 // Verify GetCurrentFrame() and PutCurrentFrame() work correctly. 117 // Verify GetCurrentFrame() and PutCurrentFrame() work correctly.
137 EXPECT_EQ(test_frame_, client_impl_->AcquireLockAndCurrentFrame()); 118 EXPECT_EQ(test_frame_, client_impl_->AcquireLockAndCurrentFrame());
138 EXPECT_EQ(0, provider_.put_current_frame_count()); 119 EXPECT_EQ(0, provider_.put_current_frame_count());
139 client_impl_->PutCurrentFrame(); 120 client_impl_->PutCurrentFrame();
140 EXPECT_EQ(1, provider_.put_current_frame_count()); 121 EXPECT_EQ(1, provider_.put_current_frame_count());
141 122
(...skipping 11 matching lines...) Expand all
153 TEST_F(VideoFrameProviderClientImplTest, DidDrawFrameIssuesPutCurrentFrame) { 134 TEST_F(VideoFrameProviderClientImplTest, DidDrawFrameIssuesPutCurrentFrame) {
154 CreateActiveVideoLayer(); 135 CreateActiveVideoLayer();
155 StartRenderingAndRenderFrame(); 136 StartRenderingAndRenderFrame();
156 EXPECT_EQ(0, provider_.put_current_frame_count()); 137 EXPECT_EQ(0, provider_.put_current_frame_count());
157 client_impl_->DidDrawFrame(); 138 client_impl_->DidDrawFrame();
158 EXPECT_EQ(1, provider_.put_current_frame_count()); 139 EXPECT_EQ(1, provider_.put_current_frame_count());
159 StopRendering(); 140 StopRendering();
160 } 141 }
161 142
162 } // namespace cc 143 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/video_frame_provider_client_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698