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

Side by Side Diff: cc/surfaces/direct_compositor_frame_sink_unittest.cc

Issue 2822143003: Remove ForceReclaimResources (Closed)
Patch Set: Change to RunLoop. Created 3 years, 8 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/surfaces/direct_compositor_frame_sink.cc ('k') | cc/surfaces/surface.h » ('j') | 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 "cc/surfaces/direct_compositor_frame_sink.h" 5 #include "cc/surfaces/direct_compositor_frame_sink.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "cc/output/renderer_settings.h" 10 #include "cc/output/renderer_settings.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 EXPECT_EQ(1u, display_output_surface_->num_sent_frames()); 164 EXPECT_EQ(1u, display_output_surface_->num_sent_frames());
165 SwapBuffersWithDamage(display_rect_); 165 SwapBuffersWithDamage(display_rect_);
166 task_runner_->RunUntilIdle(); 166 task_runner_->RunUntilIdle();
167 EXPECT_EQ(1u, display_output_surface_->num_sent_frames()); 167 EXPECT_EQ(1u, display_output_surface_->num_sent_frames());
168 display_output_surface_->set_suspended_for_recycle(false); 168 display_output_surface_->set_suspended_for_recycle(false);
169 SwapBuffersWithDamage(display_rect_); 169 SwapBuffersWithDamage(display_rect_);
170 task_runner_->RunUntilIdle(); 170 task_runner_->RunUntilIdle();
171 EXPECT_EQ(2u, display_output_surface_->num_sent_frames()); 171 EXPECT_EQ(2u, display_output_surface_->num_sent_frames());
172 } 172 }
173 173
174 TEST_F(DirectCompositorFrameSinkTest,
175 LockingResourcesDoesNotIndirectlyCauseDamage) {
176 compositor_frame_sink_->ForceReclaimResources();
177 EXPECT_EQ(1u, display_output_surface_->num_sent_frames());
178 task_runner_->RunPendingTasks();
179 EXPECT_EQ(1u, display_output_surface_->num_sent_frames());
180
181 SwapBuffersWithDamage(gfx::Rect());
182 EXPECT_EQ(1u, display_output_surface_->num_sent_frames());
183 task_runner_->RunUntilIdle();
184 EXPECT_EQ(1u, display_output_surface_->num_sent_frames());
185 }
186
187 class TestBeginFrameObserver : public BeginFrameObserverBase { 174 class TestBeginFrameObserver : public BeginFrameObserverBase {
188 public: 175 public:
189 const BeginFrameAck& ack() const { return ack_; } 176 const BeginFrameAck& ack() const { return ack_; }
190 177
191 private: 178 private:
192 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override { 179 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override {
193 ack_ = BeginFrameAck(args.source_id, args.sequence_number, 180 ack_ = BeginFrameAck(args.source_id, args.sequence_number,
194 args.sequence_number, false); 181 args.sequence_number, false);
195 return true; 182 return true;
196 } 183 }
(...skipping 19 matching lines...) Expand all
216 compositor_frame_sink_client_.begin_frame_source()->DidFinishFrame( 203 compositor_frame_sink_client_.begin_frame_source()->DidFinishFrame(
217 &observer, observer.ack()); 204 &observer, observer.ack());
218 compositor_frame_sink_client_.begin_frame_source()->RemoveObserver(&observer); 205 compositor_frame_sink_client_.begin_frame_source()->RemoveObserver(&observer);
219 206
220 // Verify that the frame sink acknowledged the last BeginFrame. 207 // Verify that the frame sink acknowledged the last BeginFrame.
221 EXPECT_EQ(observer.ack(), begin_frame_source_->last_ack()); 208 EXPECT_EQ(observer.ack(), begin_frame_source_->last_ack());
222 } 209 }
223 210
224 } // namespace 211 } // namespace
225 } // namespace cc 212 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/direct_compositor_frame_sink.cc ('k') | cc/surfaces/surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698